This service provides a register-based VxD callable interface to the common file system functions. Other VxDs in the system can use this service to make file system calls without having to issue int 21h calls. An FSD itself can call this interface to do file system operations in certain situations. The different functions provided as part of this service are described below. Since these calls can be made only by 'trusted' system components, the IFS manager does not do any parameter validation on them. Users of this service should be very careful to check that they are passing in valid parameters.
OpenCreateFile
This interface is the same as the interface for the int 21h extended open function (06Ch ). If the R0_OPENCREATFILE function code is used, the operation is done in an independent context, so that handle is globally accessible from any VM. If the R0_OPENCREAT_IN_CONTEXT function code is used, the operation is done in the context of the current thread and process.
Special Ring 0 API Open Flags: | |
Value | Meaning |
---|---|
R0_NO_CACHE | Indicates that reads and writes on the file should not be cached. All operations will be directly done to the disk. |
R0_SWAPPER_CALL | Indicates that the I/O operation is being performed to the system swap file. This is a privileged call that should be set only by the memory manager when it is doing I/O to page stuff in and out of the disk. The file system that handles swap file I/O needs to ensure certain conditions to prevent deadlocks. These are described in section 8.3.4 of this document. |
[EAX] | Handle to opened file. |
[CX] | Actual action performed. For the return values, please refer to the document describing the int 21h, function 6Ch API. |
Carry flag set, an error occurred. [AX] contains the errorcode. | |
Registers Used
EAX, ECX, Flags. |
ReadFile
This function is called to read a file previously opened by OpenCreateFile. The handle must be one returned from the OpenCreateFile service described above, it cannot be a handle opened by issuing an int 21h. If the R0_READFILE_IN_CONTEXT function code is specified, the read operation is done in the current thread context. To use this function, the handle must have previously been opened using the R0_OPENCREAT_IN_CONTEXT function. The R0_READFILE function processes the read operation in the global context.
[ECX] | Number of bytes actually read. |
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used
EAX, ECX, Flags. |
WriteFile
This function is called to write to a file previously opened by OpenCreateFile. The handle must be one returned from the OpenCreateFile service described above, it cannot be a handle opened by issuing an int 21h. If the R0_WRITEFILE_IN_CONTEXT function code is specified, the read operation is done in the current thread context. To use this function, the handle must have previously been opened using the R0_OPENCREAT_IN_CONTEXT function. The R0_READFILE function processes the read operation in the global context.
[ECX] | Number of bytes actually written. |
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used
EAX, ECX, Flags. |
CloseFile
This function is called to close a file previously opened by OpenCreateFile. The handle must be one returned from the OpenCreateFile service described above, it cannot be a handle opened by issuing an int 21h.
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used
EAX, Flags. |
GetFileSize
This function is called to get the size of a file previously opened by OpenCreateFile. The handle must be one returned from the OpenCreateFile service described above, it cannot be a handle opened by issuing an int 21h.
[EAX] | Size of the file in bytes. |
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used
EAX, Flags. |
FindFirstFile
This function is called to perform a FindFirst operation. This function provides the same functionality as the FindFirst int 21h function 714Eh and supports long filenames.
[EAX] | Find context handle to be used for a subsequent FindNextFile operation.
The find data buffer is filled in appropriately. |
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used
EAX, Flags. |
FindNextFile
This function is called to perform a FindNext operation. The handle used for this call must be one obtained by calling the FindFirstFile service described above, it cannot be a handle obtained by issuing an int 21h call.
The find data buffer is filled in appropriately.
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used
EAX, Flags. |
FindCloseFile
This function is called to terminate a Find operation. The handle used for this call must be one obtained by calling the FindFirstFile service described above, it cannot be a handle obtained by issuing an int 21h call.
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used
EAX, Flags. |
FileAttributes
This function is called to get or set the current attributes of a file. It provides the same functionality as the int 21h function 7143h.
SET_ATTRIBUTES to set the attributes of a file.
[CX] | Attributes of the file returned only on the GET_ATTRIBUTES operation. |
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used |
EAX, ECX, Flags.
RenameFile
This function is called to rename a file. This provides the same functionality as the int 21h function 7156h.
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used | |
Flags. |
DeleteFile
This function is called to delete a file. This provides the same functionality as the int 21h function 7141h.
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used | |
Flags. |
LockFile
This function is called to perform record locking operations on files. This provides the same functionality as the int 21h function 5Ch. The handle passed in should be obtained by calling the OpenCreateFile function described above, it cannot be a handle obtained by issuing an int 21h call. Note that this operation is always done in the current context because it makes no sense to have a file lock in a global context. Hence, the OpenCreateFile should have been done using the context-sensitive R0_OPENCREAT_IN_CONTEXT function code.
UNLOCK_REGION to release a record lock.
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used | |
Flags. |
GetDiskFreeSpace
This function returns the current disk free space statistics. It provides the same functionality as int 21h function 36h.
[AX] | Number of sectors per cluster. |
[BX] | Number of available clusters on disk. |
[CX] | Number of bytes per sector. |
[DX] | Total number of clusters on disk. |
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used
AX, BX, CX, DX, Flags. |
ReadAbsoluteDisk
This function is called to read absolute sectors from the disk. It provides the same functionality as the int 25h interface.
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used | |
Flags. |
WriteAbsoluteDisk
This function is called to write absolute sectors to the disk. It provides the same functionality as the int 26h interface.
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used | |
Flags. |
IoctlHandle
This function is called to do a handle-based IOCtl. It is currently used by certain system components and should not be used by other VxDs. Other than the registers documented here, the rest of the IOCtl parameters depend on the specific IOCtl being used and should be the same as that for the corresponding int 21h IOCtl sub-function.
Carry flag set, an error occurred. [AX] contains the errorcode.
Registers Used
EAX, Flags. |