SetRegistryValue method


Prototype

SetRegistryValue Proto hKey:HKEY, lpszSubKey:LPSTR, lpszValueName:LPSTR, lpszValue:LPSTR

Syntax

Invoke SetRegistryValue, hKey, lpszSubKey, lpszValueName, lpszValue

Function

Sets the specified named value from the specified registry subkey.

Parameters

hKey

Handle to one of the following predefined keys:

ecClassesRoot
ecCurrentUser
ecLocalMachine
ecUsers
ecPerformanceData
ecCurrentConfig
ecDynData

lpszSubKey

Pointer to the effective address of a null-terminated string that names the path of the subkey containing the named value to be set.

lpszValueName

Pointer to the effective address of a null-terminated string that names the named value to be set.

lpszValue

Pointer to the effective address of a null-terminated string containing the value to be set.

Return value

Eax/Rax returns TRUE if successfull, or FALSE if not.


NOTE: If the named value especified by lpszValueName does not exist, the method creates a named value with the specified name and sets it to the value specified by lpszValue.


REMARKS: The SetRegistryValue method expects lpszSubKey, lpszValueName and lpszValue to be Unicode strings if the application is running as Unicode, or ANSI strings if not (see the IsAppUnicode method). You can call SetRegistryValueA to write keys with ANSI values in Unicode applications, or SetRegistryValueW to write keys with Unicode values in ANSI applications.