OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TRegKey Class Reference

Encapsulates a registration key in the Windows Registry. More...

#include <owl/registry.h>

Classes

struct  TInfo
 Data structure returned by QueryInfo. More...
 
class  TSecurityDescriptor
 Encapsulates a SECURITY_DESCRIPTOR. More...
 

Public Types

enum  TCreateOK { CreateOK , NoCreate }
 Enumeration used to specify whether a key should be created (or simply opened). More...
 
typedef HKEY THandle
 

Public Member Functions

 TRegKey (THandle baseKey, tstring keyName, REGSAM samDesired=KEY_ALL_ACCESS, TCreateOK createOK=CreateOK)
 Creates or opens a key given a base key and a subkey name.
 
 TRegKey (THandle baseKey, LPCTSTR keyName, REGSAM samDesired=KEY_ALL_ACCESS, TCreateOK createOK=CreateOK)
 LPCTSTR overload.
 
 TRegKey (const TRegKeyIterator &iter, REGSAM samDesired=KEY_ALL_ACCESS)
 Constructs a key given the current position of a TRegKeyIterator.
 
 TRegKey (THandle aliasKey, bool shouldClose, tstring keyName)
 Constructs a TRegKey object around an existing key.
 
 TRegKey (THandle aliasKey, bool shouldClose=false, LPCTSTR keyName=nullptr)
 LPCTSTR overload.
 
 TRegKey (TRegKey &&) noexcept
 Move constructor; steals the innards of the given object.
 
 TRegKey (const TRegKey &)=delete
 
TRegKeyoperator= (const TRegKey &)=delete
 
 ~TRegKey ()
 Closes the underlying key handle, if owned.
 
 operator THandle () const
 Returns the HANDLE identifying this registry key.
 
auto GetHandle () const -> THandle
 
long DeleteKey (LPCTSTR subKeyName)
 Deletes the specified subkey of this registry key.
 
long DeleteKey (const tstring &subKeyName)
 
long NukeKey (LPCTSTR subKeyName)
 Completely eliminates a child key, including any of its subkeys.
 
long NukeKey (const tstring &subKeyName)
 
long Flush () const
 Writes the attribute of this key in the registry.
 
long Save (LPCTSTR fileName)
 Saves this key and all of its subkeys and values to the specified file.
 
long Save (const tstring &fileName)
 
long LoadKey (LPCTSTR subKeyName, LPCTSTR fileName)
 Creates a subkey under HKEY_USER or HKEY_LOCAL_MACHINE and stores registration information from a specified file into that subkey.
 
long LoadKey (const tstring &subKeyName, const tstring &fileName)
 
long ReplaceKey (LPCTSTR subKeyName, LPCTSTR newFileName, LPCTSTR oldFileName)
 Replaces the file backing this key and all of its subkeys with another file, so that when the system is next started, the key and subkeys will have the values stored in the new file.
 
long ReplaceKey (const tstring &subKeyName, const tstring &newFileName, const tstring &oldFileName)
 
long Restore (LPCTSTR fileName, uint32 options=0)
 Reads the registry information in a specified file and copies it over this key.
 
long Restore (const tstring &fileName, uint32 options=0)
 
long UnLoadKey (LPCTSTR subKeyName)
 Unloads this key and its subkeys from the registry.
 
long UnLoadKey (const tstring &subKeyName)
 
long QueryInfo (TCHAR *class_, DWORD *classSize, DWORD *subkeyCount, DWORD *maxSubkeyNameSize, DWORD *maxSubkeyClassSize, DWORD *valueCount, DWORD *maxValueNameSize, DWORD *maxValueDataSize, DWORD *securityDescriptorSize, PFILETIME lastWriteTime) const
 Retrieves information about this registry key.
 
auto QueryInfo () const -> TInfo
 Functional-style overload.
 
LPCTSTR GetName () const
 Returns a string identifying this key.
 
auto HasSubkey (const tstring &keyName) const -> bool
 Returns true if this key has a subkey with the given name.
 
auto GetSubkey (const tstring &keyName, REGSAM samDesired=KEY_READ) const -> std::optional< TRegKey >
 Returns the subkey with the given name, if it exists.
 
