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,
  [inconst GUID            *DeviceClassGuid
);

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.
 

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

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, ControlDeviceInitAPI, DeviceInitAPI, DriverCreate, KmdfIrql, KmdfIrql2, PdoDeviceInitAPI

 

 

Send comments about this topic to Microsoft

Show: