fix constructing wxRegKey from string names (replaces patch 1542052)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41142 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -143,12 +143,10 @@ wxRegKey::StdKey wxRegKey::ExtractKeyName(wxString& strKey)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  wxString strRoot = strKey.BeforeFirst(REG_SEPARATOR);
 | 
					  wxString strRoot = strKey.BeforeFirst(REG_SEPARATOR);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  HKEY hRootKey = 0;
 | 
					 | 
				
			||||||
  size_t ui;
 | 
					  size_t ui;
 | 
				
			||||||
  for ( ui = 0; ui < nStdKeys; ui++ ) {
 | 
					  for ( ui = 0; ui < nStdKeys; ui++ ) {
 | 
				
			||||||
    if ( strRoot.CmpNoCase(aStdKeys[ui].szName) == 0 ||
 | 
					    if ( strRoot.CmpNoCase(aStdKeys[ui].szName) == 0 ||
 | 
				
			||||||
         strRoot.CmpNoCase(aStdKeys[ui].szShortName) == 0 ) {
 | 
					         strRoot.CmpNoCase(aStdKeys[ui].szShortName) == 0 ) {
 | 
				
			||||||
      hRootKey = aStdKeys[ui].hkey;
 | 
					 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -156,7 +154,7 @@ wxRegKey::StdKey wxRegKey::ExtractKeyName(wxString& strKey)
 | 
				
			|||||||
  if ( ui == nStdKeys ) {
 | 
					  if ( ui == nStdKeys ) {
 | 
				
			||||||
    wxFAIL_MSG(wxT("invalid key prefix in wxRegKey::ExtractKeyName."));
 | 
					    wxFAIL_MSG(wxT("invalid key prefix in wxRegKey::ExtractKeyName."));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    hRootKey = HKEY_CLASSES_ROOT;
 | 
					    ui = HKCR;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
    strKey = strKey.After(REG_SEPARATOR);
 | 
					    strKey = strKey.After(REG_SEPARATOR);
 | 
				
			||||||
@@ -164,13 +162,13 @@ wxRegKey::StdKey wxRegKey::ExtractKeyName(wxString& strKey)
 | 
				
			|||||||
      strKey.Truncate(strKey.Len() - 1);
 | 
					      strKey.Truncate(strKey.Len() - 1);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (wxRegKey::StdKey)(int)hRootKey;
 | 
					  return (StdKey)ui;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxRegKey::StdKey wxRegKey::GetStdKeyFromHkey(WXHKEY hkey)
 | 
					wxRegKey::StdKey wxRegKey::GetStdKeyFromHkey(WXHKEY hkey)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  for ( size_t ui = 0; ui < nStdKeys; ui++ ) {
 | 
					  for ( size_t ui = 0; ui < nStdKeys; ui++ ) {
 | 
				
			||||||
    if ( (int) aStdKeys[ui].hkey == (int) hkey )
 | 
					    if ( aStdKeys[ui].hkey == (HKEY)hkey )
 | 
				
			||||||
      return (StdKey)ui;
 | 
					      return (StdKey)ui;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user