|
// Camel - CPU Identifying Tool
// Copyright (C) 2002, Iain Chesworth
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef _REGISTRY_H
#define _REGISTRY_H
// Include the Windows header files.
#include <windows.h>
class CRegistry {
public:
CRegistry();
~CRegistry();
int m_nLastError;
inline bool PathIsValid() { return (lstrlen (m_strCurrentPath) > 0); }
inline LPSTR GetCurrentPath() { return m_strCurrentPath; }
inline HKEY GetRootKey() { return m_hRootKey; }
bool ClearKey();
bool SetRootKey(HKEY hRootKey);
bool CreateKey(LPSTR strKey);
bool DeleteKey(LPSTR strKey);
bool DeleteValue(LPSTR strName);
int GetDataSize(LPSTR strValueName);
DWORD GetDataType(LPSTR strValueName);
int GetSubKeyCount();
int GetValueCount();
bool KeyExists(LPSTR strKey, HKEY hRootKey = NULL);
bool SetKey(LPSTR strKey, bool bCanCreate);
bool ValueExists(LPSTR strName);
void RenameValue(LPSTR strOldName, LPSTR strNewName);
// data reading functions
double ReadFloat(LPSTR strName, double fDefault);
LPSTR ReadString(LPSTR strName, LPSTR strDefault);
int ReadInt(LPSTR strName, int nDefault);
bool ReadBool(LPSTR strName, bool bDefault);
COLORREF ReadColor(LPSTR strName, COLORREF rgbDefault);
bool ReadFont(LPSTR strName, HFONT* pFont);
bool ReadPoint(LPSTR strName, POINT* pPoint);
bool ReadSize(LPSTR strName, SIZE* pSize);
bool ReadRect(LPSTR strName, RECT* pRect);
DWORD ReadDword(LPSTR strName, DWORD dwDefault);
// data writing functions
bool WriteBool(LPSTR strName, bool bValue);
bool WriteString(LPSTR strName, LPSTR strValue);
bool WriteFloat(LPSTR strName, double fValue);
bool WriteInt(LPSTR strName, int nValue);
bool WriteColor(LPSTR strName, COLORREF rgbValue);
bool WriteFont(LPSTR strName, HFONT* pFont);
bool WritePoint(LPSTR strName, POINT* pPoint);
bool WriteSize(LPSTR strName, SIZE* pSize);
bool WriteRect(LPSTR strName, RECT* pRect);
bool WriteDword(LPSTR strName, DWORD dwValue);
// CRegistry properties
protected:
HKEY m_hRootKey;
bool m_bLazyWrite;
LPSTR m_strCurrentPath;
};
#endif // _REGISTRY_H
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Iain Chesworth graduated from Heriot-Watt University in June of 2002 in Computer Science and Physics. He now works as a C++ programmer and plays with code in his spare time. He is also a keen cyclist and swimmer.