ReactOS  0.4.13-dev-563-g0561610
CRegistryKey Class Reference

#include <RegistryKey.h>

Inheritance diagram for CRegistryKey:
Collaboration diagram for CRegistryKey:

Public Member Functions

STDMETHODIMP QueryInterface (REFIID InterfaceId, PVOID *Interface)
 
 STDMETHODIMP_ (ULONG) AddRef()
 
 STDMETHODIMP_ (ULONG) Release()
 
 CRegistryKey (IUnknown *OuterUnknown, HANDLE hKey, BOOL CanDelete)
 
virtual ~CRegistryKey ()
 
 CRegistryKey ()
 
HRESULT InitRoot (const TCHAR *pszMachineName=NULL)
 
HRESULT Init (HKEY hKey, const TCHAR *pszPath, const TCHAR *pszKeyName, REGSAM CurrentAccess)
 
HRESULT Uninit ()
 
virtual ~CRegistryKey ()
 
const TCHARGetKeyName ()
 
BOOL IsRoot ()
 
LONG OpenSubkey (REGSAM samDesired, const TCHAR *pszSubkeyName, HKEY &rhKey)
 
LONG OpenSubkey (REGSAM samDesired, const TCHAR *pszSubkeyName, CRegistryKey &rKey)
 
LONG GetSubkeyNameMaxLength (DWORD &rdwMaxSubkeyNameLength)
 
void InitSubkeyEnumeration (TCHAR *pchSubkeyNameBuffer, DWORD dwBufferSize)
 
LONG GetNextSubkeyName (DWORD *pdwActualSize=NULL)
 
LONG GetSubkeyCount (DWORD &rdwSubkeyCount)
 
LONG GetMaxValueNameLength (DWORD &rdwMaxValueNameBufferSize)
 
LONG GetMaxValueDataSize (DWORD &rdwMaxValueDataBufferSize)
 
void InitValueEnumeration (TCHAR *pszValueNameBuffer, DWORD dwValueNameBufferSize, BYTE *pbValueDataBuffer, DWORD dwValueDataBufferSize, DWORD *pdwType)
 
LONG GetNextValue (DWORD *pdwNameActualSize=NULL, DWORD *pdwDataActualSize=NULL)
 
LONG GetValueCount (DWORD &rdwValueCount)
 
LONG GetDefaultValue (DWORD *pdwType, BYTE *pbValueDataBuffer, DWORD dwValueDataBufferSize, DWORD *pdwValueDataActualSize)
 
DWORD GetValue (TCHAR *pchValueName, DWORD *pdwType, LPBYTE lpValueDataBuffer, DWORD *pdwValueDataSize)
 
LONG CreateSubkey (REGSAM samDesired, const TCHAR *pszKeyName, HKEY &rhKey, BOOL *pblnOpened=NULL, BOOL blnVolatile=FALSE)
 
LONG GetLastWriteTime (SYSTEMTIME &st)
 
const TCHARGetLastWriteTime ()
 
LONG DeleteValue (const TCHAR *pszValueName)
 
LONG DeleteSubkey (const TCHAR *pszPatternSubkeyName)
 
LONG SetValue (LPCTSTR pszValueName, DWORD dwType, BYTE *lpData, DWORD dwDataSize)
 
TCHARGetSubKeyNameByIndex (DWORD dwIndex)
 
LONG GetSecurityDescriptor (SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, LPDWORD lpcbSecurityDescriptor)
 
LONG GetSecurityDescriptorLength (DWORD *pdwSecurityDescriptor)
 
BOOL IsPredefined ()
 
 operator HKEY ()
 

Static Public Member Functions

static BOOL IsHive (HKEY hKey)
 
static const TCHARGetValueTypeName (DWORD dwType)
 

Public Attributes

 IMP_IRegistryKey
 

Protected Attributes

HANDLE m_hKey
 
BOOL m_Deleted
 
BOOL m_CanDelete
 
LONG m_Ref
 

Private Attributes

DWORD m_dwCurrentSubKeyIndex
 
TCHARm_pchSubkeyNameBuffer
 
DWORD m_dwSubkeyNameBufferSize
 
DWORD m_dwCurrentValueIndex
 
TCHARm_pszValueNameBuffer
 
