DevHlp_ReadFileAt is used by base device drivers to read a file previously opened using DevHlp_OpenFile from a specified file location.
Calling Sequence in Assembler
LES DI, ReadFileAt MOV DL, DevHlp_ReadFileAt CALL [Device_Help]
ES DI points to a FILEIOINFO structure defined as follows
FILEIOINFO struc length dw 12 ; length of imbedded fle system operation structure ; FREADAT struc Buffer dd ? ; 16 16 pointer to input buffer Readsize dd ? ; length of data to read StartPosition dd ? ; starting position relative to the beginning of the file FREADAT ends ; FILEIOINFO ends
Results in Assembler
C Clear if file is closed. AX = zero.
C Set if error. AX = Error code. Possible errors
24 ERROR_BAD_LENGTH
Calling Sequence in C
#include "dhcalls.h"
USHORT APIENTRY DevHelp_FileReadAt
typedef struct FOPEN { PSZ FileName; /* (input) pointer to file name */ ULONG FileSize; /* (output) size of file returned by FileOpen */ } FILEOPEN; typedef struct FCLOSE { USHORT reserved /* reserved */ } FILECLOSE; typedef struct FREAD { PBYTE Buffer; /* (input) pointer to input buffer */ ULONG ReadSize; /* (input) number of bytes to read from file */ } FILEREAD; typedef struct FREADAT { PBYTE Buffer; /* (input) pointer to input buffer */ ULONG ReadSize; /* (input) number of bytes to read from file */ ULONG StartPosition /* (input) starting file position relative to the beginning of the file */ } FILEREADAT; typedef union FILEIOOP { struct FOPEN FileOpen; struct FCLOSE FileClose; struct FREAD FileRead; struct FREADAT FileReadAt; } FILEIOOP; typedef struc _DDFileIo { USHORT Length; /* (input) length of imbedded structure */ FILEIOOP Data; /* (input) imbedded file system operation structure */ } FILEIOINFO, FAR * PFILEIOINFO
Results in C
24 ERROR_BAD_LENGTH
Remarks
The current file position is set according to the StartPosition. The file is read from that file position. After a successful read, the current file position is updated.
Using this interface, one file only may be opened at a time. No handle is assigend by open. The file read is assumed to be the most recent opened using DevHlp_OpenFile.