// - add high level functions (RegisterOleServer, ...)
///////////////////////////////////////////////////////////////////////////////
// - add high level functions (RegisterOleServer, ...)
///////////////////////////////////////////////////////////////////////////////
{ HKEY_CURRENT_USER, wxT("HKEY_CURRENT_USER"), wxT("HKCU") },
{ HKEY_LOCAL_MACHINE, wxT("HKEY_LOCAL_MACHINE"), wxT("HKLM") },
{ HKEY_USERS, wxT("HKEY_USERS"), wxT("HKU") }, // short name?
{ HKEY_CURRENT_USER, wxT("HKEY_CURRENT_USER"), wxT("HKCU") },
{ HKEY_LOCAL_MACHINE, wxT("HKEY_LOCAL_MACHINE"), wxT("HKLM") },
{ HKEY_USERS, wxT("HKEY_USERS"), wxT("HKU") }, // short name?
{ HKEY_PERFORMANCE_DATA, wxT("HKEY_PERFORMANCE_DATA"), wxT("HKPD") },
{ HKEY_PERFORMANCE_DATA, wxT("HKEY_PERFORMANCE_DATA"), wxT("HKPD") },
{ HKEY_CURRENT_CONFIG, wxT("HKEY_CURRENT_CONFIG"), wxT("HKCC") },
{ HKEY_CURRENT_CONFIG, wxT("HKEY_CURRENT_CONFIG"), wxT("HKCC") },
{ HKEY_DYN_DATA, wxT("HKEY_DYN_DATA"), wxT("HKDD") }, // short name?
#endif //GNUWIN32
#endif //WINVER >= 4.0
{ HKEY_DYN_DATA, wxT("HKEY_DYN_DATA"), wxT("HKDD") }, // short name?
#endif //GNUWIN32
#endif //WINVER >= 4.0
// useful for Windows programmers: makes somewhat more clear all these zeroes
// being passed to Windows APIs
// useful for Windows programmers: makes somewhat more clear all these zeroes
// being passed to Windows APIs
- HKEY tmpKey;
- m_dwLastError = RegOpenKey((HKEY) m_hRootKey, m_strKey, &tmpKey);
- if ( m_dwLastError != ERROR_SUCCESS ) {
- wxLogSysError(m_dwLastError, _("Can't open registry key '%s'"),
- GetName().c_str());
- return FALSE;
- }
- else
- {
}
// creates key, failing if it exists and !bOkIfExists
bool wxRegKey::Create(bool bOkIfExists)
{
// check for existence only if asked (i.e. order is important!)
}
// creates key, failing if it exists and !bOkIfExists
bool wxRegKey::Create(bool bOkIfExists)
{
// check for existence only if asked (i.e. order is important!)
if ( m_dwLastError != ERROR_SUCCESS ) {
wxLogSysError(m_dwLastError, _("Can't create registry key '%s'"),
GetName().c_str());
if ( m_dwLastError != ERROR_SUCCESS ) {
wxLogSysError(m_dwLastError, _("Can't create registry key '%s'"),
GetName().c_str());
if ( (dwType == REG_EXPAND_SZ) && !raw )
{
DWORD dwExpSize = ::ExpandEnvironmentStrings(strValue, NULL, 0);
if ( (dwType == REG_EXPAND_SZ) && !raw )
{
DWORD dwExpSize = ::ExpandEnvironmentStrings(strValue, NULL, 0);
m_dwLastError = RegEnumKey((HKEY) m_hKey, lIndex++, szKeyName, WXSIZEOF(szKeyName));
m_dwLastError = RegEnumKey((HKEY) m_hKey, lIndex++, szKeyName, WXSIZEOF(szKeyName));
- // don't close this key itself for the case of empty szKey!
- if ( wxIsEmpty(szKey) )
- return TRUE;
+ // don't close this key itself for the case of empty szKey!
+ if ( wxIsEmpty(szKey) )
+ return TRUE;
+
+ HKEY hkeyDummy;
+ if ( ::RegOpenKeyEx
+ (
+ (HKEY)hRootKey,
+ szKey,
+ RESERVED,
+ KEY_ALL_ACCESS,
+ &hkeyDummy
+ ) == ERROR_SUCCESS )
+ {
+ ::RegCloseKey(hkeyDummy);
+
+ return TRUE;
+ }