ReactOS 0.4.15-dev-7934-g1dc8d80
ATL::CRegKey Class Reference

#include <atlbase.h>

Inheritance diagram for ATL::CRegKey:
Collaboration diagram for ATL::CRegKey:

Public Member Functions

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

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

Constructor & Destructor Documentation

◆ CRegKey() [1/3]

ATL::CRegKey::CRegKey ( )
inlinenoexcept

Definition at line 1123 of file atlbase.h.

1124 : m_hKey(NULL)
1125 {
1126 }
HKEY m_hKey
Definition: atlbase.h:1115
#define NULL
Definition: types.h:112

◆ CRegKey() [2/3]

ATL::CRegKey::CRegKey ( CRegKey key)
inlinenoexcept

Definition at line 1128 of file atlbase.h.

1129 : m_hKey(key.Detach())
1130 {
1131 }
Definition: copy.c:22

◆ CRegKey() [3/3]

ATL::CRegKey::CRegKey ( HKEY  hKey)
inlineexplicitnoexcept

Definition at line 1133 of file atlbase.h.

1134 : m_hKey(hKey)
1135 {
1136 }
FxAutoRegKey hKey

◆ ~CRegKey()

ATL::CRegKey::~CRegKey ( )
inlinenoexcept

Definition at line 1146 of file atlbase.h.

1147 {
1148 Close();
1149 }
LONG Close() noexcept
Definition: atlbase.h:1156

Member Function Documentation

◆ _DoDeleteKeyTree()

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

Definition at line 1478 of file atlbase.h.

1479 {
1480 ATLASSERT(hParentKey);
1481 ATLASSERT(lpszKey);
1482
1483 // open the key
1484 CRegKey key;
1485 LONG ret = key.Open(hParentKey, lpszKey);
1486 if (ret != ERROR_SUCCESS)
1487 {
1488 return ret; // failure
1489 }
1490
1491 // get the longest length of subkey names
1492 DWORD NameMax;
1493 ret = ::RegQueryInfoKey(key, NULL, NULL, NULL, NULL, &NameMax, NULL,
1494 NULL, NULL, NULL, NULL, NULL);
1495 if (ret != ERROR_SUCCESS)
1496 {
1497 return ret; // failure
1498 }
1499 ++NameMax; // for NUL
1500
1501 // allocate the string buffer for names if necessary
1502 TCHAR szNameBuf[MAX_PATH], *pszName;
1503 if (NameMax > MAX_PATH)
1504 {
1505 pszName = (TCHAR *)malloc(NameMax * sizeof(TCHAR));
1506 ATLASSERT(pszName);
1507 if (pszName == NULL)
1508 {
1509 return ERROR_OUTOFMEMORY; // failure
1510 }
1511 }
1512 else
1513 {
1514 NameMax = MAX_PATH;
1515 pszName = szNameBuf;
1516 }
1517
1518 // enumerate every subkey and delete
1519 for (;;)
1520 {
1521 DWORD Count = NameMax;
1522 ret = key.EnumKey(0, pszName, &Count);
1523 if (ret != ERROR_SUCCESS)
1524 {
1525 if (ret == ERROR_NO_MORE_ITEMS)
1527 break;
1528 }
1529
1530 ret = CRegKey::_DoDeleteKeyTree(key, pszName);
1531 if (ret != ERROR_SUCCESS)
1532 break;
1533 }
1534
1535 // close key
1536 key.Close();
1537
1538 // delete the subkey
1539 if (ret == ERROR_SUCCESS)
1540 ret = ::RegDeleteKey(hParentKey, lpszKey);
1541
1542 // delete the buffer if any
1543 if (pszName != szNameBuf)
1544 free(pszName);
1545
1546 return ret;
1547 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
static LONG _DoDeleteKeyTree(HKEY hParentKey, LPCTSTR lpszKey)
Definition: atlbase.h:1478
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
int Count
Definition: noreturn.cpp:7
long LONG
Definition: pedump.c:60
int ret
#define RegDeleteKey
Definition: winreg.h:502
#define RegQueryInfoKey
Definition: winreg.h:521
char TCHAR
Definition: xmlstorage.h:189

Referenced by _DoDeleteKeyTree(), and RecurseDeleteKey().

◆ _GetMultiStringSize()

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

Definition at line 1463 of file atlbase.h.

1464 {
1465 size_t count = 0;
1466 do
1467 {
1468 size_t len = _tcslen(pszz);
1469 count += len + 1;
1470 pszz += len + 1;
1471 } while (*pszz != TEXT('\0'));
1472 ++count;
1473 ATLASSERT(count * sizeof(TCHAR) <= ULONG_MAX);
1474 return (ULONG)count * sizeof(TCHAR);
1475 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLsizei len
Definition: glext.h:6722
#define ULONG_MAX
Definition: limits.h:44
#define TEXT(s)
Definition: k32.h:26
uint32_t ULONG
Definition: typedefs.h:59
#define _tcslen
Definition: xmlstorage.h:198

Referenced by SetMultiStringValue().

◆ Attach()

void ATL::CRegKey::Attach ( HKEY  hKey)
inlinenoexcept

Definition at line 1151 of file atlbase.h.

1152 {
1153 m_hKey = hKey;
1154 }

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

◆ Close()

LONG ATL::CRegKey::Close ( )
inlinenoexcept

Definition at line 1156 of file atlbase.h.

1157 {
1158 if (m_hKey)
1159 {
1160 HKEY hKey = Detach();
1161 return ::RegCloseKey(hKey);
1162 }
1163 return ERROR_SUCCESS;
1164 }
HKEY Detach() noexcept
Definition: atlbase.h:1166

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 
)
inlinenoexcept

Definition at line 1189 of file atlbase.h.

1195 {
1196 ATLASSERT(hKeyParent);
1197 ATLASSERT(lpszKeyName);
1198
1199 HKEY hKey = NULL;
1200 LONG lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, 0, lpszClass,
1201 dwOptions, samDesired, lpSecAttr, &hKey,
1202 lpdwDisposition);
1203 if (lRes == ERROR_SUCCESS)
1204 {
1205 Close();
1206 m_hKey = hKey;
1207 }
1208 return lRes;
1209 }
DWORD dwOptions
Definition: solitaire.cpp:25
#define RegCreateKeyEx
Definition: winreg.h:501

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

◆ DeleteSubKey()

LONG ATL::CRegKey::DeleteSubKey ( LPCTSTR  lpszSubKey)
inlinenoexcept

Definition at line 1407 of file atlbase.h.

1408 {
1410 ATLASSERT(lpszSubKey);
1411 return ::RegDeleteKey(m_hKey, lpszSubKey);
1412 }

Referenced by Cleanup_Testdata().

◆ DeleteValue()

LONG ATL::CRegKey::DeleteValue ( LPCTSTR  lpszValue)
inlinenoexcept

Definition at line 1401 of file atlbase.h.

1402 {
1404 return ::RegDeleteValue(m_hKey, lpszValue);
1405 }

Referenced by RunOnceExInstance::Exec().

◆ Detach()

HKEY ATL::CRegKey::Detach ( )
inlinenoexcept

Definition at line 1166 of file atlbase.h.

1167 {
1168 HKEY hKey = m_hKey;
1169 m_hKey = NULL;
1170 return hKey;
1171 }

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

◆ EnumKey()

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

Definition at line 1421 of file atlbase.h.

1423 {
1425 LONG ret = ::RegEnumKeyEx(m_hKey, iIndex, pszName, pnNameLength, NULL,
1426 NULL, NULL, pftLastWriteTime);
1427 return ret;
1428 }
#define RegEnumKeyEx
Definition: winreg.h:510

Referenced by RunOnceExInstance::RunOnceExInstance().

◆ Flush()

LONG ATL::CRegKey::Flush ( )
inlinenoexcept

Definition at line 1370 of file atlbase.h.

1371 {
1374 return ret;
1375 }
LONG WINAPI RegFlushKey(HKEY hKey)
Definition: reg.c:2951

◆ GetKeySecurity()

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

Definition at line 1430 of file atlbase.h.

1432 {
1434 LONG ret = ::RegGetKeySecurity(m_hKey, si, psd, pnBytes);
1435 return ret;
1436 }
LONG WINAPI RegGetKeySecurity(HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, LPDWORD lpcbSecurityDescriptor)
Definition: reg.c:2987

◆ NotifyChangeKeyValue()

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

Definition at line 1361 of file atlbase.h.

1363 {
1365 LONG ret = ::RegNotifyChangeKeyValue(m_hKey, bWatchSubtree,
1366 dwNotifyFilter, hEvent, bAsync);
1367 return ret;
1368 }
LONG WINAPI RegNotifyChangeKeyValue(HKEY hKey, BOOL bWatchSubtree, DWORD dwNotifyFilter, HANDLE hEvent, BOOL fAsynchronous)
Definition: reg.c:3152
static HANDLE hEvent
Definition: comm.c:54

◆ Open()

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

Definition at line 1173 of file atlbase.h.

1175 {
1176 ATLASSERT(hKeyParent);
1177 ATLASSERT(lpszKeyName);
1178
1179 HKEY hKey = NULL;
1180 LONG lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, 0, samDesired, &hKey);
1181 if (lRes == ERROR_SUCCESS)
1182 {
1183 Close();
1184 m_hKey = hKey;
1185 }
1186 return lRes;
1187 }
#define RegOpenKeyEx
Definition: winreg.h:520

Referenced by Cleanup_Testdata(), CFontExt::Drop(), CDefaultContextMenu::InvokeRegVerb(), RegistrySettings::Load(), LoadSettings(), CAppDB::RemoveInstalledAppFromRegistry(), RunOnceExInstance::RunOnceExInstance(), RunOnceExSection::RunOnceExSection(), RegistrySettings::SetWallpaper(), and CAppDB::UpdateInstalled().

◆ operator HKEY()

ATL::CRegKey::operator HKEY ( ) const
inlinenoexcept

Definition at line 1446 of file atlbase.h.

1447 {
1448 return m_hKey;
1449 }

◆ operator=()

CRegKey & ATL::CRegKey::operator= ( CRegKey key)
inlinenoexcept

Definition at line 1451 of file atlbase.h.

1452 {
1453 if (m_hKey != key.m_hKey)
1454 {
1455 Close();
1456 Attach(key.Detach());
1457 }
1458 return *this;
1459 }
void Attach(HKEY hKey) noexcept
Definition: atlbase.h:1151

◆ QueryBinaryValue()

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

Definition at line 1229 of file atlbase.h.

1230 {
1231 DWORD type = 0;
1232 LONG lRet = QueryValue(pszValueName, &type, pValue, pnBytes);
1233
1234 if (lRet == ERROR_SUCCESS && type != REG_BINARY)
1235 lRet = ERROR_INVALID_DATA;
1236
1237 return lRet;
1238 }
LONG QueryValue(LPCTSTR pszValueName, DWORD *pdwType, void *pData, ULONG *pnBytes) noexcept
Definition: atlbase.h:1211
PWCHAR pValue
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REG_BINARY
Definition: nt_native.h:1496
#define ERROR_INVALID_DATA
Definition: winerror.h:116

◆ QueryDWORDValue()

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

Definition at line 1217 of file atlbase.h.

1218 {
1219 ULONG size = sizeof(DWORD);
1220 DWORD type = 0;
1221 LONG lRet = QueryValue(pszValueName, &type, &dwValue, &size);
1222
1223 if (lRet == ERROR_SUCCESS && type != REG_DWORD)
1224 lRet = ERROR_INVALID_DATA;
1225
1226 return lRet;
1227 }
GLsizeiptr size
Definition: glext.h:5919
#define DWORD
Definition: nt_native.h:44
#define REG_DWORD
Definition: sdbapi.c:596

Referenced by RunOnceExInstance::RunOnceExInstance().

◆ QueryGUIDValue()

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

Definition at line 1253 of file atlbase.h.

