[PATCH 2/2] dbghelp: search in the correct directories for a wow setup
Eric Pouech
eric.pouech at gmail.com
Tue Nov 23 12:12:55 CST 2021
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
---
dlls/dbghelp/path.c | 38 +++++++++++++++++++++++++-------------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c
index f99129eac49..f93276e7b6d 100644
--- a/dlls/dbghelp/path.c
+++ b/dlls/dbghelp/path.c
@@ -32,20 +32,30 @@
WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
#ifdef __i386__
-static const WCHAR pe_dir[] = L"\\i386-windows";
-static const WCHAR so_dir[] = L"\\i386-unix";
+static const WCHAR pe_dir[] = L"\\i386-windows";
+static const WCHAR so_dir[] = L"\\i386-unix";
+static const WCHAR pe_wow_dir[] = L"";
+static const WCHAR so_wow_dir[] = L"";
#elif defined __x86_64__
-static const WCHAR pe_dir[] = L"\\x86_64-windows";
-static const WCHAR so_dir[] = L"\\x86_64-unix";
+static const WCHAR pe_dir[] = L"\\x86_64-windows";
+static const WCHAR so_dir[] = L"\\x86_64-unix";
+static const WCHAR pe_wow_dir[] = L"\\i386-windows";
+static const WCHAR so_wow_dir[] = L"\\i386-unix";
#elif defined __arm__
-static const WCHAR pe_dir[] = L"\\arm-windows";
-static const WCHAR so_dir[] = L"\\arm-unix";
+static const WCHAR pe_dir[] = L"\\arm-windows";
+static const WCHAR so_dir[] = L"\\arm-unix";
+static const WCHAR pe_wow_dir[] = L"";
+static const WCHAR so_wow_dir[] = L"";
#elif defined __aarch64__
-static const WCHAR pe_dir[] = L"\\aarch64-windows";
-static const WCHAR so_dir[] = L"\\aarch64-unix";
+static const WCHAR pe_dir[] = L"\\aarch64-windows";
+static const WCHAR so_dir[] = L"\\aarch64-unix";
+static const WCHAR pe_wow_dir[] = L"";
+static const WCHAR so_wow_dir[] = L"";
#else
-static const WCHAR pe_dir[] = L"";
-static const WCHAR so_dir[] = L"";
+static const WCHAR pe_dir[] = L"";
+static const WCHAR so_dir[] = L"";
+static const WCHAR pe_wow_dir[] = L"";
+static const WCHAR so_wow_dir[] = L"";
#endif
static inline BOOL is_sepA(char ch) {return ch == '/' || ch == '\\';}
@@ -763,14 +773,16 @@ BOOL search_dll_path(const struct process *process, const WCHAR *name, BOOL (*ma
for (i = 0;; i++)
{
WCHAR env_name[64];
+ const WCHAR* pcspe_dir = (sizeof(void*) == 4 || process->is_64bit) ? pe_dir : pe_wow_dir;
+ const WCHAR* pcsso_dir = (sizeof(void*) == 4 || process->is_64bit) ? so_dir : so_wow_dir;
swprintf(env_name, ARRAY_SIZE(env_name), L"WINEDLLDIR%u", i);
if (!(env = process_getenv(process, env_name))) return FALSE;
- len = wcslen(env) + wcslen(pe_dir) + wcslen(name) + 2;
+ len = wcslen(env) + wcslen(pcspe_dir) + wcslen(name) + 2;
if (!(buf = heap_alloc(len * sizeof(WCHAR)))) return FALSE;
if ((p = wcsrchr(name, '.')) && !lstrcmpW(p, L".so"))
- swprintf(buf, len, L"%s%s\\%s", env, so_dir, name);
+ swprintf(buf, len, L"%s%s\\%s", env, pcsso_dir, name);
else
- swprintf(buf, len, L"%s%s\\%s", env, pe_dir, name);
+ swprintf(buf, len, L"%s%s\\%s", env, pcspe_dir, name);
file = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (file != INVALID_HANDLE_VALUE)
{
More information about the wine-devel
mailing list