NdisOpenFile (NDIS 5.1) function
Note NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.
NdisOpenFile returns a handle for an opened file.
VOID NdisOpenFile( _Out_ PNDIS_STATUS Status, _Out_ PNDIS_HANDLE FileHandle, _Out_ PUINT FileLength, _In_ PNDIS_STRING FileName, _In_ NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress );
- Status [out]
Pointer to a caller-supplied variable in which this function returns the status of the open file operation, which can be one of the following:
The handle at FileHandle is valid for a subsequent call to NdisMapFile.
The given string at FileName did not specify a name found in the system object namespace.
NDIS could not allocate the resources it needed to open the file and allocate a buffer for the file contents.
The specified file's data could not be read into system memory for subsequent access by the caller.
- FileHandle [out]
Pointer to a caller-supplied variable in which this function returns the handle of the opened file if the call succeeds.
- FileLength [out]
Pointer 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 [in]
Pointer to an NDIS_STRING type containing an initialized counted string, in the system-default character set, naming the file to be opened. For Windows 2000 and later drivers, this string contains Unicode characters. That is, for Windows 2000 and later, NDIS defines the NDIS_STRING type as a UNICODE_STRING type.
- HighestAcceptableAddress [in]
Specifies the highest physical address in which the file data can be stored, or specifies -1 if the driver places no restrictions.
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.