1254 {
1255 OLECHAR buf[40] = {0};
1256 ULONG nChars = 39;
1257 LONG lRet;
1258
1259#ifdef UNICODE
1260 lRet = QueryStringValue(pszValueName, buf, &nChars);
1261#else
1262 CHAR bufA[40] = {0};
1263 lRet = QueryStringValue(pszValueName, bufA, &nChars);
1264 if (lRet != ERROR_SUCCESS)
1265 return lRet;
1266 if (!::MultiByteToWideChar(CP_THREAD_ACP, 0, bufA, -1, buf, 39))
1267 lRet = ERROR_INVALID_DATA;
1268#endif
1269 if (lRet != ERROR_SUCCESS)
1270 return lRet;
1271
1272 if (!SUCCEEDED(::CLSIDFromString(buf, &guidValue)))
1273 return ERROR_INVALID_DATA;
1274
1275 return lRet;
1276 }
LONG QueryStringValue(LPCTSTR pszValueName, LPTSTR pszValue, ULONG *pnChars) noexcept
Definition: atlbase.h:1240
WCHAR OLECHAR
Definition: compat.h:2292
#define MultiByteToWideChar
Definition: compat.h:110
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define CP_THREAD_ACP
Definition: winnls.h:233
char CHAR
Definition: xmlstorage.h:175

◆ QueryMultiStringValue()

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

Definition at line 1290 of file atlbase.h.

1292 {
1293 ULONG size = (*pnChars) * sizeof(TCHAR);
1294 DWORD type;
1295 LONG lRet = QueryValue(pszValueName, &type, pszValue, &size);
1296
1297 if (lRet == ERROR_SUCCESS && type != REG_MULTI_SZ)
1298 lRet = ERROR_INVALID_DATA;
1299
1300 *pnChars = size / sizeof(TCHAR);
1301 return lRet;
1302 }
#define REG_MULTI_SZ
Definition: nt_native.h:1501

◆ QueryQWORDValue()

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

Definition at line 1278 of file atlbase.h.

1279 {
1280 ULONG size = sizeof(ULONGLONG);
1281 DWORD type = 0;
1282 LONG lRet = QueryValue(pszValueName, &type, &qwValue, &size);
1283
1284 if (lRet == ERROR_SUCCESS && type != REG_QWORD)
1285 lRet = ERROR_INVALID_DATA;
1286
1287 return lRet;
1288 }
#define REG_QWORD
Definition: sdbapi.c:597
uint64_t ULONGLONG
Definition: typedefs.h:67

◆ QueryStringValue()

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

Definition at line 1240 of file atlbase.h.

1241 {
1242 ULONG size = (*pnChars) * sizeof(TCHAR);
1243 DWORD type = 0;
1244 LONG lRet = QueryValue(pszValueName, &type, pszValue, &size);
1245
1246 if (lRet == ERROR_SUCCESS && type != REG_SZ && type != REG_EXPAND_SZ)
1247 lRet = ERROR_INVALID_DATA;
1248
1249 *pnChars = size / sizeof(TCHAR);
1250 return lRet;
1251 }
#define REG_SZ
Definition: layer.c:22
#define REG_EXPAND_SZ
Definition: nt_native.h:1494

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

◆ QueryValue()

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

Definition at line 1211 of file atlbase.h.

1212 {
1214 return ::RegQueryValueEx(m_hKey, pszValueName, NULL, pdwType, (LPBYTE)pData, pnBytes);
1215 }
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
unsigned char * LPBYTE
Definition: typedefs.h:53

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

◆ RecurseDeleteKey()

LONG ATL::CRegKey::RecurseDeleteKey ( LPCTSTR  lpszKey)
inlinenoexcept

Definition at line 1414 of file atlbase.h.

1415 {
1417 ATLASSERT(lpszKey);
1418 return CRegKey::_DoDeleteKeyTree(m_hKey, lpszKey);
1419 }

Referenced by CAppDB::RemoveInstalledAppFromRegistry().

◆ SetBinaryValue()

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

Definition at line 1344 of file atlbase.h.

1345 {
1346 return SetValue(pszValueName, REG_BINARY, pValue, nBytes);
1347 }
@ SetValue
Definition: shader.c:1968

