mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-10 09:01:13 +02:00
Resolve functions at runtime to allow running on win2k or older.
This commit is contained in:
parent
37546d91d9
commit
ca141984d7
@ -234,17 +234,31 @@ wxString FileNames::PathFromAddr(void *addr)
|
|||||||
name.SetFullName(LAT1CTOWX(realname));
|
name.SetFullName(LAT1CTOWX(realname));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__) && defined(wxUSE_UNICODE)
|
||||||
HMODULE module;
|
// The GetModuleHandlEx() function did not appear until Windows XP and
|
||||||
if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
// GetModuleFileName() did appear until Windows 2000, so we have to
|
||||||
(LPTSTR) addr,
|
// check for them at runtime.
|
||||||
&module)) {
|
typedef BOOL (WINAPI *getmodulehandleex)(DWORD dwFlags, LPCWSTR lpModuleName, HMODULE* phModule);
|
||||||
TCHAR path[MAX_PATH];
|
typedef DWORD (WINAPI *getmodulefilename)(HMODULE hModule, LPWCH lpFilename, DWORD nSize);
|
||||||
DWORD nSize;
|
getmodulehandleex gmhe =
|
||||||
|
(getmodulehandleex) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
|
||||||
|
"GetModuleHandleExW");
|
||||||
|
getmodulefilename gmfn =
|
||||||
|
(getmodulefilename) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
|
||||||
|
"GetModuleFileNameW");
|
||||||
|
|
||||||
nSize = GetModuleFileName(module, path, MAX_PATH);
|
if (gmhe != NULL && gmfn != NULL) {
|
||||||
if (nSize && nSize < MAX_PATH) {
|
HMODULE module;
|
||||||
name = LAT1CTOWX(path);
|
if (gmhe(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
||||||
|
(LPTSTR) addr,
|
||||||
|
&module)) {
|
||||||
|
TCHAR path[MAX_PATH];
|
||||||
|
DWORD nSize;
|
||||||
|
|
||||||
|
nSize = gmfn(module, path, MAX_PATH);
|
||||||
|
if (nSize && nSize < MAX_PATH) {
|
||||||
|
name = LAT1CTOWX(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user