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
6223fdc9
Commit
6223fdc9
authored
Apr 12, 2004
by
Martin Fuchs
Committed by
Alexandre Julliard
Apr 12, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- rename 'wszCommandline' to 'wszParameters'
- separate out command line arguments from executable file name
parent
1ab301d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
16 deletions
+78
-16
shlexec.c
dlls/shell32/shlexec.c
+78
-16
No files found.
dlls/shell32/shlexec.c
View file @
6223fdc9
...
...
@@ -917,7 +917,7 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun
static
const
WCHAR
wExtLnk
[]
=
{
'.'
,
'l'
,
'n'
,
'k'
,
0
};
static
const
WCHAR
wExplorer
[]
=
{
'e'
,
'x'
,
'p'
,
'l'
,
'o'
,
'r'
,
'e'
,
'r'
,
'.'
,
'e'
,
'x'
,
'e'
,
0
};
WCHAR
wszApplicationName
[
MAX_PATH
+
2
],
wsz
Commandline
[
1024
],
wszDir
[
MAX_PATH
];
WCHAR
wszApplicationName
[
MAX_PATH
+
2
],
wsz
Parameters
[
1024
],
wszDir
[
MAX_PATH
];
SHELLEXECUTEINFOW
sei_tmp
;
/* modifiable copy of SHELLEXECUTEINFO struct */
WCHAR
wfileName
[
MAX_PATH
];
void
*
env
;
...
...
@@ -947,9 +947,9 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun
*
wszApplicationName
=
'\0'
;
if
(
sei_tmp
.
lpParameters
)
strcpyW
(
wsz
Commandline
,
sei_tmp
.
lpParameters
);
strcpyW
(
wsz
Parameters
,
sei_tmp
.
lpParameters
);
else
*
wsz
Commandline
=
'\0'
;
*
wsz
Parameters
=
'\0'
;
if
(
sei_tmp
.
lpDirectory
)
strcpyW
(
wszDir
,
sei_tmp
.
lpDirectory
);
...
...
@@ -958,7 +958,7 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun
/* adjust string pointers to point to the new buffers */
sei_tmp
.
lpFile
=
wszApplicationName
;
sei_tmp
.
lpParameters
=
wsz
Commandline
;
sei_tmp
.
lpParameters
=
wsz
Parameters
;
sei_tmp
.
lpDirectory
=
wszDir
;
if
(
sei_tmp
.
fMask
&
(
SEE_MASK_INVOKEIDLIST
|
SEE_MASK_ICON
|
SEE_MASK_HOTKEY
|
...
...
@@ -1000,13 +1000,13 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun
HCR_GetExecuteCommandW
((
sei_tmp
.
fMask
&
SEE_MASK_CLASSKEY
)
?
sei_tmp
.
hkeyClass
:
NULL
,
(
sei_tmp
.
fMask
&
SEE_MASK_CLASSNAME
)
?
sei_tmp
.
lpClass
:
NULL
,
(
sei_tmp
.
lpVerb
)
?
sei_tmp
.
lpVerb
:
wszOpen
,
wsz
Commandline
,
sizeof
(
wszCommandline
)
/
sizeof
(
WCHAR
));
wsz
Parameters
,
sizeof
(
wszParameters
)
/
sizeof
(
WCHAR
));
/* FIXME: get the extension of lpFile, check if it fits to the lpClass */
TRACE
(
"SEE_MASK_CLASSNAME->'%s', doc->'%s'
\n
"
,
debugstr_w
(
wsz
Commandline
),
debugstr_w
(
wszApplicationName
));
TRACE
(
"SEE_MASK_CLASSNAME->'%s', doc->'%s'
\n
"
,
debugstr_w
(
wsz
Parameters
),
debugstr_w
(
wszApplicationName
));
wcmd
[
0
]
=
'\0'
;
done
=
SHELL_ArgifyW
(
wcmd
,
sizeof
(
wcmd
)
/
sizeof
(
WCHAR
),
wsz
Commandline
,
wszApplicationName
,
sei_tmp
.
lpIDList
,
NULL
);
done
=
SHELL_ArgifyW
(
wcmd
,
sizeof
(
wcmd
)
/
sizeof
(
WCHAR
),
wsz
Parameters
,
wszApplicationName
,
sei_tmp
.
lpIDList
,
NULL
);
if
(
!
done
&&
wszApplicationName
[
0
])
{
strcatW
(
wcmd
,
wSpace
);
...
...
@@ -1033,7 +1033,7 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun
if
(
*
sei_tmp
.
lpParameters
)
if
(
ExpandEnvironmentStringsW
(
sei_tmp
.
lpParameters
,
buffer
,
MAX_PATH
))
lstrcpyW
(
wsz
Commandline
/*sei_tmp.lpParameters*/
,
buffer
);
lstrcpyW
(
wsz
Parameters
/*sei_tmp.lpParameters*/
,
buffer
);
hr
=
SHELL_ResolveShortCutW
((
LPWSTR
)
sei_tmp
.
lpFile
,
(
LPWSTR
)
sei_tmp
.
lpParameters
,
(
LPWSTR
)
sei_tmp
.
lpDirectory
,
sei_tmp
.
hwnd
,
sei_tmp
.
lpVerb
?
sei_tmp
.
lpVerb
:
wszEmpty
,
&
sei_tmp
.
nShow
,
(
LPITEMIDLIST
*
)
&
sei_tmp
.
lpIDList
);
...
...
@@ -1073,7 +1073,7 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun
if
(
SUCCEEDED
(
SHELL_GetPathFromIDListForExecuteW
(
sei_tmp
.
lpIDList
,
buffer
,
sizeof
(
buffer
))))
{
if
(
buffer
[
0
]
==
':'
&&
buffer
[
1
]
==
':'
)
{
/* open shell folder for the specified class GUID */
strcpyW
(
wsz
Commandline
,
buffer
);
strcpyW
(
wsz
Parameters
,
buffer
);
strcpyW
(
wszApplicationName
,
wExplorer
);
sei_tmp
.
fMask
&=
~
SEE_MASK_INVOKEIDLIST
;
...
...
@@ -1092,20 +1092,82 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun
if
(
*
sei_tmp
.
lpParameters
)
if
(
ExpandEnvironmentStringsW
(
sei_tmp
.
lpParameters
,
buffer
,
MAX_PATH
))
lstrcpyW
(
wsz
Commandline
,
buffer
);
lstrcpyW
(
wsz
Parameters
,
buffer
);
if
(
*
sei_tmp
.
lpDirectory
)
if
(
ExpandEnvironmentStringsW
(
sei_tmp
.
lpDirectory
,
buffer
,
MAX_PATH
))
lstrcpyW
(
wszDir
,
buffer
);
/* Else, try to execute the filename */
TRACE
(
"execute:'%s','%s','%s'
\n
"
,
debugstr_w
(
wszApplicationName
),
debugstr_w
(
wszCommandline
),
debugstr_w
(
wszDir
));
TRACE
(
"execute:'%s','%s','%s'
\n
"
,
debugstr_w
(
wszApplicationName
),
debugstr_w
(
wszParameters
),
debugstr_w
(
wszDir
));
/* separate out command line arguments from executable file name */
if
(
!*
sei_tmp
.
lpParameters
)
{
/* If the executable path is quoted, handle the rest of the command line as parameters. */
if
(
sei_tmp
.
lpFile
[
0
]
==
'"'
)
{
LPWSTR
src
=
wszApplicationName
/*sei_tmp.lpFile*/
+
1
;
LPWSTR
dst
=
wfileName
;
LPWSTR
end
;
/* copy the unquoted executable path to 'wfileName' */
while
(
*
src
&&
*
src
!=
'"'
)
*
dst
++
=
*
src
++
;
*
dst
=
'\0'
;
if
(
*
src
==
'"'
)
{
end
=
++
src
;
while
(
isspace
(
*
src
))
++
src
;
}
else
end
=
src
;
/* copy the parameter string to 'wszParameters' */
strcpyW
(
wszParameters
,
src
);
/* terminate previous command string after the quote character */
*
end
=
'\0'
;
}
else
{
/* If the executable name is not quoted, we have to use this search loop here,
that in CreateProcess() is not sufficient because it does not handle shell links. */
WCHAR
buffer
[
MAX_PATH
],
xlpFile
[
MAX_PATH
];
LPWSTR
space
,
s
;
LPWSTR
beg
=
wszApplicationName
/*sei_tmp.lpFile*/
;
for
(
s
=
beg
;
(
space
=
strchrW
(
s
,
' '
));
s
=
space
+
1
)
{
int
idx
=
space
-
sei_tmp
.
lpFile
;
strncpyW
(
buffer
,
sei_tmp
.
lpFile
,
idx
);
buffer
[
idx
]
=
'\0'
;
/*FIXME This finds directory paths if the targeted file name contains spaces. */
if
(
SearchPathW
(
*
sei_tmp
.
lpDirectory
?
sei_tmp
.
lpDirectory
:
NULL
,
buffer
,
wszExe
,
sizeof
(
xlpFile
),
xlpFile
,
NULL
))
{
/* separate out command from parameter string */
LPCWSTR
p
=
space
+
1
;
while
(
isspaceW
(
*
p
))
++
p
;
strcpyW
(
wszParameters
,
p
);
*
space
=
'\0'
;
break
;
}
}
strcpyW
(
wfileName
,
sei_tmp
.
lpFile
);
}
}
else
strcpyW
(
wfileName
,
sei_tmp
.
lpFile
);
strcpyW
(
wfileName
,
wszApplicationName
);
lpFile
=
wfileName
;
if
(
wszCommandline
[
0
])
{
if
(
sei_tmp
.
lpParameters
[
0
])
{
strcatW
(
wszApplicationName
,
wSpace
);
strcatW
(
wszApplicationName
,
wsz
Commandline
);
strcatW
(
wszApplicationName
,
wsz
Parameters
);
}
retval
=
execfunc
(
wszApplicationName
,
NULL
,
FALSE
,
&
sei_tmp
,
sei
);
...
...
@@ -1124,9 +1186,9 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun
strcpyW
(
wszQuotedCmd
,
wQuote
);
strcatW
(
wszQuotedCmd
,
wcmd
);
strcatW
(
wszQuotedCmd
,
wQuote
);
if
(
wsz
Commandline
[
0
])
{
if
(
wsz
Parameters
[
0
])
{
strcatW
(
wszQuotedCmd
,
wSpace
);
strcatW
(
wszQuotedCmd
,
wsz
Commandline
);
strcatW
(
wszQuotedCmd
,
wsz
Parameters
);
}
TRACE
(
"%s/%s => %s/%s
\n
"
,
debugstr_w
(
wszApplicationName
),
debugstr_w
(
sei_tmp
.
lpVerb
),
debugstr_w
(
wszQuotedCmd
),
debugstr_w
(
lpstrProtocol
));
if
(
*
lpstrProtocol
)
...
...
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