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

     Extended File Open/Create function.

          On entry:      AH         6Ch
                         AL         Reserved, must be 0
                         BX         Open mode: 0wf00000isss0aaa
                                      bits:
                                        aaa = access code
                                                0 . read
                                                1 . write
                                                2 . read/write
                                        sss = sharing mode
                                                0 . compatibility
                                                1 . deny read/write
                                                2 . deny write
                                                3 . deny read
                                                4 . deny none
                                        i
                                                0 . pass handle to child
                                                1 . no inheritance
                                        f
                                                0 . let DOS handle errors
                                                1 . let program handle errors
                                        w       0 . no commit to disk
                                                1 . auto-commit on write
                                                    (no file buffer)
                        CX          File attribute to be used
                        DX          Function control = 00000000nnnneeee
                                        nnnn (if file does not exist)
                                                0 . fail
                                                1 . create
                                        eeee (if file exists)
                                                0 . fail
                                                1 . create
                        DS:SI       Address of ASCIIZ filename


          Returns:       AX         File handle (or error if CF set)
                         CX         Action taken:
                                        1 . file opened
                                        2 . file created/opened
                                        3 . file replaced/opened

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

     This function creates a file and can also open it. It combines the
     actions of opening, creating or creating new files. You can:

                o  Create a unique file

                o  Open an existing file

                o  Create or truncate an existing file

                o  Open a file which doesn't use file buffers

                o  Disable critical error processing for the file.

     You can specify the action you want taken by setting the bits in BX and
     CX. The bits in the Open Mode (BX) are particularly important.

     The aaa bits (see above) indicate the mode in which you will access
     this file (read, write, or read/write). The sss bits indicate the
     sharing privileges you want to extend to other processes. (Note that the
     process that opens a file first gets to set the sharing privileges for
     all other processes.)

     If the f bit is 0, DOS will handle handle errors by passing them on
     to the INT 24h error handler as usual. If it is 1, the errors will be
     passed as DOS error codes to the program.

     If the w bit in the open mode is 0, any disk write is followed by an
     automatic File Commit call (INT 21h, function 68h). This writes the data
     directly out to disk. If the w bit is 1, the data is buffered as is
     normal under DOS.

        Notes:        All these actions are possible under other functions
                      (specifically: 3Ch, 3Dh, 5Bh, and 68h), but this
                      function brings them together in one place.

See Also: 3Ch 3Dh 4Ah 5Bh 68h

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