◆ SetDWORDValue()

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

Definition at line 1310 of file atlbase.h.

1311 {
1312 return SetValue(pszValueName, REG_DWORD, &dwValue, sizeof(DWORD));
1313 }

Referenced by RegistrySettings::Store().

◆ SetGUIDValue()

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

Definition at line 1331 of file atlbase.h.

1332 {
1333 OLECHAR buf[40] = {0};
1334 ::StringFromGUID2(guidValue, buf, 39);
1335#ifdef UNICODE
1336 return SetStringValue(pszValueName, buf);
1337#else
1338 CHAR bufA[40] = {0};
1339 ::WideCharToMultiByte(CP_THREAD_ACP, 0, buf, -1, bufA, 40, NULL, NULL);
1340 return SetStringValue(pszValueName, bufA);
1341#endif
1342 }
LONG SetStringValue(LPCTSTR pszValueName, LPCTSTR pszValue, DWORD dwType=REG_SZ) noexcept
Definition: atlbase.h:1315
#define WideCharToMultiByte
Definition: compat.h:111
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434

◆ SetKeySecurity()

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

Definition at line 1438 of file atlbase.h.

1440 {
1442 LONG ret = ::RegSetKeySecurity(m_hKey, si, psd);
1443 return ret;
1444 }
LONG WINAPI RegSetKeySecurity(HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor)
Definition: reg.c:4759

◆ SetKeyValue()

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

Definition at line 1389 of file atlbase.h.

1391 {
1392 CRegKey key;
1393 LONG lRet = key.Create(m_hKey, lpszKeyName);
1394 if (lRet == ERROR_SUCCESS)
1395 {
1396 lRet = key.SetStringValue(lpszValueName, lpszValue);
1397 }
1398 return lRet;
1399 }

◆ SetMultiStringValue()

LONG ATL::CRegKey::SetMultiStringValue ( LPCTSTR  pszValueName,
LPCTSTR  pszValue 
)
inlinenoexcept

Definition at line 1349 of file atlbase.h.

1350 {
1352 return SetValue(pszValueName, REG_MULTI_SZ, pszValue, dwSize);
1353 }
static ULONG _GetMultiStringSize(LPCTSTR pszz)
Definition: atlbase.h:1463
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by SetStringValue().

◆ SetQWORDValue()

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

Definition at line 1355 of file atlbase.h.

1356 {
1357 ULONG dwSize = sizeof(ULONGLONG);
1358 return SetValue(pszValueName, REG_QWORD, &qwValue, dwSize);
1359 }

◆ SetStringValue()

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

Definition at line 1315 of file atlbase.h.

1316 {
1317 SIZE_T length;
1318 switch (dwType)
1319 {
1320 case REG_SZ:
1321 case REG_EXPAND_SZ:
1322 length = (_tcslen(pszValue) + 1) * sizeof(TCHAR);
1323 return SetValue(pszValueName, dwType, pszValue, length);
1324 case REG_MULTI_SZ:
1325 return SetMultiStringValue(pszValueName, pszValue);
1326 default:
1327 return ERROR_INVALID_DATA;
1328 }
1329 }
LONG SetMultiStringValue(LPCTSTR pszValueName, LPCTSTR pszValue) noexcept
Definition: atlbase.h:1349
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
ULONG_PTR SIZE_T
Definition: typedefs.h:80

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

◆ SetValue() [1/2]

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

Definition at line 1377 of file atlbase.h.

1379 {
1380 CRegKey key;
1381 LONG lRet = key.Create(hKeyParent, lpszKeyName);
1382 if (lRet == ERROR_SUCCESS)
1383 {
1384 lRet = key.SetStringValue(lpszValueName, lpszValue);
1385 }
1386 return lRet;
1387 }

◆ SetValue() [2/2]

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

Definition at line 1304 of file atlbase.h.

1305 {
1307 return ::RegSetValueEx(m_hKey, pszValueName, 0, dwType, (const BYTE*)pValue, nBytes);
1308 }
unsigned char BYTE
Definition: xxhash.c:193

Member Data Documentation

◆ m_hKey


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