ReactOS  0.4.15-dev-4914-g2220e56
ATL::CRegKey Class Reference

#include <atlbase.h>

Inheritance diagram for ATL::CRegKey:
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 1011 of file atlbase.h.

Constructor & Destructor Documentation

◆ CRegKey() [1/3]

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

Definition at line 1022 of file atlbase.h.

1023  : m_hKey(NULL)
1024  {
1025  }
HKEY m_hKey
Definition: atlbase.h:1014
#define NULL
Definition: types.h:112

◆ CRegKey() [2/3]

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

Definition at line 1027 of file atlbase.h.

1028  : m_hKey(key.Detach())
1029  {
1030  }
HKEY m_hKey
Definition: atlbase.h:1014
Definition: copy.c:22

◆ CRegKey() [3/3]

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

Definition at line 1032 of file atlbase.h.

1033  : m_hKey(hKey)
1034  {
1035  }
HKEY m_hKey
Definition: atlbase.h:1014
FxAutoRegKey hKey

◆ ~CRegKey()

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

Definition at line 1045 of file atlbase.h.

1046  {
1047  Close();
1048  }
LONG Close()
Definition: atlbase.h:1055

Member Function Documentation

◆ _DoDeleteKeyTree()

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

Definition at line 1389 of file atlbase.h.

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

Referenced by RecurseDeleteKey().

◆ _GetMultiStringSize()

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

Definition at line 1374 of file atlbase.h.

1375  {
1376  size_t count = 0;
1377  do
1378  {
1379  size_t len = _tcslen(pszz);
1380  count += len + 1;
1381  pszz += len + 1;
1382  } while (*pszz != TEXT('\0'));
1383  ++count;
1384  ATLASSERT(count * sizeof(TCHAR) <= ULONG_MAX);
1385  return (ULONG)count * sizeof(TCHAR);
1386  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
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
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_MAX
Definition: limits.h:44

Referenced by SetMultiStringValue().

◆ Attach()

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

Definition at line 1050 of file atlbase.h.

1051  {
1052  m_hKey = hKey;
1053  }
HKEY m_hKey
Definition: atlbase.h:1014
FxAutoRegKey hKey

Referenced by operator=(), and RunOnceExSection::RunOnceExSection().

◆ Close()

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

Definition at line 1055 of file atlbase.h.

1056  {
1057  if (m_hKey)
1058  {
1059  HKEY hKey = Detach();
1061  }
1062  return ERROR_SUCCESS;
1063  }
#define ERROR_SUCCESS
Definition: deptool.c:10
HKEY m_hKey
Definition: atlbase.h:1014
HKEY Detach()
Definition: atlbase.h:1065
FxAutoRegKey hKey
#define RegCloseKey(hKey)
Definition: registry.h:47

Referenced by RunOnceExSection::CloseAndDelete(), Create(), Open(), operator=(), and ~CRegKey().

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

1099  {
1100  ATLASSERT(hKeyParent);
1101  ATLASSERT(lpszKeyName);
1102 
1103  HKEY hKey = NULL;
1104  LONG lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, 0, lpszClass,
1105  dwOptions, samDesired, lpSecAttr, &hKey,
1106  lpdwDisposition);
1107  if (lRes != ERROR_SUCCESS)
1108  {
1109  samDesired |= KEY_WOW64_64KEY;
1110  lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, 0, lpszClass,
1111  dwOptions, samDesired, lpSecAttr, &hKey,
1112  lpdwDisposition);
1113  }
1114  if (lRes == ERROR_SUCCESS)
1115  {
1116  Close();
1117  m_hKey = hKey;
1118  }
1119  return lRes;
1120  }
DWORD dwOptions
Definition: solitaire.cpp:24
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
LONG Close()
Definition: atlbase.h:1055
HKEY m_hKey
Definition: atlbase.h:1014
long LONG
Definition: pedump.c:60
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
#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 1318 of file atlbase.h.

1319  {
1320  ATLASSERT(m_hKey);
1321  ATLASSERT(lpszSubKey);
1322  return ::RegDeleteKey(m_hKey, lpszSubKey);
1323  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HKEY m_hKey
Definition: atlbase.h:1014
#define RegDeleteKey
Definition: winreg.h:502

Referenced by Cleanup_Testdata().

◆ DeleteValue()

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

Definition at line 1312 of file atlbase.h.

1313  {
1314  ATLASSERT(m_hKey);
1315  return ::RegDeleteValue(m_hKey, lpszValue);
1316  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HKEY m_hKey
Definition: atlbase.h:1014
#define RegDeleteValue
Definition: winreg.h:508

Referenced by RunOnceExInstance::Exec().

◆ Detach()

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

Definition at line 1065 of file atlbase.h.

1066  {
1067  HKEY hKey = m_hKey;
1068  m_hKey = NULL;
1069  return hKey;
1070  }
HKEY m_hKey
Definition: atlbase.h:1014
FxAutoRegKey hKey
#define NULL
Definition: types.h:112

Referenced by Close(), and RunOnceExInstance::HandleSubKey().

◆ EnumKey()

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

Definition at line 1332 of file atlbase.h.

1334  {
1335  ATLASSERT(m_hKey);
1336  LONG ret = ::RegEnumKeyEx(m_hKey, iIndex, pszName, pnNameLength, NULL,
1337  NULL, NULL, pftLastWriteTime);
1338  return ret;
1339  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HKEY m_hKey
Definition: atlbase.h:1014
long LONG
Definition: pedump.c:60
int ret
#define RegEnumKeyEx
Definition: winreg.h:510
#define NULL
Definition: types.h:112

Referenced by RunOnceExInstance::RunOnceExInstance().

◆ Flush()

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

Definition at line 1281 of file atlbase.h.

1282  {
1283  ATLASSERT(m_hKey);
1285  return ret;
1286  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
LONG WINAPI RegFlushKey(HKEY hKey)
Definition: reg.c:2974
HKEY m_hKey
Definition: atlbase.h:1014
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 1341 of file atlbase.h.

1343  {
1344  ATLASSERT(m_hKey);
1345  LONG ret = ::RegGetKeySecurity(m_hKey, si, psd, pnBytes);
1346  return ret;
1347  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HKEY m_hKey
Definition: atlbase.h:1014
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 1272 of file atlbase.h.

1274  {
1275  ATLASSERT(m_hKey);
1276  LONG ret = ::RegNotifyChangeKeyValue(m_hKey, bWatchSubtree,
1277  dwNotifyFilter, hEvent, bAsync);
1278  return ret;
1279  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HKEY m_hKey
Definition: atlbase.h:1014
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 1072 of file atlbase.h.

1074  {
1075  ATLASSERT(hKeyParent);
1076  ATLASSERT(lpszKeyName);
1077 
1078  HKEY hKey = NULL;
1079  LONG lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, 0, samDesired, &hKey);
1080  if (lRes != ERROR_SUCCESS)
1081  {
1082  samDesired |= KEY_WOW64_64KEY;
1083  lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, 0, samDesired, &hKey);
1084  }
1085  if (lRes == ERROR_SUCCESS)
1086  {
1087  Close();
1088  m_hKey = hKey;
1089  }
1090  return lRes;
1091  }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
LONG Close()
Definition: atlbase.h:1055
HKEY m_hKey
Definition: atlbase.h:1014
long LONG
Definition: pedump.c:60
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
#define RegOpenKeyEx
Definition: winreg.h:520
FxAutoRegKey hKey
#define NULL
Definition: types.h:112

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

◆ operator HKEY()

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

Definition at line 1357 of file atlbase.h.

1358  {
1359  return m_hKey;
1360  }
HKEY m_hKey
Definition: atlbase.h:1014

◆ operator=()

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

Definition at line 1362 of file atlbase.h.

1363  {
1364  if (m_hKey != key.m_hKey)
1365  {
1366  Close();
1367  Attach(key.Detach());
1368  }
1369  return *this;
1370  }
LONG Close()
Definition: atlbase.h:1055
HKEY m_hKey
Definition: atlbase.h:1014
void Attach(HKEY hKey)
Definition: atlbase.h:1050
Definition: copy.c:22

◆ QueryBinaryValue()

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

Definition at line 1140 of file atlbase.h.

1141  {
1142  DWORD type = 0;
1143  LONG lRet = QueryValue(pszValueName, &type, pValue, pnBytes);
1144 
1145  if (lRet == ERROR_SUCCESS && type != REG_BINARY)
1146  lRet = ERROR_INVALID_DATA;
1147 
1148  return lRet;
1149  }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_BINARY
Definition: nt_native.h:1496
PWCHAR pValue
long LONG
Definition: pedump.c:60
LONG QueryValue(LPCTSTR pszValueName, DWORD *pdwType, void *pData, ULONG *pnBytes)
Definition: atlbase.h:1122
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INVALID_DATA
Definition: winerror.h:116
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

◆ QueryDWORDValue()

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

Definition at line 1128 of file atlbase.h.

1129  {
1130  ULONG size = sizeof(DWORD);
1131  DWORD type = 0;
1132  LONG lRet = QueryValue(pszValueName, &type, &dwValue, &size);
1133 
1134  if (lRet == ERROR_SUCCESS && type != REG_DWORD)
1135  lRet = ERROR_INVALID_DATA;
1136 
1137  return lRet;
1138  }
#define ERROR_SUCCESS
Definition: deptool.c:10
#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:1122
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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REG_DWORD
Definition: sdbapi.c:596

Referenced by RunOnceExInstance::RunOnceExInstance().

◆ QueryGUIDValue()

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

Definition at line 1164 of file atlbase.h.

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

◆ QueryMultiStringValue()

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

Definition at line 1201 of file atlbase.h.

1203  {
1204  ULONG size = (*pnChars) * sizeof(TCHAR);
1205  DWORD type;
1206  LONG lRet = QueryValue(pszValueName, &type, pszValue, &size);
1207 
1208  if (lRet == ERROR_SUCCESS && type != REG_MULTI_SZ)
1209  lRet = ERROR_INVALID_DATA;
1210 
1211  *pnChars = size / sizeof(TCHAR);
1212  return lRet;
1213  }
#define ERROR_SUCCESS
Definition: deptool.c:10
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:1122
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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

◆ QueryQWORDValue()

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

Definition at line 1189 of file atlbase.h.

1190  {
1191  ULONG size = sizeof(ULONGLONG);
1192  DWORD type = 0;
1193  LONG lRet = QueryValue(pszValueName, &type, &qwValue, &size);
1194 
1195  if (lRet == ERROR_SUCCESS && type != REG_QWORD)
1196  lRet = ERROR_INVALID_DATA;
1197 
1198  return lRet;
1199  }
#define ERROR_SUCCESS
Definition: deptool.c:10
long LONG
Definition: pedump.c:60
LONG QueryValue(LPCTSTR pszValueName, DWORD *pdwType, void *pData, ULONG *pnBytes)
Definition: atlbase.h:1122
GLsizeiptr size
Definition: glext.h:5919
uint64_t ULONGLONG
Definition: typedefs.h:67
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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

◆ QueryStringValue()

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

Definition at line 1151 of file atlbase.h.

1152  {
1153  ULONG size = (*pnChars) * sizeof(TCHAR);
1154  DWORD type = 0;
1155  LONG lRet = QueryValue(pszValueName, &type, pszValue, &size);
1156 
1157  if (lRet == ERROR_SUCCESS && type != REG_SZ && type != REG_EXPAND_SZ)
1158  lRet = ERROR_INVALID_DATA;
1159 
1160  *pnChars = size / sizeof(TCHAR);
1161  return lRet;
1162  }
#define ERROR_SUCCESS
Definition: deptool.c:10
long LONG
Definition: pedump.c:60
LONG QueryValue(LPCTSTR pszValueName, DWORD *pdwType, void *pData, ULONG *pnBytes)
Definition: atlbase.h:1122
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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REG_SZ
Definition: layer.c:22

Referenced by CACLCustomMRU::LoadMRUList(), QueryGUIDValue(), and RunOnceExInstance::RunOnceExInstance().

◆ QueryValue()

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

Definition at line 1122 of file atlbase.h.

1123  {
1124  ATLASSERT(m_hKey);
1125  return ::RegQueryValueEx(m_hKey, pszValueName, NULL, pdwType, (LPBYTE)pData, pnBytes);
1126  }
#define RegQueryValueEx
Definition: winreg.h:524
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HKEY m_hKey
Definition: atlbase.h:1014
unsigned char * LPBYTE
Definition: typedefs.h:53
#define NULL
Definition: types.h:112
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 1325 of file atlbase.h.

1326  {
1327  ATLASSERT(m_hKey);
1328  ATLASSERT(lpszKey);
1329  return CRegKey::_DoDeleteKeyTree(m_hKey, lpszKey);
1330  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
HKEY m_hKey
Definition: atlbase.h:1014
static LONG _DoDeleteKeyTree(HKEY hParentKey, LPCTSTR lpszKey)
Definition: atlbase.h:1389

◆ SetBinaryValue()

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

Definition at line 1255 of file atlbase.h.

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

◆ SetDWORDValue()

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

Definition at line 1221 of file atlbase.h.

1222  {
1223  return SetValue(pszValueName, REG_DWORD, &dwValue, sizeof(DWORD));
1224  }
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:1215

◆ SetGUIDValue()

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

Definition at line 1242 of file atlbase.h.

1243  {
1244  OLECHAR buf[40] = {0};
1245  ::StringFromGUID2(guidValue, buf, 39);
1246 #ifdef UNICODE
1247  return SetStringValue(pszValueName, buf);
1248 #else
1249  CHAR bufA[40] = {0};
1250  ::WideCharToMultiByte(CP_THREAD_ACP, 0, buf, -1, bufA, 40, NULL, NULL);
1251  return SetStringValue(pszValueName, bufA);
1252 #endif
1253  }
WCHAR OLECHAR
Definition: compat.h:2151
#define WideCharToMultiByte
Definition: compat.h:111
char CHAR
Definition: xmlstorage.h:175
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
#define NULL
Definition: types.h:112
#define CP_THREAD_ACP
Definition: winnls.h:233
LONG SetStringValue(LPCTSTR pszValueName, LPCTSTR pszValue, DWORD dwType=REG_SZ)
Definition: atlbase.h:1226

◆ SetKeySecurity()

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

Definition at line 1349 of file atlbase.h.

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

◆ SetKeyValue()

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

Definition at line 1300 of file atlbase.h.

1302  {
1303  CRegKey key;
1304  LONG lRet = key.Create(m_hKey, lpszKeyName);
1305  if (lRet == ERROR_SUCCESS)
1306  {
1307  lRet = key.SetStringValue(lpszValueName, lpszValue);
1308  }
1309  return lRet;
1310  }
#define ERROR_SUCCESS
Definition: deptool.c:10
HKEY m_hKey
Definition: atlbase.h:1014
long LONG
Definition: pedump.c:60
HKEY key
Definition: reg.c:28
Definition: copy.c:22

◆ SetMultiStringValue()

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

Definition at line 1260 of file atlbase.h.

1261  {
1263  return SetValue(pszValueName, REG_MULTI_SZ, pszValue, dwSize);
1264  }
#define REG_MULTI_SZ
Definition: nt_native.h:1501
static ULONG _GetMultiStringSize(LPCTSTR pszz)
Definition: atlbase.h:1374
unsigned int ULONG
Definition: retypes.h:1
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void *pValue, ULONG nBytes)
Definition: atlbase.h:1215

Referenced by SetStringValue().

◆ SetQWORDValue()

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

Definition at line 1266 of file atlbase.h.

1267  {
1268  ULONG dwSize = sizeof(ULONGLONG);
1269  return SetValue(pszValueName, REG_QWORD, &qwValue, dwSize);
1270  }
uint64_t ULONGLONG
Definition: typedefs.h:67
#define REG_QWORD
Definition: sdbapi.c:597
unsigned int ULONG
Definition: retypes.h:1
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void *pValue, ULONG nBytes)
Definition: atlbase.h:1215

◆ SetStringValue()

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

Definition at line 1226 of file atlbase.h.

1227  {
1228  SIZE_T length;
1229  switch (dwType)
1230  {
1231  case REG_SZ:
1232  case REG_EXPAND_SZ:
1233  length = (_tcslen(pszValue) + 1) * sizeof(TCHAR);
1234  return SetValue(pszValueName, dwType, pszValue, length);
1235  case REG_MULTI_SZ:
1236  return SetMultiStringValue(pszValueName, pszValue);
1237  default:
1238  return ERROR_INVALID_DATA;
1239  }
1240  }
LONG SetMultiStringValue(LPCTSTR pszValueName, LPCTSTR pszValue)
Definition: atlbase.h:1260
#define REG_MULTI_SZ
Definition: nt_native.h:1501
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
char TCHAR
Definition: xmlstorage.h:189
#define ERROR_INVALID_DATA
Definition: winerror.h:116
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void *pValue, ULONG nBytes)
Definition: atlbase.h:1215
#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 1215 of file atlbase.h.

1216  {
1217  ATLASSERT(m_hKey);
1218  return ::RegSetValueEx(m_hKey, pszValueName, 0, dwType, (const BYTE*)pValue, nBytes);
1219  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
PWCHAR pValue
HKEY m_hKey
Definition: atlbase.h:1014
unsigned char BYTE
Definition: xxhash.c:193
#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 1288 of file atlbase.h.

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

Member Data Documentation

◆ m_hKey


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