mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
server-default_integrity: Create the MSI custom action server as an elevated process.
This commit is contained in:
parent
0df3e892fb
commit
180ba8c931
@ -51,7 +51,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "0a50674c6aabb0368811ece4078a2bb69d7ea1bb"
|
||||
echo "ce72f9b4263a898503c154a37df6bc9d43153f4b"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -3071,12 +3071,13 @@ fi
|
||||
# | should run unelevated by default with Vista+ setting)
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/shell32/shlexec.c, loader/wine.inf.in, server/process.c
|
||||
# | * dlls/msi/custom.c, dlls/shell32/shlexec.c, loader/wine.inf.in, server/process.c
|
||||
# |
|
||||
if test "$enable_server_default_integrity" -eq 1; then
|
||||
patch_apply server-default_integrity/0001-server-Create-processes-using-a-limited-administrato.patch
|
||||
patch_apply server-default_integrity/0002-shell32-Implement-the-runas-verb.patch
|
||||
patch_apply server-default_integrity/0003-wine.inf-Set-the-EnableLUA-value-to-1.patch
|
||||
patch_apply server-default_integrity/0004-msi-Create-the-custom-action-server-as-an-elevated-p.patch
|
||||
fi
|
||||
|
||||
# Patchset setupapi-DiskSpaceList
|
||||
|
@ -0,0 +1,68 @@
|
||||
From f2de1c5d2fcda876276e077b61f9fba5ff3f7f12 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Sun, 16 May 2021 20:49:05 -0500
|
||||
Subject: [PATCH] msi: Create the custom action server as an elevated process.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51143
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/msi/custom.c | 24 ++++++++++++++++++++++--
|
||||
1 file changed, 22 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
|
||||
index fb03958eb11..874b9b92118 100644
|
||||
--- a/dlls/msi/custom.c
|
||||
+++ b/dlls/msi/custom.c
|
||||
@@ -574,12 +574,28 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid)
|
||||
return r;
|
||||
}
|
||||
|
||||
+static HANDLE get_admin_token(void)
|
||||
+{
|
||||
+ TOKEN_ELEVATION_TYPE type;
|
||||
+ TOKEN_LINKED_TOKEN linked;
|
||||
+ DWORD size;
|
||||
+
|
||||
+ if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenElevationType, &type, sizeof(type), &size)
|
||||
+ || type == TokenElevationTypeFull)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenLinkedToken, &linked, sizeof(linked), &size))
|
||||
+ return NULL;
|
||||
+ return linked.LinkedToken;
|
||||
+}
|
||||
+
|
||||
static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch)
|
||||
{
|
||||
WCHAR path[MAX_PATH], cmdline[MAX_PATH + 23];
|
||||
PROCESS_INFORMATION pi = {0};
|
||||
STARTUPINFOW si = {0};
|
||||
WCHAR buffer[24];
|
||||
+ HANDLE token;
|
||||
void *cookie;
|
||||
HANDLE pipe;
|
||||
|
||||
@@ -601,14 +617,18 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch)
|
||||
lstrcatW(path, L"\\msiexec.exe");
|
||||
swprintf(cmdline, ARRAY_SIZE(cmdline), L"%s -Embedding %d", path, GetCurrentProcessId());
|
||||
|
||||
+ token = get_admin_token();
|
||||
+
|
||||
if (is_wow64 && arch == SCS_64BIT_BINARY)
|
||||
{
|
||||
Wow64DisableWow64FsRedirection(&cookie);
|
||||
- CreateProcessW(path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
||||
+ CreateProcessAsUserW(token, path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
||||
Wow64RevertWow64FsRedirection(cookie);
|
||||
}
|
||||
else
|
||||
- CreateProcessW(path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
||||
+ CreateProcessAsUserW(token, path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
||||
+
|
||||
+ if (token) CloseHandle(token);
|
||||
|
||||
CloseHandle(pi.hThread);
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
Loading…
Reference in New Issue
Block a user