ReactOS  0.4.14-dev-114-gc8cbd56
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 1010 of file atlbase.h.

Constructor & Destructor Documentation

◆ CRegKey() [1/3]

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

Definition at line 1021 of file atlbase.h.

1022  : m_hKey(NULL)
1023  {
1024  }
HKEY m_hKey
Definition: atlbase.h:1013
smooth NULL
Definition: ftsmooth.c:416

◆ CRegKey() [2/3]

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

Definition at line 1026 of file atlbase.h.

1027  : m_hKey(key.Detach())
1028  {
1029  }
HKEY m_hKey
Definition: atlbase.h:1013
Definition: path.c:42

◆ CRegKey() [3/3]

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

Definition at line 1031 of file atlbase.h.

1032  : m_hKey(hKey)
1033  {
1034  }
HKEY m_hKey
Definition: atlbase.h:1013

◆ ~CRegKey()

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

Definition at line 1044 of file atlbase.h.

1045  {
1046  }

Member Function Documentation

◆ _DoDeleteKeyTree()

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

Definition at line 1382 of file atlbase.h.

1383  {
1384  ATLASSERT(hParentKey);
1385  ATLASSERT(lpszKey);
1386 
1387  // open the key
1388  CRegKey key;
1389  LONG ret = key.Open(hParentKey, lpszKey);
1390  if (ret != ERROR_SUCCESS)
1391  {
1392  return ret; // failure
1393  }
1394 
1395  // get the longest length of subkey names
1396  DWORD NameMax;
1397  ret = ::RegQueryInfoKey(key, NULL, NULL, NULL, NULL, &NameMax, NULL,
1398  NULL, NULL, NULL, NULL, NULL);
1399  if (ret != ERROR_SUCCESS)
1400  {
1401  return ret; // failure
1402  }
1403  ++NameMax; // for NUL
1404 
1405  // allocate the string buffer for names if necessary
1406  TCHAR szNameBuf[MAX_PATH], *pszName;
1407  if (NameMax > MAX_PATH)
1408  {
1409  pszName = (TCHAR *)malloc(NameMax * sizeof(TCHAR));
1410  ATLASSERT(pszName);
1411  if (pszName == NULL)
1412  {
1413  return ERROR_OUTOFMEMORY; // failure
1414  }
1415  }
1416  else
1417  {
1418  NameMax = MAX_PATH;
1419  pszName = szNameBuf;
1420  }
1421 
1422  // enumerate every subkey and delete
1423  for (;;)
1424  {
1425  DWORD Count = NameMax;
1426  ret = key.EnumKey(0, pszName, &Count);
1427  if (ret != ERROR_SUCCESS)
1428  {
1429  if (ret == ERROR_NO_MORE_ITEMS)
1430  ret = ERROR_SUCCESS;
1431  break;
1432  }
1433 
1434  ret = CRegKey::_DoDeleteKeyTree(key, pszName);
1435  if (ret != ERROR_SUCCESS)
1436  break;
1437  }
1438 
1439  // close key
1440  key.Close();
1441 
1442  // delete the subkey
1443  if (ret == ERROR_SUCCESS)
1444  ret = ::RegDeleteKey(hParentKey, lpszKey);
1445 
1446  // delete the buffer if any
1447  if (pszName != szNameBuf)
1448  free(pszName);
1449 
1450  return ret;
1451  }
#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 LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
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:1382
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
Definition: path.c:42

Referenced by RecurseDeleteKey().

◆ _GetMultiStringSize()

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

Definition at line 1368 of file atlbase.h.

1369  {
1370  int count = 0;
1371  do
1372  {
1373  int len = _tcslen(pszz);
1374  count += len + 1;
1375  pszz += len + 1;
1376  } while (*pszz != TEXT('\0'));
1377  ++count;
1378  return count * sizeof(TCHAR);
1379  }
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

Referenced by SetMultiStringValue().

◆ Attach()

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

Definition at line 1048 of file atlbase.h.

1049  {
1050  m_hKey = hKey;
1051  }
HKEY m_hKey
Definition: atlbase.h:1013

Referenced by operator=().

◆ Close()

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

Definition at line 1053 of file atlbase.h.

1054  {
1055  if (m_hKey)
1056  {
1057  HKEY hKey = Detach();
1058  return ::RegCloseKey(hKey);
1059  }
1060  return ERROR_SUCCESS;
1061  }
#define ERROR_SUCCESS
Definition: deptool.c:10
HKEY m_hKey
Definition: atlbase.h:1013
HKEY Detach()
Definition: atlbase.h:1063
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423

Referenced by Create(), LoadSettings(), Open(), SaveSettings(), and CACLCustomMRU::~CACLCustomMRU().

◆ 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 1091 of file atlbase.h.

1097  {
1098  ATLASSERT(hKeyParent);
1099  ATLASSERT(lpszKeyName);
1100 
1101  HKEY hKey = NULL;
1102  LONG lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, 0, lpszClass,
1103  dwOptions, samDesired, lpSecAttr, &hKey,
1104  lpdwDisposition);
1105  if (lRes != ERROR_SUCCESS)
1106  {
1107  samDesired |= KEY_WOW64_64KEY;
1108  lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, 0, lpszClass,
1109  dwOptions, samDesired, lpSecAttr, &hKey,
1110  lpdwDisposition);
1111  }
1112  if (lRes == ERROR_SUCCESS)
1113  {
1114  Close();
1115  m_hKey = hKey;
1116  }
1117  return lRes;
1118  }
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:1053
HKEY m_hKey
Definition: atlbase.h:1013
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

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

◆ DeleteSubKey()

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

Definition at line 1316 of file atlbase.h.

1317  {
1318  ATLASSERT(m_hKey);
1319  ATLASSERT(lpszSubKey);
1320  return ::RegDeleteKey(m_hKey, lpszSubKey);
1321  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1013
#define RegDeleteKey
Definition: winreg.h:502

Referenced by Cleanup_Testdata().

◆ DeleteValue()

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

Definition at line 1310 of file atlbase.h.

1311  {
1312  ATLASSERT(m_hKey);
1313  return ::RegDeleteValue(m_hKey, lpszValue);
1314  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1013
#define RegDeleteValue
Definition: winreg.h:508

◆ Detach()

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

Definition at line 1063 of file atlbase.h.

1064  {
1065  HKEY hKey = m_hKey;
1066  m_hKey = NULL;
1067  return hKey;
1068  }
HKEY m_hKey
Definition: atlbase.h:1013
smooth NULL
Definition: ftsmooth.c:416

Referenced by Close().

◆ EnumKey()

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

Definition at line 1330 of file atlbase.h.

1332  {
1333  ATLASSERT(m_hKey);
1334  LONG ret = ::RegEnumKeyEx(m_hKey, iIndex, pszName, pnNameLength, NULL,
1335  NULL, NULL, pftLastWriteTime);
1336  return ret;
1337  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1013
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 1279 of file atlbase.h.

1280  {
1281  ATLASSERT(m_hKey);
1283  return ret;
1284  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
LONG WINAPI RegFlushKey(HKEY hKey)
Definition: reg.c:2974
HKEY m_hKey
Definition: atlbase.h:1013
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 1339 of file atlbase.h.

1341  {
1342  ATLASSERT(m_hKey);
1343  LONG ret = ::RegGetKeySecurity(m_hKey, si, psd, pnBytes);
1344  return ret;
1345  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1013
long LONG
Definition: pedump.c:60
LONG WINAPI RegGetKeySecurity(HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, LPDWORD lpcbSecurityDescriptor)
Definition: reg.c:3010
int ret

◆ NotifyChangeKeyValue()

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

Definition at line 1270 of file atlbase.h.

1272  {
1273  ATLASSERT(m_hKey);
1274  LONG ret = ::RegNotifyChangeKeyValue(m_hKey, bWatchSubtree,
1275  dwNotifyFilter, hEvent, bAsync);
1276  return ret;
1277  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1013
static HANDLE hEvent
Definition: comm.c:54
long LONG
Definition: pedump.c:60
int ret
LONG WINAPI RegNotifyChangeKeyValue(HKEY hKey, BOOL bWatchSubtree, DWORD dwNotifyFilter, HANDLE hEvent, BOOL fAsynchronous)
Definition: reg.c:3175

◆ Open()

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

Definition at line 1070 of file atlbase.h.

1072  {
1073  ATLASSERT(hKeyParent);
1074  ATLASSERT(lpszKeyName);
1075 
1076  HKEY hKey = NULL;
1077  LONG lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, 0, samDesired, &hKey);
1078  if (lRes != ERROR_SUCCESS)
1079  {
1080  samDesired |= KEY_WOW64_64KEY;
1081  lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, 0, samDesired, &hKey);
1082  }
1083  if (lRes == ERROR_SUCCESS)
1084  {
1085  Close();
1086  m_hKey = hKey;
1087  }
1088  return lRes;
1089  }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
LONG Close()
Definition: atlbase.h:1053
HKEY m_hKey
Definition: atlbase.h:1013
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

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

◆ operator HKEY()

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

Definition at line 1355 of file atlbase.h.

1356  {
1357  return m_hKey;
1358  }
HKEY m_hKey
Definition: atlbase.h:1013

◆ operator=()

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

Definition at line 1360 of file atlbase.h.

1361  {
1362  Attach(key.Detach());
1363  return *this;
1364  }
void Attach(HKEY hKey)
Definition: atlbase.h:1048
Definition: path.c:42

◆ QueryBinaryValue()

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

Definition at line 1138 of file atlbase.h.

1139  {
1140  DWORD type = 0;
1141  LONG lRet = QueryValue(pszValueName, &type, pValue, pnBytes);
1142 
1143  if (lRet == ERROR_SUCCESS && type != REG_BINARY)
1144  lRet = ERROR_INVALID_DATA;
1145 
1146  return lRet;
1147  }
#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:1120
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INVALID_DATA
Definition: winerror.h:116

Referenced by LoadSettings().

◆ QueryDWORDValue()

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

Definition at line 1126 of file atlbase.h.

1127  {
1128  ULONG size = sizeof(DWORD);
1129  DWORD type = 0;
1130  LONG lRet = QueryValue(pszValueName, &type, &dwValue, &size);
1131 
1132  if (lRet == ERROR_SUCCESS && type != REG_DWORD)
1133  lRet = ERROR_INVALID_DATA;
1134 
1135  return lRet;
1136  }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define DWORD
Definition: nt_native.h:44
long LONG
Definition: pedump.c:60
LONG QueryValue(LPCTSTR pszValueName, DWORD *pdwType, void *pData, ULONG *pnBytes)
Definition: atlbase.h:1120
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:596

◆ QueryGUIDValue()

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

Definition at line 1162 of file atlbase.h.

1163  {
1164  OLECHAR buf[40] = {0};
1165  ULONG nChars = 39;
1166  LONG lRet;
1167 
1168 #ifdef UNICODE
1169  lRet = QueryStringValue(pszValueName, buf, &nChars);
1170 #else
1171  CHAR bufA[40] = {0};
1172  lRet = QueryStringValue(pszValueName, bufA, &nChars);
1173  if (lRet != ERROR_SUCCESS)
1174  return lRet;
1175  if (!::MultiByteToWideChar(CP_THREAD_ACP, 0, bufA, -1, buf, 39))
1176  lRet = ERROR_INVALID_DATA;
1177 #endif
1178  if (lRet != ERROR_SUCCESS)
1179  return lRet;
1180 
1181  if (!SUCCEEDED(::CLSIDFromString(buf, &guidValue)))
1182  return ERROR_INVALID_DATA;
1183 
1184  return lRet;
1185  }
WCHAR OLECHAR
Definition: compat.h:1933
#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:1149
#define ERROR_INVALID_DATA
Definition: winerror.h:116
#define MultiByteToWideChar
Definition: compat.h:100
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2247
unsigned int ULONG
Definition: retypes.h:1
#define CP_THREAD_ACP
Definition: winnls.h:230
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ QueryMultiStringValue()

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

Definition at line 1199 of file atlbase.h.

1201  {
1202  ULONG size = (*pnChars) * sizeof(TCHAR);
1203  DWORD type;
1204  LONG lRet = QueryValue(pszValueName, &type, pszValue, &size);
1205 
1206  if (lRet == ERROR_SUCCESS && type != REG_MULTI_SZ)
1207  lRet = ERROR_INVALID_DATA;
1208 
1209  *pnChars = size / sizeof(TCHAR);
1210  return lRet;
1211  }
#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:1120
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 1187 of file atlbase.h.

1188  {
1189  ULONG size = sizeof(ULONGLONG);
1190  DWORD type = 0;
1191  LONG lRet = QueryValue(pszValueName, &type, &qwValue, &size);
1192 
1193  if (lRet == ERROR_SUCCESS && type != REG_QWORD)
1194  lRet = ERROR_INVALID_DATA;
1195 
1196  return lRet;
1197  }
#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:1120
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:597
unsigned int ULONG
Definition: retypes.h:1

◆ QueryStringValue()

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

Definition at line 1149 of file atlbase.h.

1150  {
1151  ULONG size = (*pnChars) * sizeof(TCHAR);
1152  DWORD type = 0;
1153  LONG lRet = QueryValue(pszValueName, &type, pszValue, &size);
1154 
1155  if (lRet == ERROR_SUCCESS && type != REG_SZ && type != REG_EXPAND_SZ)
1156  lRet = ERROR_INVALID_DATA;
1157 
1158  *pnChars = size / sizeof(TCHAR);
1159  return lRet;
1160  }
#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:1120
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

Referenced by CACLCustomMRU::Initialize(), and QueryGUIDValue().

◆ QueryValue()

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

Definition at line 1120 of file atlbase.h.

1121  {
1122  ATLASSERT(m_hKey);
1123  return ::RegQueryValueEx(m_hKey, pszValueName, NULL, pdwType, (LPBYTE)pData, pnBytes);
1124  }
#define RegQueryValueEx
Definition: winreg.h:524
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1013
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

Referenced by QueryBinaryValue(), QueryDWORDValue(), QueryMultiStringValue(), QueryQWORDValue(), and QueryStringValue().

◆ RecurseDeleteKey()

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

Definition at line 1323 of file atlbase.h.

1324  {
1325  ATLASSERT(m_hKey);
1326  ATLASSERT(lpszKey);
1327  return CRegKey::_DoDeleteKeyTree(m_hKey, lpszKey);
1328  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1013
static LONG _DoDeleteKeyTree(HKEY hParentKey, LPCTSTR lpszKey)
Definition: atlbase.h:1382

◆ SetBinaryValue()

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

Definition at line 1253 of file atlbase.h.

1254  {
1255  return SetValue(pszValueName, REG_BINARY, pValue, nBytes);
1256  }
#define REG_BINARY
Definition: nt_native.h:1496
LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void *pValue, ULONG nBytes)
Definition: atlbase.h:1213

Referenced by SaveSettings().

◆ SetDWORDValue()

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

Definition at line 1219 of file atlbase.h.

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

◆ SetGUIDValue()

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

Definition at line 1240 of file atlbase.h.

1241  {
1242  OLECHAR buf[40] = {0};
1243  ::StringFromGUID2(guidValue, buf, 39);
1244 #ifdef UNICODE
1245  return SetStringValue(pszValueName, buf);
1246 #else
1247  CHAR bufA[40] = {0};
1248  ::WideCharToMultiByte(CP_THREAD_ACP, 0, buf, -1, bufA, 40, NULL, NULL);
1249  return SetStringValue(pszValueName, bufA);
1250 #endif
1251  }
WCHAR OLECHAR
Definition: compat.h:1933
#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:2343
#define CP_THREAD_ACP
Definition: winnls.h:230
LONG SetStringValue(LPCTSTR pszValueName, LPCTSTR pszValue, DWORD dwType=REG_SZ)
Definition: atlbase.h:1224

◆ SetKeySecurity()

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

Definition at line 1347 of file atlbase.h.

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

◆ SetKeyValue()

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

Definition at line 1298 of file atlbase.h.

1300  {
1301  CRegKey key;
1302  LONG lRet = key.Create(m_hKey, lpszKeyName);
1303  if (lRet == ERROR_SUCCESS)
1304  {
1305  lRet = key.SetStringValue(lpszValueName, lpszValue);
1306  }
1307  return lRet;
1308  }
#define ERROR_SUCCESS
Definition: deptool.c:10
HKEY m_hKey
Definition: atlbase.h:1013
long LONG
Definition: pedump.c:60
HKEY key
Definition: reg.c:42
Definition: path.c:42

◆ SetMultiStringValue()

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

Definition at line 1258 of file atlbase.h.

1259  {
1261  return SetValue(pszValueName, REG_MULTI_SZ, pszValue, dwSize);
1262  }
#define REG_MULTI_SZ
Definition: nt_native.h:1501
static ULONG _GetMultiStringSize(LPCTSTR pszz)
Definition: atlbase.h:1368
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:1213

Referenced by SetStringValue().

◆ SetQWORDValue()

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

Definition at line 1264 of file atlbase.h.

1265  {
1266  ULONG dwSize = sizeof(ULONGLONG);
1267  return SetValue(pszValueName, REG_QWORD, &qwValue, dwSize);
1268  }
uint64_t ULONGLONG
Definition: typedefs.h:65
#define REG_QWORD
Definition: sdbapi.c:597
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:1213

◆ SetStringValue()

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

Definition at line 1224 of file atlbase.h.

1225  {
1226  SIZE_T length;
1227  switch (dwType)
1228  {
1229  case REG_SZ:
1230  case REG_EXPAND_SZ:
1231  length = (_tcslen(pszValue) + 1) * sizeof(TCHAR);
1232  return SetValue(pszValueName, dwType, pszValue, length);
1233  case REG_MULTI_SZ:
1234  return SetMultiStringValue(pszValueName, pszValue);
1235  default:
1236  return ERROR_INVALID_DATA;
1237  }
1238  }
LONG SetMultiStringValue(LPCTSTR pszValueName, LPCTSTR pszValue)
Definition: atlbase.h:1258
#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
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void *pValue, ULONG nBytes)
Definition: atlbase.h:1213
#define REG_SZ
Definition: layer.c:22

Referenced by CACLCustomMRU::PersistMRU(), SetGUIDValue(), RegistrySettings::SetWallpaper(), and RegistrySettings::Store().

◆ SetValue() [1/2]

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

Definition at line 1213 of file atlbase.h.

1214  {
1215  ATLASSERT(m_hKey);
1216  return ::RegSetValueEx(m_hKey, pszValueName, 0, dwType, (const BYTE*)pValue, nBytes);
1217  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HKEY m_hKey
Definition: atlbase.h:1013
unsigned char BYTE
Definition: mem.h:68
#define RegSetValueEx
Definition: winreg.h:533

Referenced by SetBinaryValue(), SetDWORDValue(), SetMultiStringValue(), SetQWORDValue(), and SetStringValue().

◆ SetValue() [2/2]

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

Definition at line 1286 of file atlbase.h.

1288  {
1289  CRegKey key;
1290  LONG lRet = key.Create(hKeyParent, lpszKeyName);
1291  if (lRet == ERROR_SUCCESS)
1292  {
1293  lRet = key.SetStringValue(lpszValueName, lpszValue);
1294  }
1295  return lRet;
1296  }
#define ERROR_SUCCESS
Definition: deptool.c:10
long LONG
Definition: pedump.c:60
HKEY key
Definition: reg.c:42
Definition: path.c:42

Member Data Documentation

◆ m_hKey


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