wusa-MSU_Package_Installer: Rebase and re-enable.

This commit is contained in:
Zebediah Figura 2019-12-02 19:28:46 -06:00
parent 2f95fb4782
commit f23d30bc06
8 changed files with 13 additions and 2288 deletions

View File

@ -1,32 +0,0 @@
From 117b12b0bda9b2a5dd4e9e70bfe7807bcb20ce26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 21 Dec 2015 01:45:07 +0100
Subject: [PATCH 2/7] wusa: Ignore systemProtection subkey of registry key.
---
programs/wusa/manifest.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/programs/wusa/manifest.c b/programs/wusa/manifest.c
index d88b5f98a9..9b43d5e246 100644
--- a/programs/wusa/manifest.c
+++ b/programs/wusa/manifest.c
@@ -449,6 +449,7 @@ error:
static BOOL read_registry_key(IXMLDOMElement *child, WCHAR *tagname, void *context)
{
static const WCHAR securityDescriptorW[] = {'s','e','c','u','r','i','t','y','D','e','s','c','r','i','p','t','o','r',0};
+ static const WCHAR systemProtectionW[] = {'s','y','s','t','e','m','P','r','o','t','e','c','t','i','o','n',0};
static const WCHAR registryValueW[] = {'r','e','g','i','s','t','r','y','V','a','l','u','e',0};
static const WCHAR nameW[] = {'n','a','m','e',0};
static const WCHAR valueTypeW[] = {'v','a','l','u','e','T','y','p','e',0};
@@ -457,6 +458,7 @@ static BOOL read_registry_key(IXMLDOMElement *child, WCHAR *tagname, void *conte
struct registrykv_entry *entry;
if (!lstrcmpW(tagname, securityDescriptorW)) return TRUE;
+ if (!lstrcmpW(tagname, systemProtectionW)) return TRUE;
if (lstrcmpW(tagname, registryValueW))
{
WINE_FIXME("Ignoring unexpected tag %s\n", debugstr_w(tagname));
--
2.23.0.rc1

View File

@ -1,29 +0,0 @@
From ae3350ac731b45fd0b47d50f0e64525ec48803f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 21 Dec 2015 01:46:34 +0100
Subject: [PATCH 3/7] wusa: Treat empty update list as error.
---
programs/wusa/main.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/programs/wusa/main.c b/programs/wusa/main.c
index 0d6e5c345c..837729554f 100644
--- a/programs/wusa/main.c
+++ b/programs/wusa/main.c
@@ -997,6 +997,12 @@ static BOOL install_msu(WCHAR *filename, struct installer_state *state)
}
}
+ if (list_empty(&state->updates))
+ {
+ WINE_ERR("No updates found, probably incompatible MSU file format?\n");
+ goto done;
+ }
+
/* perform dryrun */
set_assembly_status(&state->assemblies, ASSEMBLY_STATUS_NONE);
if (!install_updates(state, TRUE))
--
2.23.0.rc1

View File

@ -1,129 +0,0 @@
From b9426dcd2d1a01b5f7ca857a5332c102e59dbc40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 21 Dec 2015 01:47:59 +0100
Subject: [PATCH] wusa: Implement WOW64 support.
---
programs/wusa/main.c | 62 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 61 insertions(+), 1 deletion(-)
diff --git a/programs/wusa/main.c b/programs/wusa/main.c
index db29a3e5078..78b4e18483a 100644
--- a/programs/wusa/main.c
+++ b/programs/wusa/main.c
@@ -65,6 +65,12 @@ struct installer_state
struct list updates;
};
+#if defined(__x86_64__)
+static const WCHAR x86W[] = {'x','8','6',0};
+#elif defined(__i386__)
+static const WCHAR amd64W[] = {'a','m','d','6','4',0};
+#endif
+
static BOOL strbuf_init(struct strbuf *buf)
{
buf->pos = 0;
@@ -374,6 +380,14 @@ static WCHAR *lookup_expression(struct assembly_entry *assembly, const WCHAR *ke
if (!lstrcmpW(key, runtime_system32))
{
+ #if defined(__x86_64__)
+ if (!lstrcmpW(assembly->identity.architecture, x86W))
+ {
+ GetSystemWow64DirectoryW(path, sizeof(path)/sizeof(path[0]));
+ return strdupW(path);
+ }
+ #endif
+
GetSystemDirectoryW(path, sizeof(path)/sizeof(path[0]));
return strdupW(path);
}
@@ -690,8 +704,13 @@ static BOOL install_registry(struct assembly_entry *assembly, BOOL dryrun)
struct registrykv_entry *registrykv;
HKEY root, subkey;
WCHAR *path;
+ REGSAM sam = KEY_ALL_ACCESS;
BOOL ret = TRUE;
+#if defined(__x86_64__)
+ if (!lstrcmpW(assembly->identity.architecture, x86W)) sam |= KEY_WOW64_32KEY;
+#endif
+
LIST_FOR_EACH_ENTRY(registryop, &assembly->registryops, struct registryop_entry, entry)
{
if (!(path = split_registry_key(registryop->key, &root)))
@@ -700,7 +719,7 @@ static BOOL install_registry(struct assembly_entry *assembly, BOOL dryrun)
break;
}
- if (!dryrun && RegCreateKeyExW(root, path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &subkey, NULL))
+ if (!dryrun && RegCreateKeyExW(root, path, 0, NULL, REG_OPTION_NON_VOLATILE, sam, NULL, &subkey, NULL))
{
WINE_ERR("Failed to open registry key %s\n", debugstr_w(registryop->key));
ret = FALSE;
@@ -771,6 +790,14 @@ static BOOL install_assembly(struct list *manifest_list, struct assembly_identit
return FALSE;
}
+#if defined(__i386__)
+ if (!lstrcmpW(assembly->identity.architecture, amd64W))
+ {
+ WINE_ERR("Can not install amd64 assembly in 32 bit prefix\n");
+ return FALSE;
+ }
+#endif
+
assembly->status = ASSEMBLY_STATUS_IN_PROGRESS;
LIST_FOR_EACH_ENTRY(dependency, &assembly->dependencies, struct dependency_entry, entry)
@@ -1026,6 +1053,37 @@ done:
return ret;
}
+static void restart_as_x86_64(void)
+{
+ WCHAR filename[MAX_PATH];
+ PROCESS_INFORMATION pi;
+ STARTUPINFOW si;
+ DWORD exit_code = 1;
+ BOOL is_wow64;
+ void *redir;
+
+ if (!IsWow64Process(GetCurrentProcess(), &is_wow64) || !is_wow64)
+ return;
+
+ memset(&si, 0, sizeof(si));
+ si.cb = sizeof(si);
+ GetModuleFileNameW(0, filename, MAX_PATH);
+
+ Wow64DisableWow64FsRedirection(&redir);
+ if (CreateProcessW(filename, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
+ {
+ WINE_TRACE("Restarting %s\n", wine_dbgstr_w(filename));
+ WaitForSingleObject(pi.hProcess, INFINITE);
+ GetExitCodeProcess(pi.hProcess, &exit_code);
+ CloseHandle(pi.hProcess);
+ CloseHandle(pi.hThread);
+ }
+ else WINE_ERR("Failed to restart 64-bit %s, err %d\n", wine_dbgstr_w(filename), GetLastError());
+ Wow64RevertWow64FsRedirection(redir);
+
+ ExitProcess(exit_code);
+}
+
int __cdecl wmain(int argc, WCHAR *argv[])
{
static const WCHAR norestartW[] = {'/','n','o','r','e','s','t','a','r','t',0};
@@ -1034,6 +1092,8 @@ int __cdecl wmain(int argc, WCHAR *argv[])
WCHAR *filename = NULL;
int i;
+ restart_as_x86_64();
+
state.norestart = FALSE;
state.quiet = FALSE;
--
2.17.1

View File

@ -1,8 +1,7 @@
From 47c2670271bfb03dd6cfac0febb16bdf1d894600 Mon Sep 17 00:00:00 2001
From b3478336224263e3a09fb3d1324af261b0b5ec07 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 21 Dec 2015 03:01:05 +0100
Subject: [PATCH 5/7] wusa: Add workaround to be compatible with Vista
packages.
Subject: [PATCH] wusa: Add workaround to be compatible with Vista packages.
---
programs/wusa/main.c | 21 +++++++++++++++++++++
@ -11,11 +10,11 @@ Subject: [PATCH 5/7] wusa: Add workaround to be compatible with Vista
3 files changed, 44 insertions(+)
diff --git a/programs/wusa/main.c b/programs/wusa/main.c
index 3598c39660..b612828855 100644
index 49e7dc753..323b16e93 100644
--- a/programs/wusa/main.c
+++ b/programs/wusa/main.c
@@ -113,6 +113,13 @@ static BOOL strbuf_append(struct strbuf *buf, const WCHAR *str, DWORD len)
return TRUE;
@@ -346,6 +346,13 @@ static void installer_cleanup(struct installer_state *state)
}
}
+static BOOL str_starts_with(const WCHAR *str, const WCHAR *prefix)
@ -28,7 +27,7 @@ index 3598c39660..b612828855 100644
static BOOL str_ends_with(const WCHAR *str, const WCHAR *suffix)
{
DWORD str_len = lstrlenW(str), suffix_len = lstrlenW(suffix);
@@ -1005,6 +1012,20 @@ static BOOL install_msu(WCHAR *filename, struct installer_state *state)
@@ -964,6 +971,20 @@ static BOOL install_msu(const WCHAR *filename, struct installer_state *state)
FindClose(search);
}
@ -47,13 +46,13 @@ index 3598c39660..b612828855 100644
+ }
+
/* dump package information (for debugging) */
if (WINE_TRACE_ON(wusa))
if (TRACE_ON(wusa))
{
diff --git a/programs/wusa/manifest.c b/programs/wusa/manifest.c
index 9b43d5e246..2ca92c2a17 100644
index e80c11998..0f61afa45 100644
--- a/programs/wusa/manifest.c
+++ b/programs/wusa/manifest.c
@@ -704,3 +704,25 @@ done:
@@ -671,3 +671,25 @@ done:
IXMLDOMElement_Release(root);
return ret;
}
@ -80,10 +79,10 @@ index 9b43d5e246..2ca92c2a17 100644
+ return FALSE;
+}
diff --git a/programs/wusa/wusa.h b/programs/wusa/wusa.h
index 0b2b616a7c..d7f1a471b4 100644
index dcd784e76..ad9523776 100644
--- a/programs/wusa/wusa.h
+++ b/programs/wusa/wusa.h
@@ -81,6 +81,7 @@ void free_assembly(struct assembly_entry *entry) DECLSPEC_HIDDEN;
@@ -77,6 +77,7 @@ void free_assembly(struct assembly_entry *entry) DECLSPEC_HIDDEN;
void free_dependency(struct dependency_entry *entry) DECLSPEC_HIDDEN;
struct assembly_entry *load_manifest(const WCHAR *filename) DECLSPEC_HIDDEN;
BOOL load_update(const WCHAR *filename, struct list *update_list) DECLSPEC_HIDDEN;
@ -92,5 +91,5 @@ index 0b2b616a7c..d7f1a471b4 100644
static void *heap_alloc(size_t len) __WINE_ALLOC_SIZE(1);
static inline void *heap_alloc(size_t len)
--
2.23.0.rc1
2.23.0

View File

@ -1,69 +0,0 @@
From 72d2b2df1ec557664d5266b5b05e160e4d565993 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 21 Dec 2015 04:27:02 +0100
Subject: [PATCH 6/7] wusa: Improve tracing of installation process.
---
programs/wusa/main.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/programs/wusa/main.c b/programs/wusa/main.c
index b612828855..847fd8b2ce 100644
--- a/programs/wusa/main.c
+++ b/programs/wusa/main.c
@@ -471,6 +471,8 @@ static BOOL install_files_copy(struct assembly_entry *assembly, const WCHAR *sou
}
else
{
+ WINE_TRACE("Copying %s -> %s\n", debugstr_w(source), debugstr_w(target));
+
if (!create_parent_directory(target))
{
WINE_ERR("Failed to create parent directory for %s\n", debugstr_w(target));
@@ -690,6 +692,8 @@ static BOOL install_registry_value(struct assembly_entry *assembly, HKEY key, st
static const WCHAR reg_dwordW[] = {'R','E','G','_','D','W','O','R','D',0};
static const WCHAR reg_binaryW[] = {'R','E','G','_','B','I','N','A','R','Y',0};
+ WINE_TRACE("Setting registry key %s = %s\n", debugstr_w(registrykv->name), debugstr_w(registrykv->value));
+
if (!lstrcmpW(registrykv->value_type, reg_szW))
return install_registry_string(assembly, key, registrykv, REG_SZ, dryrun);
if (!lstrcmpW(registrykv->value_type, reg_expand_szW))
@@ -726,6 +730,8 @@ static BOOL install_registry(struct assembly_entry *assembly, BOOL dryrun)
break;
}
+ WINE_TRACE("Processing registry key %s\n", debugstr_w(registryop->key));
+
if (!dryrun && RegCreateKeyExW(root, path, 0, NULL, REG_OPTION_NON_VOLATILE, sam, NULL, &subkey, NULL))
{
WINE_ERR("Failed to open registry key %s\n", debugstr_w(registryop->key));
@@ -812,6 +818,8 @@ static BOOL install_assembly(struct list *manifest_list, struct assembly_identit
if (!install_assembly(manifest_list, &dependency->identity, dryrun)) return FALSE;
}
+ WINE_TRACE("Installing assembly %s%s\n", debugstr_w(name), dryrun ? " (dryrun)" : "");
+
if (!install_files(assembly, dryrun))
{
WINE_ERR("Failed to install all files for %s\n", debugstr_w(name));
@@ -824,6 +832,8 @@ static BOOL install_assembly(struct list *manifest_list, struct assembly_identit
return FALSE;
}
+ WINE_TRACE("Installation of %s finished\n", debugstr_w(name));
+
assembly->status = ASSEMBLY_STATUS_INSTALLED;
return TRUE;
}
@@ -1067,6 +1077,7 @@ static BOOL install_msu(WCHAR *filename, struct installer_state *state)
goto done;
}
+ WINE_TRACE("Installation finished\n");
ret = TRUE;
done:
--
2.23.0.rc1

View File

@ -1,40 +0,0 @@
From 63ac22a0ee910f8d56bcca6f4ef1b6618b07a888 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 21 Dec 2015 04:09:11 +0100
Subject: [PATCH 7/7] wusa: Print warning when encountering msdelta compressed
files.
---
programs/wusa/main.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/programs/wusa/main.c b/programs/wusa/main.c
index 847fd8b2ce..e9c04387fa 100644
--- a/programs/wusa/main.c
+++ b/programs/wusa/main.c
@@ -894,6 +894,7 @@ static void installer_cleanup(struct installer_state *state)
static BOOL load_assemblies_from_cab(const WCHAR *filename, struct installer_state *state)
{
+ static const WCHAR manifest_cix_xmlW[] = {'_','m','a','n','i','f','e','s','t','_','.','c','i','x','.','x','m','l',0};
static const WCHAR manifestW[] = {'.','m','a','n','i','f','e','s','t',0};
static const WCHAR mumW[] = {'.','m','u','m',0};
static const WCHAR starW[] = {'*',0};
@@ -912,6 +913,14 @@ static BOOL load_assemblies_from_cab(const WCHAR *filename, struct installer_sta
return FALSE;
}
+ if (!(path = path_combine(temp_path, manifest_cix_xmlW))) return FALSE;
+ if (GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES)
+ {
+ WINE_FIXME("Cabinet uses proprietary msdelta file compression which is not (yet) supported.\n");
+ WINE_FIXME("Installation of msu file will most likely fail.\n");
+ }
+ heap_free(path);
+
if (!(path = path_combine(temp_path, starW))) return FALSE;
search = FindFirstFileW(path, &data);
heap_free(path);
--
2.23.0.rc1

View File

@ -1,3 +1 @@
Fixes: [26757] Initial implementation of wusa.exe (MSU package installer)
Disabled: True
#No idea what this workaround is for.