}
}
+ // 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;
return FALSE;
}
-wxRegKey::ValueType wxRegKey::GetValueType(const char *szValue)
+wxRegKey::ValueType wxRegKey::GetValueType(const char *szValue) const
{
#ifdef __WIN32__
- if ( !Open() )
+ if ( ! CONST_CAST Open() )
return Type_None;
DWORD dwType;
return TRUE;
}
+// returns TRUE if the value contains a number (else it's some string)
+bool wxRegKey::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;
+ }
+ }
+
// ============================================================================
// implementation of global private functions
// ============================================================================