WdfRegistryAssignULong method

[Applies to KMDF and UMDF]

The WdfRegistryAssignULong method assigns a specified unsigned long word value to a specified value name in the registry.

Syntax


NTSTATUS WdfRegistryAssignULong(
  [in]  WDFKEY Key,
  [in]  PCUNICODE_STRING ValueName,
  [in]  ULONG Value
);

Parameters

Key [in]

A handle to a registry-key object that represents an opened registry key.

ValueName [in]

A pointer to a UNICODE_STRING structure that contains a value name.

Value [in]

A ULONG value that will be assigned to the value name that ValueName specifies.

Return value

WdfRegistryAssignULong returns STATUS_SUCCESS if the operation succeeds. Otherwise, the method might return one of the following values:

Return codeDescription
STATUS_INVALID_DEVICE_REQUEST

WdfRegistryAssignULong was not called at IRQL = PASSIVE_LEVEL.

STATUS_INVALID_PARAMETER

An invalid parameter was specified.

STATUS_ACCESS_DENIED

The driver did not open the registry key with KEY_SET_VALUE access.

 

This method also might return other NTSTATUS values.

A bug check occurs if the driver supplies an invalid object handle.

Remarks

If the value name that the ValueName parameter specifies already exists, WdfRegistryAssignULong updates the value's data.

The framework sets the value's data type to REG_DWORD.

For more information about registry-key objects, see Using the Registry in Framework-Based Drivers.

Examples

The following code example assigns the constant MY_VALUE to the ValueName value, under a specified registry key.


UNICODE_STRING valueName;
NTSTATUS status;

RtlInitUnicodeString(
                     &valueName,
                     L"ValueName"
                     );
status = WdfRegistryAssignULong(
                                Key,
                                &valueName,
                                MY_VALUE
                                );

Requirements

Minimum KMDF version

1.0

Minimum UMDF version

2.0

Header

Wdfregistry.h (include Wdf.h)

Library

Wdf01000.sys (KMDF);
WUDFx02000.dll (UMDF)

IRQL

PASSIVE_LEVEL

DDI compliance rules

DriverCreate, KmdfIrql, KmdfIrql2

See also

UNICODE_STRING
WdfRegistryAssignValue
WdfRegistryAssignMemory
WdfRegistryAssignMultiString
WdfRegistryAssignUnicodeString
WdfRegistryAssignString

 

 

Send comments about this topic to Microsoft

Afficher:
© 2014 Microsoft