Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  Function 6CH, introduced in DOS version 4, combines the functionality of
  several previously supported interrupt 21H functions. This function lets
  you specify several different actions at the time you open a file:

  .  You can open an existing file (as in functions 0FH and 3DH).

  .  You can create a file or truncate an existing file (as in functions 16H
     and 3CH).

  .  You can create a file that is guaranteed to be new (as in function
     5BH).

  .  You can open a file for which every write operation is automatically
     committed to disk (as if you called function 68H after each write).

  .  You can disable interrupt 24H (critical-error) processing for the file.

  When you call function 6CH, you select a combination of these actions by
  setting bits in registers BX (Figure D-3) and DX (Figure D-4). The other
  registers specify information required by DOS to open or create the file:
  CX contains the file-create attribute if you're creating a file; DS:SI
  contains a pointer to an ASCIIZ filename; and AL must contain 00H.


                        Bit
  15 14 13 12 11 10 9  8   7  6  5  4  3  2  1  0         Value     Meaning
  ----------------------------------------------------------------------------------------------
  .  .  .  .  .  .  .  .   .  .  .  .  .  0  0  0         0         Access code: read only
  .  .  .  .  .  .  .  .   .  .  .  .  .  0  0  1         1         Access code: write only
  .  .  .  .  .  .  .  .   .  .  .  .  .  0  1  0         2         Access code: read/write
  .  .  .  .  .  .  .  .   .  .  .  .  0  .  .  .                   (Reserved)
  .  .  .  .  .  .  .  .   .  0  0  0  .  .  .  .         0         Sharing mode: compatibility
  .  .  .  .  .  .  .  .   .  0  0  1  .  .  .  .         1         Sharing mode: deny
                                                                    read/write
  .  .  .  .  .  .  .  .   .  0  1  0  .  .  .  .         2         Sharing mode: deny write
  .  .  .  .  .  .  .  .   .  0  1  1  .  .  .  .         3         Sharing mode: deny read
  .  .  .  .  .  .  .  .   .  1  0  0  .  .  .  .         4         Sharing mode: deny none
  .  .  .  .  .  .  .  .   0  .  .  .  .  .  .  .         0         Inherit: child inherits
                                                                    handles
  .  .  .  .  .  .  .  .   1  .  .  .  .  .  .  .         1         Inherit: no inherited
                                                                    handles
  .  .  .  0  0  0  0  0   .  .  .  .  .  .  .  .                   (Reserved)
  .  .  0  .  .  .  .  .   .  .  .  .  .  .  .  .         0         INT 24H: enabled
  .  .  1  .  .  .  .  .   .  .  .  .  .  .  .  .         1         INT 24H: disabled
  .  0  .  .  .  .  .  .   .  .  .  .  .  .  .  0         0         Auto-commit: disabled
  .  1  .  .  .  .  .  .   .  .  .  .  .  .  .  1         1         Auto-commit: enabled
  0  .  .  .  .  .  .  .   .  .  .  .  .  .  .  .                   (Reserved)
  ----------------------------------------------------------------------------------------------


  Figure D-3.  Bit-field values in register BX for interrupt 21H, function
  6CH.


                        Bit
  15 14 13 12 11 10 9  8   7  6  5  4  3  2  1  0         Value     Meaning
  ----------------------------------------------------------------------------------------------
  .  .  .  .  .  .  .  .   .  .  .  .  0  0  0  0         0         If file exists: fail
  .  .  .  .  .  .  .  .   .  .  .  .  0  0  0  1         1         If file exists: open
  .  .  .  .  .  .  .  .   .  .  .  .  0  0  1  0         2         If file exists: truncate and
                                                                    open
  .  .  .  .  .  .  .  .   0  0  0  0  .  .  .  .         0         If file not found: fail
  .  .  .  .  .  .  .  .   0  0  0  1  .  .  .  .         1         If file not found: create
  0  0  0  0  0  0  0  0   .  .  .  .  .  .  .  .                   (Reserved)
  ----------------------------------------------------------------------------------------------


  Figure D-4.  Bit-field values in register DX for interrupt 21H, function
  6CH.

  If the create or open operation is successful, function 6CH returns with
  the carry flag clear, a file handle in AX, and a result code in CX. The
  possible result codes are 01H (existing file opened), 02H (new file
  created and opened), and 03H (existing file truncated and opened). If an
  error occurs, the function sets the carry flag and returns an error code
  in AX. Possible error codes depend on the type of operation you requested.
  They include 01H (invalid function), 02H (file not found), 03H (path not
  found), 04H (no handles available), 05H (access denied), and 50H (file
  already exists).

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson