3.1.4.1.33 ApiSetValue (Opnum 32)

(Protocol Version 2) In response to the ApiSetValue request from the client, the server MUST set the data that is associated with the specified value and cluster registry key.

The server MUST accept an ApiSetValue request only if its protocol server state is read/write, as specified in section 3.1.1.

 error_status_t ApiSetValue(
   [in] HKEY_RPC hKey,
   [in, string] const wchar_t * lpValueName,
   [in] unsigned long dwType,
   [in, size_is(cbData)] const unsigned char *lpData,
   [in] unsigned long cbData
 );

hKey: The RPC context handle for a key that was previously obtained by a call to ApiGetRootKey, ApiCreateKey, or ApiOpenKey.

lpValueName: A null-terminated string that is the name of the value to set, as specified in [MS-RRP]. If this parameter is set to NULL or an empty string, the server MUST set the value to the default value of the specified key, as specified in [MS-RRP]. If the specified value name is not present, the server MUST create it.

dwType: The type of data to be stored MUST be one of the following values. A server SHOULD support all of the following values.

Value

Meaning

REG_NONE

0x00000000

No defined value type.

REG_SZ

0x00000001

A null-terminated Unicode string.

REG_EXPAND_SZ

0x00000002

A null-terminated Unicode string that contains unexpanded references to environment variables.

REG_BINARY

0x00000003

Binary data in any form.

REG_DWORD

0x00000004

A 32-bit unsigned integer, as defined in [MS-DTYP] section 2.2.9.

REG_MULTI_SZ

0x00000007

A null-terminated array of null-terminated Unicode strings, such that the last two characters of the array are both null terminators. See [MS-RRP] section 2.2.5.

lpData: A pointer to a buffer that contains the data to set for the value entry, or NULL.

cbData: The length, in bytes, of the data to be stored.

Return Values: The method MUST return 0x00000000 (ERROR_SUCCESS) on success.

For any other condition, the server MUST return a value that is not one of the values listed in the preceding table. The client MUST behave in one consistent, identical manner for all values that are not listed in the preceding table, except as specified in section 3.2.4.6.