Add support for Unicode to wxStackWalker.

Use wide-char versions of debug help functions if available, falling back to
the narrow char ones otherwise.

Also improve 64 bit support by using 64 bit versions of the functions if
available as well.

Closes #15138.
This commit is contained in:
Suzumizaki-Kimitaka
2015-06-19 13:43:06 +09:00
committed by Vadim Zeitlin
parent 20ac03bfd8
commit 28587c97d8
6 changed files with 634 additions and 106 deletions

View File

@@ -77,15 +77,8 @@ 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(PCSTR name, DWORD_32_64 base, ULONG size, void *data);
EnumModulesProc(const wxChar* name, DWORD64 base, ULONG size, PVOID data);
};
// ============================================================================
@@ -172,8 +165,8 @@ wxString wxVersionDLL::GetFileVersion(const wxString& filename) const
/* static */
BOOL CALLBACK
wxDynamicLibraryDetailsCreator::EnumModulesProc(PCSTR name,
DWORD_32_64 base,
wxDynamicLibraryDetailsCreator::EnumModulesProc(const wxChar* name,
DWORD64 base,
ULONG size,
void *data)
{
@@ -276,15 +269,9 @@ wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded()
params.dlls = &dlls;
params.verDLL = &verDLL;
// Note that the cast of EnumModulesProc is needed because the type of
// PENUMLOADED_MODULES_CALLBACK changed: in old SDK versions its first
// argument was non-const PSTR while now it's PCSTR. By explicitly
// casting to whatever the currently used headers require we ensure
// that the code compilers in any case.
if ( !wxDbgHelpDLL::EnumerateLoadedModules
if ( !wxDbgHelpDLL::CallEnumerateLoadedModules
(
::GetCurrentProcess(),
(PENUMLOADED_MODULES_CALLBACK)
wxDynamicLibraryDetailsCreator::EnumModulesProc,
&params
) )