Added patch to implement of wusa.exe (MSU package installer).

This commit is contained in:
Sebastian Lackner 2015-12-21 03:16:54 +01:00
parent 47e0b460b4
commit d14e078ed7
9 changed files with 2290 additions and 0 deletions

View File

@ -34,6 +34,11 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [1]:**
* Initial implementation of wusa.exe (MSU package installer) ([Wine Bug #26757](https://bugs.winehq.org/show_bug.cgi?id=26757))
**Bug fixes and features in Wine Staging 1.8-rc4 [267]:**
*Note: The following list only contains features and bug fixes which are not

View File

@ -344,6 +344,7 @@ patch_enable_all ()
enable_ws2_32_WriteWatches="$1"
enable_ws2_32_getaddrinfo="$1"
enable_wtsapi32_EnumerateProcesses="$1"
enable_wusa_MSU_Package_Installer="$1"
}
# Enable or disable all categories
@ -1145,6 +1146,9 @@ patch_enable ()
wtsapi32-EnumerateProcesses)
enable_wtsapi32_EnumerateProcesses="$2"
;;
wusa-MSU_Package_Installer)
enable_wusa_MSU_Package_Installer="$2"
;;
*)
return 1
;;
@ -6806,6 +6810,29 @@ if test "$enable_wtsapi32_EnumerateProcesses" -eq 1; then
) >> "$patchlist"
fi
# Patchset wusa-MSU_Package_Installer
# |
# | This patchset fixes the following Wine bugs:
# | * [#26757] Initial implementation of wusa.exe (MSU package installer)
# |
# | Modified files:
# | * programs/wusa/Makefile.in, programs/wusa/main.c, programs/wusa/manifest.c, programs/wusa/wusa.h
# |
if test "$enable_wusa_MSU_Package_Installer" -eq 1; then
patch_apply wusa-MSU_Package_Installer/0001-wusa-Implement-basic-installation-logic.patch
patch_apply wusa-MSU_Package_Installer/0002-wusa-Ignore-systemProtection-subkey-of-registry-key.patch
patch_apply wusa-MSU_Package_Installer/0003-wusa-Treat-empty-update-list-as-error.patch
patch_apply wusa-MSU_Package_Installer/0004-wusa-Implement-WOW64-support.patch
patch_apply wusa-MSU_Package_Installer/0005-wusa-Add-workaround-to-be-compatible-with-Vista-pack.patch
(
echo '+ { "Michael Müller", "wusa: Implement basic installation logic.", 1 },';
echo '+ { "Michael Müller", "wusa: Ignore systemProtection subkey of registry key.", 1 },';
echo '+ { "Michael Müller", "wusa: Treat empty update list as error.", 1 },';
echo '+ { "Michael Müller", "wusa: Implement WOW64 support.", 1 },';
echo '+ { "Sebastian Lackner", "wusa: Add workaround to be compatible with Vista packages.", 1 },';
) >> "$patchlist"
fi
if test "$enable_patchlist" -eq 1; then

View File

@ -0,0 +1,32 @@
From f4415437d092f621e2cb292cf290a7910165d05f 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: 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 fc1f65b..63e56e0 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 (!strcmpW(tagname, securityDescriptorW)) return TRUE;
+ if (!strcmpW(tagname, systemProtectionW)) return TRUE;
if (strcmpW(tagname, registryValueW))
{
WINE_FIXME("Ignoring unexpected tag %s\n", debugstr_w(tagname));
--
2.6.4

View File

@ -0,0 +1,29 @@
From e489fac14e207ba0973c145ede43587457cc0be1 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: 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 7c1dfef..9cd8a2d 100644
--- a/programs/wusa/main.c
+++ b/programs/wusa/main.c
@@ -998,6 +998,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.6.4

View File

@ -0,0 +1,126 @@
From 3bd8282421aad38c45c38d2f3510c46560a4902d 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: wusa: Implement WOW64 support.
---
programs/wusa/main.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 58 insertions(+), 1 deletion(-)
diff --git a/programs/wusa/main.c b/programs/wusa/main.c
index 9cd8a2d..5dae802 100644
--- a/programs/wusa/main.c
+++ b/programs/wusa/main.c
@@ -66,6 +66,9 @@ struct installer_state
struct list updates;
};
+static const WCHAR x86W[] = {'x','8','6',0};
+static const WCHAR amd64W[] = {'a','m','d','6','4',0};
+
static BOOL strbuf_init(struct strbuf *buf)
{
buf->pos = 0;
@@ -375,6 +378,14 @@ static WCHAR *lookup_expression(struct assembly_entry *assembly, const WCHAR *ke
if (!strcmpW(key, runtime_system32))
{
+ #if defined(__x86_64__)
+ if (!strcmpW(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);
}
@@ -691,8 +702,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 (!strcmpW(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)))
@@ -701,7 +717,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;
@@ -772,6 +788,14 @@ static BOOL install_assembly(struct list *manifest_list, struct assembly_identit
return FALSE;
}
+#if defined(__i386__)
+ if (!strcmpW(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)
@@ -1027,6 +1051,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 wmain(int argc, WCHAR *argv[])
{
static const WCHAR norestartW[] = {'/','n','o','r','e','s','t','a','r','t',0};
@@ -1035,6 +1090,8 @@ int wmain(int argc, WCHAR *argv[])
WCHAR *filename = NULL;
int i;
+ restart_as_x86_64();
+
state.norestart = FALSE;
state.quiet = FALSE;
--
2.6.4

View File

@ -0,0 +1,95 @@
From c848126e160493a7baa717c96e663ef5ebddb542 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 21 Dec 2015 03:01:05 +0100
Subject: wusa: Add workaround to be compatible with Vista packages.
---
programs/wusa/main.c | 21 +++++++++++++++++++++
programs/wusa/manifest.c | 22 ++++++++++++++++++++++
programs/wusa/wusa.h | 1 +
3 files changed, 44 insertions(+)
diff --git a/programs/wusa/main.c b/programs/wusa/main.c
index 5dae802..834da33 100644
--- a/programs/wusa/main.c
+++ b/programs/wusa/main.c
@@ -111,6 +111,13 @@ static BOOL strbuf_append(struct strbuf *buf, const WCHAR *str, DWORD len)
return TRUE;
}
+static BOOL str_starts_with(const WCHAR *str, const WCHAR *prefix)
+{
+ DWORD str_len = strlenW(str), prefix_len = strlenW(prefix);
+ if (prefix_len > str_len) return FALSE;
+ return !strncmpiW(str, prefix, prefix_len);
+}
+
static BOOL str_ends_with(const WCHAR *str, const WCHAR *suffix)
{
DWORD str_len = strlenW(str), suffix_len = strlenW(suffix);
@@ -1003,6 +1010,20 @@ static BOOL install_msu(WCHAR *filename, struct installer_state *state)
FindClose(search);
}
+ /* Windows Vista MSU files do not contain an xml file - what is the correct way to get
+ * the update list? For now just install all assemblies starting with "Package_for_KB". */
+ if (list_empty(&state->updates))
+ {
+ static const WCHAR package_for_kbW[] = {'P','a','c','k','a','g','e','_','f','o','r','_','K','B',0};
+ struct assembly_entry *assembly;
+ LIST_FOR_EACH_ENTRY(assembly, &state->assemblies, struct assembly_entry, entry)
+ {
+ if (!assembly->identity.name) continue;
+ if (str_starts_with(assembly->identity.name, package_for_kbW))
+ queue_update(assembly, &state->updates);
+ }
+ }
+
/* dump package information (for debugging) */
if (WINE_TRACE_ON(wusa))
{
diff --git a/programs/wusa/manifest.c b/programs/wusa/manifest.c
index 63e56e0..0d6fae6 100644
--- a/programs/wusa/manifest.c
+++ b/programs/wusa/manifest.c
@@ -704,3 +704,25 @@ done:
IXMLDOMElement_Release(root);
return ret;
}
+
+BOOL queue_update(struct assembly_entry *assembly, struct list *update_list)
+{
+ struct dependency_entry *entry;
+
+ if (!(entry = alloc_dependency()))
+ return FALSE;
+
+ if (!(entry->identity.name = strdupW(assembly->identity.name))) goto error;
+ if (!(entry->identity.version = strdupW(assembly->identity.version))) goto error;
+ if (!(entry->identity.architecture = strdupW(assembly->identity.architecture))) goto error;
+ if (!(entry->identity.language = strdupW(assembly->identity.language))) goto error;
+ if (!(entry->identity.pubkey_token = strdupW(assembly->identity.pubkey_token))) goto error;
+
+ WINE_TRACE("Queued update %s\n", debugstr_w(entry->identity.name));
+ list_add_tail(update_list, &entry->entry);
+ return TRUE;
+
+error:
+ free_dependency(entry);
+ return FALSE;
+}
diff --git a/programs/wusa/wusa.h b/programs/wusa/wusa.h
index eada6d9..ef5793b 100644
--- a/programs/wusa/wusa.h
+++ b/programs/wusa/wusa.h
@@ -82,6 +82,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;
+BOOL queue_update(struct assembly_entry *assembly, struct list *update_list) DECLSPEC_HIDDEN;
static void *heap_alloc(size_t len) __WINE_ALLOC_SIZE(1);
static inline void *heap_alloc(size_t len)
--
2.6.4

View File

@ -0,0 +1 @@
Fixes: [26757] Initial implementation of wusa.exe (MSU package installer)

View File

@ -1,6 +1,7 @@
wine-staging (1.8) UNRELEASED; urgency=low
* Update nvencodeapi wrapper patchset to version 6.0 and fix Debian
compatibility.
* Added patch to implement of wusa.exe (MSU package installer).
-- Sebastian Lackner <sebastian@fds-team.de> Sun, 20 Dec 2015 22:54:04 +0100
wine-staging (1.8~rc4) unstable; urgency=low