GPIO_CLX_ProcessAddDevicePreDeviceCreate函式 (gpioclx.h)

GPIO_CLX_ProcessAddDevicePreDeviceCreate方法會將初始化資訊載入兩個結構,這些結構會當做輸入參數傳遞至 WdfDeviceCreate 方法。

語法

NTSTATUS GPIO_CLX_ProcessAddDevicePreDeviceCreate(
  [in]      WDFDRIVER              Driver,
  [in, out] PWDFDEVICE_INIT        DeviceInit,
  [out]     PWDF_OBJECT_ATTRIBUTES FdoAttributes
);

參數

[in] Driver

GPIO 控制器驅動程式之架構驅動程式物件的 WDFDRIVER 句柄。

[in, out] DeviceInit

架構配置 WDFDEVICE_INIT 結構的指標。 這個方法會將初始化資訊載入這個結構。 傳回時,此結構已準備好作為 WdfDeviceCreate 方法的輸入參數。

[out] FdoAttributes

呼叫端配置 WDF_OBJECT_ATTRIBUTES 結構的指標。 這個方法會將初始化資訊載入這個結構。 傳回時,此結構已準備好作為 WdfDeviceCreate 方法的輸入參數。

傳回值

如果 呼叫成功,GPIO_CLX_ProcessAddDevicePreDeviceCreate會傳回STATUS_SUCCESS。 可能的傳回值包括下列錯誤碼。

傳回碼 Description
STATUS_INVALID_PARAMETER
呼叫端不是 GpioClx 的已註冊用戶端。
STATUS_INSUFFICIENT_RESOURCES
記憶體不足。

備註

GPIO 控制器驅動程式必須在其 EvtDriverDeviceAdd 回呼函式中呼叫這個方法,才能呼叫 WdfDeviceCreate 方法,以建立代表 GPIO 控制器的裝置物件 (FDO) 。 否則,GPIO 架構延伸模組 (GpioClx) 無法處理新架構裝置物件的 I/O 要求或處理中斷。

範例

下列程式代碼範例顯示 「XYZ」 GPIO 控制器裝置的 GPIO 控制器驅動程式中的 EvtDriverDeviceAdd 回呼函式。

NTSTATUS
  XyzEvtDriverDeviceAdd(
    _In_ WDFDRIVER Driver,
    _Inout_ PWDFDEVICE_INIT DeviceInit
    )
{
    WDFDEVICE Device;
    WDF_OBJECT_ATTRIBUTES FdoAttributes;
    NTSTATUS Status;

    Status = GPIO_CLX_ProcessAddDevicePreDeviceCreate(Driver,
                                                      DeviceInit,
                                                      &FdoAttributes);
    if (!NT_SUCCESS(Status)) {
        goto ExitDeviceAdd;
    }

    //
    // Call the framework to create the device and attach it to the lower stack.
    //

    Status = WdfDeviceCreate(&DeviceInit, &FdoAttributes, &Device);
    if (!NT_SUCCESS(Status)) {
        goto ExitDeviceAdd;
    }

    Status = GPIO_CLX_ProcessAddDevicePostDeviceCreate(Driver, Device);
    if (!NT_SUCCESS(Status)) {
        goto ExitDeviceAdd;
    }

ExitDeviceAdd:
    return Status;
}

在上述程式代碼範例中, WdfDeviceCreate 呼叫會建立代表 GPIO 控制器裝置的架構裝置物件。 這個呼叫點的兩個輸入參數會 指向 WDFDEVICE_INITWDF_OBJECT_ATTRIBUTES 結構。 這些結構是由 GPIO_CLX_ProcessAddDevicePreDeviceCreate 呼叫所修改,其位於 WdfDeviceCreate 呼叫之前。 來自 WdfDeviceCreate 呼叫的輸出參數GPIO_CLX_ProcessAddDevicePostDeviceCreate呼叫的輸入參數,後面接著 WdfDeviceCreate 呼叫。

規格需求

需求
最低支援的用戶端 從 Windows 8 開始提供。
目標平台 Universal
標頭 gpioclx.h
程式庫 Msgpioclxstub.lib
IRQL PASSIVE_LEVEL

另請參閱

EvtDriverDeviceAdd

GPIO_CLX_ProcessAddDevicePostDeviceCreate

WDFDEVICE_INIT

WDF_OBJECT_ATTRIBUTES

WdfDeviceCreate