Mohamad Al-Jaf : wusa: Support wow64 architecture identifier.

Alexandre Julliard julliard at winehq.org
Wed Apr 6 16:09:00 CDT 2022


Module: wine
Branch: master
Commit: 3b851296026e63d33ee7cec38eed4bc24abeeade
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3b851296026e63d33ee7cec38eed4bc24abeeade

Author: Mohamad Al-Jaf <mohamadaljaf at gmail.com>
Date:   Wed Apr  6 13:18:07 2022 +0200

wusa: Support wow64 architecture identifier.

Signed-off-by: Mohamad Al-Jaf <mohamadaljaf at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/wusa/main.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/programs/wusa/main.c b/programs/wusa/main.c
index 74dfeb68d5f..53534628c31 100644
--- a/programs/wusa/main.c
+++ b/programs/wusa/main.c
@@ -477,6 +477,14 @@ static BOOL strbuf_append(struct strbuf *buf, const WCHAR *str, DWORD len)
     return TRUE;
 }
 
+static BOOL assembly_is_wow64(const struct assembly_entry *assembly)
+{
+#ifdef __x86_64__
+    return !wcsicmp(assembly->identity.architecture, L"x86") || !wcsicmp(assembly->identity.architecture, L"wow64");
+#endif
+    return FALSE;
+}
+
 static WCHAR *lookup_expression(struct assembly_entry *assembly, const WCHAR *key)
 {
     WCHAR path[MAX_PATH];
@@ -484,25 +492,19 @@ static WCHAR *lookup_expression(struct assembly_entry *assembly, const WCHAR *ke
 
     if (!wcsicmp(key, L"runtime.system32") || !wcsicmp(key, L"runtime.drivers") || !wcsicmp(key, L"runtime.wbem"))
     {
-#ifdef __x86_64__
-        if (!wcsicmp(assembly->identity.architecture, L"x86")) csidl = CSIDL_SYSTEMX86;
-#endif
-        if (!csidl) csidl = CSIDL_SYSTEM;
+        if (assembly_is_wow64(assembly)) csidl = CSIDL_SYSTEMX86;
+        else csidl = CSIDL_SYSTEM;
     }
     else if (!wcsicmp(key, L"runtime.windows") || !wcsicmp(key, L"runtime.inf")) csidl = CSIDL_WINDOWS;
     else if (!wcsicmp(key, L"runtime.programfiles"))
     {
-#ifdef __x86_64__
-        if (!wcsicmp(assembly->identity.architecture, L"x86")) csidl = CSIDL_PROGRAM_FILESX86;
-#endif
-        if (!csidl) csidl = CSIDL_PROGRAM_FILES;
+        if (assembly_is_wow64(assembly)) csidl = CSIDL_PROGRAM_FILESX86;
+        else csidl = CSIDL_PROGRAM_FILES;
     }
     else if (!wcsicmp(key, L"runtime.commonfiles"))
     {
-#ifdef __x86_64__
-        if (!wcsicmp(assembly->identity.architecture, L"x86")) csidl = CSIDL_PROGRAM_FILES_COMMONX86;
-#endif
-        if (!csidl) csidl = CSIDL_PROGRAM_FILES_COMMON;
+        if (assembly_is_wow64(assembly)) csidl = CSIDL_PROGRAM_FILES_COMMONX86;
+        else csidl = CSIDL_PROGRAM_FILES_COMMON;
     }
 #ifdef __x86_64__
     else if (!wcsicmp(key, L"runtime.programfilesx86")) csidl = CSIDL_PROGRAM_FILESX86;




More information about the wine-cvs mailing list