WdfRegistryAssignString メソッド

The WdfRegistryAssignString method assigns a string to a specified value name in the registry. The string is contained in a specified framework string object.

構文

NTSTATUS WdfRegistryAssignString(
  [in]  WDFKEY Key,
  [in]  PCUNICODE_STRING ValueName,
  [in]  WDFSTRING String
);

パラメーター

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.

String [in]

A handle to a framework string object that contains a string.

戻り値

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

リターン コード説明
STATUS_INVALID_DEVICE_REQUEST

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

解説

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

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

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

The following code example creates a string object that contains the string "String1" and assigns the string to the ValueName value, under a specified registry key.

WDFSTRING string1;
UNICODE_STRING ustring1, valueName;
NTSTATUS status;

RtlInitUnicodeString(
                     &ustring1,
                     L"String1"
                     );
RtlInitUnicodeString(
                     &valueName,
                     L"ValueName"
                     );

status = WdfStringCreate(
                         &ustring1,
                         WDF_NO_OBJECT_ATTRIBUTES,
                         &string1
                         );
if (NT_SUCCESS(status)) {
    status = WdfRegistryAssignString(
                                     Key,
                                     &valueName,
                                     string1
                                     );
}

要件

バージョン

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

参照

RtlInitUnicodeString
UNICODE_STRING
WdfRegistryAssignValue
WdfRegistryAssignMemory
WdfRegistryAssignMultiString
WdfRegistryAssignUnicodeString
WdfRegistryAssignULong
WdfStringCreate

 

 

コミュニティの追加

追加
表示:
© 2015 Microsoft