ReactOS 0.4.15-dev-8236-g99f0937
cicreg.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CicRegKey
 

Functions

EXTERN_C LSTATUS _cicRegKey_Open (CicRegKey &self, HKEY hKey, LPCTSTR lpSubKey, REGSAM samDesired)
 
EXTERN_C LSTATUS _cicRegKey_Create (CicRegKey &self, HKEY hKey, LPCTSTR lpSubKey)
 
EXTERN_C LSTATUS _cicRegKey_RecurseDeleteKey (CicRegKey &self, LPCTSTR lpSubKey)
 
EXTERN_C LSTATUS _cicRegKey_EnumValue (CicRegKey &self, DWORD dwIndex, LPTSTR lpValueName, DWORD cchValueName)
 
EXTERN_C LSTATUS _cicRegKey_QuerySz (CicRegKey &self, LPCTSTR pszValueName, LPTSTR pszValue, DWORD cchValueMax)
 

Function Documentation

◆ _cicRegKey_Create()

EXTERN_C LSTATUS _cicRegKey_Create ( CicRegKey self,
HKEY  hKey,
LPCTSTR  lpSubKey 
)

Definition at line 25 of file cicreg.cpp.

26{
27 HKEY hNewKey;
29 KEY_ALL_ACCESS, NULL, &hNewKey, NULL);
30 if (error != ERROR_SUCCESS)
31 return error;
32
33 self.Close();
34 self.m_hKey = hNewKey;
35 return error;
36}
HKEY m_hKey
Definition: cicreg.h:13
void Close()
Definition: cicreg.h:89
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NULL
Definition: types.h:112
FxAutoRegKey hKey
#define error(str)
Definition: mkdosfs.c:1605
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define RegCreateKeyEx
Definition: winreg.h:501

Referenced by CicRegKey::Create().

◆ _cicRegKey_EnumValue()

EXTERN_C LSTATUS _cicRegKey_EnumValue ( CicRegKey self,
DWORD  dwIndex,
LPTSTR  lpValueName,
DWORD  cchValueName 
)

Definition at line 39 of file cicreg.cpp.

40{
41 DWORD dwSaveLen = cchValueName;
42 LSTATUS error = ::RegEnumValue(self.m_hKey, dwIndex, lpValueName, &cchValueName,
43 NULL, NULL, NULL, NULL);
44 if (dwSaveLen)
45 lpValueName[error == ERROR_SUCCESS ? dwSaveLen - 1 : 0] = 0;
46 return error;
47}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RegEnumValue
Definition: winreg.h:511

Referenced by CicRegKey::EnumValue().

◆ _cicRegKey_Open()

EXTERN_C LSTATUS _cicRegKey_Open ( CicRegKey self,
HKEY  hKey,
LPCTSTR  lpSubKey,
REGSAM  samDesired 
)

Definition at line 12 of file cicreg.cpp.

13{
14 HKEY hNewKey;
15 LSTATUS error = ::RegOpenKeyEx(hKey, lpSubKey, 0, samDesired, &hNewKey);
16 if (error != ERROR_SUCCESS)
17 return error;
18
19 self.Close();
20 self.m_hKey = hNewKey;
21 return error;
22}
#define RegOpenKeyEx
Definition: winreg.h:520

Referenced by CicRegKey::Open().

◆ _cicRegKey_QuerySz()

EXTERN_C LSTATUS _cicRegKey_QuerySz ( CicRegKey self,
LPCTSTR  pszValueName,
LPTSTR  pszValue,
DWORD  cchValueMax 
)

Definition at line 50 of file cicreg.cpp.

51{
52 DWORD cbValueMax = cchValueMax * sizeof(TCHAR);
53 LSTATUS error = ::RegQueryValueEx(self.m_hKey, pszValueName, 0, NULL, (LPBYTE)pszValue, &cbValueMax);
54 if (cchValueMax > 0)
55 pszValue[(error == ERROR_SUCCESS) ? (cchValueMax - 1) : 0] = UNICODE_NULL;
56 return error;
57}
#define UNICODE_NULL
unsigned char * LPBYTE
Definition: typedefs.h:53
#define RegQueryValueEx
Definition: winreg.h:524
char TCHAR
Definition: xmlstorage.h:189

Referenced by CicRegKey::QuerySz().

◆ _cicRegKey_RecurseDeleteKey()

EXTERN_C LSTATUS _cicRegKey_RecurseDeleteKey ( CicRegKey self,
LPCTSTR  lpSubKey 
)

Definition at line 60 of file cicreg.cpp.

61{
62 CicRegKey regKey;
63 LSTATUS error = regKey.Open(self.m_hKey, lpSubKey, KEY_READ | KEY_WRITE);
64 if (error != ERROR_SUCCESS)
65 return error;
66
69 do
70 {
72 error = ::RegEnumKeyEx(regKey, 0, szName, &cchName, NULL, NULL, NULL, NULL);
73 if (error != ERROR_SUCCESS)
74 break;
75
78 } while (error == ERROR_SUCCESS);
79
80 regKey.Close();
81
82 return self.DeleteSubKey(lpSubKey);
83}
LSTATUS Open(HKEY hKey, LPCTSTR lpSubKey, REGSAM samDesired=KEY_READ)
Definition: cicreg.h:51
LSTATUS RecurseDeleteKey(LPCTSTR lpSubKey)
Definition: cicreg.h:113
LSTATUS DeleteSubKey(LPCTSTR lpSubKey)
Definition: cicreg.h:103
#define MAX_PATH
Definition: compat.h:34
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_WRITE
Definition: nt_native.h:1031
static const WCHAR szName[]
Definition: powrprof.c:45
#define _countof(array)
Definition: sndvol32.h:70
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2767
#define RegEnumKeyEx
Definition: winreg.h:510

Referenced by CicRegKey::RecurseDeleteKey().