WdfDeviceInitSetDeviceClass method
[Applies to KMDF only]
The WdfDeviceInitSetDeviceClass method specifies a GUID that identifies the device's device setup class.
Syntax
VOID WdfDeviceInitSetDeviceClass( [in] PWDFDEVICE_INIT DeviceInit, [in] const GUID *DeviceClassGuid );
Parameters
- DeviceInit [in]
-
A pointer to a WDFDEVICE_INIT structure.
- DeviceClassGuid [in]
-
A pointer to a GUID that identifies a device setup class that was previously installed on the computer.
Note You should always specify a custom class GUID. You should not specify an existing class GUID. If you specify an existing class GUID, other drivers that attempt to specify that existing class GUID might fail to install or might install with incorrect security settings.
Return value
None
Remarks
The registry can contain values that override the values that a driver specifies when it calls WdfDeviceInitAssignSDDLString, WdfDeviceInitSetDeviceType, WdfDeviceInitSetCharacteristics, and WdfDeviceInitSetExclusive. The driver can call WdfDeviceInitSetDeviceClass to specify a GUID that identifies the section of the registry that contains the override values. This GUID also identifies the device's device setup class.
Typically, a driver calls WdfDeviceInitSetDeviceClass only if it is creating a control device.
For more information about using the registry, see Setting Device Object Registry Properties After Installation.
If a driver calls WdfDeviceInitSetDeviceClass, it must do so before it calls WdfDeviceCreate.
For more information about calling WdfDeviceCreate, see Creating a Framework Device Object.
If you are writing a UMDF driver, you must modify your driver's INF file or make registry changes to specify a device setup class. For more information about using the registry, see Setting Device Object Registry Properties During Installation.
Examples
The following code example sets a device's setup class to the system device class.
WdfDeviceInitSetDeviceClass( DeviceInit, &GUID_DEVCLASS_SYSTEM );
Requirements
Minimum KMDF version | 1.0 |
---|---|
Header |
|
Library |
|
IRQL | <= DISPATCH_LEVEL |
DDI compliance rules | ChildDeviceInitAPI, ControlDeviceInitAPI, DeviceInitAPI, DriverCreate, KmdfIrql, KmdfIrql2, PdoDeviceInitAPI |