serious bug in KeyExists() fixed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7367 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-05-08 22:49:40 +00:00
parent fb5ac85a06
commit 8dbbdfd06f

View File

@@ -709,8 +709,11 @@ bool wxRegKey::HasValue(const wxChar *szValue) const
if ( !CONST_CAST Open() ) if ( !CONST_CAST Open() )
return FALSE; return FALSE;
return RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, LONG dwRet = ::RegQueryValueEx((HKEY) m_hKey,
NULL, NULL, NULL) == ERROR_SUCCESS; WXSTRINGCAST szValue,
RESERVED,
NULL, NULL, NULL);
return dwRet == ERROR_SUCCESS;
#else // WIN16 #else // WIN16
// only unnamed value exists // only unnamed value exists
return IsEmpty(szValue); return IsEmpty(szValue);
@@ -1014,8 +1017,13 @@ bool wxRegKey::IsNumericValue(const wxChar *szValue) const
// ============================================================================ // ============================================================================
// implementation of global private functions // implementation of global private functions
// ============================================================================ // ============================================================================
bool KeyExists(WXHKEY hRootKey, const wxChar *szKey) bool KeyExists(WXHKEY hRootKey, const wxChar *szKey)
{ {
// don't close this key itself for the case of empty szKey!
if ( wxIsEmpty(szKey) )
return TRUE;
HKEY hkeyDummy; HKEY hkeyDummy;
if ( RegOpenKey( (HKEY) hRootKey, szKey, &hkeyDummy) == ERROR_SUCCESS ) { if ( RegOpenKey( (HKEY) hRootKey, szKey, &hkeyDummy) == ERROR_SUCCESS ) {
RegCloseKey(hkeyDummy); RegCloseKey(hkeyDummy);