Espandi Riduci a icona

WdfDeviceInitSetDeviceClass method

[Applies to KMDF only]

The WdfDeviceInitSetDeviceClass method specifies a GUID that identifies the device's device setup class.


VOID WdfDeviceInitSetDeviceClass(
  [in]       PWDFDEVICE_INIT DeviceInit,
  [inconst GUID            *DeviceClassGuid


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



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.


The following code example sets a device's setup class to the system device class.



Target platform


Minimum KMDF version



Wdfdevice.h (include Wdf.h)


Wdf01000.sys (see Framework Library Versioning.)



DDI compliance rules

ChildDeviceInitAPI, ControlDeviceInitAPI, DeviceInitAPI, DriverCreate, KmdfIrql, KmdfIrql2, PdoDeviceInitAPI



Send comments about this topic to Microsoft

© 2015 Microsoft