uLib
User mode C/C++ extended API library for Win32 programmers.
|
Supplements to the advapi32 registry functions.
#include <uLib/RegFunc.h>
Macros | |
#define | KEY_CONTROL (DELETE| READ_CONTROL| WRITE_DAC| WRITE_OWNER) |
#define | KEY_RW (KEY_READ|KEY_WRITE) |
#define | ALL_SECURITY_INFO |
#define | REG_OK(rc) (rc == NOERROR) |
#define | REG_ERR(rc) (rc != NOERROR) |
#define | RegQueryDefaultValue(hKey, pType, pData, pSize) RegQueryValueEx( hKey, _T(""), 0, pType, pData, pSize ) |
#define | RegQuerySubkeys(hKey, pNrKeys, pCcKeyname) RegQueryInfoKey( hKey, 0,0,0, pNrKeys, pCcKeyname, 0,0,0,0,0,0 ) |
Functions | |
HKEY | RegCloseKeyEx (HKEY Key) |
BOOL | RegKeyExist (HKEY BaseKey, CSTR RegPath) |
BOOL | RegValueExist (HKEY hKey, CSTR Name) |
LONG | RegDeleteBranch (HKEY Parent, CSTR SubkeyName) |
LONG | _RegRenameKey (HKEY BaseKey, CSTR Subkey, CSTR NewSubkeyName) |
LONG | RegRenameValue (HKEY hKey, CSTR OldName, CSTR NewName) |
CSTR | RegSysKeyName (HKEY hkey) |
CSTR | RegSysKeyAcronym (HKEY hkey) |
CSTR | RegTypeName (DWORD type) |
CSTR | RegValueName (CSTR name) |
LONG | RegSetDWord (HKEY hKey, CSTR ValName, DWORD Val) |
LONG | RegGetDWord (HKEY hKey, CSTR ValName, PDWORD pVal) |
LONG | RegGetUInt (HKEY hKey, CSTR ValName, PUINT pVal) |
LONG | RegGetBool (HKEY hKey, CSTR ValName, bool *pVal) |
LONG | RegSetBinary (HKEY hKey, CSTR ValName, PBYTE Val, DWORD Size) |
LONG | RegGetBinary (HKEY hKey, CSTR ValName, PBYTE pVal, PDWORD pSize) |
LONG | RegSetString (HKEY hKey, CSTR ValName, CSTR Str, DWORD Type) |
LONG | RegGetString (HKEY hKey, CSTR ValName, TSTR Buf, PDWORD Size, PDWORD Type) |
LONG | SaveWindowRect (HWND hWnd, HKEY baseKey, CSTR regPath, CSTR valName) |
LONG | RestoreWindowRect (HWND hWnd, HKEY baseKey, CSTR regPath, CSTR valName) |
#define KEY_CONTROL (DELETE| READ_CONTROL| WRITE_DAC| WRITE_OWNER) |
#define ALL_SECURITY_INFO |
#define RegQueryDefaultValue | ( | hKey, | |
pType, | |||
pData, | |||
pSize | |||
) | RegQueryValueEx( hKey, _T(""), 0, pType, pData, pSize ) |
#define RegQuerySubkeys | ( | hKey, | |
pNrKeys, | |||
pCcKeyname | |||
) | RegQueryInfoKey( hKey, 0,0,0, pNrKeys, pCcKeyname, 0,0,0,0,0,0 ) |
RegQuerySubkeys gets subkey count and length of longest subkey name.
Either parameter may be NULL if you don't need it's content.
hKey | An open or predefined key. |
pNrKeys | Pointer to a dword that receives the subkey count. |
pCcKeyname | Pointer to a dword that recieves char count. |
HKEY RegCloseKeyEx | ( | HKEY | Key | ) |
RegCloseKeyEx closes the Key and returns NULL on success (like LocalFree).
On failure it calls SetLastError and returns Key as-is.
Key | An open registry key. |
Definition at line 22 of file RegFunc.cpp.
RegKeyExist returns TRUE if the specified key exists.
BaseKey | An open or predefined key. |
RegPath | A subkey path under BaseKey. |
Definition at line 35 of file RegFunc.cpp.
RegValueExist checks if the value exist.
hKey | An open or predefined key. |
Name | The value name. |
Definition at line 46 of file RegFunc.cpp.
LONG RegDeleteBranch | ( | HKEY | Parent, |
CSTR | SubkeyName | ||
) |
RegDeleteBranch recursively deletes a key and all it's sub-keys.
(Works like SHDeleteKey(), but doesn't need the shell API.)
Parent | An open or predefined key. |
SubkeyName | Name of a subkey to delete. |
Definition at line 213 of file RegFunc.cpp.
_RegRenameKey renames a registry subkey, preserving class and security settings.
BaseKey | An open or predefined key |
Subkey | Existing subkey pathname |
NewSubkeyName | New subkey pathname |
_RegRenameKey() works, due to registry design necessity, by copying the whole
branch, retaining security settings et c, to a new key with NewSubKeyName.
The interim branch copy is held temporarily in a RegSaveKey subhive file.
Note: As of SDK 7.0, RegRenameKey() is available, as Unicode only,
so this legacy function was renamed _RegRenameKey to avert the name clash.
uLib's _RegRenameKey() predates RegRenameKey[W], and was originally written
for WinNT4/2k/XP.
Definition at line 301 of file RegFunc.cpp.
RegRenameValue renames a registry value.
Definition at line 71 of file RegFunc.cpp.
CSTR RegSysKeyName | ( | HKEY | hkey | ) |
RegSysKeyName(), RegSysKeyAcronym(), and RegTypeName(), returns
human readable string representations for predefined registry constants.
Return e.g. "HKEY_LOCAL_MACHINE", or NULL.
Definition at line 440 of file RegFunc.cpp.
CSTR RegSysKeyAcronym | ( | HKEY | hkey | ) |
Return e.g. "HKLM", or NULL
Definition at line 467 of file RegFunc.cpp.
Return e.g. "REG_DWORD", or NULL.
Definition at line 493 of file RegFunc.cpp.
If 'name' is a non-empty string, it is returned verbatim,
else if NULL, "(null)" is returned, or if empty, "(default)" is returned.
Definition at line 516 of file RegFunc.cpp.
Definition at line 95 of file RegFunc.cpp.
Definition at line 100 of file RegFunc.cpp.
LONG RegGetUInt | ( | HKEY | hKey, |
CSTR | ValName, | ||
PUINT | pVal | ||
) |
Definition at line 111 of file RegFunc.cpp.
LONG RegGetBool | ( | HKEY | hKey, |
CSTR | ValName, | ||
bool * | pVal | ||
) |
Definition at line 116 of file RegFunc.cpp.
Definition at line 126 of file RegFunc.cpp.
Definition at line 131 of file RegFunc.cpp.
Definition at line 144 of file RegFunc.cpp.
Definition at line 151 of file RegFunc.cpp.
Save/Restore window position and size from registry.
Do not use on child windows.
Definition at line 167 of file RegFunc.cpp.
See SaveWindowRect().
Definition at line 184 of file RegFunc.cpp.