Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- DOS 5.0 Ref. - <b>function 6ch extended open/create dos 4.0+</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function 6Ch            Extended Open/Create                         DOS 4.0+

    This function combines the following functions:
        Create File with Handle (3Ch)
        Open File with Handle   (3Dh)
        Commit File             (68h)

        Entry   AH    = 6Ch
                AL    = 00h   (Reserved = 0)
                BX    = Open mode (access)     ;.ce. .... isss Raaa
                CX    = File attributes        ;          ..x. .xxx
                DH    = 00h   (Reserved = 0)   ;
                DL    = Action                 ;          eeee nnnn
                DS:SI = Pointer to ASCIIZ filename

        Return  AX = File handle
                CX = Action taken:
                     | 1 = File opened
                     | 2 = File created/opened
                     | 3 = File replaced/opened
                or
                AX = Error code, if CF is set
                     | 01h Invalid function
                     | 02h File not found
                     | 03h Path not found
                     | 04h No handle available
                     | 05h Access denied

    ------------------------------------------------------------------

    The Open Mode code in BX can be a combination (ORable) of values
    from the following table:

        open_access_readonly     = 00h   Open the file for read-only
                                         access
        open_access_writeonly    = 01h   Open the file for write-only
                                         access
        open_access_readwrite    = 02h   Open the file for read-and-
                                         write access

        open_share_compatibility = 00h   Permit other programs any
                                         access to the file. On a
                                         given computer, any program
                                         can open the file any number
                                         of times with this mode. This
                                         is the default sharing value
        open_share_denyreadwrite = 10h   Do not permit any other
                                         program to open the file
        open_share_denywrite     = 20h   Do not permit any other
                                         program to open the file
                                         for write access
        open_share_denyread      = 30h   Do not permit any other
                                         program to open the file
                                         for read access
        open_share_denynone      = 40h   Permit other programs read or
                                         write access, but no program
                                         may open the file for
                                         compatibility access.

        open_flags_noinherit     = 80h   A child program created with
                                         function 4b00h (EXEC) does
                                         not inherit the file handle.
                                         If this mode is not set,
                                         child programs inherit the
                                         file handle.

        open_flags_nocrit_err  = 2000h   Interrupt 24h will not be
                                         called if a critical error
                                         occurs while DOS is opening
                                         this file. Instead, DOS
                                         simply returns an error value
                                         to the program.
        open_flags_commit      = 4000h   DOS commits the file (updates
                                         file contents on disk) after
                                         each write operation.

    ------------------------------------------------------------------

    The file attributes in CX (ignored if not creating a file) can be
    a combination of the following values: attr_normal, attr_readonly,
    attr_hidden, attr_system, attr_archive.


    The Action parameter in DL specifies the action to take if the
    file exists or if it does not exist. It can be a combination of
    the following values:

        file_open       = 01h           Open the file. Fail if the
                                        file does not exist.
        file_truncate   = 02h           Open the file and truncate it
                                        to zero length (replace
                                        existing file). Fail if the
                                        file does not exist.
        file_create     = 10h           Create a new file if the file
                                        does not already exist.

    ------------------------------------------------------------------

    Network
    If the specified file is on a network drive, function 6ch creates
    the file only if the network grants access to the drive or
    directory. Similarly, the function opens the file only if the
    network grants read, write, or both read and write access to the
    drive or directory.

See Also: 3ch 3dh 68h 4ah 5bh Int 24h File attributes

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