uint32 GetSubkeyCount () const
 Returns the number of subkeys attached to this key.
 
auto HasValue (const tstring &valueName) const -> bool
 Return true if this key has a value with the given name.
 
auto GetValue (const tstring &valueName) const -> std::optional< TRegValue >
 Returns the value with the given name, if it exists within this key.
 
uint32 GetValueCount () const
 Returns the number of values attached to this key.
 
template<typename T >
auto GetValueOrDefault (const tstring &valueName, T defaultValue) const
 Returns the value of the given name, if it exists, or the given default value, otherwise.
 
long EnumKey (int index, TCHAR *subKeyName, int subKeyNameSize) const
 Enumerates the subkeys of this registry key.
 
long SetValue (LPCTSTR valName, uint32 type, const uint8 *data, uint32 dataSize) const
 Associates a value with this key.
 
long SetValue (const tstring &valName, uint32 type, const uint8 *data, uint32 dataSize) const
 
long SetValue (LPCTSTR valName, uint32 data) const
 Associates a 4-byte value with this key.
 
long SetValue (const tstring &valName, uint32 data) const
 
long SetValue (LPCTSTR valName, const tstring &value) const
 Associates a string value with this key.
 
long SetValue (const tstring &valName, const tstring &value) const
 
long QueryValue (LPCTSTR valName, uint32 *type, uint8 *data, uint32 *dataSize) const
 Retrieves the value associated with the unnamed value for this key in the registry.
 
long QueryValue (const tstring &valName, uint32 *type, uint8 *data, uint32 *dataSize) const
 
long DeleteValue (LPCTSTR valName) const
 Removes a named value from this registry key.
 
long DeleteValue (const tstring &valName) const
 
long EnumValue (int index, TCHAR *valueName, uint32 &valueNameSize, uint32 *type=nullptr, uint8 *data=nullptr, uint32 *dataSize=nullptr) const
 Enumerates the values associated with this key.
 
Security attributes
auto GetSecurity (SECURITY_INFORMATION infoRequested, PSECURITY_DESCRIPTOR secDesc, DWORD *secDescSize) const -> long
 Retrieves a copy of the security descriptor protecting this registry key.
 
auto GetSecurity (SECURITY_INFORMATION infoRequested) const -> TSecurityDescriptor
 Retrieves a copy of the security descriptor protecting this registry key.
 
auto SetSecurity (SECURITY_INFORMATION infoToSet, PSECURITY_DESCRIPTOR secDesc) const -> long
 Sets the security descriptor of this key.
 
void SetSecurity (SECURITY_INFORMATION infoToSet, const TSecurityDescriptor &s) const
 Sets the security descriptor of this key.
 

Static Public Member Functions

Accessors to system predefined registry keys
static auto GetClassesRoot () -> TRegKey &
 Special predefined root key used by shell and OLE applications (HKEY_CLASSES_ROOT).
 
static auto GetClassesRootClsid () -> TRegKey &
 Commonly used subkey by shell and OLE applications (HKEY_CLASSES_ROOT\CLSID).
 
static auto GetCurrentConfig () -> TRegKey &
 Special predefined root key containing information about the current hardware profile of the local computer system (HKEY_CURRENT_CONFIG).
 
static auto GetCurrentUser () -> TRegKey &
 Special predefined root key defining the preferences of the current user (HKEY_CURRENT_USER).
 
static auto GetLocalMachine () -> TRegKey &
 Special predefined root key defining the physical state of the computer (HKEY_LOCAL_MACHINE).
 
static auto GetPerformanceData () -> TRegKey &
 Special predefined root key used to obtain performance data (HKEY_PERFORMANCE_DATA).
 
static auto GetUsers () -> TRegKey &
 Special predefined root key defining the default user configuration (HKEY_USERS).
 

Protected Attributes

THandle Key
 This Key's Handle.
 
tstring Name
 This Key's Name.
 
DWORD SubkeyCount
 Number of subkeys.
 
DWORD ValueCount
 Number of value entries.
 
bool ShouldClose
 Should this key be closed on destruction.
 

Detailed Description

Encapsulates a registration key in the Windows Registry.

Definition at line 114 of file registry.h.

Member Typedef Documentation

◆ THandle

Definition at line 117 of file registry.h.

Member Enumeration Documentation

◆ TCreateOK

Enumeration used to specify whether a key should be created (or simply opened).

Enumerator
CreateOK 

Create key if it does not exist.

NoCreate 

Don't create, simply open.

Definition at line 122 of file registry.h.

Constructor & Destructor Documentation

◆ TRegKey() [1/7]

owl::TRegKey::TRegKey ( THandle baseKey,
tstring keyName,
REGSAM samDesired = KEY_ALL_ACCESS,
TCreateOK createOK = CreateOK )

Creates or opens a key given a base key and a subkey name.

The user can specify the desired access rights to the key and provide an ok-to-create or open-only indicator. To check whether a subkey exists before creating a TRegKey, you can call TRegKey::HasSubkey on the base key.

Returns
Throws TXRegistry on failure.
Note
Passing an empty string for the key name is allowed but not very useful. It will just give you a new handle to the base key. In most cases, you should use the aliasing constructor instead; TRegKey::TRegKey(THandle aliasKey, bool shouldClose, tstring keyName).

Definition at line 128 of file registry.cpp.

References __except, __try, _T, CHECK, CreateOK, GetExceptionCode, Key, Name, QueryInfo(), SubkeyCount, and ValueCount.

◆ TRegKey() [2/7]

owl::TRegKey::TRegKey ( THandle baseKey,
LPCTSTR keyName,
REGSAM samDesired = KEY_ALL_ACCESS,
TCreateOK createOK = CreateOK )

LPCTSTR overload.

Forwards to TRegKey::TRegKey(THandle baseKey, tstring keyName, REGSAM, TCreateOK).

Note
If you pass nullptr for the key name, it will be translated to an empty string.

Definition at line 173 of file registry.cpp.

References CHECK, and Key.

◆ TRegKey() [3/7]

owl::TRegKey::TRegKey ( const TRegKeyIterator & iter,
REGSAM samDesired = KEY_ALL_ACCESS )
explicit

Constructs a key given the current position of a TRegKeyIterator.

Returns
Throws TXRegistry on failure.

Definition at line 183 of file registry.cpp.

References __except, __try, _MAX_PATH, _T, CHECK, COUNTOF, GetExceptionCode, Key, Name, QueryInfo(), SubkeyCount, and ValueCount.

◆ TRegKey() [4/7]

owl::TRegKey::TRegKey ( THandle aliasKey,
bool shouldClose,
tstring keyName )

Constructs a TRegKey object around an existing key.

Commonly used for wrapping the preexisting pseudo-keys, such as HKEY_CURRENT_USER. If true is passed for parameter shouldClose, then the object takes ownership of the handle, and the handle will be closed when the object is destructed.

Returns
Throws TXRegistry on failure.
See also
The preexisting pseudo-keys can be accessed by the static member functions TRegKey::GetClassesRoot, TRegKey::GetClassesRootClsid, TRegKey::GetCurrentConfig, TRegKey::GetCurrentUser, TRegKey::GetLocalMachine, TRegKey::GetPerformanceData and TRegKey::GetUsers.

Definition at line 231 of file registry.cpp.

References __except, __try, _T, CHECK, GetExceptionCode, Key, Name, QueryInfo(), SubkeyCount, and ValueCount.

◆ TRegKey() [5/7]

owl::TRegKey::TRegKey ( THandle aliasKey,
bool shouldClose = false,
LPCTSTR keyName = nullptr )
explicit

LPCTSTR overload.

Forwards to TRegKey::TRegKey(THandle, bool shouldClose, tstring keyName).

Note
If you pass nullptr for the key name, it will be translated to an empty string.

Definition at line 264 of file registry.cpp.

References CHECK, and Key.

◆ TRegKey() [6/7]

owl::TRegKey::TRegKey ( TRegKey && v)
noexcept

Move constructor; steals the innards of the given object.

Definition at line 273 of file registry.cpp.

◆ TRegKey() [7/7]

owl::TRegKey::TRegKey ( const TRegKey & )
delete

◆ ~TRegKey()

owl::TRegKey::~TRegKey ( )

Closes the underlying key handle, if owned.

Definition at line 288 of file registry.cpp.

References _T, Key, ShouldClose, and WARN.