DWORD m_dwValueNameBufferSize
 
BYTEm_pbValueDataBuffer
 
DWORD m_dwValueDataBufferSize
 
DWORDm_pdwType
 
HKEY m_hKey
 
TCHARm_pszKeyName
 
TCHARm_pszMachineName
 
REGSAM m_CurrentAccess
 

Detailed Description

Definition at line 17 of file registry.cpp.

Constructor & Destructor Documentation

◆ CRegistryKey() [1/2]

CRegistryKey::CRegistryKey ( IUnknown OuterUnknown,
HANDLE  hKey,
BOOL  CanDelete 
)
inline

Definition at line 40 of file registry.cpp.

40 : m_hKey(hKey), m_Deleted(FALSE), m_CanDelete(CanDelete), m_Ref(0){}
BOOL m_Deleted
Definition: registry.cpp:46
HANDLE m_hKey
Definition: registry.cpp:45
BOOL m_CanDelete
Definition: registry.cpp:47

◆ ~CRegistryKey() [1/2]

CRegistryKey::~CRegistryKey ( )
virtual

Definition at line 51 of file registry.cpp.

52 {
53  if (!m_Deleted)
54  {
55  // close key only when has not been deleted yet
56  ZwClose(m_hKey);
57  }
58 }
BOOL m_Deleted
Definition: registry.cpp:46
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
HANDLE m_hKey
Definition: registry.cpp:45

◆ CRegistryKey() [2/2]

CRegistryKey::CRegistryKey ( )

Definition at line 44 of file RegistryKey.cpp.

45 {
48  m_CurrentAccess = 0;
49  m_hKey = NULL;
50 }
TCHAR * m_pszMachineName
Definition: RegistryKey.h:254
smooth NULL
Definition: ftsmooth.c:416
TCHAR * m_pszKeyName
Definition: RegistryKey.h:253
HANDLE m_hKey
Definition: registry.cpp:45
REGSAM m_CurrentAccess
Definition: RegistryKey.h:255

◆ ~CRegistryKey() [2/2]

virtual CRegistryKey::~CRegistryKey ( )
virtual

Member Function Documentation

◆ CreateSubkey()

LONG CRegistryKey::CreateSubkey ( REGSAM  samDesired,
const TCHAR pszKeyName,
HKEY rhKey,
BOOL pblnOpened = NULL,
BOOL  blnVolatile = FALSE 
)

Definition at line 501 of file RegistryKey.cpp.

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 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_OPENED_EXISTING_KEY
Definition: nt_native.h:1085
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
HANDLE m_hKey
Definition: registry.cpp:45
unsigned long DWORD
Definition: ntddk_ex.h:95
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
#define RegCreateKeyEx
Definition: winreg.h:501

Referenced by CRegistryTree::NewKey().

◆ DeleteSubkey()

LONG CRegistryKey::DeleteSubkey ( const TCHAR pszPatternSubkeyName)

Definition at line 562 of file RegistryKey.cpp.

563 {
564  return RegDeleteKey(m_hKey,pszSubkeyName);
565 }
HANDLE m_hKey
Definition: registry.cpp:45
#define RegDeleteKey
Definition: winreg.h:502

Referenced by CRegistryTree::DeleteSubkeys().

◆ DeleteValue()

LONG CRegistryKey::DeleteValue ( const TCHAR pszValueName)

Definition at line 572 of file RegistryKey.cpp.

573 {
574  return RegDeleteValue(m_hKey,pszValueName);
575 }
#define RegDeleteValue
Definition: winreg.h:508
HANDLE m_hKey
Definition: registry.cpp:45

◆ GetDefaultValue()

LONG CRegistryKey::GetDefaultValue ( DWORD pdwType,
BYTE pbValueDataBuffer,
DWORD  dwValueDataBufferSize,
DWORD pdwValueDataActualSize 
)

Definition at line 450 of file RegistryKey.cpp.

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 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
HANDLE m_hKey
Definition: registry.cpp:45
unsigned long DWORD
Definition: ntddk_ex.h:95

◆ GetKeyName()

const TCHAR * CRegistryKey::GetKeyName ( )

Definition at line 156 of file RegistryKey.cpp.

157 {
159 }
TCHAR * m_pszMachineName
Definition: RegistryKey.h:254
TCHAR * m_pszKeyName
Definition: RegistryKey.h:253
#define _T(x)
Definition: vfdio.h:22

Referenced by CRegistryTree::DeleteSubkeys(), CRegistryTree::GetCurrentPath(), CRegistryTree::GetKey(), and OpenSubkey().

◆ GetLastWriteTime() [1/2]

LONG CRegistryKey::GetLastWriteTime ( SYSTEMTIME st)

Definition at line 526 of file RegistryKey.cpp.

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 }
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:211
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:178
HANDLE m_hKey
Definition: registry.cpp:45
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

◆ GetLastWriteTime() [2/2]

const TCHAR * CRegistryKey::GetLastWriteTime ( )

Definition at line 540 of file RegistryKey.cpp.

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 }
#define ERROR_SUCCESS
Definition: deptool.c:10
const TCHAR * GetLastWriteTime()
WORD wMonth
Definition: winbase.h:871
WORD wYear
Definition: winbase.h:870
WORD wMinute
Definition: winbase.h:875
Definition: bufpool.h:45
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
WORD wSecond
Definition: winbase.h:876
#define _stprintf
Definition: utility.h:124
WORD wDay
Definition: winbase.h:873
WORD wHour
Definition: winbase.h:874
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ GetMaxValueDataSize()

LONG CRegistryKey::GetMaxValueDataSize ( DWORD rdwMaxValueDataBufferSize)

Definition at line 380 of file RegistryKey.cpp.

381 {
382  return RegQueryInfoKeyW(m_hKey,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,&rdwMaxValueDataBuferSize,NULL,NULL);
383 }
smooth NULL
Definition: ftsmooth.c:416
HANDLE m_hKey
Definition: registry.cpp:45
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

◆ GetMaxValueNameLength()

LONG CRegistryKey::GetMaxValueNameLength ( DWORD rdwMaxValueNameBufferSize)

Definition at line 385 of file RegistryKey.cpp.

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 }
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
HANDLE m_hKey
Definition: registry.cpp:45
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

◆ GetNextSubkeyName()

LONG CRegistryKey::GetNextSubkeyName ( DWORD pdwActualSize = NULL)

Definition at line 333 of file RegistryKey.cpp.

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 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
_TCHAR * _tcsncpy(_TCHAR *dst, const _TCHAR *src, size_t n)
Definition: tcsncpy.h:9
DWORD m_dwSubkeyNameBufferSize
Definition: RegistryKey.h:243
DWORD m_dwCurrentSubKeyIndex
Definition: RegistryKey.h:239
long LONG
Definition: pedump.c:60
TCHAR * m_pszMachineName
Definition: RegistryKey.h:254
smooth NULL
Definition: ftsmooth.c:416
HANDLE m_hKey
Definition: registry.cpp:45
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RegEnumKeyEx
Definition: winreg.h:510
static const TCHAR * g_ppszHiveNames[]
Definition: RegistryKey.cpp:29
TCHAR * m_pchSubkeyNameBuffer
Definition: RegistryKey.h:242

Referenced by CRegistryTree::DeleteSubkeys(), and CRegistryTree::InternalGetSubkey().

◆ GetNextValue()

LONG CRegistryKey::GetNextValue ( DWORD pdwNameActualSize = NULL,
DWORD pdwDataActualSize = NULL 
)

Definition at line 416 of file RegistryKey.cpp.

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 }
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
long LONG
Definition: pedump.c:60
BYTE * m_pbValueDataBuffer
Definition: RegistryKey.h:248
smooth NULL
Definition: ftsmooth.c:416
DWORD m_dwCurrentValueIndex
Definition: RegistryKey.h:245
HANDLE m_hKey
Definition: registry.cpp:45
DWORD m_dwValueDataBufferSize
Definition: RegistryKey.h:249
unsigned long DWORD
Definition: ntddk_ex.h:95
TCHAR * m_pszValueNameBuffer
Definition: RegistryKey.h:246
DWORD m_dwValueNameBufferSize
Definition: RegistryKey.h:247
DWORD * m_pdwType
Definition: RegistryKey.h:250
LONG RegEnumValue(HKEY Key, ULONG Index, PWCHAR ValueName, ULONG *NameSize, ULONG *Type, PUCHAR Data, ULONG *DataSize)

◆ GetSecurityDescriptor()

LONG CRegistryKey::GetSecurityDescriptor ( SECURITY_INFORMATION  SecurityInformation,
PSECURITY_DESCRIPTOR  pSecurityDescriptor,
LPDWORD  lpcbSecurityDescriptor 
)

Definition at line 557 of file RegistryKey.cpp.

558 {
559  return RegGetKeySecurity(m_hKey,SecurityInformation,pSecurityDescriptor,lpcbSecurityDescriptor);
560 }
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION SecurityInformation
Definition: fltkernel.h:1339
HANDLE m_hKey
Definition: registry.cpp:45
LONG WINAPI RegGetKeySecurity(HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, LPDWORD lpcbSecurityDescriptor)
Definition: reg.c:3010

◆ GetSecurityDescriptorLength()

LONG CRegistryKey::GetSecurityDescriptorLength ( DWORD pdwSecurityDescriptor)

Definition at line 551 of file RegistryKey.cpp.

552 {
554  NULL,NULL,pdwSecurityDescriptor,NULL);
555 }
smooth NULL
Definition: ftsmooth.c:416
HANDLE m_hKey
Definition: registry.cpp:45
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

◆ GetSubkeyCount()

LONG CRegistryKey::GetSubkeyCount ( DWORD rdwSubkeyCount)

Definition at line 375 of file RegistryKey.cpp.

376 {
377  return RegQueryInfoKeyW(m_hKey,NULL,NULL,NULL,&rdwSubkeyCount,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
378 }
smooth NULL
Definition: ftsmooth.c:416
HANDLE m_hKey
Definition: registry.cpp:45
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

◆ GetSubKeyNameByIndex()

TCHAR* CRegistryKey::GetSubKeyNameByIndex ( DWORD  dwIndex)

◆ GetSubkeyNameMaxLength()

LONG CRegistryKey::GetSubkeyNameMaxLength ( DWORD rdwMaxSubkeyNameLength)

Definition at line 300 of file RegistryKey.cpp.

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 }
#define RegQueryInfoKey
Definition: winreg.h:521
#define ERROR_SUCCESS
Definition: deptool.c:10
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 LONG
Definition: pedump.c:60
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
r l[0]
Definition: byte_order.h:167
HANDLE m_hKey
Definition: registry.cpp:45
static const TCHAR * g_ppszHiveNames[]
Definition: RegistryKey.cpp:29

Referenced by CRegistryTree::DeleteSubkeys(), and CRegistryTree::InternalGetSubkey().

◆ GetValue()

DWORD CRegistryKey::GetValue ( TCHAR pchValueName,
DWORD pdwType,
LPBYTE  lpValueDataBuffer,
DWORD pdwValueDataSize 
)

Definition at line 496 of file RegistryKey.cpp.

497 {
498  return RegQueryValueEx(m_hKey,pchValueName,NULL,pdwType,lpValueDataBuffer,pdwValueDataSize);
499 }
#define RegQueryValueEx
Definition: winreg.h:524
smooth NULL
Definition: ftsmooth.c:416
HANDLE m_hKey
Definition: registry.cpp:45

◆ GetValueCount()

LONG CRegistryKey::GetValueCount ( DWORD rdwValueCount)

Definition at line 442 of file RegistryKey.cpp.

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 }
smooth NULL
Definition: ftsmooth.c:416
HANDLE m_hKey
Definition: registry.cpp:45
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

◆ GetValueTypeName()

const TCHAR * CRegistryKey::GetValueTypeName ( DWORD  dwType)
static

Definition at line 465 of file RegistryKey.cpp.

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 }
#define REG_BINARY
Definition: nt_native.h:1496
#define REG_RESOURCE_REQUIREMENTS_LIST
Definition: nt_native.h:1504
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define REG_RESOURCE_LIST
Definition: nt_native.h:1502
#define REG_FULL_RESOURCE_DESCRIPTOR
Definition: nt_native.h:1503
#define REG_LINK
Definition: nt_native.h:1500
#define _T(x)
Definition: vfdio.h:22
#define REG_DWORD_LITTLE_ENDIAN
Definition: nt_native.h:1498
#define REG_DWORD_BIG_ENDIAN
Definition: nt_native.h:1499
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define REG_NONE
Definition: nt_native.h:1492
#define REG_SZ
Definition: layer.c:22

Referenced by CShellCommandDir::Execute(), and CShellCommandValue::Execute().

◆ Init()

HRESULT CRegistryKey::Init ( HKEY  hKey,
const TCHAR pszPath,
const TCHAR pszKeyName,
REGSAM  CurrentAccess 
)

Definition at line 91 of file RegistryKey.cpp.

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 }
HRESULT hr
Definition: shlfolder.c:183
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT Uninit()
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
TCHAR * m_pszKeyName
Definition: RegistryKey.h:253
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
HANDLE m_hKey
Definition: registry.cpp:45
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
REGSAM m_CurrentAccess
Definition: RegistryKey.h:255
#define _stprintf
Definition: utility.h:124
#define S_OK
Definition: intsafe.h:59

Referenced by CRegistryTree::InternalGetSubkey(), and OpenSubkey().

◆ InitRoot()

HRESULT CRegistryKey::InitRoot ( const TCHAR pszMachineName = NULL)

Definition at line 52 of file RegistryKey.cpp.

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 }
HRESULT hr
Definition: shlfolder.c:183
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
TCHAR * m_pszMachineName
Definition: RegistryKey.h:254
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT Uninit()
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
TCHAR * m_pszKeyName
Definition: RegistryKey.h:253
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
HANDLE m_hKey
Definition: registry.cpp:45
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
REGSAM m_CurrentAccess
Definition: RegistryKey.h:255
#define S_OK
Definition: intsafe.h:59

Referenced by CRegistryTree::CRegistryTree(), CRegistryTree::GetKey(), and CRegistryTree::SetMachineName().

◆ InitSubkeyEnumeration()

void CRegistryKey::InitSubkeyEnumeration ( TCHAR pchSubkeyNameBuffer,
DWORD  dwBufferSize 
)

Definition at line 326 of file RegistryKey.cpp.

327 {
328  m_pchSubkeyNameBuffer = pszSubkeyNameBuffer;
329  m_dwSubkeyNameBufferSize = dwBufferSize;
331 }
DWORD m_dwSubkeyNameBufferSize
Definition: RegistryKey.h:243
DWORD m_dwCurrentSubKeyIndex
Definition: RegistryKey.h:239
TCHAR * m_pchSubkeyNameBuffer
Definition: RegistryKey.h:242

Referenced by CRegistryTree::DeleteSubkeys(), and CRegistryTree::InternalGetSubkey().

◆ InitValueEnumeration()

void CRegistryKey::InitValueEnumeration ( TCHAR pszValueNameBuffer,
DWORD  dwValueNameBufferSize,
BYTE pbValueDataBuffer,
DWORD  dwValueDataBufferSize,
DWORD pdwType 
)

Definition at line 398 of file RegistryKey.cpp.

403 {
404  m_pszValueNameBuffer = pszValueNameBuffer;
405  m_dwValueNameBufferSize = dwValueNameBufferSize;
406  m_pbValueDataBuffer = pbValueDataBuffer;
407  m_dwValueDataBufferSize = dwValueDataBufferSize;
408  m_pdwType = pdwType;
409 
411 }
BYTE * m_pbValueDataBuffer
Definition: RegistryKey.h:248
DWORD m_dwCurrentValueIndex
Definition: RegistryKey.h:245
DWORD m_dwValueDataBufferSize
Definition: RegistryKey.h:249
TCHAR * m_pszValueNameBuffer
Definition: RegistryKey.h:246
DWORD m_dwValueNameBufferSize
Definition: RegistryKey.h:247
DWORD * m_pdwType
Definition: RegistryKey.h:250

◆ IsHive()

BOOL CRegistryKey::IsHive ( HKEY  hKey)
static

Definition at line 140 of file RegistryKey.cpp.

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 }
#define HKEY_USERS
Definition: winreg.h:13
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_DYN_DATA
Definition: winreg.h:16
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define HKEY_PERFORMANCE_DATA
Definition: winreg.h:14
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by Uninit().

◆ IsPredefined()

BOOL CRegistryKey::IsPredefined ( )

◆ IsRoot()

◆ OpenSubkey() [1/2]

LONG CRegistryKey::OpenSubkey ( REGSAM  samDesired,
const TCHAR pszSubkeyName,
HKEY rhKey 
)

Definition at line 166 of file RegistryKey.cpp.

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 }
#define HKEY_USERS
Definition: winreg.h:13
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INTERNAL_ERROR
Definition: winerror.h:840
#define _tcsicmp
Definition: xmlstorage.h:205
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_DYN_DATA
Definition: winreg.h:16
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define pch(ap)
Definition: match.c:418
long LONG
Definition: pedump.c:60
TCHAR * m_pszMachineName
Definition: RegistryKey.h:254
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
HANDLE m_hKey
Definition: registry.cpp:45
#define RegConnectRegistry
Definition: winreg.h:495
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define RegOpenKeyEx
Definition: winreg.h:520
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define HKEY_PERFORMANCE_DATA
Definition: winreg.h:14
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CRegistryTree::DeleteSubkeys(), CRegistryTree::InternalGetSubkey(), and OpenSubkey().

◆ OpenSubkey() [2/2]

LONG CRegistryKey::OpenSubkey ( REGSAM  samDesired,
const TCHAR pszSubkeyName,
CRegistryKey rKey 
)

Definition at line 266 of file RegistryKey.cpp.

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 }
HRESULT Init(HKEY hKey, const TCHAR *pszPath, const TCHAR *pszKeyName, REGSAM CurrentAccess)
Definition: RegistryKey.cpp:91
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define ERROR_INTERNAL_ERROR
Definition: winerror.h:840
const TCHAR * GetKeyName()
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
LONG OpenSubkey(REGSAM samDesired, const TCHAR *pszSubkeyName, HKEY &rhKey)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
char TCHAR
Definition: xmlstorage.h:189
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_TCHAR * _tcscat(_TCHAR *s, const _TCHAR *append)
Definition: tcscat.h:8
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

◆ operator HKEY()

Definition at line 239 of file RegistryKey.h.

239 {return m_hKey;};
HANDLE m_hKey
Definition: registry.cpp:45

◆ QueryInterface()

NTSTATUS NTAPI CRegistryKey::QueryInterface ( REFIID  InterfaceId,
PVOID Interface 
)

Definition at line 63 of file registry.cpp.

66 {
68 
69  DPRINT("CRegistryKey::QueryInterface entered\n");
70  if (IsEqualGUIDAligned(refiid, IID_IRegistryKey) ||
72  {
73  *Output = PVOID(PREGISTRYKEY(this));
74  PUNKNOWN(*Output)->AddRef();
75  return STATUS_SUCCESS;
76  }
77 
79  {
80  DPRINT1("CRegistryKey::QueryInterface no interface!!! iface %S\n", GuidString.Buffer);
82  }
83 
84  return STATUS_UNSUCCESSFUL;
85 }
static PWSTR GuidString
Definition: apphelp.c:91
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
void DPRINT(...)
Definition: polytest.cpp:61
void * PVOID
Definition: retypes.h:9
IRegistryKey * PREGISTRYKEY
Definition: portcls.h:999
const GUID IID_IUnknown
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
ULONG AddRef()
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Definition: arc.h:85
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:2777

Referenced by PcNewRegistryKey().

◆ SetValue()

LONG CRegistryKey::SetValue ( LPCTSTR  pszValueName,
DWORD  dwType,
BYTE lpData,
DWORD  dwDataSize 
)

Definition at line 567 of file RegistryKey.cpp.

568 {
569  return RegSetValueEx(m_hKey,pszValueName,0,dwType,lpData,dwDataSize);
570 }
HANDLE m_hKey
Definition: registry.cpp:45
#define RegSetValueEx
Definition: winreg.h:533

◆ STDMETHODIMP_() [1/2]

CRegistryKey::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 22 of file registry.cpp.

23  {
25  return m_Ref;
26  }
#define InterlockedIncrement
Definition: armddk.h:53

◆ STDMETHODIMP_() [2/2]

CRegistryKey::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 27 of file registry.cpp.

28  {
30 
31  if (!m_Ref)
32  {
33  delete this;
34  return 0;
35  }
36  return m_Ref;
37  }
#define InterlockedDecrement
Definition: armddk.h:52

◆ Uninit()

HRESULT CRegistryKey::Uninit ( )

Definition at line 117 of file RegistryKey.cpp.

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 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL IsHive(HKEY hKey)
#define E_FAIL
Definition: ddrawi.h:102
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
TCHAR * m_pszMachineName
Definition: RegistryKey.h:254
smooth NULL
Definition: ftsmooth.c:416
TCHAR * m_pszKeyName
Definition: RegistryKey.h:253
HANDLE m_hKey
Definition: registry.cpp:45
#define S_OK
Definition: intsafe.h:59

Referenced by Init(), and InitRoot().

Member Data Documentation

◆ IMP_IRegistryKey

CRegistryKey::IMP_IRegistryKey

Definition at line 39 of file registry.cpp.

◆ m_CanDelete

BOOL CRegistryKey::m_CanDelete
protected

Definition at line 47 of file registry.cpp.

◆ m_CurrentAccess

REGSAM CRegistryKey::m_CurrentAccess
private

Definition at line 255 of file RegistryKey.h.

Referenced by CRegistryKey(), Init(), and InitRoot().

◆ m_Deleted

BOOL CRegistryKey::m_Deleted
protected

Definition at line 46 of file registry.cpp.

Referenced by ~CRegistryKey().

◆ m_dwCurrentSubKeyIndex

DWORD CRegistryKey::m_dwCurrentSubKeyIndex
private

Definition at line 239 of file RegistryKey.h.

Referenced by GetNextSubkeyName(), and InitSubkeyEnumeration().

◆ m_dwCurrentValueIndex

DWORD CRegistryKey::m_dwCurrentValueIndex
private

Definition at line 245 of file RegistryKey.h.

Referenced by GetNextValue(), and InitValueEnumeration().

◆ m_dwSubkeyNameBufferSize

DWORD CRegistryKey::m_dwSubkeyNameBufferSize
private

Definition at line 243 of file RegistryKey.h.

Referenced by GetNextSubkeyName(), and InitSubkeyEnumeration().

◆ m_dwValueDataBufferSize

DWORD CRegistryKey::m_dwValueDataBufferSize
private

Definition at line 249 of file RegistryKey.h.

Referenced by GetNextValue(), and InitValueEnumeration().

◆ m_dwValueNameBufferSize

DWORD CRegistryKey::m_dwValueNameBufferSize
private

Definition at line 247 of file RegistryKey.h.

Referenced by GetNextValue(), and InitValueEnumeration().

◆ m_hKey [1/2]

◆ m_hKey [2/2]

HKEY CRegistryKey::m_hKey
private

Definition at line 252 of file RegistryKey.h.

◆ m_pbValueDataBuffer

BYTE* CRegistryKey::m_pbValueDataBuffer
private

Definition at line 248 of file RegistryKey.h.

Referenced by GetNextValue(), and InitValueEnumeration().

◆ m_pchSubkeyNameBuffer

TCHAR* CRegistryKey::m_pchSubkeyNameBuffer
private

Definition at line 242 of file RegistryKey.h.

Referenced by GetNextSubkeyName(), and InitSubkeyEnumeration().

◆ m_pdwType

DWORD* CRegistryKey::m_pdwType
private

Definition at line 250 of file RegistryKey.h.

Referenced by GetNextValue(), and InitValueEnumeration().

◆ m_pszKeyName

TCHAR* CRegistryKey::m_pszKeyName
private

Definition at line 253 of file RegistryKey.h.

Referenced by CRegistryKey(), GetKeyName(), Init(), InitRoot(), and Uninit().

◆ m_pszMachineName

TCHAR* CRegistryKey::m_pszMachineName
private

Definition at line 254 of file RegistryKey.h.

Referenced by CRegistryKey(), GetKeyName(), GetNextSubkeyName(), InitRoot(), OpenSubkey(), and Uninit().

◆ m_pszValueNameBuffer

TCHAR* CRegistryKey::m_pszValueNameBuffer
private

Definition at line 246 of file RegistryKey.h.

Referenced by GetNextValue(), and InitValueEnumeration().

◆ m_Ref

LONG CRegistryKey::m_Ref
protected

Definition at line 48 of file registry.cpp.

Referenced by STDMETHODIMP_().


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