X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/89077ebcc8990c84d94a601b221210d3ff7a8ec7..9a6be59a80461adb9e7c4bc7754d6a0b1a8c708d:/src/msw/registry.cpp?ds=sidebyside diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp index 9ab127dd67..5d59c9ee38 100644 --- a/src/msw/registry.cpp +++ b/src/msw/registry.cpp @@ -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;