DevHlp CloseFile
DevHlp_CloseFile is used by base device drivers to close a file previously opened using DevHlp_OpenFile. This devhlp closes a file opened by DevHlp_OpenFile.
Syntax
C
DevHlp_CloseFile ( PFILEIOINFO pFileClose)
Assembler
LES DI, FileClose MOV DL, DevHlp_CloseFile CALL [Device_Help]
Parameters
C
- pFILEIOINFO input
- Pointer to the FILEIOINFO structure defined as follows
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 fromfile */
} 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
Assembler
ES DI points to a FILEIOINFO structure defined as follows
FILEIOINFO struc ;
length dw 2 ; length of imbedded fle system operation structure
; must contain value 2 for CloseFile
FCLOSE struc
reserved dw ? ; reserved
FCLOSE ends
;
FILEIOINFO ends
Data Structure
; assembler structure SYICloseFile struc length dw 2 ; length of structure (must be 2) SYICloseFile ends
Return Code
C
Success Indicator 0 if file was closed.
- 24 ERROR_BAD_LENGTH
- Length in the FILEIOINFO structure is invalid.
Assembler
Results in Assembler
C Clear if the file is closed. AX = zero..
C Set if error. AX = Error Code. Possible errors
- 24 ERROR_BAD_LENGTH
- The length in the FILEIOINFO structure is invalid.
Errors
Remarks
DevHlp_FileClose may be called at initialization time only. It provides a primitive interface to the mini-IFS or micro_IFS at initialization.
Using this interface, one file only may be opened at a time. No handle is assigned by open. The file closed is assumed to be the most recent opened using DevHlp_OpenFile.
Valid at INIT time only. See also restrictions of DevHlp_OpenFile.
Example Code
C Sample
#include "dhcalls.h"
USHORT APIENTRY DevHlp_CloseFile
( PFILEIOINFO pFileClose)
pFILEIOINFO input
Pointer to the FILEIOINFO structure defined as follows
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 fromfile */
} 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
Assembler
LES DI, FileClose MOV DL, DevHlp_CloseFile CALL [Device_Help]