forked from WinMerge/winmerge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegKey.h
50 lines (43 loc) · 1.39 KB
/
RegKey.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* @file RegKey.h
*
* @brief Declaration of CRegKeyEx C++ wrapper class for reading Windows registry
*/
#pragma once
#include <Windows.h>
#include "UnicodeString.h"
/**
* @brief Class for reading/writing registry.
*/
class CRegKeyEx
{
// Construction
public:
CRegKeyEx();
~CRegKeyEx();
// Operations
public:
void Close();
LONG Open(HKEY hKeyRoot, LPCTSTR pszPath);
LONG OpenWithAccess(HKEY hKeyRoot, LPCTSTR pszPath, REGSAM regsam);
LONG OpenNoCreateWithAccess(HKEY hKeyRoot, LPCTSTR pszPath, REGSAM regsam);
bool QueryRegMachine(LPCTSTR key);
bool QueryRegUser(LPCTSTR key);
LONG WriteDword (LPCTSTR pszKey, DWORD dwVal);
LONG WriteString (LPCTSTR pszKey, LPCTSTR pszVal);
LONG WriteBool (LPCTSTR pszKey, bool bVal);
LONG WriteFloat (LPCTSTR pszKey, float fVal);
DWORD ReadDword (LPCTSTR pszKey, DWORD defval);
float ReadFloat (LPCTSTR pszKey, float defval);
bool ReadBool(LPCTSTR pszKey, bool defval);
LONG ReadLong (LPCTSTR pszKey, LONG defval);
UINT ReadUint (LPCTSTR pszKey, UINT defval);
UINT ReadInt (LPCTSTR pszKey, int defval);
short int ReadShort (LPCTSTR pszKey, short int defval);
BYTE ReadByte (LPCTSTR pszKey, BYTE defval);
String ReadString (LPCTSTR pszKey, LPCTSTR defval);
void ReadChars (LPCTSTR pszKey, LPTSTR pData, DWORD dwLength, LPCTSTR defval);
protected:
HKEY m_hKey; /**< Open key (HKLM, HKCU, etc). */
String m_sPath; /**< Path to actual key to open. */
};