Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aleksandr Isakov
wine-fonts
Commits
ce341f7b
Commit
ce341f7b
authored
Feb 26, 2021
by
Zebediah Figura
Committed by
Vitaly Lipatov
Jul 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Implement the "runas" verb.
Based on a patch by Michael Müller. Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
parent
a21e3dd9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
shlexec.c
dlls/shell32/shlexec.c
+24
-2
No files found.
dlls/shell32/shlexec.c
View file @
ce341f7b
...
...
@@ -288,6 +288,21 @@ static HRESULT SHELL_GetPathFromIDListForExecuteW(LPCITEMIDLIST pidl, LPWSTR psz
return
hr
;
}
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
;
}
/*************************************************************************
* SHELL_ExecuteW [Internal]
*
...
...
@@ -301,6 +316,7 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
UINT
gcdret
=
0
;
WCHAR
curdir
[
MAX_PATH
];
DWORD
dwCreationFlags
;
HANDLE
token
=
NULL
;
TRACE
(
"Execute %s from directory %s
\n
"
,
debugstr_w
(
lpCmd
),
debugstr_w
(
psei
->
lpDirectory
));
...
...
@@ -322,8 +338,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
&&
!
wcsicmp
(
psei
->
lpVerb
,
L"runas"
))
token
=
get_admin_token
();
if
(
CreateProcessAsUserW
(
token
,
NULL
,
(
LPWSTR
)
lpCmd
,
NULL
,
NULL
,
FALSE
,
dwCreationFlags
,
env
,
NULL
,
&
startup
,
&
info
))
{
/* Give 30 seconds to the app to come up, if desired. Probably only needed
when starting app immediately before making a DDE connection. */
...
...
@@ -343,6 +363,8 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
retval
=
ERROR_BAD_FORMAT
;
}
CloseHandle
(
token
);
TRACE
(
"returning %Iu
\n
"
,
retval
);
psei_out
->
hInstApp
=
(
HINSTANCE
)
retval
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment