ReactOS  0.4.12-dev-18-gf469aca
ATL::CRegKey Class Reference

#include <atlbase.h>

Collaboration diagram for ATL::CRegKey:

Public Member Functions

 CRegKey () throw ()
 
 CRegKey (CRegKey &key) throw ()
 
 CRegKey (HKEY hKey) throw ()
 
 ~CRegKey () throw ()
 
void Attach (HKEY hKey) throw ()
 
LONG Close () throw ()
 
HKEY Detach () throw ()
 
LONG Open (HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired=KEY_READ|KEY_WRITE) throw ()
 
LONG Create (HKEY hKeyParent, LPCTSTR lpszKeyName, LPTSTR lpszClass=REG_NONE, DWORD dwOptions=REG_OPTION_NON_VOLATILE, REGSAM samDesired=KEY_READ|KEY_WRITE, LPSECURITY_ATTRIBUTES lpSecAttr=NULL, LPDWORD lpdwDisposition=NULL) throw ()
 
LONG QueryValue (LPCTSTR pszValueName, DWORD *pdwType, void *pData, ULONG *pnBytes) throw ()
 
LONG QueryDWORDValue (LPCTSTR pszValueName, DWORD &dwValue) throw ()
 
LONG QueryBinaryValue (LPCTSTR pszValueName, void *pValue, ULONG *pnBytes) throw ()
 
LONG QueryStringValue (LPCTSTR pszValueName, LPTSTR pszValue, ULONG *pnChars) throw ()
 
LONG QueryGUIDValue (LPCTSTR pszValueName, GUID &guidValue) throw ()
 
LONG QueryQWORDValue (LPCTSTR pszValueName, ULONGLONG &qwValue) throw ()
 
LONG QueryMultiStringValue (LPCTSTR pszValueName, LPTSTR pszValue, ULONG *pnChars) throw ()
 
LONG SetValue (LPCTSTR pszValueName, DWORD dwType, const void *pValue, ULONG nBytes) throw ()
 
LONG SetDWORDValue (LPCTSTR pszValueName, DWORD dwValue) throw ()
 
LONG SetStringValue (LPCTSTR pszValueName, LPCTSTR pszValue, DWORD dwType=REG_SZ) throw ()
 
LONG SetGUIDValue (LPCTSTR pszValueName, REFGUID guidValue) throw ()
 
LONG SetBinaryValue (LPCTSTR pszValueName, const void *pValue, ULONG nBytes) throw ()
 
LONG SetMultiStringValue (LPCTSTR pszValueName, LPCTSTR pszValue) throw ()
 
LONG SetQWORDValue (LPCTSTR pszValueName, ULONGLONG qwValue) throw ()
 
LONG NotifyChangeKeyValue (BOOL bWatchSubtree, DWORD dwNotifyFilter, HANDLE hEvent, BOOL bAsync=TRUE) throw ()
 
LONG Flush () throw ()
 
LONG SetKeyValue (LPCTSTR lpszKeyName, LPCTSTR lpszValue, LPCTSTR lpszValueName=NULL) throw ()
 
LONG DeleteValue (LPCTSTR lpszValue) throw ()
 
LONG DeleteSubKey (LPCTSTR lpszSubKey) throw ()
 
LONG RecurseDeleteKey (LPCTSTR lpszKey) throw ()
 
LONG EnumKey (DWORD iIndex, LPTSTR pszName, LPDWORD pnNameLength, FILETIME *pftLastWriteTime=NULL) throw ()
 
LONG GetKeySecurity (SECURITY_INFORMATION si, PSECURITY_DESCRIPTOR psd, LPDWORD pnBytes) throw ()
 
LONG SetKeySecurity (SECURITY_INFORMATION si, PSECURITY_DESCRIPTOR psd) throw ()
 
 operator HKEY () const throw ()
 
CRegKeyoperator= (CRegKey &key) throw ()
 

Static Public Member Functions

static LONG WINAPI SetValue (HKEY hKeyParent, LPCTSTR lpszKeyName, LPCTSTR lpszValue, LPCTSTR lpszValueName=NULL)
 

Public Attributes

HKEY m_hKey
 

Static Protected Member Functions

static ULONG _GetMultiStringSize (LPCTSTR pszz)
 
static LONG _DoDeleteKeyTree (HKEY hParentKey, LPCTSTR lpszKey)
 

Detailed Description

Definition at line 1018 of file atlbase.h.

Constructor & Destructor Documentation

◆ CRegKey() [1/3]

ATL::CRegKey::CRegKey ( )
throw (
)
inline

Definition at line 1029 of file atlbase.h.

1030  : m_hKey(NULL)
1031  {
1032  }
HKEY m_hKey
Definition: atlbase.h:1021
smooth NULL
Definition: ftsmooth.c:416

◆ CRegKey() [2/3]

ATL::CRegKey::CRegKey ( CRegKey key)
throw (
)
inline

Definition at line 1034 of file atlbase.h.

1035  : m_hKey(key.Detach())
1036  {
1037  }
HKEY m_hKey
Definition: atlbase.h:1021
HKEY Detach()
Definition: atlbase.h:1071

◆ CRegKey() [3/3]

ATL::CRegKey::CRegKey ( HKEY  hKey)
throw (
)
inlineexplicit

Definition at line 1039 of file atlbase.h.

1040  : m_hKey(hKey)
1041  {
1042  }
HKEY m_hKey
Definition: atlbase.h:1021

◆ ~CRegKey()

ATL::CRegKey::~CRegKey ( )
throw (
)
inline

Definition at line 1052 of file atlbase.h.

1053  {
1054  }

Member Function Documentation

◆ _DoDeleteKeyTree()

static LONG ATL::CRegKey::_DoDeleteKeyTree ( HKEY  hParentKey,
LPCTSTR  lpszKey 
)
inlinestaticprotected

Definition at line 1390 of file atlbase.h.

Referenced by RecurseDeleteKey().

1391  {
1392  ATLASSERT(hParentKey);
1393  ATLASSERT(lpszKey);
1394 
1395  // open the key
1396  CRegKey key;
1397  LONG ret = key.Open(hParentKey, lpszKey);
1398  if (ret != ERROR_SUCCESS)
1399  {
1400  return ret; // failure
1401  }
1402 
1403  // get the longest length of subkey names
1404  DWORD NameMax;
1405  ret = ::RegQueryInfoKey(key, NULL, NULL, NULL, NULL, &NameMax, NULL,
1406  NULL, NULL, NULL, NULL, NULL);
1407  if (ret != ERROR_SUCCESS)
1408  {
1409  return ret; // failure
1410  }
1411  ++NameMax; // for NUL
1412 
1413  // allocate the string buffer for names if necessary
1414  TCHAR szNameBuf[MAX_PATH], *pszName;
1415  if (NameMax > MAX_PATH)
1416  {
1417  pszName = (TCHAR *)malloc(NameMax * sizeof(TCHAR));
1418  ATLASSERT(pszName);
1419  if (pszName == NULL)
1420  {
1421  return ERROR_OUTOFMEMORY; // failure
1422  }
1423  }
1424  else
1425  {
1426  NameMax = MAX_PATH;
1427  pszName = szNameBuf;
1428  }
1429 
1430  // enumerate every subkey and delete
1431  for (;;)
1432  {
1433  DWORD Count = NameMax;
1434  ret = key.EnumKey(0, pszName, &Count);
1435  if (ret != ERROR_SUCCESS)
1436  {
1437  if (ret == ERROR_NO_MORE_ITEMS)
1438  ret = ERROR_SUCCESS;
1439  break;
1440  }
1441 
1442  ret = CRegKey::_DoDeleteKeyTree(key, pszName);
1443  if (ret != ERROR_SUCCESS)
1444  break;
1445  }
1446 
1447  // close key
1448  key.Close();
1449 
1450  // delete the subkey
1451  if (ret == ERROR_SUCCESS)
1452  ret = ::RegDeleteKey(hParentKey, lpszKey);
1453 
1454  // delete the buffer if any
1455  if (pszName != szNameBuf)
1456  free(pszName);
1457 
1458  return ret;
1459  }
#define RegQueryInfoKey
Definition: winreg.h:521
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
#define free
Definition: debug_ros.c:5
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
LONG Close()
Definition: atlbase.h:1061
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
#define MAX_PATH
Definition: compat.h:26
LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired=KEY_READ|KEY_WRITE)
Definition: atlbase.h:1078
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG EnumKey(DWORD iIndex, LPTSTR pszName, LPDWORD pnNameLength, FILETIME *pftLastWriteTime=NULL)
Definition: atlbase.h:1338
int ret
HKEY key
Definition: reg.c:42
#define RegDeleteKey
Definition: winreg.h:502
#define malloc
Definition: debug_ros.c:4
static LONG _DoDeleteKeyTree(HKEY hParentKey, LPCTSTR lpszKey)
Definition: atlbase.h:1390
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

◆ _GetMultiStringSize()

static ULONG ATL::CRegKey::_GetMultiStringSize ( LPCTSTR  pszz)
inlinestaticprotected

Definition at line 1376 of file atlbase.h.

Referenced by SetMultiStringValue().

1377  {
1378  int count = 0;
1379  do
1380  {
1381  int len = _tcslen(pszz);
1382  count += len + 1;
1383  pszz += len + 1;
1384  } while (*pszz != TEXT('\0'));
1385  ++count;
1386  return count * sizeof(TCHAR);
1387  }
GLuint GLuint GLsizei count
Definition: gl.h:1545
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
char TCHAR
Definition: xmlstorage.h:189
GLenum GLsizei len
Definition: glext.h:6722
#define TEXT(s)
Definition: k32.h:26

◆ Attach()

void ATL::CRegKey::Attach ( HKEY  hKey)
throw (
)
inline

Definition at line 1056 of file atlbase.h.

1057  {
1058  m_hKey = hKey;
1059  }
HKEY m_hKey
Definition: atlbase.h:1021

◆ Close()

LONG ATL::CRegKey::Close ( void  )
throw (
)
inline

Definition at line 1061 of file atlbase.h.

Referenced by _DoDeleteKeyTree(), GetInstalledVersion_WowUser(), InitLogs(), LoadSettings(), SaveSettings(), test_IACLCustomMRU_Continue(), and CACLCustomMRU::~CACLCustomMRU().

1062  {
1063  if (m_hKey)
1064  {
1065  HKEY hKey = Detach();
1066  return ::RegCloseKey(hKey);
1067  }
1068  return ERROR_SUCCESS;
1069  }
#define ERROR_SUCCESS
Definition: deptool.c:10
HKEY m_hKey
Definition: atlbase.h:1021
HKEY Detach()
Definition: atlbase.h:1071
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423

◆ Create()

LONG ATL::CRegKey::Create ( HKEY  hKeyParent,
LPCTSTR  lpszKeyName,
LPTSTR  lpszClass = REG_NONE,
DWORD  dwOptions = REG_OPTION_NON_VOLATILE,
REGSAM  samDesired = KEY_READ | KEY_WRITE,
LPSECURITY_ATTRIBUTES  lpSecAttr = NULL,
LPDWORD  lpdwDisposition = NULL 
)
throw (
)
inline

Definition at line 1099 of file atlbase.h.

Referenced by CACLCustomMRU::Initialize(), InitLogs(), SaveSettings(), SetKeyValue(), SetValue(), and RegistrySettings::Store().

1105  {
1106  ATLASSERT(hKeyParent);
1107  ATLASSERT(lpszKeyName);
1108 
1109  HKEY hKey = NULL;
1110  LONG lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, NULL, lpszClass,
1111  dwOptions, samDesired, lpSecAttr, &hKey,
1112  lpdwDisposition);
1113  if (lRes != ERROR_SUCCESS)
1114  {
1115  samDesired |= KEY_WOW64_64KEY;
1116  lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, NULL, lpszClass,
1117  dwOptions, samDesired, lpSecAttr, &hKey,
1118  lpdwDisposition);
1119  }
1120  if (lRes == ERROR_SUCCESS)
1121  {
1122  Close();
1123  m_hKey = hKey;
1124  }
1125  return lRes;
1126  }
DWORD dwOptions
Definition: solitaire.cpp:23
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
LONG Close()
Definition: atlbase.h:1061
HKEY m_hKey
Definition: atlbase.h:1021
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
#define RegCreateKeyEx
Definition: winreg.h:501

◆ DeleteSubKey()

LONG ATL::CRegKey::DeleteSubKey ( LPCTSTR  lpszSubKey)
throw (
)
inline

Definition at line 1324 of file atlbase.h.

Referenced by Cleanup_Testdata().

1325  {
1326  ATLASSERT(m_hKey);
1327  ATLASSERT(lpszSubKey);
1328  return ::RegDeleteKey(m_hKey, lpszSubKey);
1329  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1021
#define RegDeleteKey
Definition: winreg.h:502

◆ DeleteValue()

LONG ATL::CRegKey::DeleteValue ( LPCTSTR  lpszValue)
throw (
)
inline

Definition at line 1318 of file atlbase.h.

1319  {
1320  ATLASSERT(m_hKey);
1321  return ::RegDeleteValue(m_hKey, lpszValue);
1322  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1021
#define RegDeleteValue
Definition: winreg.h:508

◆ Detach()

HKEY ATL::CRegKey::Detach ( )
throw (
)
inline

Definition at line 1071 of file atlbase.h.

1072  {
1073  HKEY hKey = m_hKey;
1074  m_hKey = NULL;
1075  return hKey;
1076  }
HKEY m_hKey
Definition: atlbase.h:1021
smooth NULL
Definition: ftsmooth.c:416

◆ EnumKey()

LONG ATL::CRegKey::EnumKey ( DWORD  iIndex,
LPTSTR  pszName,
LPDWORD  pnNameLength,
FILETIME pftLastWriteTime = NULL 
)
throw (
)
inline

Definition at line 1338 of file atlbase.h.

Referenced by _DoDeleteKeyTree().

1340  {
1341  ATLASSERT(m_hKey);
1342  LONG ret = ::RegEnumKeyEx(m_hKey, iIndex, pszName, pnNameLength, NULL,
1343  NULL, NULL, pftLastWriteTime);
1344  return ret;
1345  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1021
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
int ret
#define RegEnumKeyEx
Definition: winreg.h:510

◆ Flush()

LONG ATL::CRegKey::Flush ( )
throw (
)
inline

Definition at line 1287 of file atlbase.h.

1288  {
1289  ATLASSERT(m_hKey);
1291  return ret;
1292  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
LONG WINAPI RegFlushKey(HKEY hKey)
Definition: reg.c:2988
HKEY m_hKey
Definition: atlbase.h:1021
long LONG
Definition: pedump.c:60
int ret

◆ GetKeySecurity()

LONG ATL::CRegKey::GetKeySecurity ( SECURITY_INFORMATION  si,
PSECURITY_DESCRIPTOR  psd,
LPDWORD  pnBytes 
)
throw (
)
inline

Definition at line 1347 of file atlbase.h.

1349  {
1350  ATLASSERT(m_hKey);
1351  LONG ret = ::RegGetKeySecurity(m_hKey, si, psd, pnBytes);
1352  return ret;
1353  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1021
long LONG
Definition: pedump.c:60
LONG WINAPI RegGetKeySecurity(HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, LPDWORD lpcbSecurityDescriptor)
Definition: reg.c:3024
int ret

◆ NotifyChangeKeyValue()

LONG ATL::CRegKey::NotifyChangeKeyValue ( BOOL  bWatchSubtree,
DWORD  dwNotifyFilter,
HANDLE  hEvent,
BOOL  bAsync = TRUE 
)
throw (
)
inline

Definition at line 1278 of file atlbase.h.

1280  {
1281  ATLASSERT(m_hKey);
1282  LONG ret = ::RegNotifyChangeKeyValue(m_hKey, bWatchSubtree,
1283  dwNotifyFilter, hEvent, bAsync);
1284  return ret;
1285  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1021
long LONG
Definition: pedump.c:60
int ret
LONG WINAPI RegNotifyChangeKeyValue(HKEY hKey, BOOL bWatchSubtree, DWORD dwNotifyFilter, HANDLE hEvent, BOOL fAsynchronous)
Definition: reg.c:3190

◆ Open()

LONG ATL::CRegKey::Open ( HKEY  hKeyParent,
LPCTSTR  lpszKeyName,
REGSAM  samDesired = KEY_READ | KEY_WRITE 
)
throw (
)
inline

Definition at line 1078 of file atlbase.h.

Referenced by _DoDeleteKeyTree(), Cleanup_Testdata(), GetInstalledVersion_WowUser(), RegistrySettings::Load(), LoadSettings(), Settings_GetOutputPath(), Settings_GetShouldWriteDump(), RegistrySettings::SetWallpaper(), test_IACLCustomMRU_Continue(), and verify_mru_().

1080  {
1081  ATLASSERT(hKeyParent);
1082  ATLASSERT(lpszKeyName);
1083 
1084  HKEY hKey = NULL;
1085  LONG lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, NULL, samDesired, &hKey);
1086  if (lRes != ERROR_SUCCESS)
1087  {
1088  samDesired |= KEY_WOW64_64KEY;
1089  lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, NULL, samDesired, &hKey);
1090  }
1091  if (lRes == ERROR_SUCCESS)
1092  {
1093  Close();
1094  m_hKey = hKey;
1095  }
1096  return lRes;
1097  }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
LONG Close()
Definition: atlbase.h:1061
HKEY m_hKey
Definition: atlbase.h:1021
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
#define RegOpenKeyEx
Definition: winreg.h:520

◆ operator HKEY()

ATL::CRegKey::operator HKEY ( ) const
throw (
)
inline

Definition at line 1363 of file atlbase.h.

1364  {
1365  return m_hKey;
1366  }
HKEY m_hKey
Definition: atlbase.h:1021

◆ operator=()

CRegKey& ATL::CRegKey::operator= ( CRegKey key)
throw (
)
inline

Definition at line 1368 of file atlbase.h.

1369  {
1370  Attach(key.Detach());
1371  return *this;
1372  }
HKEY Detach()
Definition: atlbase.h:1071
void Attach(HKEY hKey)
Definition: atlbase.h:1056

◆ QueryBinaryValue()

LONG ATL::CRegKey::QueryBinaryValue ( LPCTSTR  pszValueName,
void pValue,
ULONG pnBytes 
)
throw (
)
inline

Definition at line 1146 of file atlbase.h.

Referenced by RegistrySettings::Load(), and LoadSettings().

1147  {
1148  DWORD type = 0;
1149  LONG lRet = QueryValue(pszValueName, &type, pValue, pnBytes);
1150 
1151  if (lRet == ERROR_SUCCESS && type != REG_BINARY)
1152  lRet = ERROR_INVALID_DATA;
1153 
1154  return lRet;
1155  }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_BINARY
Definition: nt_native.h:1496
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
long LONG
Definition: pedump.c:60
LONG QueryValue(LPCTSTR pszValueName, DWORD *pdwType, void *pData, ULONG *pnBytes)
Definition: atlbase.h:1128
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INVALID_DATA
Definition: winerror.h:116

◆ QueryDWORDValue()

LONG ATL::CRegKey::QueryDWORDValue ( LPCTSTR  pszValueName,
DWORD dwValue 
)
throw (
)
inline

Definition at line 1134 of file atlbase.h.

Referenced by ReadDWORD(), and Settings_GetShouldWriteDump().

1135  {
1136  ULONG size = sizeof(DWORD);
1137  DWORD type = 0;
1138  LONG lRet = QueryValue(pszValueName, &type, &dwValue, &size);
1139 
1140  if (lRet == ERROR_SUCCESS && type != REG_DWORD)
1141  lRet = ERROR_INVALID_DATA;
1142 
1143  return lRet;
1144  }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define DWORD
Definition: msvc.h:34
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
long LONG
Definition: pedump.c:60
LONG QueryValue(LPCTSTR pszValueName, DWORD *pdwType, void *pData, ULONG *pnBytes)
Definition: atlbase.h:1128
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INVALID_DATA
Definition: winerror.h:116
unsigned int ULONG
Definition: retypes.h:1
#define REG_DWORD
Definition: sdbapi.c:539

◆ QueryGUIDValue()

LONG ATL::CRegKey::QueryGUIDValue ( LPCTSTR  pszValueName,
GUID guidValue 
)
throw (
)
inline

Definition at line 1170 of file atlbase.h.

1171  {
1172  OLECHAR buf[40] = {0};
1173  ULONG nChars = 39;
1174  LONG lRet;
1175 
1176 #ifdef UNICODE
1177  lRet = QueryStringValue(pszValueName, buf, &nChars);
1178 #else
1179  CHAR bufA[40] = {0};
1180  lRet = QueryStringValue(pszValueName, bufA, &nChars);
1181  if (lRet != ERROR_SUCCESS)
1182  return lRet;
1183  if (!::MultiByteToWideChar(CP_THREAD_ACP, 0, bufA, -1, buf, 39))
1184  lRet = ERROR_INVALID_DATA;
1185 #endif
1186  if (lRet != ERROR_SUCCESS)
1187  return lRet;
1188 
1189  if (!SUCCEEDED(::CLSIDFromString(buf, &guidValue)))
1190  return ERROR_INVALID_DATA;
1191 
1192  return lRet;
1193  }
WCHAR OLECHAR
Definition: compat.h:1926
#define ERROR_SUCCESS
Definition: deptool.c:10
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char CHAR
Definition: xmlstorage.h:175
long LONG
Definition: pedump.c:60
LONG QueryStringValue(LPCTSTR pszValueName, LPTSTR pszValue, ULONG *pnChars)
Definition: atlbase.h:1157
#define ERROR_INVALID_DATA
Definition: winerror.h:116
#define MultiByteToWideChar
Definition: compat.h:100
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2250
unsigned int ULONG
Definition: retypes.h:1
#define CP_THREAD_ACP
Definition: winnls.h:221
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ QueryMultiStringValue()

LONG ATL::CRegKey::QueryMultiStringValue ( LPCTSTR  pszValueName,
LPTSTR  pszValue,
ULONG pnChars 
)
throw (
)
inline

Definition at line 1207 of file atlbase.h.

1209  {
1210  ULONG size = (*pnChars) * sizeof(TCHAR);
1211  DWORD type;
1212  LONG lRet = QueryValue(pszValueName, &type, pszValue, &size);
1213 
1214  if (lRet == ERROR_SUCCESS && type != REG_MULTI_SZ)
1215  lRet = ERROR_INVALID_DATA;
1216 
1217  *pnChars = size / sizeof(TCHAR);
1218  return lRet;
1219  }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
long LONG
Definition: pedump.c:60
#define REG_MULTI_SZ
Definition: nt_native.h:1501
LONG QueryValue(LPCTSTR pszValueName, DWORD *pdwType, void *pData, ULONG *pnBytes)
Definition: atlbase.h:1128
char TCHAR
Definition: xmlstorage.h:189
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INVALID_DATA
Definition: winerror.h:116
unsigned int ULONG
Definition: retypes.h:1

◆ QueryQWORDValue()

LONG ATL::CRegKey::QueryQWORDValue ( LPCTSTR  pszValueName,
ULONGLONG qwValue 
)
throw (
)
inline

Definition at line 1195 of file atlbase.h.

1196  {
1197  ULONG size = sizeof(ULONGLONG);
1198  DWORD type = 0;
1199  LONG lRet = QueryValue(pszValueName, &type, &qwValue, &size);
1200 
1201  if (lRet == ERROR_SUCCESS && type != REG_QWORD)
1202  lRet = ERROR_INVALID_DATA;
1203 
1204  return lRet;
1205  }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
long LONG
Definition: pedump.c:60
LONG QueryValue(LPCTSTR pszValueName, DWORD *pdwType, void *pData, ULONG *pnBytes)
Definition: atlbase.h:1128
GLsizeiptr size
Definition: glext.h:5919
uint64_t ULONGLONG
Definition: typedefs.h:65
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INVALID_DATA
Definition: winerror.h:116
#define REG_QWORD
Definition: sdbapi.c:540
unsigned int ULONG
Definition: retypes.h:1

◆ QueryStringValue()

LONG ATL::CRegKey::QueryStringValue ( LPCTSTR  pszValueName,
LPTSTR  pszValue,
ULONG pnChars 
)
throw (
)
inline

Definition at line 1157 of file atlbase.h.

Referenced by GetInstalledVersion_WowUser(), CACLCustomMRU::Initialize(), ReadFileHistory(), Settings_GetOutputPath(), and verify_mru_().

1158  {
1159  ULONG size = (*pnChars) * sizeof(TCHAR);
1160  DWORD type = 0;
1161  LONG lRet = QueryValue(pszValueName, &type, pszValue, &size);
1162 
1163  if (lRet == ERROR_SUCCESS && type != REG_SZ && type != REG_EXPAND_SZ)
1164  lRet = ERROR_INVALID_DATA;
1165 
1166  *pnChars = size / sizeof(TCHAR);
1167  return lRet;
1168  }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
long LONG
Definition: pedump.c:60
LONG QueryValue(LPCTSTR pszValueName, DWORD *pdwType, void *pData, ULONG *pnBytes)
Definition: atlbase.h:1128
char TCHAR
Definition: xmlstorage.h:189
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INVALID_DATA
Definition: winerror.h:116
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
unsigned int ULONG
Definition: retypes.h:1
#define REG_SZ
Definition: layer.c:22

◆ QueryValue()

LONG ATL::CRegKey::QueryValue ( LPCTSTR  pszValueName,
DWORD pdwType,
void pData,
ULONG pnBytes 
)
throw (
)
inline

Definition at line 1128 of file atlbase.h.

1129  {
1130  ATLASSERT(m_hKey);
1131  return ::RegQueryValueEx(m_hKey, pszValueName, NULL, pdwType, (LPBYTE)pData, pnBytes);
1132  }
#define RegQueryValueEx
Definition: winreg.h:524
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1021
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416

◆ RecurseDeleteKey()

LONG ATL::CRegKey::RecurseDeleteKey ( LPCTSTR  lpszKey)
throw (
)
inline

Definition at line 1331 of file atlbase.h.

1332  {
1333  ATLASSERT(m_hKey);
1334  ATLASSERT(lpszKey);
1335  return CRegKey::_DoDeleteKeyTree(m_hKey, lpszKey);
1336  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1021
static LONG _DoDeleteKeyTree(HKEY hParentKey, LPCTSTR lpszKey)
Definition: atlbase.h:1390

◆ SetBinaryValue()

LONG ATL::CRegKey::SetBinaryValue ( LPCTSTR  pszValueName,
const void pValue,
ULONG  nBytes 
)
throw (
)
inline

Definition at line 1261 of file atlbase.h.

Referenced by SaveSettings(), and RegistrySettings::Store().

1262  {
1263  return SetValue(pszValueName, REG_BINARY, pValue, nBytes);
1264  }
#define REG_BINARY
Definition: nt_native.h:1496
LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void *pValue, ULONG nBytes)
Definition: atlbase.h:1221

◆ SetDWORDValue()

LONG ATL::CRegKey::SetDWORDValue ( LPCTSTR  pszValueName,
DWORD  dwValue 
)
throw (
)
inline

Definition at line 1227 of file atlbase.h.

Referenced by InitLogs(), and RegistrySettings::Store().

1228  {
1229  return SetValue(pszValueName, REG_DWORD, &dwValue, sizeof(DWORD));
1230  }
unsigned long DWORD
Definition: ntddk_ex.h:95
#define REG_DWORD
Definition: sdbapi.c:539
LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void *pValue, ULONG nBytes)
Definition: atlbase.h:1221

◆ SetGUIDValue()

LONG ATL::CRegKey::SetGUIDValue ( LPCTSTR  pszValueName,
REFGUID  guidValue 
)
throw (
)
inline

Definition at line 1248 of file atlbase.h.

1249  {
1250  OLECHAR buf[40] = {0};
1251  ::StringFromGUID2(guidValue, buf, 39);
1252 #ifdef UNICODE
1253  return SetStringValue(pszValueName, buf);
1254 #else
1255  CHAR bufA[40] = {0};
1256  ::WideCharToMultiByte(CP_THREAD_ACP, 0, buf, -1, bufA, 40, NULL, NULL);
1257  return SetStringValue(pszValueName, bufA);
1258 #endif
1259  }
WCHAR OLECHAR
Definition: compat.h:1926
#define WideCharToMultiByte
Definition: compat.h:101
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char CHAR
Definition: xmlstorage.h:175
smooth NULL
Definition: ftsmooth.c:416
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2346
#define CP_THREAD_ACP
Definition: winnls.h:221
LONG SetStringValue(LPCTSTR pszValueName, LPCTSTR pszValue, DWORD dwType=REG_SZ)
Definition: atlbase.h:1232

◆ SetKeySecurity()

LONG ATL::CRegKey::SetKeySecurity ( SECURITY_INFORMATION  si,
PSECURITY_DESCRIPTOR  psd 
)
throw (
)
inline

Definition at line 1355 of file atlbase.h.

1357  {
1358  ATLASSERT(m_hKey);
1359  LONG ret = ::RegSetKeySecurity(m_hKey, si, psd);
1360  return ret;
1361  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1021
long LONG
Definition: pedump.c:60
LONG WINAPI RegSetKeySecurity(HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor)
Definition: reg.c:4791
int ret

◆ SetKeyValue()

LONG ATL::CRegKey::SetKeyValue ( LPCTSTR  lpszKeyName,
LPCTSTR  lpszValue,
LPCTSTR  lpszValueName = NULL 
)
throw (
)
inline

Definition at line 1306 of file atlbase.h.

1308  {
1309  CRegKey key;
1310  LONG lRet = key.Create(m_hKey, lpszKeyName);
1311  if (lRet == ERROR_SUCCESS)
1312  {
1313  lRet = key.SetStringValue(lpszValueName, lpszValue);
1314  }
1315  return lRet;
1316  }
#define ERROR_SUCCESS
Definition: deptool.c:10
HKEY m_hKey
Definition: atlbase.h:1021
long LONG
Definition: pedump.c:60
HKEY key
Definition: reg.c:42
LONG Create(HKEY hKeyParent, LPCTSTR lpszKeyName, LPTSTR lpszClass=REG_NONE, DWORD dwOptions=REG_OPTION_NON_VOLATILE, REGSAM samDesired=KEY_READ|KEY_WRITE, LPSECURITY_ATTRIBUTES lpSecAttr=NULL, LPDWORD lpdwDisposition=NULL)
Definition: atlbase.h:1099
LONG SetStringValue(LPCTSTR pszValueName, LPCTSTR pszValue, DWORD dwType=REG_SZ)
Definition: atlbase.h:1232

◆ SetMultiStringValue()

LONG ATL::CRegKey::SetMultiStringValue ( LPCTSTR  pszValueName,
LPCTSTR  pszValue 
)
throw (
)
inline

Definition at line 1266 of file atlbase.h.

1267  {
1269  return SetValue(pszValueName, REG_MULTI_SZ, pszValue, dwSize);
1270  }
#define REG_MULTI_SZ
Definition: nt_native.h:1501
static ULONG _GetMultiStringSize(LPCTSTR pszz)
Definition: atlbase.h:1376
unsigned int ULONG
Definition: retypes.h:1
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void *pValue, ULONG nBytes)
Definition: atlbase.h:1221

◆ SetQWORDValue()

LONG ATL::CRegKey::SetQWORDValue ( LPCTSTR  pszValueName,
ULONGLONG  qwValue 
)
throw (
)
inline

Definition at line 1272 of file atlbase.h.

1273  {
1274  ULONG dwSize = sizeof(ULONGLONG);
1275  return SetValue(pszValueName, REG_QWORD, &qwValue, dwSize);
1276  }
uint64_t ULONGLONG
Definition: typedefs.h:65
#define REG_QWORD
Definition: sdbapi.c:540
unsigned int ULONG
Definition: retypes.h:1
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void *pValue, ULONG nBytes)
Definition: atlbase.h:1221

◆ SetStringValue()

LONG ATL::CRegKey::SetStringValue ( LPCTSTR  pszValueName,
LPCTSTR  pszValue,
DWORD  dwType = REG_SZ 
)
throw (
)
inline

Definition at line 1232 of file atlbase.h.

Referenced by InitLogs(), CACLCustomMRU::PersistMRU(), SetKeyValue(), SetValue(), RegistrySettings::SetWallpaper(), RegistrySettings::Store(), and test_IACLCustomMRU_Continue().

1233  {
1234  ULONG length;
1235  switch (dwType)
1236  {
1237  case REG_SZ:
1238  case REG_EXPAND_SZ:
1239  length = (_tcslen(pszValue) + 1) * sizeof(TCHAR);
1240  return SetValue(pszValueName, dwType, pszValue, length);
1241  case REG_MULTI_SZ:
1242  return SetMultiStringValue(pszValueName, pszValue);
1243  default:
1244  return ERROR_INVALID_DATA;
1245  }
1246  }
LONG SetMultiStringValue(LPCTSTR pszValueName, LPCTSTR pszValue)
Definition: atlbase.h:1266
#define REG_MULTI_SZ
Definition: nt_native.h:1501
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
char TCHAR
Definition: xmlstorage.h:189
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define ERROR_INVALID_DATA
Definition: winerror.h:116
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
unsigned int ULONG
Definition: retypes.h:1
LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void *pValue, ULONG nBytes)
Definition: atlbase.h:1221
#define REG_SZ
Definition: layer.c:22

◆ SetValue() [1/2]

LONG ATL::CRegKey::SetValue ( LPCTSTR  pszValueName,
DWORD  dwType,
const void pValue,
ULONG  nBytes 
)
throw (
)
inline

Definition at line 1221 of file atlbase.h.

1222  {
1223  ATLASSERT(m_hKey);
1224  return ::RegSetValueEx(m_hKey, pszValueName, NULL, dwType, (const BYTE*)pValue, nBytes);
1225  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1021
smooth NULL
Definition: ftsmooth.c:416
unsigned char BYTE
Definition: ntddk_ex.h:96
#define RegSetValueEx
Definition: winreg.h:533

◆ SetValue() [2/2]

static LONG WINAPI ATL::CRegKey::SetValue ( HKEY  hKeyParent,
LPCTSTR  lpszKeyName,
LPCTSTR  lpszValue,
LPCTSTR  lpszValueName = NULL 
)
inlinestatic

Definition at line 1294 of file atlbase.h.

1296  {
1297  CRegKey key;
1298  LONG lRet = key.Create(hKeyParent, lpszKeyName);
1299  if (lRet == ERROR_SUCCESS)
1300  {
1301  lRet = key.SetStringValue(lpszValueName, lpszValue);
1302  }
1303  return lRet;
1304  }
#define ERROR_SUCCESS
Definition: deptool.c:10
long LONG
Definition: pedump.c:60
HKEY key
Definition: reg.c:42
LONG Create(HKEY hKeyParent, LPCTSTR lpszKeyName, LPTSTR lpszClass=REG_NONE, DWORD dwOptions=REG_OPTION_NON_VOLATILE, REGSAM samDesired=KEY_READ|KEY_WRITE, LPSECURITY_ATTRIBUTES lpSecAttr=NULL, LPDWORD lpdwDisposition=NULL)
Definition: atlbase.h:1099
LONG SetStringValue(LPCTSTR pszValueName, LPCTSTR pszValue, DWORD dwType=REG_SZ)
Definition: atlbase.h:1232

Member Data Documentation

◆ m_hKey

HKEY ATL::CRegKey::m_hKey

Definition at line 1021 of file atlbase.h.

Referenced by CACLCustomMRU::PersistMRU().


The documentation for this class was generated from the following file: