|
#ifndef __CeReg_h__
#define __CeReg_h__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "CeDebug.h"
/////////////////////////////////////////////////////////////////////////////
// CeRegKey
class CeRegKey
{
public:
CeRegKey();
~CeRegKey();
// Attributes
public:
operator HKEY() const;
HKEY m_hKey;
// Operations
public:
LONG QueryValue(DWORD& dwValue, LPCTSTR lpszValueName);
LONG SetValue(DWORD dwValue, LPCTSTR lpszValueName);
LONG QueryValue(LPTSTR szValue, LPCTSTR lpszValueName, DWORD* pdwCount);
LONG SetValue(LPCTSTR lpszValue, LPCTSTR lpszValueName = NULL);
LONG QueryValue(BYTE* lpByte, LPCTSTR lpszValueName, DWORD* pdwCount);
LONG SetValue(BYTE* lpByte, DWORD dwCount, LPCTSTR lpszValueName = NULL);
LONG SetKeyValue(LPCTSTR lpszKeyName, LPCTSTR lpszValue, LPCTSTR lpszValueName = NULL);
static LONG WINAPI SetValue(HKEY hKeyParent, LPCTSTR lpszKeyName,
LPCTSTR lpszValue, LPCTSTR lpszValueName = NULL);
LONG Create(HKEY hKeyParent, LPCTSTR lpszKeyName,
LPTSTR lpszClass = REG_NONE, DWORD dwOptions = REG_OPTION_NON_VOLATILE,
REGSAM samDesired = KEY_ALL_ACCESS,
LPSECURITY_ATTRIBUTES lpSecAttr = NULL,
LPDWORD lpdwDisposition = NULL);
LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName,
REGSAM samDesired = KEY_ALL_ACCESS);
LONG Close();
HKEY Detach();
void Attach(HKEY hKey);
LONG DeleteSubKey(LPCTSTR lpszSubKey);
LONG RecurseDeleteKey(LPCTSTR lpszKey);
LONG DeleteValue(LPCTSTR lpszValue);
// Note: this method does NOT try to get more than 128 length key
BOOL SubKey(DWORD dwIndex, LPTSTR szSubKey) const;
};
inline CeRegKey::CeRegKey()
{m_hKey = NULL;}
inline CeRegKey::~CeRegKey()
{Close();}
inline CeRegKey::operator HKEY() const
{return m_hKey;}
inline HKEY CeRegKey::Detach()
{
HKEY hKey = m_hKey;
m_hKey = NULL;
return hKey;
}
inline void CeRegKey::Attach(HKEY hKey)
{
_ASSERTE(m_hKey == NULL);
m_hKey = hKey;
}
inline LONG CeRegKey::DeleteSubKey(LPCTSTR lpszSubKey)
{
_ASSERTE(m_hKey != NULL);
return RegDeleteKey(m_hKey, lpszSubKey);
}
inline LONG CeRegKey::DeleteValue(LPCTSTR lpszValue)
{
_ASSERTE(m_hKey != NULL);
return RegDeleteValue(m_hKey, (LPTSTR)lpszValue);
}
#endif // __CeReg_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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.