INT 21H (0x21) Function 39H (0x39 or 57) Create directory 3AH (0x3A or 58) Delete directory 3BH (0x3B or 59) Set current directory 3CH (0x3C or 60) Create file 3DH (0x3D or 61) Open file 3EH (0x3E or 62) Close file 3FH (0x3F or 63) Read file or device 40H (0x40 or 64) Write file or device 41H (0x41 or 65) Delete file 42H (0x42 or 66) Set file pointer

Files Recovery Software
Home Contact Details Customer Support Download Demo Products  

 
 

INT 21H (0x21)

Function 39H (0x39 or 57) --> Create directory

Call with: AH = 39H
DS: DX = segment: offset of ASCIIZ pathname

Returns: If function successful
Carry flag = clear

If function unsuccessful
Carry flag = set
AX = error code

Comments:

This function creates a directory using the specified drive and path.

ASCIIZ is known as the sequence of ASCII characters terminated be, Null or Zero, Byte.                                             

INT 21H (0x21)

Function 3AH (0x3A or 58) --> Delete directory

Call with: AH = 3AH
DS: DX = segment: offset of ASCIIZ pathname

Returns: If function successful
Carry flag = clear

If function unsuccessful
Carry flag = set
AX = error code

Comments:

This function removes a directory using the specified drive and path. If any element of the pathname does not exist or directory is not empty or access is denied or specified directory is also current directory, the function of deleting the directory fails.

INT 21H (0x21)

Function 3BH (0x3B or 59) --> Set current directory

Call with: AH = 3BH
DS: DX = segment: offset of ASCIIZ pathname

Returns: If function successful
Carry flag = clear

If function unsuccessful
Carry flag = set
AX = error code

Comments:

This function sets the current or default directory using the specified drive and path. If the specified path or any element of the path does not exist, the function fails.

INT 21H (0x21)

Function 3CH (0x3C or 60) --> Create file

Call with: AH = 3CH
CX = file attribute, where attribute
significance bits may be Combined.
Significance of bits is given in the
following Table:

Bit(s)       

Significance (if set) 

0

Read-only

1

Hidden

2

System

3

Volume label

4

Reserved (0)

5

Archive

6 – 15

Reserved (0)

DS: DX = segment: offset of ASCIIZ
pathname

Returns: If function successful
Carry flag = clear
AX = handle

If function unsuccessful
Carry flag = set
AX = error code

Comments:

If an ASCIIZ pathname is given, this function creates a new file in the designated or default directory on the designated or default disk drive. If the specified file already exists, it is truncated to zero length. In either case, the file is opened and a handle is returned that can be used by the program for subsequent access to the file.

If any element of the pathname does not exists or file is being created in root directory and root directory is full or access is denied or a file with read – only attribute is already in the specified directory, the function of creating file fails.

INT 21H (0x21)

Function 3DH (0x3D or 61) --> Open file

Call with: AH = 3DH
AL = access mode

Access mode bits significance is given in the following table:

Bits

Significance

0 – 2

Access Mode
000 = read access
001 = write access
010 = read/write access

3

Reserved (0)

4 – 6

Sharing Mode
000 = compatibility mode
001 = deny all
010 = deny write
011 = deny read
100 = deny none

7

Inheritance flag
0 = child process inherits handle
1 = child does not inherit handle

DS: DX = segment: offset of ASCIIZ pathname

Returns: If function successful
Carry flag = clear
AX = handle

If function unsuccessful
Carry flag = set
AX = error code

Comments:

If an ASCIIZ pathname is given, this function opens the specified file in the designated or default directory on the designated or default disk drive. A handle is returned which can be used by the program for subsequent access to the file.

INT 21H (0x21)

Function 3EH (0x3E or 62) --> Close file

Call with: AH = 3EH
BX = handle

Returns: If function successful
Carry flag = clear

If function unsuccessful
Carry flag = set
AX = error code

Comments:

This function flushes all internal buffers associated with the file to disk, closes the file, and releases the handle for reuse, of previously open or created with success of a given handle. If the file was modified, the time and date stamp and file size are updated in the directory entry of the file.

INT 21H (0x21)

Function 3FH (0x3F or 63) --> Read file or device

Call with: AH = 3FH
BX = handle
CX = number of bytes to read

DS: DX = segment: offset of buffer

Returns: If function successful
Carry flag = clear
AX = byte transferred

If function unsuccessful
Carry flag = set
AX = error code

Comments:

This function transfers data at the current file-pointer position from the file into the buffer and then updates the file pointer position for a given valid file handle from a previous open or create operation, a buffer address, and a length in bytes.

INT 21H (0x21)

Function 40H (0x40 or 64) --> Write file or device

Call with: AH = 40H
BX = handle
CX = number of bytes to write
DS: DX = segment: offset of buffer

Returns: If function successful
Carry flag = clear
AX = byte transferred

If function unsuccessful
Carry flag = set
AX = error code

Comments:

This function transfers data from the buffer into the file and then updates the file pointer position for given valid file handle from a previous open or create operation, a buffer address, and a length in bytes. If the function is called with CX = 0, the file is truncated or extended to the current file pointer position.

INT 21H (0x21)

Function 41H (0x41 or 65) --> Delete file

Call with: AH = 41H
DS: DX = segment: offset of ASCIIZ pathname

Returns: If function successful
Carry flag = clear

If function unsuccessful
Carry flag = set
AX = error code

Call with: AH = 40H
BX = handle
CX = number of bytes to write
DS: DX = segment: offset of buffer

Returns: If function successful
Carry flag = clear
AX = byte transferred

If function unsuccessful
Carry flag = set
AX = error code

Comments:

This function transfers data from the buffer into the file and then updates the file pointer position for given valid file handle from a previous open or create operation, a buffer address, and a length in bytes. If the function is called with CX = 0, the file is truncated or extended to the current file pointer position.

INT 21H (0x21)

Function 41H (0x41 or 65) --> Delete file

Call with: AH = 41H
DS: DX = segment: offset of ASCIIZ pathname

Returns: If function successful
Carry flag = clear

If function unsuccessful
Carry flag = set
AX = error code

Comments:

This function deletes a file from the default or specified disk and directory. The function deletes a file by replacing the first character of its filename in the root directory with the character E5H (0xE5) and making the file’s clusters as available for the new data in the file allocation table. Till then actual data stored in those clusters is not overwritten.

INT 21H (0x21)

Function 42H (0x42 or 66) --> Set file pointer

Call with: AH = 42H
AL = method code
00H absolute offset from start of file
01H signed offset from current file
pointer
02H signed offset from end of file
BX = handle
CX = most significant half of offset
DX = least significant half of offset

Returns: If function is successful
Carry flag = clear
DX = most significant half of resulting file
pointer
AX = least significant half of resulting file
pointer

If function is unsuccessful
Carry flag = set
AX = error code

Comments:

This function sets the file pointer location relative to the start of file, end of file, or current file position.

This function deletes a file from the default or specified disk and directory. The function deletes a file by replacing the first character of its filename in the root directory with the character E5H (0xE5) and making the file’s clusters as available for the new data in the file allocation table. Till then actual data stored in those clusters is not overwritten.

INT 21H (0x21)

Function 42H (0x42 or 66) --> Set file pointer

Call with: AH = 42H
AL = method code
00H absolute offset from start of file
01H signed offset from current file
pointer
02H signed offset from end of file
BX = handle
CX = most significant half of offset
DX = least significant half of offset

Returns: If function is successful
Carry flag = clear
DX = most significant half of resulting file
pointer
AX = least significant half of resulting file
pointer

If function is unsuccessful
Carry flag = set
AX = error code

Comments:

This function sets the file pointer location relative to the start of file, end of file, or current file position.

Previous page

page 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20

 
 

page 21 | 22 | 23 | 24 | 25 | 26

Next page
 
 
Data Recovery Book
 
Chapter 1 An Overview of Data Recovery
Chapter 2 Introduction of Hard Disks
Chapter 3 Logical Approach to Disks and OS
Chapter 4 Number Systems
Chapter 5 Introduction of C Programming
Chapter 6 Introduction to Computer Basics
Chapter 7 Necessary DOS Commands
Chapter 8 Disk-BIOS Functions and Interrupts Handling With C
Chapter 9 Handling Large Hard Disks
Chapter 10 Data Recovery From Corrupted Floppy
Chapter 11 Making Backups
Chapter 12 Reading and Modifying MBR with Programming
Chapter 13 Reading and Modifying DBR with Programming
Chapter 14 Programming for “Raw File” Recovery
Chapter 15 Programming for Data Wipers
Chapter 16 Developing more Utilities for Disks
Appendix Glossary of Data Recovery Terms
 
 

Pro Data Doctor

Home

Products

Contact Details

Customer Support

Download Demo

Terms and Conditions

 
Pro Data Doctor