WdfDeviceInitSetDeviceClass - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdfdevice.h

VOID WdfDeviceInitSetDeviceClass(
  [in] PWDFDEVICE_INIT DeviceInit,
  [in] const GUID      *DeviceClassGuid
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfdevice-wdfdeviceinitsetdeviceclass)

WdfDeviceInitSetDeviceClass function

Description

[Applies to KMDF only]

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

Parameters

DeviceInit [in]

A pointer to a WDFDEVICE_INIT structure.

DeviceClassGuid [in]

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.

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
                            );