信息
您所需的主题如下所示。但此主题未包含在此库中。

EvtDeviceFileCreate

A driver's EvtDeviceFileCreate callback function handles operations that must be performed when an application requests access to a device.

语法

EVT_WDF_DEVICE_FILE_CREATE EvtDeviceFileCreate;

VOID EvtDeviceFileCreate(
  __in  WDFDEVICE Device,
  __in  WDFREQUEST Request,
  __in  WDFFILEOBJECT FileObject
)
{ ... }

参数

Device [in]

A handle to a framework device object.

Request [in]

A handle to a framework request object that represents a file creation request.

FileObject [in]

A handle to a framework file object that describes a file that is being opened for the specified request. This parameter is NULL if the driver has specified WdfFileObjectNotRequired for the FileObjectClass member of the WDF_FILEOBJECT_CONFIG structure.

返回值

None

评论

The framework calls a driver's EvtDeviceFileCreate callback function when a user application or another driver opens the device to perform an I/O operation, such as reading or writing a file.

The driver can pass the Request handle to WdfRequestGetParameters to retrieve parameters that are associated with the file creation request. The parameters are stored in the Parameters.Create member of the WDF_REQUEST_PARAMETERS structure.

This callback function is called synchronously, in the context of the user thread that opens the device.

To register an EvtDeviceFileCreate callback function, the driver must call the WdfDeviceInitSetFileObjectConfig method.

For more information about framework file objects and the EvtDeviceFileCreate callback function, see Framework File Objects.

示例

The function type is declared in Wdfdevice.h, as follows.

typedef VOID
 (EVT_WDF_DEVICE_FILE_CREATE)(
    IN WDFDEVICE  Device,
    IN WDFREQUEST  Request,
    IN WDFFILEOBJECT  FileObject
    );

To define an EvtDeviceFileCreate callback function that is named MyDeviceFileCreate, you must first provide a function declaration that SDV and other verification tools require, as follows:

EVT_WDF_DEVICE_FILE_CREATE  MyDeviceFileCreate;

Then, implement your callback function as follows:

VOID
 MyDeviceFileCreate (
    IN WDFDEVICE  Device,
    IN WDFREQUEST  Request,
    IN WDFFILEOBJECT  FileObject
    )
  {...}

要求

版本

Supported by version 1.0 and later versions of KMDF.

标头

Wdfdevice.h (包括Wdf.h)

IRQL

PASSIVE_LEVEL

另请参见

WDF_FILEOBJECT_CONFIG

 

 

社区附加资源

显示:
© 2014 Microsoft