Partager via


NdisOpenFile (Windows Embedded CE 6.0)

1/6/2010

This function returns a handle for an opened file.

Syntax

VOID NdisOpenFile(
  PNDIS_STATUS Status,
  PNDIS_HANDLE FileHandle,
  PUINT FileLength,
  PNDIS_STRING FileName,
  NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress
);

Parameters

  • Status
    [out] Points to a caller-supplied variable in which this function returns the status of the open file operation.
  • FileHandle
    [out] Points to a caller-supplied variable in which this function returns the handle of the opened file if the call succeeds.
  • FileLength
    [out] 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
    [in] Points to a buffered, caller-initialized counted string, in the system-default character set, naming the file to be opened.
  • HighestAcceptableAddress
    [in] Specifies the highest physical address in which the file data can be stored, or specifies -1 if the driver places no restrictions.

Return Value

The following table shows the return values for the status of this function.

Value Description

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 caller could not read the specified file's data into system memory for subsequent access.

Remarks

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. By calling NdisUnmapFile, NdisOpenFile can page out the file to minimize resource consumption while the driver is not accessing the file data. When finished using the file, MiniportInitialize must call NdisCloseFile.

Requirements

Header ndis.h
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

NDIS Library Functions
NdisMCreateLog
NdisCloseFile
NdisMapFile
NdisUnmapFile
MiniportInitialize