00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 class Registry : public SystemCode {
00012 _PROTECTED_:
00013 #ifdef DF_LNX
00014 String path;
00015 #else
00016 uint32 keyhand;
00017 #endif
00018 uint32 kidx;
00019 uint32 vidx;
00020 public:
00021 BOOL Valid;
00022
00023 ~Registry() {if (Valid) Close();}
00024
00025
00026 Registry();
00027
00028
00029 BOOL Open(uint32 key, char *subkey, int access);
00030 BOOL Open(Registry &key, char *subkey, int access);
00031
00032
00033 BOOL Close();
00034
00035
00036 BOOL SetValue(char *valuename, int _type, PTR data, int datasiz);
00037 BOOL SetValue(char *valuename, char *str);
00038
00039
00040 BOOL CreateValue(char *valuename, int _type, PTR data, int datasiz);
00041 BOOL CreateValue(char *valuename, char *str);
00042
00043
00044 BOOL GetValue(char *valuename, PTR data, int &datasiz);
00045
00046
00047 BOOL GetValue(char *valuename, String &s);
00048
00049
00050 BOOL GetValueType(char *valuename, int &_type);
00051
00052
00053 BOOL GetValueSize(char *valuename, int &_size);
00054
00055
00056 BOOL DeleteKey(char *subkey);
00057
00058
00059 BOOL DeleteValue(char *valuename);
00060
00061
00062 BOOL FindFirstKey (String &_name);
00063 BOOL FindNextKey (String &_name);
00064 BOOL FindFirstValue(String &_name, int &_type);
00065 BOOL FindNextValue (String &_name, int &_type);
00066
00067
00068
00069
00070 static BOOL DeleteKey(uint32 key, char *subkey);
00071 static BOOL DeleteValue(uint32 key, char *subkey, char *valuename);
00072
00073
00074 static BOOL DeleteKeyEx(uint32 key, char *subkey);
00075
00076
00077 static BOOL GetValue(uint32 key, char *subkey, char *value, String &s);
00078 static BOOL SetValue(uint32 key, char *subkey, char *value, String &s);
00079
00080 static BOOL CreateKey(uint32 key, char *subkey);
00081 };
00082
00083 class RegistryEnumerator : public SystemCode, public Enumerator {
00084 _PROTECTED_:
00085 Registry reg;
00086 BOOL keys, first;
00087 public:
00088
00089 BOOL First(char *);
00090 BOOL Next();
00091 BOOL Close();
00092 BOOL IsFolder();
00093 void GetRootPath(String &s);
00094 };
00095
00096
00097 #define REG_STR 1 //reg_sz
00098 #define REG_SZ REG_STR
00099 #define REG_EXPAND_STR 2
00100 #define REG_EXPAND_SZ REG_EXPAND_STR
00101 #define REG_BIN 3 //reg_binary
00102 #define REG_BINARY REG_BIN
00103 #define REG_DWORD 4 //reg_dword
00104 #define REG_UINT32 4
00105
00106 #define HKEY_CLASSES_ROOT ( 0x80000000 )
00107 #define HKEY_CURRENT_USER ( 0x80000001 )
00108 #define HKEY_LOCAL_MACHINE ( 0x80000002 )
00109 #define HKEY_USERS ( 0x80000003 )
00110 #define HKEY_PERFORMANCE_DATA ( 0x80000004 )
00111 #define HKEY_CURRENT_CONFIG ( 0x80000005 )
00112 #define HKEY_DYN_DATA ( 0x80000006 )
00113