Member Function Documentation

◆ DeleteKey() [1/2]

long owl::TRegKey::DeleteKey ( const tstring & subKeyName)
inline

Definition at line 183 of file registry.h.

◆ DeleteKey() [2/2]

long owl::TRegKey::DeleteKey ( LPCTSTR subKeyName)
inline

Deletes the specified subkey of this registry key.

Definition at line 878 of file registry.h.

References Key.

◆ DeleteValue() [1/2]

long owl::TRegKey::DeleteValue ( const tstring & valName) const
inline

Definition at line 383 of file registry.h.

◆ DeleteValue() [2/2]

long owl::TRegKey::DeleteValue ( LPCTSTR valName) const
inline

Removes a named value from this registry key.

Definition at line 1054 of file registry.h.

References Key.

◆ EnumKey()

long owl::TRegKey::EnumKey ( int index,
TCHAR * subKeyName,
int subKeyNameSize ) const
inline

Enumerates the subkeys of this registry key.

Definition at line 869 of file registry.h.

References Key.

◆ EnumValue()

long owl::TRegKey::EnumValue ( int index,
TCHAR * valueName,
uint32 & valueNameSize,
uint32 * type = nullptr,
uint8 * data = nullptr,
uint32 * dataSize = nullptr ) const
inline

Enumerates the values associated with this key.

Copy the value name and data block associated with the passed index.

Definition at line 1087 of file registry.h.

References Key.

◆ Flush()

long owl::TRegKey::Flush ( ) const
inline

Writes the attribute of this key in the registry.

Definition at line 886 of file registry.h.

References Key.

◆ GetClassesRoot()

auto owl::TRegKey::GetClassesRoot ( ) -> TRegKey&
static

Special predefined root key used by shell and OLE applications (HKEY_CLASSES_ROOT).

Registry entries subordinate to this key define types (or classes) of documents and the properties associated with those types. Shell and COM applications use the information stored under this key.

See also
https://docs.microsoft.com/en-us/windows/win32/sysinfo/hkey-classes-root-key

Definition at line 32 of file registry.cpp.

References _T.

◆ GetClassesRootClsid()

auto owl::TRegKey::GetClassesRootClsid ( ) -> TRegKey&
static

Commonly used subkey by shell and OLE applications (HKEY_CLASSES_ROOT\CLSID).

Definition at line 41 of file registry.cpp.

References _T.

◆ GetCurrentConfig()

auto owl::TRegKey::GetCurrentConfig ( ) -> TRegKey&
static

Special predefined root key containing information about the current hardware profile of the local computer system (HKEY_CURRENT_CONFIG).

The information under this key describes only the differences between the current hardware configuration and the standard configuration. Information about the standard hardware configuration is stored under the Software and System keys of HKEY_LOCAL_MACHINE.

See also
https://technet.microsoft.com/library/286f12b7-265b-4632-a4e1-987d025023e6

Definition at line 55 of file registry.cpp.

References _T.

◆ GetCurrentUser()

auto owl::TRegKey::GetCurrentUser ( ) -> TRegKey&
static

Special predefined root key defining the preferences of the current user (HKEY_CURRENT_USER).

These preferences include the settings of environment variables, data about program groups, colors, printers, network connections, and application preferences. This key makes it easier to establish the current user's settings; the key maps to the current user's branch in HKEY_USERS. Under this key, software vendors store the current user-specific preferences to be used within their applications. Microsoft, for example, creates the HKEY_CURRENT_USER\Software\Microsoft key for its applications to use, with each application creating its own subkey under the Microsoft key.

See also
https://technet.microsoft.com/library/6b6d2dcc-a083-4c49-9000-6f1324b20877

Definition at line 72 of file registry.cpp.

References _T.

◆ GetHandle()

auto owl::TRegKey::GetHandle ( ) const -> THandle
inline

Definition at line 180 of file registry.h.

◆ GetLocalMachine()

auto owl::TRegKey::GetLocalMachine ( ) -> TRegKey&
static

Special predefined root key defining the physical state of the computer (HKEY_LOCAL_MACHINE).

Includes data about the bus type, system memory, and installed hardware and software. It contains subkeys that hold current configuration data, including Plug and Play information (the Enum branch, which includes a complete list of all hardware that has ever been on the system), network logon preferences, network security information, software-related information (such as server names and the location of the server), and other system information.

See also
https://technet.microsoft.com/library/f4704e81-0b33-4ecd-b2e4-e41b50bb758c

Definition at line 87 of file registry.cpp.

References _T.

◆ GetName()

LPCTSTR owl::TRegKey::GetName ( ) const
inline

Returns a string identifying this key.

Definition at line 1008 of file registry.h.

References Name.

◆ GetPerformanceData()

auto owl::TRegKey::GetPerformanceData ( ) -> TRegKey&
static

Special predefined root key used to obtain performance data (HKEY_PERFORMANCE_DATA).

The data is not actually stored in the registry; the registry functions cause the system to collect the data from its source.

Definition at line 98 of file registry.cpp.

References _T.

◆ GetSecurity() [1/2]

auto owl::TRegKey::GetSecurity ( SECURITY_INFORMATION infoRequested) const -> TSecurityDescriptor
inline

Retrieves a copy of the security descriptor protecting this registry key.

Parameters
infoRequestedindicates the requested security information.
Returns
If successful, a TRegKey::TSecurityDescriptor is returned.
Exceptions
TXRegistryis thrown on failure.
See also
RegGetKeySecurity in the Windows API.

Definition at line 911 of file registry.h.

◆ GetSecurity() [2/2]

auto owl::TRegKey::GetSecurity ( SECURITY_INFORMATION infoRequested,
PSECURITY_DESCRIPTOR secDesc,
DWORD * secDescSize ) const -> long
inline

Retrieves a copy of the security descriptor protecting this registry key.

See also
RegGetKeySecurity in the Windows API.

Definition at line 897 of file registry.h.

◆ GetSubkey()

auto owl::TRegKey::GetSubkey ( const tstring & keyName,
REGSAM samDesired = KEY_READ ) const -> std::optional<TRegKey>

Returns the subkey with the given name, if it exists.

If the key does not exist, std::nullopt is returned. If access is denied, or any other error occurs, a TXRegistry exception is thrown. The key name may include a path with subkey names separated by backslash, e.g. "Software\\Program".

Parameters
samDesiredA mask that specifies the desired access rights to the key to be opened. For possible values of this parameter, see the Windows API documentation.
See also
https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regopenkeyexa
https://docs.microsoft.com/en-gb/windows/win32/sysinfo/registry-key-security-and-access-rights

Definition at line 376 of file registry.cpp.

References _T, and PRECONDITION.

◆ GetSubkeyCount()

uint32 owl::TRegKey::GetSubkeyCount ( ) const
inline

Returns the number of subkeys attached to this key.

Definition at line 992 of file registry.h.

References SubkeyCount.

◆ GetUsers()

auto owl::TRegKey::GetUsers ( ) -> TRegKey&
static

Special predefined root key defining the default user configuration (HKEY_USERS).

Registry entries subordinate to this key define the default user configuration for new users on the local computer and the user configuration for the current user.

See also
TRegKey::GetCurrentUser

Definition at line 110 of file registry.cpp.

References _T.

◆ GetValue()

auto owl::TRegKey::GetValue ( const tstring & valueName) const -> std::optional<TRegValue>

Returns the value with the given name, if it exists within this key.

If the value does not exist, std::nullopt is returned. If the given name is empty, the default value is assumed, which always exists. If access is denied, or any other error occurs, a TXRegistry exception is thrown.

Definition at line 402 of file registry.cpp.

References PRECONDITION.

◆ GetValueCount()

uint32 owl::TRegKey::GetValueCount ( ) const
inline

Returns the number of values attached to this key.

Definition at line 1000 of file registry.h.

References ValueCount.

◆ GetValueOrDefault()

template<typename T >
auto owl::TRegKey::GetValueOrDefault ( const tstring & valueName,
T defaultValue ) const
inline

Returns the value of the given name, if it exists, or the given default value, otherwise.

A conversion of the TRegValue to type T is attempted. The provided default value must be convertible to T. The types supported for T are owl::uint32, owl::uint64 and owl::tstring.

