This Book's Link Library (Cont.)
CloseFile
It closes a file that was previously opened.
The file is identified by a 32-bit integer handle, which is passed in EAX.
CreateOutputFile
It creates a disk file and opens it in output mode.
Pass the offset of a file name in EDX.
When the procedure returns,
- if the file was created successfully,
EAX contains a valid file handle;
- otherwise,
EAX equals INVALID_HANDLE_VALUE (a predefined constant).
OpenInputFile
It opens an existing file for input.
Pass it the offset of a filename in EDX.
When it returns,
- if the file was opened successfully,
EAX contains a valid file handle;
- otherwise,
EAX equals INVALID_HANDLE_VALUE.
ReadFromFile
It reads an input file into a buffer.
Pass it an open file handle in EAX, the offset of a buffer in EDX, and the maximum number of bytes to read in ECX.
When the procedure returns,
- if
CF = 0, EAX contains a count of the number of bytes read from the file;
- if
CF = 1, EAX contains the system error code explaining what went wrong.
WriteToFile
It writes the contents of a buffer to an output file.
Pass it a valid file handle in EAX, the offset of the buffer in EDX, and the number of bytes to write in ECX.
When the procedure returns, EAX contains a count of the number of bytes written.