Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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
wine
wine-cw
Commits
f7d47b49
Commit
f7d47b49
authored
Oct 16, 2018
by
Mark Jansen
Committed by
Alexandre Julliard
Oct 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Expand environment strings in ShellExecute.
Signed-off-by:
Alistair Leslie-Hughes
<
leslie_alistair@hotmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
55e3a4d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
4 deletions
+49
-4
shlexec.c
dlls/shell32/shlexec.c
+46
-1
shlexec.c
dlls/shell32/tests/shlexec.c
+3
-3
No files found.
dlls/shell32/shlexec.c
View file @
f7d47b49
...
...
@@ -1557,6 +1557,26 @@ static void do_error_dialog( UINT_PTR retval, HWND hwnd )
MessageBoxW
(
hwnd
,
msg
,
NULL
,
MB_ICONERROR
);
}
static
WCHAR
*
expand_environment
(
const
WCHAR
*
str
)
{
WCHAR
*
buf
;
DWORD
len
;
len
=
ExpandEnvironmentStringsW
(
str
,
NULL
,
0
);
if
(
!
len
)
return
NULL
;
buf
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
if
(
!
buf
)
return
NULL
;
len
=
ExpandEnvironmentStringsW
(
str
,
buf
,
len
);
if
(
!
len
)
{
heap_free
(
buf
);
return
NULL
;
}
return
buf
;
}
/*************************************************************************
* SHELL_execute [Internal]
*/
...
...
@@ -1570,7 +1590,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
SEE_MASK_UNICODE
|
SEE_MASK_ASYNCOK
|
SEE_MASK_HMONITOR
;
WCHAR
parametersBuffer
[
1024
],
dirBuffer
[
MAX_PATH
],
wcmdBuffer
[
1024
];
WCHAR
*
wszApplicationName
,
*
wszParameters
,
*
wszDir
,
*
wcmd
;
WCHAR
*
wszApplicationName
,
*
wszParameters
,
*
wszDir
,
*
wcmd
=
NULL
;
DWORD
dwApplicationNameLen
=
MAX_PATH
+
2
;
DWORD
parametersLen
=
ARRAY_SIZE
(
parametersBuffer
);
DWORD
wcmdLen
=
ARRAY_SIZE
(
wcmdBuffer
);
...
...
@@ -1676,6 +1696,30 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
TRACE
(
"-- idlist=%p (%s)
\n
"
,
sei_tmp
.
lpIDList
,
debugstr_w
(
wszApplicationName
));
}
if
(
sei_tmp
.
fMask
&
SEE_MASK_DOENVSUBST
)
{
WCHAR
*
tmp
;
tmp
=
expand_environment
(
sei_tmp
.
lpFile
);
if
(
!
tmp
)
{
retval
=
SE_ERR_OOM
;
goto
end
;
}
heap_free
(
wszApplicationName
);
sei_tmp
.
lpFile
=
wszApplicationName
=
tmp
;
tmp
=
expand_environment
(
sei_tmp
.
lpDirectory
);
if
(
!
tmp
)
{
retval
=
SE_ERR_OOM
;
goto
end
;
}
if
(
wszDir
!=
dirBuffer
)
heap_free
(
wszDir
);
sei_tmp
.
lpDirectory
=
wszDir
=
tmp
;
}
if
(
ERROR_SUCCESS
==
ShellExecute_FromContextMenu
(
&
sei_tmp
)
)
{
sei
->
hInstApp
=
(
HINSTANCE
)
33
;
...
...
@@ -1846,6 +1890,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
retval
=
(
UINT_PTR
)
ShellExecuteW
(
sei_tmp
.
hwnd
,
sei_tmp
.
lpVerb
,
lpstrTmpFile
,
NULL
,
NULL
,
0
);
}
end:
TRACE
(
"retval %lu
\n
"
,
retval
);
heap_free
(
wszApplicationName
);
...
...
dlls/shell32/tests/shlexec.c
View file @
f7d47b49
...
...
@@ -2133,13 +2133,13 @@ static void test_lnks(void)
get_long_path_name
(
params
,
filename
,
sizeof
(
filename
));
okChildPath
(
"argvA4"
,
filename
);
todo_wait
rc
=
shell_execute_ex
(
SEE_MASK_NOZONECHECKS
|
SEE_MASK_DOENVSUBST
,
NULL
,
"%TMPDIR%
\\
test_shortcut_shlexec.lnk"
,
NULL
,
NULL
,
NULL
);
rc
=
shell_execute_ex
(
SEE_MASK_NOZONECHECKS
|
SEE_MASK_DOENVSUBST
,
NULL
,
"%TMPDIR%
\\
test_shortcut_shlexec.lnk"
,
NULL
,
NULL
,
NULL
);
okShell
(
rc
>
32
,
"failed: rc=%lu err=%u
\n
"
,
rc
,
GetLastError
());
okChildInt
(
"argcA"
,
5
);
todo_wine
okChildString
(
"argvA3"
,
"Open"
);
okChildString
(
"argvA3"
,
"Open"
);
sprintf
(
params
,
"%s
\\
test file.shlexec"
,
tmpdir
);
get_long_path_name
(
params
,
filename
,
sizeof
(
filename
));
todo_wine
okChildPath
(
"argvA4"
,
filename
);
okChildPath
(
"argvA4"
,
filename
);
}
/* Should just run our executable */
...
...
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