Using Files In A Driver
The Microsoft Windows executive represents files by file objects, which are executive objects that are managed by the object manager. (Directories are also represented by file objects.)
Kernel-mode components refer to a file by its object name, which is \DosDevices concatenated to the file's full path. (On Microsoft Windows 2000 and later versions of the operating system, \?? is equivalent to \DosDevices.) For example, the object name of the C:\WINDOWS\example.txt file is \DosDevices\C:\WINDOWS\example.txt. You use the object name to open a handle to a file. For more information about object names, see Object Names.
Open a handle to the file.
For more information, see Opening a Handle to a File.
Perform the intended operations by calling the appropriate ZwXxxFile routines.
For more information, see Using a File Handle.
Close the handle by calling ZwClose.
Every time that you open a handle to a file, the Windows executive creates a file object that represents the file, and it returns an open handle to that object. Therefore, multiple file objects can exist for a single file. (Because a user-mode application can copy a handle, multiple handles can also exist for the same file object.) After all the open handles to a file object are closed, the Windows executive deletes the file object.
Build date: 2/11/2014