Sets the data and type of a specified value under a registry key.
LONG RegSetValueEx( HKEY hKey, LPCTSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData );
hKey
HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER HKEY_LOCAL_MACHINE HKEY_USERS HKEY_PERFORMANCE_DATA
lpValueName
If lpValueName is NULL or an empty string, "", the call sets the type and data for the key's unnamed or default value.
Registry keys do not have default values, but they can have one unnamed value, which can be of any type.
Reserved
dwType
REG_BINARY |
Binary data in any form. |
REG_DWORD |
A 32-bit number. |
REG_DWORD_LITTLE_ENDIAN |
A 32-bit number in little-endian format. This is equivalent to REG_DWORD. |
REG_DWORD_BIG_ENDIAN |
A 32-bit number in big-endian format. |
REG_EXPAND_SZ |
A null-terminated string that contains unexpanded references to environment variables (for example, "%PATH%"). It is either a Unicode or ANSI string, depending on whether you use the Unicode or ANSI calls. |
REG_LINK |
A Unicode symbolic link. |
REG_MULTI_SZ |
An array of null-terminated strings, terminated by two null characters. |
REG_NONE |
No defined value type. |
REG_RESOURCE_LIST |
A device-driver resource list. |
REG_SZ |
A null-terminated string. It is either a Unicode or ANSI string depending, on whether you use the Unicode or ANSI calls.
Do not use the REG_SZ type to store hard-coded paths to the system root directory or to the drive that contains the system files. Instead, use the REG_EXPAND_SZ type with environment variables such as "%SystemRoot%". This ensures that the path is up-to-date even if the user remaps the system drive to a different drive letter. |
lpData
cbData
lpData
parameter. If the data is of type REG_SZ, REG_EXPAND_SZ, or REG_MULTI_SZ, cbData
must include the size of the terminating null character. Value lengths are limited by available memory. Long values (more than 2048 bytes) should be stored as files with the filenames stored in the registry. This helps the registry perform efficiently. Application elements such as icons, bitmaps, and executable files should be stored as files and not be placed in the registry.
The key identified by the hKey parameter must be opened with KEY_SET_VALUE access. To open the key, use RegCreateKeyEx or RegOpenKeyEx.
If dwType is the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type and the ANSI version of this function is used (either by explicitly calling RegSetValueEx or by not defining UNICODE before including the WINDOWS.H file), the data pointed to by the lpData parameter must be an ANSI character string. The string is converted to Unicode then stored in the registry.
ERROR_SUCCESS
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/iwin32.h | iwin32.h iwin32rt.h |
rt.lib |
Note
This function operates in the real-time portion of your application.
RegCreateKeyEx, RegOpenKeyEx, RegQueryValueEx, RegSetValueEx, iwin32 API, iwin32 Overview