Rebase against 16e73be10d940c9c04101a47687a6f8a385c2b0f.

This commit is contained in:
Zebediah Figura
2021-09-17 17:45:25 -05:00
parent 3a06c15dd2
commit fdcc8bec48
9 changed files with 105 additions and 105 deletions

View File

@@ -1,4 +1,4 @@
From 138645fb816f0b4fc9fe55f12ec20a4a6d5e2893 Mon Sep 17 00:00:00 2001
From 5b1f4126d7eed65f68fb46bec05b226d75ce63e5 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 26 Feb 2021 22:31:19 -0600
Subject: [PATCH] shell32: Implement the "runas" verb.
@@ -10,14 +10,14 @@ Based on a patch by Michael Müller.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/shell32/shlexec.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
dlls/shell32/shlexec.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index 49f7867ef7e..9a8bf4b5b52 100644
index ba393ad7794..f6e108fd6bf 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -305,6 +305,21 @@ static HRESULT SHELL_GetPathFromIDListForExecuteW(LPCITEMIDLIST pidl, LPWSTR psz
@@ -299,6 +299,21 @@ static HRESULT SHELL_GetPathFromIDListForExecuteW(LPCITEMIDLIST pidl, LPWSTR psz
return hr;
}
@@ -39,14 +39,7 @@ index 49f7867ef7e..9a8bf4b5b52 100644
/*************************************************************************
* SHELL_ExecuteW [Internal]
*
@@ -312,12 +327,14 @@ static HRESULT SHELL_GetPathFromIDListForExecuteW(LPCITEMIDLIST pidl, LPWSTR psz
static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
const SHELLEXECUTEINFOW *psei, LPSHELLEXECUTEINFOW psei_out)
{
+ static const WCHAR runasW[] = {'r','u','n','a','s',0};
STARTUPINFOW startup;
PROCESS_INFORMATION info;
UINT_PTR retval = SE_ERR_NOASSOC;
@@ -312,6 +327,7 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
UINT gcdret = 0;
WCHAR curdir[MAX_PATH];
DWORD dwCreationFlags;
@@ -54,14 +47,14 @@ index 49f7867ef7e..9a8bf4b5b52 100644
TRACE("Execute %s from directory %s\n", debugstr_w(lpCmd), debugstr_w(psei->lpDirectory));
@@ -339,8 +356,12 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
@@ -333,8 +349,12 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
dwCreationFlags = CREATE_UNICODE_ENVIRONMENT;
if (!(psei->fMask & SEE_MASK_NO_CONSOLE))
dwCreationFlags |= CREATE_NEW_CONSOLE;
- if (CreateProcessW(NULL, (LPWSTR)lpCmd, NULL, NULL, FALSE, dwCreationFlags, env,
- NULL, &startup, &info))
+
+ if (psei->lpVerb && !strcmpiW(psei->lpVerb, runasW))
+ if (psei->lpVerb && !wcsicmp(psei->lpVerb, L"runas"))
+ token = get_admin_token();
+
+ if (CreateProcessAsUserW(token, NULL, (LPWSTR)lpCmd, NULL, NULL, FALSE,
@@ -69,7 +62,7 @@ index 49f7867ef7e..9a8bf4b5b52 100644
{
/* Give 30 seconds to the app to come up, if desired. Probably only needed
when starting app immediately before making a DDE connection. */
@@ -360,6 +381,8 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
@@ -354,6 +374,8 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
retval = ERROR_BAD_FORMAT;
}
@@ -79,5 +72,5 @@ index 49f7867ef7e..9a8bf4b5b52 100644
psei_out->hInstApp = (HINSTANCE)retval;
--
2.30.2
2.33.0