NdisOpenFile
VOID
NdisOpenFile(
OUT PNDIS_STATUS Status,
OUT PNDIS_HANDLE FileHandle,
OUT PUINT FileLength,
IN PNDIS_STRING FileName,
IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress
);
NdisOpenFile returns a handle for an opened file.
Parameters
-
Status
-
Points to a caller-supplied variable in which this function returns the status
of the open file operation, which can be one of the following:
-
NDIS_STATUS_SUCCESS
-
The handle at FileHandle is valid for a subsequent call to NdisMapFile.
-
NDIS_STATUS_FILE_NOT_FOUND
-
The given string at FileName did not specify a name found in the system
object namespace.
-
NDIS_STATUS_RESOURCES
-
NDIS could not allocate the resources it needed to open the file and allocate
a buffer for the file contents.
-
NDIS_STATUS_ERROR_READING_FILE
-
The specified file’s data could not be read into system memory for subsequent
access by the caller.
-
FileHandle
-
Points to a caller-supplied variable in which this function returns the handle
of the opened file if the call succeeds.
-
FileLength
-
Points to a caller-supplied variable in which this function writes the number
of bytes of data in the opened file if the call succeeds.
-
FileName
-
Points to a buffered, caller-initialized counted string, in the system-default
character set, naming the file to be opened. For Windows NT drivers, this
string contains Unicode characters.
-
HighestAcceptableAddress
-
Specifies the highest physical address in which the file data can be stored,
or specifies -1 if the driver places no restrictions.
Comments
NdisOpenFile opens a disk file, typically a file the driver will later
download to program an intelligent NIC. NdisOpenFile also allocates
storage to hold file contents for the driver’s subsequent call to NdisMapFile.
A NIC driver should call NdisOpenFile only from MiniportInitialize.
When NdisOpenFile returns, the NIC driver can access file data by
calling NdisMapFile. It can call NdisUnmapFile to page out the
file so it does not consume resources unnecessarily while the driver is not
accessing the file data. When finished using the file, MiniportInitialize must
call NdisCloseFile.
Callers of NdisOpenFile run at IRQL PASSIVE_LEVEL.
See Also
MiniportInitialize, NdisMCreateLog,
NdisCloseFile, NdisMapFile,
NdisUnmapFile