Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
94074ad3
Commit
94074ad3
authored
Aug 31, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Aug 31, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Don't use the working directory passed into ShellExecute* functions if it isn't valid.
parent
6c9b788f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
shlexec.c
dlls/shell32/shlexec.c
+15
-5
No files found.
dlls/shell32/shlexec.c
View file @
94074ad3
...
@@ -306,14 +306,25 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
...
@@ -306,14 +306,25 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
UINT
gcdret
=
0
;
UINT
gcdret
=
0
;
WCHAR
curdir
[
MAX_PATH
];
WCHAR
curdir
[
MAX_PATH
];
DWORD
dwCreationFlags
;
DWORD
dwCreationFlags
;
const
WCHAR
*
lpDirectory
=
NULL
;
TRACE
(
"Execute %s from directory %s
\n
"
,
debugstr_w
(
lpCmd
),
debugstr_w
(
psei
->
lpDirectory
));
TRACE
(
"Execute %s from directory %s
\n
"
,
debugstr_w
(
lpCmd
),
debugstr_w
(
psei
->
lpDirectory
));
/* make sure we don't fail the CreateProcess if the calling app passes in
* a bad working directory */
if
(
psei
->
lpDirectory
&&
psei
->
lpDirectory
[
0
])
{
DWORD
attr
=
GetFileAttributesW
(
psei
->
lpDirectory
);
if
(
attr
!=
INVALID_FILE_ATTRIBUTES
&&
attr
&
FILE_ATTRIBUTE_DIRECTORY
)
lpDirectory
=
psei
->
lpDirectory
;
}
/* ShellExecute specifies the command from psei->lpDirectory
/* ShellExecute specifies the command from psei->lpDirectory
* if present. Not from the current dir as CreateProcess does */
* if present. Not from the current dir as CreateProcess does */
if
(
psei
->
lpDirectory
&&
psei
->
lpDirectory
[
0
]
)
if
(
lpDirectory
)
if
(
(
gcdret
=
GetCurrentDirectoryW
(
MAX_PATH
,
curdir
)))
if
(
(
gcdret
=
GetCurrentDirectoryW
(
MAX_PATH
,
curdir
)))
if
(
!
SetCurrentDirectoryW
(
psei
->
lpDirectory
))
if
(
!
SetCurrentDirectoryW
(
lpDirectory
))
ERR
(
"cannot set directory %s
\n
"
,
debugstr_w
(
psei
->
lpDirectory
));
ERR
(
"cannot set directory %s
\n
"
,
debugstr_w
(
lpDirectory
));
ZeroMemory
(
&
startup
,
sizeof
(
STARTUPINFOW
));
ZeroMemory
(
&
startup
,
sizeof
(
STARTUPINFOW
));
startup
.
cb
=
sizeof
(
STARTUPINFOW
);
startup
.
cb
=
sizeof
(
STARTUPINFOW
);
startup
.
dwFlags
=
STARTF_USESHOWWINDOW
;
startup
.
dwFlags
=
STARTF_USESHOWWINDOW
;
...
@@ -322,8 +333,7 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
...
@@ -322,8 +333,7 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
if
(
psei
->
fMask
&
SEE_MASK_NO_CONSOLE
)
if
(
psei
->
fMask
&
SEE_MASK_NO_CONSOLE
)
dwCreationFlags
|=
CREATE_NEW_CONSOLE
;
dwCreationFlags
|=
CREATE_NEW_CONSOLE
;
if
(
CreateProcessW
(
NULL
,
(
LPWSTR
)
lpCmd
,
NULL
,
NULL
,
FALSE
,
dwCreationFlags
,
env
,
if
(
CreateProcessW
(
NULL
,
(
LPWSTR
)
lpCmd
,
NULL
,
NULL
,
FALSE
,
dwCreationFlags
,
env
,
psei
->
lpDirectory
&&
*
psei
->
lpDirectory
?
psei
->
lpDirectory
:
NULL
,
lpDirectory
,
&
startup
,
&
info
))
&
startup
,
&
info
))
{
{
/* Give 30 seconds to the app to come up, if desired. Probably only needed
/* Give 30 seconds to the app to come up, if desired. Probably only needed
when starting app immediately before making a DDE connection. */
when starting app immediately before making a DDE connection. */
...
...
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