Class used for various registry operations, under a single pre-defined registry key. More...
#include <CCRegistry.h>
Public Types | |
enum | RegistryOperation |
Possible registry error types. | |
Static Public Member Functions | |
static std::tstring | GetString (HKEY hKey, LPCTSTR pPath, LPCTSTR pName, bool *pSuccess=NULL, DWORD dwExtraFlags=0) |
Retrieves a string registry value from anywhere in the registry. | |
static bool | SetString (HKEY hKey, LPCTSTR pPath, LPCTSTR pName, LPCTSTR pValue) |
Sets a string value anywhere in the registry. | |
static bool | GetBinary (HKEY hKey, LPCTSTR pPath, LPCTSTR pName, unsigned char *&pBuffer, int &nBytes) |
Retrieves a binary registry value from anywhere in the registry. | |
static bool | SetBinary (HKEY hKey, LPCTSTR pPath, LPCTSTR pName, unsigned char *pBuffer, int nBytes) |
Sets a binary value anywhere in the registry. | |
static DWORD | GetNumber (HKEY hKey, LPCTSTR pPath, LPCTSTR pName, bool *pSuccess=NULL) |
Retrieves a numeric value from the registry. | |
static bool | SetNumber (HKEY hKey, LPCTSTR pPath, LPCTSTR pName, DWORD dwValue) |
Sets a numeric in the registry. | |
static bool | TestWrite (HKEY hKey, LPCTSTR pPath) |
Tests if writing a value in the registry is allowed. | |
static RegistryOperation | GetLastErrorOperation () |
Returns the last registry error type. | |
static DWORD | GetLastError () |
Returns the last system error code for the registry operation. | |
Static Protected Attributes | |
static enum RegistryOperation | eLastErrorOp = None |
Last error type. | |
static DWORD | dwLastError = 0 |
Last error code. |
Class used for various registry operations, under a single pre-defined registry key.
CCRegistry supports all kinds of registry operations, including basic ones like getting and setting of values (both string and numeric), and specific ones like retrieving C-Center plugin DLL paths. Additionally, it has a different registry base path depending on the product and debug mode (Cogniview vs. CogniviewD vs. CatIndex).
It should have been a namespace and not a class as it's a fully static class, has no members and all its functions are static.
Definition at line 47 of file CCRegistry.h.
bool CCRegistry::GetBinary | ( | HKEY | hFromKey, | |
LPCTSTR | pPath, | |||
LPCTSTR | pName, | |||
unsigned char *& | pBuffer, | |||
int & | nBytes | |||
) | [static] |
Retrieves a binary registry value from anywhere in the registry.
hKey | the registry key to look in (can be any valid HKEY value) | |
pPath | path to the string, inside the key | |
pName | the string name | |
pBuffer[out] | reference to a variable that receives the pointer to a new byte array containing the binary data | |
nBytes[out] | number of bytes that were allocated and populated in pBuffer |
Definition at line 258 of file CCRegistry.cpp.
References dwLastError, and eLastErrorOp.
Referenced by PrintCalcData::ReadFromRegistry().
static DWORD CCRegistry::GetLastError | ( | ) | [inline, static] |
Returns the last system error code for the registry operation.
Definition at line 94 of file CCRegistry.h.
References dwLastError.
static RegistryOperation CCRegistry::GetLastErrorOperation | ( | ) | [inline, static] |
Returns the last registry error type.
Definition at line 89 of file CCRegistry.h.
References eLastErrorOp.
DWORD CCRegistry::GetNumber | ( | HKEY | hFromKey, | |
LPCTSTR | pPath, | |||
LPCTSTR | pName, | |||
bool * | pSuccess = NULL | |||
) | [static] |
Retrieves a numeric value from the registry.
hFromKey | the registry key to look in (can be any valid HKEY value) | |
pPath | path to the number, under the base key | |
pName | name of the number | |
[out] | pSuccess | If not NULL, will contain a success flag. |
Definition at line 198 of file CCRegistry.cpp.
References dwLastError, and eLastErrorOp.
Referenced by PrintCalcData::ReadFromRegistry().
std::tstring CCRegistry::GetString | ( | HKEY | hFromKey, | |
LPCTSTR | pPath, | |||
LPCTSTR | pName, | |||
bool * | pSuccess = NULL , |
|||
DWORD | dwExtraFlags = 0 | |||
) | [static] |
Retrieves a string registry value from anywhere in the registry.
hFromKey | the registry key to look in (can be any valid HKEY value) | |
pPath | path to the string, inside the key | |
pName | the string name | |
[out] | pSuccess | If not NULL, will contain a success flag. |
Definition at line 46 of file CCRegistry.cpp.
References dwLastError, eLastErrorOp, and tstring.
Referenced by CCCPDFExcelAddinObj::OnButtonClick().
bool CCRegistry::SetBinary | ( | HKEY | hKey, | |
LPCTSTR | pPath, | |||
LPCTSTR | pName, | |||
unsigned char * | pBuffer, | |||
int | nBytes | |||
) | [static] |
Sets a binary value anywhere in the registry.
hKey | the registry key to look in (can be any valid HKEY value) | |
pPath | path to the string, inside the key | |
pName | the string name | |
pBuffer | pointer to the byte array to store | |
nBytes | number of bytes in pBuffer to store |
Definition at line 322 of file CCRegistry.cpp.
References dwLastError, and eLastErrorOp.
Referenced by PrintCalcData::WriteToRegistry().
bool CCRegistry::SetNumber | ( | HKEY | hFromKey, | |
LPCTSTR | pPath, | |||
LPCTSTR | pName, | |||
DWORD | dwValue | |||
) | [static] |
Sets a numeric in the registry.
hFromKey | the registry key to look in (can be any valid HKEY value) | |
pPath | path to the number, under the base key | |
pName | name of the number | |
dwValue | number value |
Definition at line 167 of file CCRegistry.cpp.
References dwLastError, and eLastErrorOp.
Referenced by PrintCalcData::WriteToRegistry().
bool CCRegistry::SetString | ( | HKEY | hKey, | |
LPCTSTR | pPath, | |||
LPCTSTR | pName, | |||
LPCTSTR | pValue | |||
) | [static] |
Sets a string value anywhere in the registry.
hKey | the registry key to look in (can be any valid HKEY value) | |
pPath | path to the string, inside the key | |
pName | the string name | |
pValue | the string to set |
Definition at line 117 of file CCRegistry.cpp.
References dwLastError, and eLastErrorOp.
bool CCRegistry::TestWrite | ( | HKEY | hKey, | |
LPCTSTR | pPath | |||
) | [static] |
Tests if writing a value in the registry is allowed.
hKey | the registry key to look in (can be any valid HKEY value) | |
pPath | path to the string, inside the key |
Definition at line 145 of file CCRegistry.cpp.
References dwLastError, and eLastErrorOp.
CCRegistry::RegistryOperation CCRegistry::eLastErrorOp = None [static, protected] |
Last error type.
Last error's operation.
Definition at line 98 of file CCRegistry.h.
Referenced by GetBinary(), GetLastErrorOperation(), GetNumber(), GetString(), SetBinary(), SetNumber(), SetString(), and TestWrite().