Bewerken

Delen via


WdfPdoInitAssignRawDevice function (wdfpdo.h)

[Applies to KMDF only]

The WdfPdoInitAssignRawDevice method indicates that the calling driver can support a specified device in raw mode.

Syntax

NTSTATUS WdfPdoInitAssignRawDevice(
  [in] PWDFDEVICE_INIT DeviceInit,
  [in] const GUID      *DeviceClassGuid
);

Parameters

[in] DeviceInit

A pointer to a WDFDEVICE_INIT structure.

[in] DeviceClassGuid

A pointer to a GUID that identifies a device setup class.

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.

For more information, see the following Remarks section.

Return value

If the operation succeeds, the method returns STATUS_SUCCESS. Otherwise it returns STATUS_INVALID_PARAMETER.

Remarks

The driver must call WdfPdoInitAssignRawDevice before calling WdfDeviceCreate. For more information about calling WdfDeviceCreate, see Creating a Framework Device Object.

The registry can contain values that override the values that a driver specifies when it calls WdfDeviceInitAssignSDDLString, WdfDeviceInitSetDeviceType, WdfDeviceInitSetCharacteristics, and WdfDeviceInitSetExclusive. The WdfPdoInitAssignRawDevice method's DeviceClassGuid parameter specifies a GUID that identifies the section of the registry that contains the override values. The DeviceClassGuid parameter only identifies a section of the registry and does not actually set the device setup class for the device. The INF Version section in your device and driver's INF file sets the device setup class. Typically, the DeviceClassGuid parameter's GUID should match the GUID that the INF Version section specifies.

For more information about using the registry, see Setting Device Object Registry Properties After Installation.

Examples

The following snippet from the kmdf_enumswitches driver sample indicates that a driver can support the specified device in raw mode.

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

status = WdfPdoInitAssignRawDevice(
                                   pDeviceInit,
                                   &GUID_DEVCLASS_MYUNIQUEID
                                   );

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdfpdo.h (include Wdf.h)
Library Wdf01000.sys (see Framework Library Versioning.)
IRQL PASSIVE_LEVEL
DDI compliance rules ChildDeviceInitAPI(kmdf), DriverCreate(kmdf), InitFreeDeviceCallback(kmdf), InitFreeDeviceCreate(kmdf), InitFreeNull(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), PdoDeviceInitAPI(kmdf), PdoInitFreeDeviceCallback(kmdf), PdoInitFreeDeviceCreate(kmdf)

See also

WdfDeviceInitAssignSDDLString

WdfDeviceInitSetCharacteristics

WdfDeviceInitSetDeviceType

WdfDeviceInitSetExclusive