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。 可能的傳回值包括下列錯誤碼。
傳回碼 | 描述 |
---|---|
|
呼叫端不是 GpioClx 的已註冊用戶端。 |
|
記憶體不足。 |
言論
GPIO 控制器驅動程序必須在其 EvtDriverDeviceAdd 回呼函式中呼叫此方法,才能呼叫代表 GPIO 控制器的 WdfDeviceCreate 方法。 否則,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_INIT 和 WDF_OBJECT_ATTRIBUTES 結構。 這些結構是由 GPIO_CLX_ProcessAddDevicePreDeviceCreate 呼叫所修改,在 WdfDeviceCreate 呼叫之前。 輸出參數 Device,從 WdfDeviceCreate 呼叫,是 GPIO_CLX_ProcessAddDevicePostDeviceCreate 呼叫的輸入參數,後面接著 WdfDeviceCreate 呼叫。
要求
要求 | 價值 |
---|---|
最低支援的用戶端 | 從 Windows 8 開始提供。 |
目標平臺 | 普遍 |
標頭 | gpioclx.h |
連結庫 | Msgpioclxstub.lib |
IRQL | PASSIVE_LEVEL |