NdisMapFile function (ndis.h)

The NdisMapFile function maps an already open file into a caller-accessible buffer if the file is currently unmapped.

Syntax

void NdisMapFile(
  [out] PNDIS_STATUS Status,
  [out] PVOID        *MappedBuffer,
  [in]  NDIS_HANDLE  FileHandle
);

Parameters

[out] Status

A pointer to a caller-supplied variable in which this function returns the status of the mapping operation, which can be one of the following:

NDIS_STATUS_SUCCESS

The caller has exclusive access to the file contents until the NdisUnmapFile function is called.

NDIS_STATUS_ALREADY_MAPPED

The caller cannot access the file contents at this time.

[out] MappedBuffer

A pointer to a caller-supplied variable in which this function returns the base virtual address of the mapped file contents or NULL.

[in] FileHandle

The handle that was returned by a preceding call to the NdisOpenFile function.

Return value

None

Remarks

NdisMapFile associates (maps) a virtual address range with an opened file so the driver can access the file contents. NdisMapFile allows only one mapping of a particular file to be outstanding at any time. Consequently, a successful caller is given exclusive access to the file data until NdisUnmapFile or the NdisCloseFile function is called.

A miniport driver can map and unmap such an open file as necessary, using alternating calls to NdisMapFile and NdisUnmapFile. A call to NdisCloseFile releases the FileHandle and deallocates the buffer containing the file contents.

A miniport driver can call NdisMapFile only during initialization.

Requirements

Requirement Value
Minimum supported client Supported for NDIS 6.0 and NDIS 5.1 drivers (see NdisMapFile (NDIS 5.1)) in Windows Vista. Supported for NDIS 5.1 drivers (see NdisMapFile (NDIS 5.1)) in Windows XP.
Target Platform Universal
Header ndis.h (include Video.h)
Library Ndis.lib
IRQL <= DISPATCH_LEVEL
DDI compliance rules Irql_Miscellaneous_Function(ndis)

See also

MiniportInitializeEx

NdisCloseFile

NdisOpenFile

NdisUnmapFile