Enumerates open files on the specified drive.
mov ax, 440Dh ; generic IOCTL
mov bx, DriveNum ; see below
mov ch, 08h ; device category (must be 08h)
mov cl, 6Dh ; Enumerate Open Files
mov dx, seg PathBuf ; see below
mov ds, dx
mov dx, offset PathBuf
mov si, FileIndex ; see below
mov di, EnumType ; see below
int 21h
jc error
mov [OpenMode], ax ; mode file was opened in
mov [FileType], cx ; normal file or memory-mapped file
Clears the carry flag, copies the path of an open file to the given buffer, and sets the AX and CX registers to the following values if successful:
AX | Mode that the file was opened in, which is a combination of access mode, sharing mode, and open flags. It can be one value each from the access and sharing modes and any combination of open flags. | |
Access modes | ||
OPEN_ACCESS_READONLY (0000h) | ||
OPEN_ACCESS_WRITEONLY (0001h) | ||
OPEN_ACCESS_READWRITE (0002h) | ||
OPEN_ACCESS_RO_NOMODLASTACCESS (0004h) | ||
Share modes | ||
OPEN_SHARE_COMPATIBLE (0000h) | ||
OPEN_SHARE_DENYREADWRITE (0010h) | ||
OPEN_SHARE_DENYWRITE (0020h) | ||
OPEN_SHARE_DENYREAD (0030h) | ||
OPEN_SHARE_DENYNONE (0040h) | ||
Open flags | ||
OPEN_FLAGS_NOINHERIT (0080h) | ||
OPEN_FLAGS_NO_BUFFERING (0100h) | ||
OPEN_FLAGS_NO_COMPRESS (0200h) | ||
OPEN_FLAGS_ALIAS_HINT (0400h) | ||
OPEN_FLAGS_NOCRITERR (2000h) | ||
OPEN_FLAGS_COMMIT (4000h) | ||
CX | File type. It can be one of the following values: | |
0 | For normal files | |
1 | For a memory-mapped files (memory-mapped files are unmovable) | |
2 | For any other unmovable files (32-bit Windows-based DLLs and executables) | |
4 | For the swap file |
Note that if a memory-mapped file is returned (CX = 1), the value returned in the AX register is limited to the following values:
OPEN_ACCESS_READONLY (0000h) |
OPEN_ACCESS_READWRITE (0002h) |
Otherwise, the function sets the carry flag and sets the AX register to the following error value:
ERROR_ACCESS_DENIED | The value of FileIndex exceeds the number of open files on the drive. |
This function returns information about one file at a time. To enumerate all open files, the function must be called repeatedly with FileIndex set to a new value for each call. FileIndex should be set to zero initially and then incremented by one for each subsequent call. The function returns the ERROR_NO_MORE_FILES error value when all open files on the volume have been enumerated.