📄 registry.h
字号:
#endif //UNDER_CE (WindowsCE)
//@cmember
/* Retrieves a REG_SZ value (32-bit only).*/
virtual BOOL GetStringValue( LPCTSTR lpszValueName,
CString& strReturn );
//@cmember
/* Retrieves a REG_MULTI_SZ value (32-bit only).*/
virtual BOOL GetStringArrayValue( LPCTSTR name_of_value,
CStringArray& return_array );
#else
//@cmember
/* Determines the number of subkeys in the curently open key.*/
virtual BOOL GetSubkeys(LPCTSTR lpszBuffer, UINT& nKeys);
#endif //WIN32
#ifdef WIN32
//@cmember
/* Retrieves a REG_BINARY value (32-bit only).*/
virtual BOOL GetValue( LPCTSTR lpszValueName,
CByteArray& return_array );
//@cmember
/* Retrieves a REG_DWORD value (32-bit only).*/
virtual BOOL GetValue( LPCTSTR lpszValueName,
DWORD& dwReturnValue );
//@cmember
/* Retrieves a REG_MULTI_SZ value (32-bit only).*/
virtual BOOL GetValue( LPCTSTR lpszValueName,
CStringArray& return_array );
//@cmember
/* Retrieves a REG_SZ value (32-bit only).*/
virtual BOOL GetValue( LPCTSTR lpszValueName,
CString& strReturn );
#ifndef UNDER_CE
//@cmember
/* Loads a registry key from a file (32-bit only).*/
virtual BOOL Load( LPCTSTR lpszSubkeyName,
LPCTSTR lpszFileName );
//@cmember
/* Indicates when a registry key has changed (32-bit only).*/
virtual BOOL NotifyChange( const HANDLE hEvent = NULL,
const NotifyChangeFilter changes_to_be_reported = notifyLastSet,
const BOOL bAllSubkeys = changeSpecifiedKeyOnly,
const BOOL bWaitForChange = WAIT_FOR_CHANGE );
#endif //UNDER_CE (WindowsCE)
//@cmember
/* Opens a registry key (32-bit only).*/
virtual BOOL Open( LPCTSTR lpszSubkey,
const CreatePermissions security_access_mask = permissionAllAccess );
#else
//@cmember
/* Opens the specified key (32-bit only).*/
virtual BOOL Open( LPCTSTR lpszSubkey);
#endif //WIN32
#ifdef WIN32
//@cmember
/* Queries for information about the currently opened key (32-bit only).*/
virtual BOOL QueryInfo( void );
//@cmember
/* Retrieves the type and data for a specified value name (32-bit only).*/
virtual BOOL QueryValue( LPCTSTR lpszValueName,
KeyValueTypes& value_type,
LPBYTE lpbBuffer,
DWORD& dwBufferSize);
#else
//@cmember
/* Retrieves the type and data for a specified value name (16-bit only).*/
virtual BOOL QueryValue( LPCTSTR lpSubKey,
SECPBYTE lpbBuffer,
LONG& lBufferSize);
#endif //WIN32
#ifdef WIN32
#ifndef UNDER_CE
//@cmember
/* Encapsulates the RegReplaceKey API (32-bit only).*/
virtual BOOL Replace( LPCTSTR lpszSubkeyName,
LPCTSTR lpszNewFile,
LPCTSTR lpszBackupFile);
//@cmember
/* Encapsulates the RegRestoreKey API (32-bit only).*/
virtual BOOL Restore( LPCTSTR lpszSavedTreeFile,
const DWORD dwVolatilityFlags = NULL );
//@cmember
/* Encapsulates the RegSaveKey API (32-bit only).*/
virtual BOOL Save( LPCTSTR lpszDestFile,
LPSECURITY_ATTRIBUTES pSecurityAttributes = NULL );
#endif //UNDER_CE (WindowsCE)
//@cmember
/* Sets a value for the key name specified as REG_BINARY (32-bit only).*/
virtual BOOL SetBinaryValue( LPCTSTR lpszValueName,
const CByteArray& bytes_to_write );
//@cmember
/* Sets a value for the key name specified as REG_DWORD (32-bit only).*/
virtual BOOL SetDoubleWordValue( LPCTSTR lpszValueName,
DWORD dwValue );
#ifndef UNDER_CE
//@cmember
/* Encapsulates the RegSetKeySecurity API (32-bit only).*/
virtual BOOL SetSecurity( const SECURITY_INFORMATION& SecurityInformation,
const PSECURITY_DESCRIPTOR pSecurityDescriptor );
#endif //UNDER_CE (WindowsCE)
//@cmember
/* Sets a value for the key name specified as REG_SZ (32-bit only).*/
virtual BOOL SetStringValue( LPCTSTR lpszValueName,
const CString& string_value );
//@cmember
/* Sets a value for the key name specified as REG_MULTI_SZ (32-bit only).*/
virtual BOOL SetStringArrayValue( LPCTSTR lpszValueName,
const CStringArray& string_array );
//@cmember
/* Sets a value for the key name specified as REG_BINARY (32-bit only).*/
virtual BOOL SetValue( LPCTSTR lpszValueName,
const CByteArray& bytes_to_write );
//@cmember
/* Sets a value for the key name specified as REG_DWORD (32-bit only).*/
virtual BOOL SetValue( LPCTSTR lpszValueName, DWORD dwValue );
//@cmember
/* Sets a value for the key name specified as REG_MULTI_SZ (32-bit only).*/
virtual BOOL SetValue( LPCTSTR lpszValueName,
const CStringArray& strings_to_write );
//@cmember
/* Sets a value for the key name specified as REG_SZ (32-bit only).*/
virtual BOOL SetValue( LPCTSTR lpszValueName,
const CString& strWrite );
//@cmember
/* Sets a value for the key name specified (32-bit only).*/
virtual BOOL SetValue( LPCTSTR lpszValueName,
const KeyValueTypes type_of_value_to_set,
LPBYTE lpbValueData,
const DWORD dwSize );
#else
//@cmember
/* Sets a value for the key name specified (16-bit only).*/
virtual BOOL SetValue( LPCTSTR lpSubKey,
const CString& strWrite );
#endif //WIN32
#ifdef WIN32
#ifndef UNDER_CE
//@cmember
/* Encapsulates the RegUnLoadKey API.*/
virtual BOOL UnLoad( LPCTSTR lpszSubkey );
#endif //UNDER_CE (WindowsCE)
//
//@cmember
/* Converts an HKEY constant to its string equivalent.*/
static BOOL KeyToStr(HKEY hKey,CString& strKey);
//
//@cmember
/* Converts a string equivalent to an HKEY value.*/
static HKEY StrToKey(const CString& strKey);
#endif
// Normalizes a keyname
static void NormalizeKey(CString& strKey, BOOL bSubkey = FALSE);
// Concatenates a key with a subkey
static CString ConcatenateKeys (LPCTSTR strKey, LPCTSTR strSubkey);
// Implementation
public:
virtual ~Registry();
//@cmember
/* The error code for the last operation.*/
LONG m_lErrorCode;
//@cmember
/* The handle to the currently open registry key.*/
HKEY m_hKey;
//@cmember
/* The handle to the current registry.*/
HKEY m_hRegistry;
#ifdef WIN32
//@cmember
/* The longest subkey name length of last queried key.*/
DWORD m_dwLongestSubkeyNameLength;
//@cmember
/* The longest class name length of last queried key.*/
DWORD m_dwLongestClassNameLength;
//@cmember
/* The longest value name length of last queried key.*/
DWORD m_dwLongestValueNameLength;
//@cmember
/* The longest value data length of last queried key.*/
DWORD m_dwLongestValueDataLength;
//@cmember
/* The longest security descriptor length of last queried key.*/
DWORD m_dwSecurityDescriptorLength;
//@cmember
/* The time the last queried key was written to.*/
FILETIME m_fileTimeLastWrite;
#endif
//@cmember
/* The class name of the currently open key.*/
CString m_strClassName;
//@cmember
/* The computer name for the currently connected registry.*/
CString m_strComputerName;
//@cmember
/* The name of the currently open key.*/
CString m_strKeyName;
//@cmember
/* The name of the currently connected registry.*/
CString m_strRegistryName;
//@cmember
/* The number of subkeys of the last queried key.*/
DWORD m_dwNumberOfSubkeys;
//@cmember
/* The number of values in the last queried key.*/
DWORD m_dwNumberOfValues;
//@cmember
/* The time the last queried key was written to.*/
CTime m_timeLastWrite;
//@cmember
/* Indicates whether the registry is local or on a remote system.*/
BOOL m_bRemote;
//@cmember
/* Incidates whether the registry key should be closed when done. */
BOOL m_bCloseKeyOnDisconnect;
};
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -