X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/defbed48e78f4e84b35f62c2c1b7fd58d740501c..17f504ec9d688dc61bf10090a808a25ba34c50af:/src/msw/dlmsw.cpp diff --git a/src/msw/dlmsw.cpp b/src/msw/dlmsw.cpp index f0f1076135..2e6d519edd 100644 --- a/src/msw/dlmsw.cpp +++ b/src/msw/dlmsw.cpp @@ -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); }; // ---------------------------------------------------------------------------- @@ -97,7 +104,7 @@ HMODULE wxGetModuleHandle(const char *name, void *addr) // GetModuleHandleEx() is only available under XP and later, coincidence?) // check if we can use GetModuleHandleEx - typedef BOOL (WINAPI *GetModuleHandleEx_t)(DWORD, LPCTSTR, HMODULE *); + typedef BOOL (WINAPI *GetModuleHandleEx_t)(DWORD, LPCSTR, HMODULE *); static const GetModuleHandleEx_t INVALID_FUNC_PTR = (GetModuleHandleEx_t)-1; @@ -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,12 +251,22 @@ wxDynamicLibraryDetailsCreator::EnumModulesProc(PSTR name, // wxDynamicLibrary implementation // ============================================================================ +// ---------------------------------------------------------------------------- +// misc functions +// ---------------------------------------------------------------------------- + +wxDllType wxDynamicLibrary::GetProgramHandle() +{ + return (wxDllType)::GetModuleHandle(NULL); +} + // ---------------------------------------------------------------------------- // loading/unloading DLLs // ---------------------------------------------------------------------------- /* static */ -wxDllType wxDynamicLibrary::RawLoad(const wxString& libname) +wxDllType +wxDynamicLibrary::RawLoad(const wxString& libname, int WXUNUSED(flags)) { return ::LoadLibrary(libname); } @@ -261,7 +280,13 @@ void wxDynamicLibrary::Unload(wxDllType handle) /* static */ void *wxDynamicLibrary::RawGetSymbol(wxDllType handle, const wxString& name) { - return ::GetProcAddress(handle, name); + return (void *)::GetProcAddress(handle, +#ifdef __WXWINCE__ + name.c_str() +#else + name.ToAscii() +#endif // __WXWINCE__ + ); } // ---------------------------------------------------------------------------- @@ -273,6 +298,7 @@ wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded() { wxDynamicLibraryDetailsArray dlls; +#if wxUSE_DBGHELP if ( wxDbgHelpDLL::Init() ) { // prepare to use functions for version info extraction @@ -292,6 +318,7 @@ wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded() wxLogLastError(_T("EnumerateLoadedModules")); } } +#endif // wxUSE_DBGHELP return dlls; }