WdfDeviceSetCharacteristics 函式 (wdfdevice.h)

[僅適用於 KMDF]

WdfDeviceSetCharacteristics 方法會設定指定裝置的裝置特性。

語法

void WdfDeviceSetCharacteristics(
  [in] WDFDEVICE Device,
  [in] ULONG     DeviceCharacteristics
);

參數

[in] Device

架構裝置物件的句柄。

[in] DeviceCharacteristics

值,包含代表裝置特性的 ORed 系統定義常數。 如需詳細資訊,請參閱 DEVICE_OBJECT 結構的特性成員。

傳回值

備註

如果驅動程式提供無效的物件句柄,就會發生錯誤檢查。

您應該先在 EvtDriverDeviceAdd 回呼函式中呼叫 WdfDeviceInitSetCharacteristics 方法,再呼叫 WdfDeviceCreate 來設定裝置特性。 如果您的驅動程式在 EvtDriverDeviceAdd 回呼函式傳回之前無法判斷裝置的特性,驅動程式通常應該在其 EvtDevicePrepareHardware 回呼函式中呼叫 WdfDeviceSetCharacteristics

WdfDeviceSetCharacteristics 的每個呼叫都會覆寫任何先前呼叫的設定。

範例

下列程式代碼範例會設定指定裝置的FILE_REMOVABLE_MEDIA特性。

WdfDeviceSetCharacteristics(
                            Device,
                            FILE_REMOVABLE_MEDIA
                            );

規格需求

需求
目標平台 Universal
最低 KMDF 版本 1.0
標頭 wdfdevice.h (包含 Wdf.h)
程式庫 Wdf01000.sys (請參閱 Framework Library Versioning.)
IRQL <=DISPATCH_LEVEL
DDI 合規性規則 DriverCreate (kmdf) KmdfIrql (kmdf) KmdfIrql2 (kmdf) 、 KmdfIrqlExplicit (kmdf)

另請參閱

WdfDeviceGetCharacteristics

WdfDeviceInitSetCharacteristics