1 // Windows/Registry.h 2 3 #ifndef __WINDOWS_REGISTRY_H 4 #define __WINDOWS_REGISTRY_H 5 6 #include "Common/Buffer.h" 7 #include "Common/MyString.h" 8 #include "Common/Types.h" 9 10 #ifndef _WIN32 11 class HKEY_Impl; 12 13 typedef HKEY_Impl * HKEY; 14 15 /* 16 #define HKEY_CLASSES_ROOT ((HKEY) 0x80000000) 17 #define HKEY_LOCAL_MACHINE ((HKEY) 0x80000002) 18 #define HKEY_USERS ((HKEY) 0x80000003) 19 #define HKEY_PERFORMANCE_DATA ((HKEY) 0x80000004) 20 #define HKEY_CURRENT_CONFIG ((HKEY) 0x80000005) 21 #define HKEY_DYN_DATA ((HKEY) 0x80000006) 22 */ 23 #define HKEY_CURRENT_USER ((HKEY) 0x80000001) 24 25 26 typedef DWORD REGSAM; 27 #define ERROR_SUCCESS (0) 28 #define KEY_READ (0x1234) // FIXME 29 #define KEY_ALL_ACCESS (~0) // FIXME 30 31 /* ------------------------------ end registry ------------------------------ */ 32 33 #endif 34 35 namespace NWindows { 36 namespace NRegistry { 37 38 const TCHAR kKeyNameDelimiter = TEXT(CHAR_PATH_SEPARATOR); 39 40 // LONG SetValue(HKEY parentKey, LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value); 41 42 class CKey 43 { 44 HKEY _object; 45 public: CKey()46 CKey(): _object(NULL) {} 47 ~CKey(); 48 HKEY()49 operator HKEY() const { return _object; } 50 51 #if 0 52 HKEY Detach(); 53 void Attach(HKEY key); 54 LONG Create(HKEY parentKey, LPCTSTR keyName, 55 LPTSTR keyClass = REG_NONE, DWORD options = REG_OPTION_NON_VOLATILE, 56 REGSAM accessMask = KEY_ALL_ACCESS, 57 LPSECURITY_ATTRIBUTES securityAttributes = NULL, 58 LPDWORD disposition = NULL); 59 LONG Open(HKEY parentKey, LPCTSTR keyName, 60 REGSAM accessMask = KEY_ALL_ACCESS); 61 #endif // #if 0 62 LONG Create(HKEY parentKey, LPCTSTR keyName); 63 LONG Open(HKEY parentKey, LPCTSTR keyName, 64 REGSAM accessMask = KEY_ALL_ACCESS); 65 66 LONG Close(); 67 68 LONG DeleteSubKey(LPCTSTR subKeyName); 69 LONG RecurseDeleteKey(LPCTSTR subKeyName); 70 71 LONG DeleteValue(LPCTSTR name); 72 #ifndef _UNICODE 73 LONG DeleteValue(LPCWSTR name); 74 #endif 75 76 LONG SetValue(LPCTSTR valueName, UInt32 value); 77 LONG SetValue(LPCTSTR valueName, bool value); 78 LONG SetValue(LPCTSTR valueName, LPCTSTR value); 79 // LONG SetValue(LPCTSTR valueName, const CSysString &value); 80 #ifndef _UNICODE 81 LONG SetValue(LPCWSTR name, LPCWSTR value); 82 // LONG SetValue(LPCWSTR name, const UString &value); 83 #endif 84 85 LONG SetValue(LPCTSTR name, const void *value, UInt32 size); 86 87 LONG SetKeyValue(LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value); 88 89 LONG QueryValue(LPCTSTR name, UInt32 &value); 90 LONG QueryValue(LPCTSTR name, bool &value); 91 LONG QueryValue(LPCTSTR name, LPTSTR value, UInt32 &dataSize); 92 LONG QueryValue(LPCTSTR name, CSysString &value); 93 94 #ifndef _UNICODE 95 LONG QueryValue(LPCWSTR name, LPWSTR value, UInt32 &dataSize); 96 LONG QueryValue(LPCWSTR name, UString &value); 97 #endif 98 99 LONG QueryValue(LPCTSTR name, void *value, UInt32 &dataSize); 100 LONG QueryValue(LPCTSTR name, CByteBuffer &value, UInt32 &dataSize); 101 102 LONG EnumKeys(CSysStringVector &keyNames); 103 }; 104 105 }} 106 107 #endif 108