Note
T can not be LPCTSTR, because that would return a pointer to a dead object (the TRegValue object looked up is local to the function). Use owl::tstring instead.

Definition at line 336 of file registry.h.

◆ HasSubkey()

auto owl::TRegKey::HasSubkey ( const tstring & keyName) const -> bool

Returns true if this key has a subkey with the given name.

If an error occurs, e.g. access is denied, it is assumed the subkey exists. The key name may include a path with subkey names separated by backslash, e.g. "Software\\Program".

Definition at line 354 of file registry.cpp.

References PRECONDITION.

◆ HasValue()

auto owl::TRegKey::HasValue ( const tstring & valueName) const -> bool

Return true if this key has a value with the given name.

If the given name is empty, the default value is assumed, which always exists. If an error occurs, e.g. access is denied, it is assumed the value exists.

Definition at line 390 of file registry.cpp.

References PRECONDITION.

◆ LoadKey() [1/2]

long owl::TRegKey::LoadKey ( const tstring & subKeyName,
const tstring & fileName )
inline

Definition at line 281 of file registry.h.

◆ LoadKey() [2/2]

long owl::TRegKey::LoadKey ( LPCTSTR subKeyName,
LPCTSTR fileName )
inline

Creates a subkey under HKEY_USER or HKEY_LOCAL_MACHINE and stores registration information from a specified file into that subkey.

This registration information is in the form of a hive. A hive is a discrete body of keys, subkeys, and values that is rooted at the top of the registry hierarchy. A hive is backed by a single file and a .LOG file.

Definition at line 956 of file registry.h.

References Key.

◆ NukeKey() [1/2]

long owl::TRegKey::NukeKey ( const tstring & subKeyName)
inline

Definition at line 187 of file registry.h.

◆ NukeKey() [2/2]

long owl::TRegKey::NukeKey ( LPCTSTR subKeyName)

Completely eliminates a child key, including any of its subkeys.

Definition at line 411 of file registry.cpp.

References DeleteKey(), GetName(), and GetSubkey().

◆ operator THandle()

owl::TRegKey::operator THandle ( ) const
inline

Returns the HANDLE identifying this registry key.

Definition at line 861 of file registry.h.

◆ operator=()

TRegKey & owl::TRegKey::operator= ( const TRegKey & )
delete

◆ QueryInfo() [1/2]

auto owl::TRegKey::QueryInfo ( ) const -> TInfo

Functional-style overload.

Returns
A data structure containing information about the key. If an error occurs, TXRegistry is thrown.

Definition at line 326 of file registry.cpp.

References _T, MAX_PATH, and QueryInfo().

◆ QueryInfo() [2/2]

long owl::TRegKey::QueryInfo ( TCHAR * class_,
DWORD * classSize,
DWORD * subkeyCount,
DWORD * maxSubkeyNameSize,
DWORD * maxSubkeyClassSize,
DWORD * valueCount,
DWORD * maxValueNameSize,
DWORD * maxValueDataSize,
DWORD * securityDescriptorSize,
PFILETIME lastWriteTime ) const

Retrieves information about this registry key.

Wrapper for RegQueryInfoKey in the Windows API.

See also
https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regqueryinfokeya

Definition at line 302 of file registry.cpp.

References Key.

◆ QueryValue() [1/2]

long owl::TRegKey::QueryValue ( const tstring & valName,
uint32 * type,
uint8 * data,
uint32 * dataSize ) const
inline

Definition at line 379 of file registry.h.

◆ QueryValue() [2/2]

long owl::TRegKey::QueryValue ( LPCTSTR valName,
uint32 * type,
uint8 * data,
uint32 * dataSize ) const
inline

Retrieves the value associated with the unnamed value for this key in the registry.

Definition at line 1042 of file registry.h.

References Key.

◆ ReplaceKey() [1/2]

long owl::TRegKey::ReplaceKey ( const tstring & subKeyName,
const tstring & newFileName,
const tstring & oldFileName )
inline

Definition at line 285 of file registry.h.

◆ ReplaceKey() [2/2]

long owl::TRegKey::ReplaceKey ( LPCTSTR subKeyName,
LPCTSTR newFileName,
LPCTSTR oldFileName )
inline

Replaces the file backing this key and all of its subkeys with another file, so that when the system is next started, the key and subkeys will have the values stored in the new file.

