1. registry files corresponding to the recent registry.h changes
2. badly famous wxRegConfig::DeleteAll() bug corrected git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8801e78f99
commit
90186e524e
@ -160,7 +160,21 @@ public:
|
||||
|
||||
// access to values and subkeys
|
||||
// get value type
|
||||
ValueType GetValueType(const char *szValue);
|
||||
ValueType GetValueType(const char *szValue) const;
|
||||
// returns TRUE if the value contains a number (else it's some string)
|
||||
bool IsNumericValue(const char *szValue) const
|
||||
{
|
||||
ValueType type = GetValueType(szValue);
|
||||
switch ( type ) {
|
||||
case Type_Dword:
|
||||
case Type_Dword_little_endian:
|
||||
case Type_Dword_big_endian:
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// assignment operators set the default value of the key
|
||||
wxRegKey& operator=(const wxString& strValue)
|
||||
|
@ -202,18 +202,16 @@ void MyFrame::OnAbout(wxCommandEvent&)
|
||||
|
||||
void MyFrame::OnDelete(wxCommandEvent&)
|
||||
{
|
||||
// VZ: it seems that DeleteAll() wreaks havoc on NT. Disabled until I
|
||||
// investigate it further, do _not_ compile this code in meanwhile!
|
||||
// JACS: wxRegConfig::DeleteAll is disabled, so it's safe to call DeleteAll,
|
||||
// it just won't do anything useful on Win95/NT.
|
||||
if ( wxConfigBase::Get()->DeleteAll() ) {
|
||||
wxLogMessage("Config file/registry key successfully deleted.");
|
||||
wxLogMessage("Config file/registry key successfully deleted.");
|
||||
|
||||
delete wxConfigBase::Set((wxConfigBase *) NULL);
|
||||
wxConfigBase::DontCreateOnDemand();
|
||||
}
|
||||
else
|
||||
wxLogError("Deleting config file/registry key failed.");
|
||||
delete wxConfigBase::Set((wxConfigBase *) NULL);
|
||||
wxConfigBase::DontCreateOnDemand();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError("Deleting config file/registry key failed.");
|
||||
}
|
||||
}
|
||||
|
||||
MyFrame::~MyFrame()
|
||||
|
@ -528,16 +528,15 @@ bool wxRegConfig::DeleteAll()
|
||||
{
|
||||
m_keyLocal.Close();
|
||||
m_keyGlobal.Close();
|
||||
#if 1
|
||||
wxFAIL_MSG("wxRegConfig::DeleteAll will wipe out your entire registry, so please do not use until it's fixed!");
|
||||
return FALSE;
|
||||
#else
|
||||
|
||||
bool bOk = m_keyLocalRoot.DeleteSelf();
|
||||
if ( bOk )
|
||||
|
||||
// make sure that we opened m_keyGlobalRoot and so it has a reasonable name:
|
||||
// otherwise we will delete HKEY_CLASSES_ROOT recursively
|
||||
if ( bOk && m_keyGlobalRoot.IsOpened() )
|
||||
bOk = m_keyGlobalRoot.DeleteSelf();
|
||||
|
||||
return bOk;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -427,6 +427,18 @@ bool wxRegKey::DeleteSelf()
|
||||
}
|
||||
}
|
||||
|
||||
// prevent a buggy program from erasing one of the root registry keys or an
|
||||
// immediate subkey (i.e. one which doesn't have '\\' inside) of any other
|
||||
// key except HKCR (HKCR has some "deleteable" subkeys)
|
||||
if ( m_strKey.IsEmpty() || (m_hRootKey != HKCR &&
|
||||
m_strKey.Find(REG_SEPARATOR) == wxNOT_FOUND) ) {
|
||||
wxLogError(_("Registry key '%s' is needed for normal system operation,\n"
|
||||
"deleting it will leave your system in unusable state:\n"
|
||||
"operation aborted."), GetFullName(this));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// we can't delete keys while enumerating because it confuses GetNextKey, so
|
||||
// we first save the key names and then delete them all
|
||||
wxArrayString astrSubkeys;
|
||||
|
Loading…
Reference in New Issue
Block a user