- ///\r
- Registry() : m_root(NULL) { setRoot(NULL, _T("")); }\r
- ///\r
- Registry(HKEY i_root, const tstring &i_path)\r
- : m_root(i_root), m_path(i_path) { setRoot(i_root, i_path); }\r
- \r
- /// set registry root and path\r
- void setRoot(HKEY i_root, const tstring &i_path)\r
- {\r
- m_root = i_root;\r
- m_path = i_path;\r
- _TCHAR exePath[GANA_MAX_PATH];\r
- _TCHAR exeDrive[GANA_MAX_PATH];\r
- _TCHAR exeDir[GANA_MAX_PATH];\r
- GetModuleFileName(NULL, exePath, GANA_MAX_PATH);\r
- _tsplitpath_s(exePath, exeDrive, GANA_MAX_PATH, exeDir, GANA_MAX_PATH, NULL, 0, NULL, 0);\r
- m_path = exeDrive;\r
- m_path += exeDir;\r
- m_path += _T("yamy.ini");\r
- }\r
- \r
- /// remvoe\r
- bool remove(const tstring &i_name = _T("")) const\r
- { return remove(m_root, m_path, i_name); }\r
- \r
- /// does exist the key ?\r
- bool doesExist() const { return doesExist(m_root, m_path); }\r
-\r
- /// read DWORD\r
- bool read(const tstring &i_name, int *o_value, int i_defaultValue = 0)\r
- const\r
- { return read(m_root, m_path, i_name, o_value, i_defaultValue); }\r
- /// write DWORD\r
- bool write(const tstring &i_name, int i_value) const\r
- { return write(m_root, m_path, i_name, i_value); }\r
- \r
- /// read tstring\r
- bool read(const tstring &i_name, tstring *o_value, \r
- const tstring &i_defaultValue = _T("")) const\r
- { return read(m_root, m_path, i_name, o_value, i_defaultValue); }\r
- /// write tstring\r
- bool write(const tstring &i_name, const tstring &i_value) const\r
- { return write(m_root, m_path, i_name, i_value); }\r
+ ///\r
+ Registry() : m_root(NULL) {\r
+ setRoot(NULL, _T(""));\r
+ }\r
+ ///\r
+ Registry(HKEY i_root, const tstring &i_path)\r
+ : m_root(i_root), m_path(i_path) {\r
+ setRoot(i_root, i_path);\r
+ }\r
+\r
+ /// set registry root and path\r
+ void setRoot(HKEY i_root, const tstring &i_path) {\r
+ m_root = i_root;\r
+ if (m_root) {\r
+ m_path = i_path;\r
+ } else {\r
+ _TCHAR exePath[GANA_MAX_PATH];\r
+ _TCHAR exeDrive[GANA_MAX_PATH];\r
+ _TCHAR exeDir[GANA_MAX_PATH];\r
+ GetModuleFileName(NULL, exePath, GANA_MAX_PATH);\r
+ _tsplitpath_s(exePath, exeDrive, GANA_MAX_PATH, exeDir, GANA_MAX_PATH, NULL, 0, NULL, 0);\r
+ m_path = exeDrive;\r
+ m_path += exeDir;\r
+ m_path += _T("yamy.ini");\r
+ }\r
+ }\r
+\r
+ /// remvoe\r
+ bool remove(const tstring &i_name = _T("")) const {\r
+ return remove(m_root, m_path, i_name);\r
+ }\r
+\r
+ /// does exist the key ?\r
+ bool doesExist() const {\r
+ return doesExist(m_root, m_path);\r
+ }\r
+\r
+ /// read DWORD\r
+ bool read(const tstring &i_name, int *o_value, int i_defaultValue = 0)\r
+ const {\r
+ return read(m_root, m_path, i_name, o_value, i_defaultValue);\r
+ }\r
+ /// write DWORD\r
+ bool write(const tstring &i_name, int i_value) const {\r
+ return write(m_root, m_path, i_name, i_value);\r
+ }\r
+\r
+ /// read tstring\r
+ bool read(const tstring &i_name, tstring *o_value,\r
+ const tstring &i_defaultValue = _T("")) const {\r
+ return read(m_root, m_path, i_name, o_value, i_defaultValue);\r
+ }\r
+ /// write tstring\r
+ bool write(const tstring &i_name, const tstring &i_value) const {\r
+ return write(m_root, m_path, i_name, i_value);\r
+ }\r