Definition at line 966 of file registry.h.

References Key.

◆ Restore() [1/2]

long owl::TRegKey::Restore ( const tstring & fileName,
uint32 options = 0 )
inline

Definition at line 289 of file registry.h.

◆ Restore() [2/2]

long owl::TRegKey::Restore ( LPCTSTR fileName,
uint32 options = 0 )
inline

Reads the registry information in a specified file and copies it over this key.

This registry information may be in the form of a key and multiple levels of subkeys.

Definition at line 976 of file registry.h.

References Key.

◆ Save() [1/2]

long owl::TRegKey::Save ( const tstring & fileName)
inline

Definition at line 277 of file registry.h.

◆ Save() [2/2]

long owl::TRegKey::Save ( LPCTSTR fileName)
inline

Saves this key and all of its subkeys and values to the specified file.

Definition at line 944 of file registry.h.

References Key.

◆ SetSecurity() [1/2]

void owl::TRegKey::SetSecurity ( SECURITY_INFORMATION infoToSet,
const TSecurityDescriptor & s ) const
inline

Sets the security descriptor of this key.

Parameters
infoToSetindicates the security information to set.
Exceptions
TXRegistryis thrown on failure.
See also
RegSetKeySecurity in the Windows API.

Definition at line 935 of file registry.h.

References _T, owl::TRegKey::TSecurityDescriptor::GetData(), and SetSecurity().

◆ SetSecurity() [2/2]

auto owl::TRegKey::SetSecurity ( SECURITY_INFORMATION infoToSet,
PSECURITY_DESCRIPTOR secDesc ) const -> long
inline

Sets the security descriptor of this key.

See also
RegSetKeySecurity in the Windows API.

Definition at line 922 of file registry.h.

◆ SetValue() [1/6]

long owl::TRegKey::SetValue ( const tstring & valName,
const tstring & value ) const
inline

Definition at line 375 of file registry.h.

◆ SetValue() [2/6]

long owl::TRegKey::SetValue ( const tstring & valName,
uint32 data ) const
inline

Definition at line 371 of file registry.h.

◆ SetValue() [3/6]

long owl::TRegKey::SetValue ( const tstring & valName,
uint32 type,
const uint8 * data,
uint32 dataSize ) const
inline

Definition at line 367 of file registry.h.

◆ SetValue() [4/6]

long owl::TRegKey::SetValue ( LPCTSTR valName,
const tstring & value ) const
inline

Associates a string value with this key.

Definition at line 1032 of file registry.h.

References SetValue().

◆ SetValue() [5/6]

long owl::TRegKey::SetValue ( LPCTSTR valName,
uint32 data ) const
inline

Associates a 4-byte value with this key.

Definition at line 1024 of file registry.h.

References SetValue().

◆ SetValue() [6/6]

long owl::TRegKey::SetValue ( LPCTSTR valName,
uint32 type,
const uint8 * data,
uint32 dataSize ) const
inline

Associates a value with this key.

Definition at line 1016 of file registry.h.

References Key.

◆ UnLoadKey() [1/2]

long owl::TRegKey::UnLoadKey ( const tstring & subKeyName)
inline

Definition at line 293 of file registry.h.

◆ UnLoadKey() [2/2]

long owl::TRegKey::UnLoadKey ( LPCTSTR subKeyName)
inline

Unloads this key and its subkeys from the registry.

Definition at line 984 of file registry.h.

References Key.

Member Data Documentation

◆ Key

THandle owl::TRegKey::Key
protected

This Key's Handle.

Definition at line 392 of file registry.h.

◆ Name

tstring owl::TRegKey::Name
protected

This Key's Name.

Definition at line 393 of file registry.h.

◆ ShouldClose

bool owl::TRegKey::ShouldClose
protected

Should this key be closed on destruction.

Definition at line 396 of file registry.h.

◆ SubkeyCount

DWORD owl::TRegKey::SubkeyCount
protected

Number of subkeys.

Definition at line 394 of file registry.h.

◆ ValueCount

DWORD owl::TRegKey::ValueCount
protected

Number of value entries.

Definition at line 395 of file registry.h.


The documentation for this class was generated from the following files: