WdfDeviceInitSetDeviceClass function (wdfdevice.h)

[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

[in] DeviceInit

A pointer to a WDFDEVICE_INIT structure.

[in] DeviceClassGuid

Pointer to a GUID that identifies a section of the registry containing possible overrides for the DefaultSDDLString, DeviceType, DeviceCharacteristics, and Exclusive parameters.

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.

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.

Examples

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

DEFINE_GUID(GUID_DEVCLASS_MYUNIQUEID,
0xf149fe88, 0x f6cc, 0x47e3, 0x85, 0x94, 0xe2, 0xaa, 0xb6, 0xe0, 0x3b, 0xdf);

WdfDeviceInitSetDeviceClass(
                            DeviceInit,
                            &GUID_DEVCLASS_MYUNIQUEID
                            );

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdfdevice.h (include Wdf.h)
Library Wdf01000.sys (see Framework Library Versioning.)
IRQL <= DISPATCH_LEVEL
DDI compliance rules ChildDeviceInitAPI(kmdf), ControlDeviceInitAPI(kmdf), DeviceInitAPI(kmdf), DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), PdoDeviceInitAPI(kmdf)