DevHlp CloseFile: Difference between revisions
Created page with "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 <PR..." |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:DevHlp_CloseFile}} | |||
DevHlp_CloseFile is used by base device drivers to close a file previously opened using DevHlp_OpenFile. | 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. | This devhlp closes a file opened by DevHlp_OpenFile. | ||
Line 56: | Line 57: | ||
<PRE> | <PRE> | ||
FILEIOINFO struc ; | FILEIOINFO struc ; | ||
length dw 2 ; length of imbedded fle system operation structure | length dw 2 ; length of imbedded fle system operation structure | ||
; must contain value 2 for CloseFile | ; must contain value 2 for CloseFile | ||
FCLOSE struc | FCLOSE struc | ||
reserved dw ? ; reserved | reserved dw ? ; reserved | ||
FCLOSE ends | FCLOSE ends | ||
; | ; | ||
FILEIOINFO ends | FILEIOINFO ends | ||
</PRE> | |||
====Data Structure==== | |||
<PRE> | |||
; assembler structure | |||
SYICloseFile struc | |||
length dw 2 ; length of structure (must be 2) | |||
SYICloseFile ends | |||
</PRE> | </PRE> | ||
Line 72: | Line 81: | ||
===Assembler=== | ===Assembler=== | ||
Results in Assembler | |||
C Clear if the file is closed. AX = zero.. | C Clear if the file is closed. AX = zero.. | ||
Line 78: | Line 87: | ||
C Set if error. AX = Error Code. Possible errors | C Set if error. AX = Error Code. Possible errors | ||
; 24 ERROR_BAD_LENGTH : The length in the FILEIOINFO structure is invalid. | ; 24 ERROR_BAD_LENGTH : The length in the FILEIOINFO structure is invalid. | ||
==Errors== | ==Errors== | ||
Line 86: | Line 95: | ||
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. | 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== | ==Example Code== |
Latest revision as of 15:29, 18 May 2025
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]