///////////////////////////////////////////////////////////////////////////////
-// Name: msw/registry.cpp
+// Name: src/msw/registry.cpp
// Purpose: implementation of registry classes and functions
// Author: Vadim Zeitlin
// Modified by:
// - add high level functions (RegisterOleServer, ...)
///////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "registry.h"
-#endif
-
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/msw/wrapwin.h"
+ #include "wx/string.h"
+ #include "wx/intl.h"
+ #include "wx/log.h"
#endif
-// other wxWidgets headers
-#include "wx/string.h"
-#include "wx/intl.h"
-#include "wx/log.h"
-#include "wx/file.h"
-#include "wx/wfstream.h"
+#include "wx/file.h"
+#include "wx/wfstream.h"
// Windows headers
-#include "wx/msw/wrapwin.h"
-
#ifdef __WXWINCE__
#include "wx/msw/private.h"
#include <winbase.h>
{
wxString strRoot = strKey.BeforeFirst(REG_SEPARATOR);
- HKEY hRootKey = 0;
size_t ui;
for ( ui = 0; ui < nStdKeys; ui++ ) {
if ( strRoot.CmpNoCase(aStdKeys[ui].szName) == 0 ||
strRoot.CmpNoCase(aStdKeys[ui].szShortName) == 0 ) {
- hRootKey = aStdKeys[ui].hkey;
break;
}
}
if ( ui == nStdKeys ) {
wxFAIL_MSG(wxT("invalid key prefix in wxRegKey::ExtractKeyName."));
- hRootKey = HKEY_CLASSES_ROOT;
+ ui = HKCR;
}
else {
strKey = strKey.After(REG_SEPARATOR);
strKey.Truncate(strKey.Len() - 1);
}
- return (wxRegKey::StdKey)(int)hRootKey;
+ return (StdKey)ui;
}
wxRegKey::StdKey wxRegKey::GetStdKeyFromHkey(WXHKEY hkey)
{
for ( size_t ui = 0; ui < nStdKeys; ui++ ) {
- if ( (int) aStdKeys[ui].hkey == (int) hkey )
+ if ( aStdKeys[ui].hkey == (HKEY)hkey )
return (StdKey)ui;
}
{
// first get the type and size of the data
- DWORD dwType, dwSize;
+ DWORD dwType=REG_NONE, dwSize=0;
m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED,
&dwType, NULL, &dwSize);
if ( m_dwLastError == ERROR_SUCCESS )
if ( !str.empty() && str.Last() == REG_SEPARATOR )
str.Truncate(str.Len() - 1);
}
-