WdfRegistryAssignMemory メソッド

The WdfRegistryAssignMemory method assigns data that is contained in a specified memory buffer to a specified value name in the registry.

構文

NTSTATUS WdfRegistryAssignMemory(
  [in]            WDFKEY Key,
  [in]            PCUNICODE_STRING ValueName,
  [in]            ULONG ValueType,
  [in]            WDFMEMORY Memory,
  [in, optional]  PWDFMEMORY_OFFSET MemoryOffsets
);

パラメーター

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.

ValueType [in]

A value that identifies the data type. For a list of data type values, see the Type member of KEY_VALUE_BASIC_INFORMATION.

Memory [in]

A handle to a framework memory object. This object represents a buffer that contains data that will be assigned to the value name that ValueName points to.

MemoryOffsets [in, optional]

A pointer to a driver-supplied WDFMEMORY_OFFSET structure that identifies a subsection of the buffer that Memory specifies. This parameter is optional and can be NULL.

戻り値

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

リターン コード説明
STATUS_INVALID_DEVICE_REQUEST

WdfRegistryAssignMemory 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.

STATUS_INTEGER_OVERFLOW

The contents of the WDFMEMORY_OFFSET structure that the MemoryOffsets parameter specified were invalid.

 

This method also might return other NTSTATUS values.

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

解説

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

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

The following code example creates a framework memory object, loads the object's buffer with fake data, and assigns the buffer's contents to a registry value.

PUCHAR pBuffer;
WDFMEMORY memory;
NTSTATUS status;
UCHAR i;
DECLARE_UNICODE_STRING_SIZE(valueName, L"MyValueName");

status = WdfMemoryCreate(
                         WDF_NO_OBJECT_ATTRIBUTES,
                         NonPagedPool,
                         0,
                         MEMORY_LENGTH,
                         &memory,
                         (PVOID*)&pBuffer
                         );
if (NT_SUCCESS(status)) {

    // Fill the buffer with fake data.
    for (i = 1; i <= MEMORY_LENGTH; i++) {
        pBuffer[i-1] = i;
    }

    status = WdfRegistryAssignMemory(
                                     Key,
                                     &valueName,
                                     REG_BINARY,
                                     memory,
                                     NULL
                                     );
}

要件

バージョン

Available in version 1.0 and later versions of KMDF.

ヘッダー

Wdfregistry.h (includeWdf.h)

ライブラリ

Wdf<MajorVersionNumber>000.sys (see Framework Library Versions.)

IRQL

PASSIVE_LEVEL

参照

KEY_VALUE_BASIC_INFORMATION
UNICODE_STRING
WDFMEMORY_OFFSET
WdfMemoryCreate
WdfRegistryAssignValue
WdfRegistryAssignMultiString
WdfRegistryAssignString
WdfRegistryAssignUnicodeString
WdfRegistryAssignULong

 

 

コミュニティの追加

追加
表示:
© 2015 Microsoft