// wdfregistry.h
NTSTATUS WdfRegistryQueryULong(
[in] WDFKEY Key,
[in] PCUNICODE_STRING ValueName,
[out] PULONG Value
);
View the official Windows Driver Kit DDI referenceNo description available.
[Applies to KMDF and UMDF]
The WdfRegistryQueryULong method retrieves the unsigned long word (REG_DWORD) data that is currently assigned to a specified registry value and copies the data to a specified location.
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 name for the registry value.
Value [out]A pointer to a location that receives the data that is assigned to the registry value that ValueName specifies.
WdfRegistryQueryULong returns STATUS_SUCCESS if the operation succeeds. Otherwise, the method might return one of the following values:
| Return code | Description |
|---|---|
| STATUS_INVALID_DEVICE_REQUEST | WdfRegistryQueryULong was not called at IRQL = PASSIVE_LEVEL. |
| STATUS_INVALID_PARAMETER | An invalid parameter was specified. |
| STATUS_INSUFFICIENT_RESOURCES | There was insufficient memory to complete the operation. |
| STATUS_ACCESS_DENIED | The driver did not open the registry key with KEY_QUERY_VALUE, KEY_READ, or KEY_ALL_ACCESS access. |
| STATUS_OBJECT_TYPE_MISMATCH | The data type of the registry value that the ValueName parameter specified was not REG_DWORD. |
| STATUS_OBJECT_NAME_NOT_FOUND | The registry value was not available. |
This method also might return other NTSTATUS values.
A bug check occurs if the driver supplies an invalid object handle.
For more information about registry-key objects, see Using the Registry in WDF Drivers.
The following code example retrieves the data that is currently assigned to the NumberOfThings value.
NTSTATUS status;
ULONG value;
DECLARE_CONST_UNICODE_STRING(valueName, L"NumberOfThings");
status = WdfRegistryQueryULong(
hKey,
&valueName,
&value
);