IoSetDevicePropertyData function (wdm.h)

The IoSetDevicePropertyData routine modifies the current setting for a device property.

Syntax

NTSTATUS IoSetDevicePropertyData(
  [in]           PDEVICE_OBJECT   Pdo,
  [in]           const DEVPROPKEY *PropertyKey,
  [in]           LCID             Lcid,
  [in]           ULONG            Flags,
  [in]           DEVPROPTYPE      Type,
  [in]           ULONG            Size,
  [in, optional] PVOID            Data
);

Parameters

[in] Pdo

A pointer to the physical device object (PDO) for the device that is being queried.

[in] PropertyKey

A pointer to a DEVPROPKEY structure that specifies the device property key.

[in] Lcid

A locale identifier. Set this parameter either to a language-specific LCID value or to LOCALE_NEUTRAL.

The LOCALE_NEUTRAL LCID specifies that the property is language-neutral (that is, not specific to any language).

Do not set this parameter to LOCALE_SYSTEM_DEFAULT or LOCALE_USER_DEFAULT.

For more information about language-specific LCID values, see LCID Structure.

[in] Flags

Set this parameter to PLUGPLAY_PROPERTY_PERSISTENT if the property value set by this routine should persist across computer restarts. Otherwise, set Flags to zero.

Windows 8 and Windows Server 2012 and later operating systems treat Flags as if PLUGPLAY_PROPERTY_PERSISTENT is always passed.

[in] Type

A DEVPROPTYPE value that specifies the type of the data that is provided in the Data buffer.

[in] Size

The size, in bytes, of the buffer that Data points to.

[in, optional] Data

A pointer to the device property data. Set this parameter to NULL to delete the specified property. If Data is non-NULL, the routine stores an internal copy of the property value. The buffer pointed to by Data does not need to remain valid after the call returns.

Return value

IoSetDevicePropertyData returns STATUS_SUCCESS if the call was successful, or the appropriate NTSTATUS code on failure.

Remarks

To see property types available for use by this routine, see DEVPROP_TYPE_BYTE and adjacent pages for DEVPROP_TYPE_*.

Kernel-mode drivers use the IoSetDevicePropertyData routine to modify device properties that are defined as part of the unified device property model. For more information about device properties, see Device Properties.

To delete a property for a specific locale, pass a language-specific LCID value in Lcid and NULL in Data.

To delete a property for all locales, pass LOCALE_NEUTRAL in Lcid and NULL in Data.

To modify a property for a specific locale, pass a language-specific LCID value in Lcid and non-NULL in Data.

To modify a property for all locales, pass LOCALE_NEUTRAL in Lcid and non-NULL in Data.

Beginning with Windows 8 and Windows Server 2012 passing LOCALE_NEUTRAL in Lcid is treated like any other locale.

Drivers can use the IoGetDevicePropertyData routine to obtain the current value for a device property.

Callers of IoSetDeviceProperty must be running at IRQL <= APC_LEVEL in the context of a system thread.

Requirements

Requirement Value
Minimum supported client Available starting with Windows Vista.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= APC_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport), PowerIrpDDis(wdm)

See also

DEVPROPKEY

DEVPROPTYPE

IoGetDevicePropertyData