ReactOS  0.4.13-dev-563-g0561610
RegistryKey.cpp
Go to the documentation of this file.
1 /*
2  * regexpl - Console Registry Explorer
3  *
4  * Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 // RegistryKey.cpp: implementation of the CRegistryKey class.
23 //
25 
26 #include "ph.h"
27 #include "RegistryKey.h"
28 
29 static const TCHAR *g_ppszHiveNames[] =
30 {
31  _T("HKEY_CLASSES_ROOT"),
32  _T("HKEY_CURRENT_USER"),
33  _T("HKEY_LOCAL_MACHINE"),
34  _T("HKEY_USERS"),
35  _T("HKEY_PERFORMANCE_DATA"),
36  _T("HKEY_CURRENT_CONFIG"),
37  _T("HKEY_DYN_DATA")
38 };
39 
41 // Construction/Destruction
43 
45 {
48  m_CurrentAccess = 0;
49  m_hKey = NULL;
50 }
51 
52 HRESULT CRegistryKey::InitRoot(const TCHAR *pszMachineName)
53 {
54  if ((pszMachineName)&&
55  ((_tcslen(pszMachineName) < 3)||
56  (pszMachineName[0] != _T('\\'))||
57  (pszMachineName[1] != _T('\\'))
58  )
59  )
60  {
61  return E_INVALIDARG;
62  }
63 
64  HRESULT hr = Uninit();
65  if (FAILED(hr))
66  return hr;
67 
68  if (pszMachineName)
69  { // copy machine name
70  size_t size = _tcslen(pszMachineName);
71 
72  m_pszMachineName = new (std::nothrow) TCHAR [size+2];
73  if (!m_pszMachineName)
74  return E_OUTOFMEMORY;
75  _tcscpy(m_pszMachineName,pszMachineName);
76  m_pszMachineName[size] = _T('\\');
77  m_pszMachineName[size+1] = 0;
78  }
79  else
80  {
81  m_pszMachineName = NULL; // local registry
82  }
83 
85  m_CurrentAccess = 0;
86  ASSERT(m_hKey == NULL);
87 
88  return S_OK;
89 }
90 
91 HRESULT CRegistryKey::Init(HKEY hKey, const TCHAR *pszPath, const TCHAR *pszKeyName, REGSAM CurrentAccess)
92 {
93  HRESULT hr = Uninit();
94  if (FAILED(hr))
95  return hr;
96 
97  if (!pszKeyName || !hKey)
98  return E_INVALIDARG;
99 
100  // copy key name name
101  size_t size = _tcslen(pszKeyName);
102  if (pszPath)
103  size += _tcslen(pszPath);
104 
105  m_pszKeyName = new (std::nothrow) TCHAR [size+2];
106  if (!m_pszKeyName)
107  return E_OUTOFMEMORY;
108  _stprintf(m_pszKeyName,_T("%s%s\\"),pszPath?pszPath:_T(""),pszKeyName);
109 
110  m_CurrentAccess = CurrentAccess;
111  m_hKey = hKey;
112  ASSERT(m_hKey);
113 
114  return S_OK;
115 }
116 
118 {
119  if (m_pszKeyName)
120  {
121  delete [] m_pszKeyName;
122  m_pszKeyName = NULL;
123  }
124 
125  if (m_pszMachineName)
126  {
127  delete [] m_pszMachineName;
129  }
130 
131  LONG nError = ERROR_SUCCESS;
132  if((m_hKey != NULL)&&(!IsHive(m_hKey)))
133  nError = RegCloseKey(m_hKey);
134 
135  m_hKey = NULL;
136 
137  return (nError == ERROR_SUCCESS)?S_OK:E_FAIL;
138 }
139 
141 {
142  return ((hKey == HKEY_CLASSES_ROOT)||
143  (hKey == HKEY_CURRENT_USER)||
144  (hKey == HKEY_LOCAL_MACHINE)||
145  (hKey == HKEY_USERS)||
146  (hKey == HKEY_PERFORMANCE_DATA)||
147  (hKey == HKEY_CURRENT_CONFIG)||
148  (hKey == HKEY_DYN_DATA));
149 }
150 
152 {
153  Uninit();
154 }
155 
157 {
159 }
160 
162 {
163  return m_hKey == NULL;
164 }
165 
166 LONG CRegistryKey::OpenSubkey(REGSAM samDesired, const TCHAR *pszSubkeyName, HKEY &rhKey)
167 {
168  if (m_hKey == NULL)
169  { // subkey of root key is hive root key.
170  if ((_tcsicmp(pszSubkeyName,_T("HKCR")) == 0)||
171  (_tcsicmp(pszSubkeyName,_T("HKEY_CLASSES_ROOT")) == 0))
172  {
173  rhKey = HKEY_CLASSES_ROOT;
174 
175  if (m_pszMachineName)
176  return ERROR_FILE_NOT_FOUND;
177 
178  return ERROR_SUCCESS;
179  }
180  else if ((_tcsicmp(pszSubkeyName,_T("HKCU")) == 0)||
181  (_tcsicmp(pszSubkeyName,_T("HKEY_CURRENT_USER")) == 0))
182  {
183  rhKey = HKEY_CURRENT_USER;
184 
185  if (m_pszMachineName)
186  return ERROR_FILE_NOT_FOUND;
187 
188  return ERROR_SUCCESS;
189  }
190  else if ((_tcsicmp(pszSubkeyName,_T("HKLM")) == 0)||
191  (_tcsicmp(pszSubkeyName,_T("HKEY_LOCAL_MACHINE")) == 0))
192  {
193  rhKey = HKEY_LOCAL_MACHINE;
194 
195  if (m_pszMachineName)
196  return RegConnectRegistry(m_pszMachineName,rhKey,&rhKey);
197 
198  return ERROR_SUCCESS;
199  }
200  else if ((_tcsicmp(pszSubkeyName,_T("HKU")) == 0)||
201  (_tcsicmp(pszSubkeyName,_T("HKEY_USERS")) == 0))
202  {
203  rhKey = HKEY_USERS;
204 
205  if (m_pszMachineName)
206  return RegConnectRegistry(m_pszMachineName,rhKey,&rhKey);
207 
208  return ERROR_SUCCESS;
209  }
210  else if ((_tcsicmp(pszSubkeyName,_T("HKPD")) == 0)||
211  (_tcsicmp(pszSubkeyName,_T("HKEY_PERFORMANCE_DATA")) == 0))
212  {
213  rhKey = HKEY_PERFORMANCE_DATA;
214 
215  if (m_pszMachineName)
216  return RegConnectRegistry(m_pszMachineName,rhKey,&rhKey);
217 
218  return ERROR_SUCCESS;
219  }
220  else if ((_tcsicmp(pszSubkeyName,_T("HKDD")) == 0)||
221  (_tcsicmp(pszSubkeyName,_T("HKEY_DYN_DATA")) == 0))
222  {
223  rhKey = HKEY_DYN_DATA;
224 
225  if (m_pszMachineName)
226  return RegConnectRegistry(m_pszMachineName,rhKey,&rhKey);
227 
228  return ERROR_SUCCESS;
229  }
230  else if ((_tcsicmp(pszSubkeyName,_T("HKCC")) == 0)||
231  (_tcsicmp(pszSubkeyName,_T("HKEY_CURRENT_CONFIG")) == 0))
232  {
233  rhKey = HKEY_CURRENT_CONFIG;
234 
235  if (m_pszMachineName)
236  {
238  while (*pch)
239  pch++;
240  pch--;
241 
242  ASSERT(*pch == _T('\\'));
243  if (*pch != _T('\\'))
244  return ERROR_INTERNAL_ERROR;
245 
246  *pch = 0;
247 
248  LONG nError = RegConnectRegistry(m_pszMachineName,rhKey,&rhKey);
249 
250  *pch = _T('\\');
251 
252  return nError;
253  }
254 
255  return ERROR_SUCCESS;
256  }
257  else
258  {
259  return ERROR_FILE_NOT_FOUND;
260  }
261  }
262 
263  return RegOpenKeyEx(m_hKey,pszSubkeyName,0,samDesired,&rhKey);
264 }
265 
266 LONG CRegistryKey::OpenSubkey(REGSAM samDesired, const TCHAR *pszSubkeyName, CRegistryKey &rKey)
267 {
268  HKEY hKey;
269  LONG nError = OpenSubkey(samDesired, pszSubkeyName, hKey);
270 
271  if (nError == ERROR_SUCCESS)
272  {
273  const TCHAR *pszKeyName = GetKeyName();
274  size_t size = _tcslen(pszKeyName) + _tcslen(pszSubkeyName) + 1;
275  TCHAR *pszSubkeyFullName = new (std::nothrow) TCHAR [size];
276  if (!pszSubkeyFullName)
277  {
278  nError = RegCloseKey(hKey);
279  ASSERT(nError == ERROR_SUCCESS);
280  return ERROR_OUTOFMEMORY;
281  }
282  _tcscpy(pszSubkeyFullName,pszKeyName);
283  _tcscat(pszSubkeyFullName,pszSubkeyName);
284  HRESULT hr = rKey.Init(hKey,GetKeyName(),pszSubkeyName,samDesired);
285  delete[] pszSubkeyName;
286  if (FAILED(hr))
287  {
288  nError = RegCloseKey(hKey);
289  ASSERT(nError == ERROR_SUCCESS);
290  if (hr == (HRESULT)E_OUTOFMEMORY)
291  return ERROR_OUTOFMEMORY;
292  else
293  return ERROR_INTERNAL_ERROR;
294  }
295  }
296 
297  return nError;
298 }
299 
301 {
302  if (m_hKey == NULL)
303  { // root key
304  rdwMaxSubkeyNameLength = 0;
305  for(int i = 0; i < 7 ; i++)
306  {
307  size_t l = _tcslen(g_ppszHiveNames[i]);
308  if (rdwMaxSubkeyNameLength < l)
309  rdwMaxSubkeyNameLength = l;
310  }
311 
312  rdwMaxSubkeyNameLength++; // terminating null
313 
314  return ERROR_SUCCESS;
315  }
316 
317  LONG nRet;
318 
319  nRet = RegQueryInfoKey(m_hKey,NULL,NULL,NULL,NULL,&rdwMaxSubkeyNameLength,NULL,NULL,NULL,NULL,NULL,NULL);
320 
321  rdwMaxSubkeyNameLength = (nRet == ERROR_SUCCESS)?(rdwMaxSubkeyNameLength+1):0;
322 
323  return nRet;
324 }
325 
326 void CRegistryKey::InitSubkeyEnumeration(TCHAR *pszSubkeyNameBuffer, DWORD dwBufferSize)
327 {
328  m_pchSubkeyNameBuffer = pszSubkeyNameBuffer;
329  m_dwSubkeyNameBufferSize = dwBufferSize;
331 }
332 
334 {
335  LONG nError;
336 
337  if (m_hKey == NULL)
338  {
340  {
343  nError = ERROR_SUCCESS;
344  if (pdwActualSize)
345  *pdwActualSize = strlen(m_pchSubkeyNameBuffer);
346  }
347  else
348  {
349  nError = ERROR_NO_MORE_ITEMS;
350  }
351  }
352  else
353  {
354  DWORD dwActualSize = m_dwSubkeyNameBufferSize;
355  FILETIME ft;
356  nError = RegEnumKeyEx(m_hKey,
359  &dwActualSize,
360  NULL,
361  NULL,
362  NULL,
363  &ft);
364  if (pdwActualSize)
365  *pdwActualSize = dwActualSize;
366  }
367 
369 
370  if (pdwActualSize)
371  *pdwActualSize = strlen(m_pchSubkeyNameBuffer);
372  return nError;
373 }
374 
376 {
377  return RegQueryInfoKeyW(m_hKey,NULL,NULL,NULL,&rdwSubkeyCount,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
378 }
379 
380 LONG CRegistryKey::GetMaxValueDataSize(DWORD& rdwMaxValueDataBuferSize)
381 {
382  return RegQueryInfoKeyW(m_hKey,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,&rdwMaxValueDataBuferSize,NULL,NULL);
383 }
384 
386 {
387  rdwMaxValueNameBuferSize = 0;
388 
389  if (!m_hKey)
390  return 0; // the root key abstraction has only subkeys (hives)
391 
392  LONG nError = RegQueryInfoKeyW(m_hKey,NULL,NULL,NULL,NULL,NULL,NULL,NULL,&rdwMaxValueNameBuferSize,NULL,NULL,NULL);
393 
394  rdwMaxValueNameBuferSize++;
395  return nError;
396 }
397 
398 void CRegistryKey::InitValueEnumeration(TCHAR *pszValueNameBuffer,
399  DWORD dwValueNameBufferSize,
400  BYTE *pbValueDataBuffer,
401  DWORD dwValueDataBufferSize,
402  DWORD *pdwType)
403 {
404  m_pszValueNameBuffer = pszValueNameBuffer;
405  m_dwValueNameBufferSize = dwValueNameBufferSize;
406  m_pbValueDataBuffer = pbValueDataBuffer;
407  m_dwValueDataBufferSize = dwValueDataBufferSize;
408  m_pdwType = pdwType;
409 
411 }
412 
413 
414 // On input dwValueNameSize is size in characters of buffer pointed by pchValueNameBuffer
415 // On output dwValueNameSize contains number of characters stored in buffer
416 LONG CRegistryKey::GetNextValue(DWORD *pdwNameActualSize, DWORD *pdwDataActualSize)
417 {
418  if (!m_hKey)
419  return ERROR_NO_MORE_ITEMS; // the root key abstraction has only subkeys (hives)
420 
421  DWORD dwValueNameBufferSize = m_dwValueNameBufferSize;
422  DWORD dwValueDataBufferSize = m_dwValueDataBufferSize;
423  LONG nError = RegEnumValue(m_hKey,
426  &dwValueNameBufferSize,
427  NULL,
428  m_pdwType,
430  &dwValueDataBufferSize);
431 
432  if (pdwNameActualSize)
433  *pdwNameActualSize = dwValueNameBufferSize;
434 
435  if (pdwDataActualSize)
436  *pdwDataActualSize = dwValueDataBufferSize;
437 
439  return nError;
440 }
441 
443 {
444  if (!m_hKey)
445  return 0; // the root key abstraction has only subkeys (hives)
446 
447  return RegQueryInfoKeyW(m_hKey,NULL,NULL,NULL,NULL,NULL,NULL,&rdwValueCount,NULL,NULL,NULL,NULL);
448 }
449 
451  BYTE *pbValueDataBuffer,
452  DWORD dwValueDataBufferSize,
453  DWORD *pdwValueDataActualSize)
454 {
455  DWORD dwBufferSize = dwValueDataBufferSize;
456 
457  LONG nError = RegQueryValueEx(m_hKey,NULL,NULL,pdwType,pbValueDataBuffer,&dwBufferSize);
458 
459  if (pdwValueDataActualSize && (nError == ERROR_SUCCESS))
460  *pdwValueDataActualSize = dwBufferSize;
461 
462  return nError;
463 }
464 
466 {
467  switch(dwType)
468  {
469  case REG_NONE:
470  return _T("REG_NONE");
471  case REG_SZ:
472  return _T("REG_SZ");
473  case REG_EXPAND_SZ:
474  return _T("REG_EXPAND_SZ");
475  case REG_BINARY:
476  return _T("REG_BINARY");
478  return _T("REG_DWORD_LITTLE_ENDIAN");
480  return _T("REG_DWORD_BIG_ENDIAN");
481  case REG_LINK:
482  return _T("REG_LINK");
483  case REG_MULTI_SZ:
484  return _T("REG_MULTI_SZ");
485  case REG_RESOURCE_LIST:
486  return _T("REG_RESOURCE_LIST");
488  return _T("REG_FULL_RESOURCE_DESCRIPTOR");
490  return _T("REG_RESOURCE_REQUIREMENTS_LIST");
491  default:
492  return _T("Unkown Type");
493  }
494 }
495 
496 DWORD CRegistryKey::GetValue(TCHAR *pchValueName, DWORD *pdwType, LPBYTE lpValueDataBuffer, DWORD *pdwValueDataSize)
497 {
498  return RegQueryValueEx(m_hKey,pchValueName,NULL,pdwType,lpValueDataBuffer,pdwValueDataSize);
499 }
500 
502  const TCHAR *pszSubkeyName,
503  HKEY &rhKey,
504  BOOL *pblnOpened,
505  BOOL blnVolatile)
506 {
507  DWORD dwDisposition;
508 
509  LONG nError = RegCreateKeyEx(
510  m_hKey,
511  pszSubkeyName,
512  0,
513  NULL,
515  samDesired,
516  NULL,
517  &rhKey,
518  &dwDisposition);
519 
520  if ((nError == ERROR_SUCCESS)&&(pblnOpened))
521  *pblnOpened = dwDisposition == REG_OPENED_EXISTING_KEY;
522 
523  return nError;
524 }
525 
527 {
528  FILETIME ftLocal,ft;
530 
531  if (nError == ERROR_SUCCESS)
532  {
533  FileTimeToLocalFileTime(&ft,&ftLocal);
534  FileTimeToSystemTime(&ftLocal,&st);
535  }
536 
537  return nError;
538 }
539 
541 {
542  SYSTEMTIME st;
543  if (GetLastWriteTime(st) != ERROR_SUCCESS)
544  return _T("(Cannot get time last write time)");
545 
546  static TCHAR Buffer[256];
547  _stprintf(Buffer,_T("%d.%d.%d %02d:%02d:%02d"),st.wDay,st.wMonth,st.wYear,st.wHour,st.wMinute,st.wSecond);
548  return Buffer;
549 }
550 
552 {
554  NULL,NULL,pdwSecurityDescriptor,NULL);
555 }
556 
558 {
559  return RegGetKeySecurity(m_hKey,SecurityInformation,pSecurityDescriptor,lpcbSecurityDescriptor);
560 }
561 
562 LONG CRegistryKey::DeleteSubkey(const TCHAR *pszSubkeyName)
563 {
564  return RegDeleteKey(m_hKey,pszSubkeyName);
565 }
566 
567 LONG CRegistryKey::SetValue(LPCTSTR pszValueName, DWORD dwType, BYTE *lpData, DWORD dwDataSize)
568 {
569  return RegSetValueEx(m_hKey,pszValueName,0,dwType,lpData,dwDataSize);
570 }
571 
573 {
574  return RegDeleteValue(m_hKey,pszValueName);
575 }
#define HKEY_USERS
Definition: winreg.h:13
#define RegQueryValueEx
Definition: winreg.h:524
LONG GetNextValue(DWORD *pdwNameActualSize=NULL, DWORD *pdwDataActualSize=NULL)
HRESULT Init(HKEY hKey, const TCHAR *pszPath, const TCHAR *pszKeyName, REGSAM CurrentAccess)
Definition: RegistryKey.cpp:91
LONG DeleteValue(const TCHAR *pszValueName)
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define RegQueryInfoKey
Definition: winreg.h:521
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD GetValue(TCHAR *pchValueName, DWORD *pdwType, LPBYTE lpValueDataBuffer, DWORD *pdwValueDataSize)
HRESULT hr
Definition: shlfolder.c:183
#define ERROR_INTERNAL_ERROR
Definition: winerror.h:840
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
const TCHAR * GetLastWriteTime()
#define _tcsicmp
Definition: xmlstorage.h:205
WORD wMonth
Definition: winbase.h:871
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define REG_BINARY
Definition: nt_native.h:1496
static BOOL IsHive(HKEY hKey)
#define HKEY_CURRENT_USER
Definition: winreg.h:11
_TCHAR * _tcsncpy(_TCHAR *dst, const _TCHAR *src, size_t n)
Definition: tcsncpy.h:9
DWORD m_dwSubkeyNameBufferSize
Definition: RegistryKey.h:243
const TCHAR * GetKeyName()
LONG SetValue(LPCTSTR pszValueName, DWORD dwType, BYTE *lpData, DWORD dwDataSize)
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
LONG GetValueCount(DWORD &rdwValueCount)
void InitValueEnumeration(TCHAR *pszValueNameBuffer, DWORD dwValueNameBufferSize, BYTE *pbValueDataBuffer, DWORD dwValueDataBufferSize, DWORD *pdwType)
#define HKEY_DYN_DATA
Definition: winreg.h:16
#define REG_OPENED_EXISTING_KEY
Definition: nt_native.h:1085
HRESULT InitRoot(const TCHAR *pszMachineName=NULL)
Definition: RegistryKey.cpp:52
LONG GetSubkeyNameMaxLength(DWORD &rdwMaxSubkeyNameLength)
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:211
#define E_FAIL
Definition: ddrawi.h:102
#define REG_RESOURCE_REQUIREMENTS_LIST
Definition: nt_native.h:1504
#define pch(ap)
Definition: match.c:418
LONG GetMaxValueDataSize(DWORD &rdwMaxValueDataBufferSize)
WORD wYear
Definition: winbase.h:870
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
LONG OpenSubkey(REGSAM samDesired, const TCHAR *pszSubkeyName, HKEY &rhKey)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
DWORD m_dwCurrentSubKeyIndex
Definition: RegistryKey.h:239
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
DWORD SECURITY_INFORMATION
Definition: ms-dtyp.idl:311
TCHAR * m_pszMachineName
Definition: RegistryKey.h:254
BYTE * m_pbValueDataBuffer
Definition: RegistryKey.h:248
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT Uninit()
WORD wMinute
Definition: winbase.h:875
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION SecurityInformation
Definition: fltkernel.h:1339
Definition: bufpool.h:45
#define REG_RESOURCE_LIST
Definition: nt_native.h:1502
#define REG_FULL_RESOURCE_DESCRIPTOR
Definition: nt_native.h:1503
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
LONG GetMaxValueNameLength(DWORD &rdwMaxValueNameBufferSize)
TCHAR * m_pszKeyName
Definition: RegistryKey.h:253
DWORD m_dwCurrentValueIndex
Definition: RegistryKey.h:245
r l[0]
Definition: byte_order.h:167
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
char TCHAR
Definition: xmlstorage.h:189
#define RegDeleteValue
Definition: winreg.h:508
#define REG_LINK
Definition: nt_native.h:1500
#define _T(x)
Definition: vfdio.h:22
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:178
HANDLE m_hKey
Definition: registry.cpp:45
GLsizeiptr size
Definition: glext.h:5919
LONG DeleteSubkey(const TCHAR *pszPatternSubkeyName)
LONG WINAPI RegGetKeySecurity(HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, LPDWORD lpcbSecurityDescriptor)
Definition: reg.c:3010
LONG HRESULT
Definition: typedefs.h:77
DWORD m_dwValueDataBufferSize
Definition: RegistryKey.h:249
#define RegConnectRegistry
Definition: winreg.h:495
LONG GetSecurityDescriptor(SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, LPDWORD lpcbSecurityDescriptor)
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3686
WORD wSecond
Definition: winbase.h:876
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
TCHAR * m_pszValueNameBuffer
Definition: RegistryKey.h:246
LONG GetNextSubkeyName(DWORD *pdwActualSize=NULL)
#define REG_DWORD_LITTLE_ENDIAN
Definition: nt_native.h:1498
LONG CreateSubkey(REGSAM samDesired, const TCHAR *pszKeyName, HKEY &rhKey, BOOL *pblnOpened=NULL, BOOL blnVolatile=FALSE)
unsigned char BYTE
Definition: mem.h:68
#define RegEnumKeyEx
Definition: winreg.h:510
virtual ~CRegistryKey()
Definition: registry.cpp:51
#define REG_DWORD_BIG_ENDIAN
Definition: nt_native.h:1499
static const TCHAR * g_ppszHiveNames[]
Definition: RegistryKey.cpp:29
TCHAR * m_pchSubkeyNameBuffer
Definition: RegistryKey.h:242
REGSAM m_CurrentAccess
Definition: RegistryKey.h:255
#define _stprintf
Definition: utility.h:124
DWORD m_dwValueNameBufferSize
Definition: RegistryKey.h:247
WORD wDay
Definition: winbase.h:873
DWORD * m_pdwType
Definition: RegistryKey.h:250
#define S_OK
Definition: intsafe.h:59
#define RegOpenKeyEx
Definition: winreg.h:520
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
WORD wHour
Definition: winbase.h:874
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define RegDeleteKey
Definition: winreg.h:502
void InitSubkeyEnumeration(TCHAR *pchSubkeyNameBuffer, DWORD dwBufferSize)
static const TCHAR * GetValueTypeName(DWORD dwType)
_TCHAR * _tcscat(_TCHAR *s, const _TCHAR *append)
Definition: tcscat.h:8
uint32_t * LPDWORD
Definition: typedefs.h:57
LONG GetDefaultValue(DWORD *pdwType, BYTE *pbValueDataBuffer, DWORD dwValueDataBufferSize, DWORD *pdwValueDataActualSize)
LONG GetSecurityDescriptorLength(DWORD *pdwSecurityDescriptor)
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LONG RegEnumValue(HKEY Key, ULONG Index, PWCHAR ValueName, ULONG *NameSize, ULONG *Type, PUCHAR Data, ULONG *DataSize)
#define HKEY_PERFORMANCE_DATA
Definition: winreg.h:14
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
#define REG_NONE
Definition: nt_native.h:1492
LONG GetSubkeyCount(DWORD &rdwSubkeyCount)
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22