]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/dlmsw.cpp
Include wx/window.h according to precompiled headers of wx/wx.h (with other minor...
[wxWidgets.git] / src / msw / dlmsw.cpp
index 67b52f000af3c203e9a4fdf83cd9c8d9d3d05dda..2e6d519eddf32be06c15cea071fe1889b350a6ab 100644 (file)
@@ -79,8 +79,15 @@ public:
         wxVersionDLL *verDLL;
     };
 
+    // TODO: fix EnumerateLoadedModules() to use EnumerateLoadedModules64()
+    #ifdef __WIN64__
+        typedef DWORD64 DWORD_32_64;
+    #else
+        typedef DWORD DWORD_32_64;
+    #endif
+
     static BOOL CALLBACK
-        EnumModulesProc(PSTR name, DWORD base, ULONG size, void *data);
+    EnumModulesProc(PSTR name, DWORD_32_64 base, ULONG size, void *data);
 };
 
 // ----------------------------------------------------------------------------
@@ -121,8 +128,10 @@ HMODULE wxGetModuleHandle(const char *name, void *addr)
             return hmod;
     }
 
-    // if failed, try by name
-    return ::GetModuleHandleA(name);
+    // Windows CE only has Unicode API, so even we have an ANSI string here, we
+    // still need to use GetModuleHandleW() there and so do it everywhere to
+    // avoid #ifdefs -- this code is not performance-critical anyhow...
+    return ::GetModuleHandle(wxString::FromAscii((char *)name));
 }
 
 // ============================================================================
@@ -207,7 +216,7 @@ wxString wxVersionDLL::GetFileVersion(const wxString& filename) const
 /* static */
 BOOL CALLBACK
 wxDynamicLibraryDetailsCreator::EnumModulesProc(PSTR name,
-                                                DWORD base,
+                                                DWORD_32_64 base,
                                                 ULONG size,
                                                 void *data)
 {
@@ -242,6 +251,15 @@ wxDynamicLibraryDetailsCreator::EnumModulesProc(PSTR name,
 // wxDynamicLibrary implementation
 // ============================================================================
 
+// ----------------------------------------------------------------------------
+// misc functions
+// ----------------------------------------------------------------------------
+
+wxDllType wxDynamicLibrary::GetProgramHandle()
+{
+    return (wxDllType)::GetModuleHandle(NULL);
+}
+
 // ----------------------------------------------------------------------------
 // loading/unloading DLLs
 // ----------------------------------------------------------------------------
@@ -262,7 +280,13 @@ void wxDynamicLibrary::Unload(wxDllType handle)
 /* static */
 void *wxDynamicLibrary::RawGetSymbol(wxDllType handle, const wxString& name)
 {
-    return ::GetProcAddress(handle, name.ToAscii());
+    return (void *)::GetProcAddress(handle,
+#ifdef __WXWINCE__
+                                            name.c_str()
+#else
+                                            name.ToAscii()
+#endif // __WXWINCE__
+                                   );
 }
 
 // ----------------------------------------------------------------------------