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
e3dbbd14
Commit
e3dbbd14
authored
Nov 16, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Nov 19, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Use a helper function for executing a found executable.
parent
645802d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
17 deletions
+27
-17
shlexec.c
dlls/shell32/shlexec.c
+27
-17
No files found.
dlls/shell32/shlexec.c
View file @
e3dbbd14
...
@@ -1366,12 +1366,35 @@ static BOOL SHELL_translate_idlist( LPSHELLEXECUTEINFOW sei, LPWSTR wszParameter
...
@@ -1366,12 +1366,35 @@ static BOOL SHELL_translate_idlist( LPSHELLEXECUTEINFOW sei, LPWSTR wszParameter
return
appKnownSingular
;
return
appKnownSingular
;
}
}
static
UINT_PTR
SHELL_quote_and_execute
(
LPCWSTR
wcmd
,
LPCWSTR
wszParameters
,
LPWSTR
lpstrProtocol
,
LPCWSTR
wszApplicationName
,
LPWSTR
env
,
LPSHELLEXECUTEINFOW
psei
,
LPSHELLEXECUTEINFOW
psei_out
,
SHELL_ExecuteW32
execfunc
)
{
static
const
WCHAR
wQuote
[]
=
{
'"'
,
0
};
static
const
WCHAR
wSpace
[]
=
{
' '
,
0
};
UINT_PTR
retval
;
WCHAR
wszQuotedCmd
[
MAX_PATH
+
2
];
/* Must quote to handle case where cmd contains spaces,
* else security hole if malicious user creates executable file "C:\\Program"
*/
strcpyW
(
wszQuotedCmd
,
wQuote
);
strcatW
(
wszQuotedCmd
,
wcmd
);
strcatW
(
wszQuotedCmd
,
wQuote
);
if
(
wszParameters
[
0
])
{
strcatW
(
wszQuotedCmd
,
wSpace
);
strcatW
(
wszQuotedCmd
,
wszParameters
);
}
TRACE
(
"%s/%s => %s/%s
\n
"
,
debugstr_w
(
wszApplicationName
),
debugstr_w
(
psei
->
lpVerb
),
debugstr_w
(
wszQuotedCmd
),
debugstr_w
(
lpstrProtocol
));
if
(
*
lpstrProtocol
)
retval
=
execute_from_key
(
lpstrProtocol
,
wszApplicationName
,
env
,
psei
->
lpParameters
,
wcmd
,
execfunc
,
psei
,
psei_out
);
else
retval
=
execfunc
(
wszQuotedCmd
,
env
,
FALSE
,
psei
,
psei_out
);
return
retval
;
}
/*************************************************************************
/*************************************************************************
* SHELL_execute [Internal]
* SHELL_execute [Internal]
*/
*/
BOOL
SHELL_execute
(
LPSHELLEXECUTEINFOW
sei
,
SHELL_ExecuteW32
execfunc
)
BOOL
SHELL_execute
(
LPSHELLEXECUTEINFOW
sei
,
SHELL_ExecuteW32
execfunc
)
{
{
static
const
WCHAR
wQuote
[]
=
{
'"'
,
0
};
static
const
WCHAR
wSpace
[]
=
{
' '
,
0
};
static
const
WCHAR
wSpace
[]
=
{
' '
,
0
};
static
const
WCHAR
wWww
[]
=
{
'w'
,
'w'
,
'w'
,
0
};
static
const
WCHAR
wWww
[]
=
{
'w'
,
'w'
,
'w'
,
0
};
static
const
WCHAR
wFile
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
0
};
static
const
WCHAR
wFile
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
0
};
...
@@ -1666,22 +1689,9 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
...
@@ -1666,22 +1689,9 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
retval
=
SHELL_FindExecutable
(
sei_tmp
.
lpDirectory
,
lpFile
,
sei_tmp
.
lpVerb
,
wcmd
,
1024
,
lpstrProtocol
,
&
env
,
sei_tmp
.
lpIDList
,
sei_tmp
.
lpParameters
);
retval
=
SHELL_FindExecutable
(
sei_tmp
.
lpDirectory
,
lpFile
,
sei_tmp
.
lpVerb
,
wcmd
,
1024
,
lpstrProtocol
,
&
env
,
sei_tmp
.
lpIDList
,
sei_tmp
.
lpParameters
);
if
(
retval
>
32
)
/* Found */
if
(
retval
>
32
)
/* Found */
{
{
WCHAR
wszQuotedCmd
[
MAX_PATH
+
2
];
retval
=
SHELL_quote_and_execute
(
wcmd
,
wszParameters
,
lpstrProtocol
,
/* Must quote to handle case where cmd contains spaces,
wszApplicationName
,
env
,
&
sei_tmp
,
* else security hole if malicious user creates executable file "C:\\Program"
sei
,
execfunc
);
*/
strcpyW
(
wszQuotedCmd
,
wQuote
);
strcatW
(
wszQuotedCmd
,
wcmd
);
strcatW
(
wszQuotedCmd
,
wQuote
);
if
(
wszParameters
[
0
])
{
strcatW
(
wszQuotedCmd
,
wSpace
);
strcatW
(
wszQuotedCmd
,
wszParameters
);
}
TRACE
(
"%s/%s => %s/%s
\n
"
,
debugstr_w
(
wszApplicationName
),
debugstr_w
(
sei_tmp
.
lpVerb
),
debugstr_w
(
wszQuotedCmd
),
debugstr_w
(
lpstrProtocol
));
if
(
*
lpstrProtocol
)
retval
=
execute_from_key
(
lpstrProtocol
,
wszApplicationName
,
env
,
sei_tmp
.
lpParameters
,
wcmd
,
execfunc
,
&
sei_tmp
,
sei
);
else
retval
=
execfunc
(
wszQuotedCmd
,
env
,
FALSE
,
&
sei_tmp
,
sei
);
HeapFree
(
GetProcessHeap
(),
0
,
env
);
HeapFree
(
GetProcessHeap
(),
0
,
env
);
}
}
else
if
(
PathIsURLW
(
lpFile
))
/* File not found, check for URL */
else
if
(
PathIsURLW
(
lpFile
))
/* File not found, check for URL */
...
...
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