UfxFdoInit 函数 (ufxclient.h)

初始化客户端驱动程序随后在调用 WdfDeviceCreate时提供的WDFDEVICE_INIT结构。

语法

NTSTATUS UfxFdoInit(
  [in]      WDFDRIVER              WdfDriver,
  [in, out] PWDFDEVICE_INIT        DeviceInit,
  [in, out] PWDF_OBJECT_ATTRIBUTES FdoAttributes
);

参数

[in] WdfDriver

驱动程序的 WDF 驱动程序对象的句柄,驱动程序从先前调用 WdfDriverCreateWdfGetDriver获取。

[in, out] DeviceInit

指向 WDFDEVICE_INIT 结构的指针。

[in, out] FdoAttributes

指向调用方分配 WDF_OBJECT_ATTRIBUTES 结构的指针,该结构描述对象的对象属性

返回值

如果作成功,该方法将返回STATUS_SUCCESS,或NT_SUCCESS(status) 等于 TRUE 的另一个状态值。 否则,它将返回一个状态值,NT_SUCCESS(status) 等于 FALSE。

言论

客户端驱动程序在其 EvtDriverDeviceAdd 回调函数中接收指向框架分配 WDFDEVICE_INIT 结构的指针。 然后,在调用 WdfDeviceCreate 以创建 WDFDEVICE 对象之前,它会使用此指针调用 UfxFdoInit

默认情况下,对于 WDF 驱动程序,设备的函数驱动程序是电源策略所有者。

以下代码片段演示如何调用 UfxFdoInit

NTSTATUS
UfxClientDeviceCreate(
    _In_ WDFDRIVER Driver,
    _In_ PWDFDEVICE_INIT DeviceInit
    )
/*++

Routine Description:

    Worker routine called to create a device and its software resources.

Arguments:

    Driver - WDF driver object

    DeviceInit - Pointer to an opaque init structure. Memory for this
                 structure will be freed by the framework when WdfDeviceCreate
                 succeeds. So don't access the structure after that point.

Return Value:

    Appropriate NTSTATUS value

--*/
{
    WDF_OBJECT_ATTRIBUTES DeviceAttributes;
    WDFDEVICE WdfDevice;

    PAGED_CODE();

    WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&DeviceAttributes, CONTROLLER_CONTEXT);

    //
    // Do UFX-specific initialization
    //
    Status = UfxFdoInit(Driver, DeviceInit, &DeviceAttributes);

    //
    // Proceed to WdfDeviceCreate
    //
    
    ...

}

要求

要求 价值
最低支持的客户端 Windows 10
目标平台 窗户
标头 ufxclient.h
ufxstub.lib
IRQL PASSIVE_LEVEL