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
dccccfc2
Commit
dccccfc2
authored
Oct 16, 2012
by
Jason Edmeades
Committed by
Alexandre Julliard
Oct 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Handle very odd delimiter support for command line.
parent
f9105db0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
50 deletions
+63
-50
batch.c
programs/cmd/batch.c
+14
-3
builtins.c
programs/cmd/builtins.c
+26
-25
directory.c
programs/cmd/directory.c
+1
-1
test_cmdline.cmd.exp
programs/cmd/tests/test_cmdline.cmd.exp
+11
-11
wcmd.h
programs/cmd/wcmd.h
+1
-1
wcmdmain.c
programs/cmd/wcmdmain.c
+10
-9
No files found.
programs/cmd/batch.c
View file @
dccccfc2
...
...
@@ -128,6 +128,9 @@ void WCMD_batch (WCHAR *file, WCHAR *command, BOOL called, WCHAR *startLabel, HA
* end [O] Optional. Pointer to the last char of param n in s
* raw [I] True to return the parameter in raw format (quotes maintained)
* False returns the parameter with quotes stripped
* wholecmdline [I] True to indicate this routine is being used to parse the
* command line, and special logic for arg0->1 transition
* needs to be applied.
*
* RETURNS
* Success: The nth delimited parameter found in s
...
...
@@ -143,7 +146,8 @@ void WCMD_batch (WCHAR *file, WCHAR *command, BOOL called, WCHAR *startLabel, HA
* other API calls, e.g. c:\"a b"\c is returned as c:\a b\c. However, some commands
* need to preserve the exact syntax (echo, for, etc) hence the raw option.
*/
WCHAR
*
WCMD_parameter
(
WCHAR
*
s
,
int
n
,
WCHAR
**
start
,
WCHAR
**
end
,
BOOL
raw
)
WCHAR
*
WCMD_parameter
(
WCHAR
*
s
,
int
n
,
WCHAR
**
start
,
WCHAR
**
end
,
BOOL
raw
,
BOOL
wholecmdline
)
{
static
const
WCHAR
defaultDelims
[]
=
{
' '
,
'\t'
,
','
,
'='
,
';'
,
'\0'
};
int
curParamNb
=
0
;
...
...
@@ -173,6 +177,12 @@ WCHAR *WCMD_parameter (WCHAR *s, int n, WCHAR **start, WCHAR **end, BOOL raw)
/* Once we have found a delimiter, break */
if
(
strchrW
(
defaultDelims
,
*
p
)
!=
NULL
)
break
;
/* Very odd special case - Seems as if a ( acts as a delimiter which is
not swallowed but is effective only when it comes between the program
name and the parameters. Need to avoid this triggering when used
to walk parameters generally. */
if
(
wholecmdline
&&
curParamNb
==
0
&&
*
p
==
'('
)
break
;
/* If we find a quote, copy until we get the end quote */
if
(
*
p
==
'"'
)
{
p
++
;
...
...
@@ -418,8 +428,9 @@ void WCMD_HandleTildaModifiers(WCHAR **start, const WCHAR *forVariable,
strcpyW
(
outputparam
,
context
->
batchfileW
);
}
else
if
((
*
lastModifier
>=
'1'
&&
*
lastModifier
<=
'9'
))
{
strcpyW
(
outputparam
,
WCMD_parameter
(
context
->
command
,
*
lastModifier
-
'0'
+
context
->
shift_count
[
*
lastModifier
-
'0'
],
NULL
,
NULL
,
FALSE
));
WCMD_parameter
(
context
->
command
,
*
lastModifier
-
'0'
+
context
->
shift_count
[
*
lastModifier
-
'0'
],
NULL
,
NULL
,
FALSE
,
TRUE
));
}
else
{
strcpyW
(
outputparam
,
forValue
);
}
...
...
programs/cmd/builtins.c
View file @
dccccfc2
...
...
@@ -541,7 +541,7 @@ void WCMD_copy(WCHAR * command) {
opt_d
=
opt_v
=
opt_n
=
opt_z
=
opt_y
=
opt_noty
=
FALSE
;
/* Walk through all args, building up a list of files to process */
thisparam
=
WCMD_parameter
(
command
,
argno
++
,
&
rawarg
,
NULL
,
TRUE
);
thisparam
=
WCMD_parameter
(
command
,
argno
++
,
&
rawarg
,
NULL
,
TRUE
,
FALSE
);
while
(
*
(
thisparam
))
{
WCHAR
*
pos1
,
*
pos2
;
BOOL
inquotes
;
...
...
@@ -599,7 +599,7 @@ void WCMD_copy(WCHAR * command) {
}
/* This parameter was purely switches, get the next one */
thisparam
=
WCMD_parameter
(
command
,
argno
++
,
&
rawarg
,
NULL
,
TRUE
);
thisparam
=
WCMD_parameter
(
command
,
argno
++
,
&
rawarg
,
NULL
,
TRUE
,
FALSE
);
continue
;
}
...
...
@@ -623,7 +623,8 @@ void WCMD_copy(WCHAR * command) {
/* Move to next thing to process */
thisparam
++
;
if
(
*
thisparam
==
0x00
)
thisparam
=
WCMD_parameter
(
command
,
argno
++
,
&
rawarg
,
NULL
,
TRUE
);
if
(
*
thisparam
==
0x00
)
thisparam
=
WCMD_parameter
(
command
,
argno
++
,
&
rawarg
,
NULL
,
TRUE
,
FALSE
);
continue
;
}
...
...
@@ -680,7 +681,7 @@ void WCMD_copy(WCHAR * command) {
thisparam
=
pos1
;
continue
;
}
else
{
thisparam
=
WCMD_parameter
(
command
,
argno
++
,
&
rawarg
,
NULL
,
TRUE
);
thisparam
=
WCMD_parameter
(
command
,
argno
++
,
&
rawarg
,
NULL
,
TRUE
,
FALSE
);
}
}
...
...
@@ -1018,7 +1019,7 @@ void WCMD_create_dir (WCHAR *command) {
}
/* Loop through all args */
while
(
TRUE
)
{
WCHAR
*
thisArg
=
WCMD_parameter
(
command
,
argno
++
,
&
argN
,
NULL
,
FALSE
);
WCHAR
*
thisArg
=
WCMD_parameter
(
command
,
argno
++
,
&
argN
,
NULL
,
FALSE
,
FALSE
);
if
(
!
argN
)
break
;
if
(
!
create_full_path
(
thisArg
))
{
WCMD_print_error
();
...
...
@@ -1323,7 +1324,7 @@ BOOL WCMD_delete (WCHAR *command) {
WCHAR
*
thisArg
;
argN
=
NULL
;
thisArg
=
WCMD_parameter
(
command
,
argno
,
&
argN
,
NULL
,
FALSE
);
thisArg
=
WCMD_parameter
(
command
,
argno
,
&
argN
,
NULL
,
FALSE
,
FALSE
);
if
(
!
argN
)
break
;
/* no more parameters */
if
(
argN
[
0
]
==
'/'
)
...
...
@@ -1547,7 +1548,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
int
parameterNo
=
0
;
/* Handle optional qualifiers (multiple are allowed) */
WCHAR
*
thisArg
=
WCMD_parameter
(
p
,
parameterNo
++
,
NULL
,
NULL
,
FALSE
);
WCHAR
*
thisArg
=
WCMD_parameter
(
p
,
parameterNo
++
,
NULL
,
NULL
,
FALSE
,
FALSE
);
optionsRoot
[
0
]
=
0
;
while
(
thisArg
&&
*
thisArg
==
'/'
)
{
...
...
@@ -1571,7 +1572,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
/* Retrieve next parameter to see if is root/options (raw form required
with for /f, or unquoted in for /r) */
thisArg
=
WCMD_parameter
(
p
,
parameterNo
,
NULL
,
NULL
,
doFileset
);
thisArg
=
WCMD_parameter
(
p
,
parameterNo
,
NULL
,
NULL
,
doFileset
,
FALSE
);
/* Next parm is either qualifier, path/options or variable -
only care about it if it is the path/options */
...
...
@@ -1590,7 +1591,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
}
/* Step to next token */
thisArg
=
WCMD_parameter
(
p
,
parameterNo
++
,
NULL
,
NULL
,
FALSE
);
thisArg
=
WCMD_parameter
(
p
,
parameterNo
++
,
NULL
,
NULL
,
FALSE
,
FALSE
);
}
/* Ensure line continues with variable */
...
...
@@ -1615,7 +1616,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
WINE_TRACE
(
"Variable identified as %s
\n
"
,
wine_dbgstr_w
(
variable
));
/* Ensure line continues with IN */
thisArg
=
WCMD_parameter
(
p
,
parameterNo
++
,
NULL
,
NULL
,
FALSE
);
thisArg
=
WCMD_parameter
(
p
,
parameterNo
++
,
NULL
,
NULL
,
FALSE
,
FALSE
);
if
(
!
thisArg
||
!
(
CompareStringW
(
LOCALE_USER_DEFAULT
,
NORM_IGNORECASE
|
SORT_STRINGSORT
,
thisArg
,
sizeof
(
inW
)
/
sizeof
(
inW
[
0
]),
inW
,
...
...
@@ -1714,7 +1715,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
WINE_TRACE
(
"Processing for set %p
\n
"
,
thisSet
);
i
=
0
;
while
(
*
(
item
=
WCMD_parameter
(
thisSet
->
command
,
i
,
&
itemStart
,
NULL
,
TRUE
)))
{
while
(
*
(
item
=
WCMD_parameter
(
thisSet
->
command
,
i
,
&
itemStart
,
NULL
,
TRUE
,
FALSE
)))
{
/*
* If the parameter within the set has a wildcard then search for matching files
...
...
@@ -1835,7 +1836,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
while
(
WCMD_fgets
(
buffer
,
sizeof
(
buffer
)
/
sizeof
(
WCHAR
),
input
))
{
/* Skip blank lines*/
parm
=
WCMD_parameter
(
buffer
,
0
,
&
where
,
NULL
,
FALSE
);
parm
=
WCMD_parameter
(
buffer
,
0
,
&
where
,
NULL
,
FALSE
,
FALSE
);
WINE_TRACE
(
"Parsed parameter: %s from %s
\n
"
,
wine_dbgstr_w
(
parm
),
wine_dbgstr_w
(
buffer
));
...
...
@@ -1866,7 +1867,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
/* Skip blank lines, and re-extract parameter now string has quotes removed */
strcpyW
(
buffer
,
item
);
parm
=
WCMD_parameter
(
buffer
,
0
,
&
where
,
NULL
,
FALSE
);
parm
=
WCMD_parameter
(
buffer
,
0
,
&
where
,
NULL
,
FALSE
,
FALSE
);
WINE_TRACE
(
"Parsed parameter: %s from %s
\n
"
,
wine_dbgstr_w
(
parm
),
wine_dbgstr_w
(
buffer
));
...
...
@@ -2138,7 +2139,7 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) {
WINE_TRACE
(
"Condition: %s
\n
"
,
wine_dbgstr_w
(
condition
));
if
(
!
lstrcmpiW
(
condition
,
errlvlW
))
{
WCHAR
*
param
=
WCMD_parameter
(
p
,
1
+
negate
,
NULL
,
NULL
,
FALSE
);
WCHAR
*
param
=
WCMD_parameter
(
p
,
1
+
negate
,
NULL
,
NULL
,
FALSE
,
FALSE
);
WCHAR
*
endptr
;
long
int
param_int
=
strtolW
(
param
,
&
endptr
,
10
);
if
(
*
endptr
)
{
...
...
@@ -2146,24 +2147,24 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) {
return
;
}
test
=
((
long
int
)
errorlevel
>=
param_int
);
WCMD_parameter
(
p
,
2
+
negate
,
&
command
,
NULL
,
FALSE
);
WCMD_parameter
(
p
,
2
+
negate
,
&
command
,
NULL
,
FALSE
,
FALSE
);
}
else
if
(
!
lstrcmpiW
(
condition
,
existW
))
{
test
=
(
GetFileAttributesW
(
WCMD_parameter
(
p
,
1
+
negate
,
NULL
,
NULL
,
FALSE
))
test
=
(
GetFileAttributesW
(
WCMD_parameter
(
p
,
1
+
negate
,
NULL
,
NULL
,
FALSE
,
FALSE
))
!=
INVALID_FILE_ATTRIBUTES
);
WCMD_parameter
(
p
,
2
+
negate
,
&
command
,
NULL
,
FALSE
);
WCMD_parameter
(
p
,
2
+
negate
,
&
command
,
NULL
,
FALSE
,
FALSE
);
}
else
if
(
!
lstrcmpiW
(
condition
,
defdW
))
{
test
=
(
GetEnvironmentVariableW
(
WCMD_parameter
(
p
,
1
+
negate
,
NULL
,
NULL
,
FALSE
),
test
=
(
GetEnvironmentVariableW
(
WCMD_parameter
(
p
,
1
+
negate
,
NULL
,
NULL
,
FALSE
,
FALSE
),
NULL
,
0
)
>
0
);
WCMD_parameter
(
p
,
2
+
negate
,
&
command
,
NULL
,
FALSE
);
WCMD_parameter
(
p
,
2
+
negate
,
&
command
,
NULL
,
FALSE
,
FALSE
);
}
else
if
((
s
=
strstrW
(
p
,
eqeqW
)))
{
/* We need to get potential surrounding double quotes, so param1/2 can't be used */
WCHAR
*
leftPart
,
*
leftPartEnd
,
*
rightPart
,
*
rightPartEnd
;
s
+=
2
;
WCMD_parameter
(
p
,
0
+
negate
+
caseInsensitive
,
&
leftPart
,
&
leftPartEnd
,
FALSE
);
WCMD_parameter
(
p
,
1
+
negate
+
caseInsensitive
,
&
rightPart
,
&
rightPartEnd
,
FALSE
);
WCMD_parameter
(
p
,
0
+
negate
+
caseInsensitive
,
&
leftPart
,
&
leftPartEnd
,
FALSE
,
FALSE
);
WCMD_parameter
(
p
,
1
+
negate
+
caseInsensitive
,
&
rightPart
,
&
rightPartEnd
,
FALSE
,
FALSE
);
test
=
caseInsensitive
?
(
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
leftPart
,
leftPartEnd
-
leftPart
+
1
,
...
...
@@ -2171,7 +2172,7 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) {
:
(
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
0
,
leftPart
,
leftPartEnd
-
leftPart
+
1
,
rightPart
,
rightPartEnd
-
rightPart
+
1
)
==
CSTR_EQUAL
);
WCMD_parameter
(
s
,
1
,
&
command
,
NULL
,
FALSE
);
WCMD_parameter
(
s
,
1
,
&
command
,
NULL
,
FALSE
,
FALSE
);
}
else
{
WCMD_output_stderr
(
WCMD_LoadMessage
(
WCMD_SYNTAXERR
));
...
...
@@ -2346,7 +2347,7 @@ void WCMD_remove_dir (WCHAR *command) {
/* Loop through all args */
while
(
argN
)
{
WCHAR
*
thisArg
=
WCMD_parameter
(
command
,
argno
++
,
&
argN
,
NULL
,
FALSE
);
WCHAR
*
thisArg
=
WCMD_parameter
(
command
,
argno
++
,
&
argN
,
NULL
,
FALSE
,
FALSE
);
if
(
argN
&&
argN
[
0
]
!=
'/'
)
{
WINE_TRACE
(
"rd: Processing arg %s (quals:%s)
\n
"
,
wine_dbgstr_w
(
thisArg
),
wine_dbgstr_w
(
quals
));
...
...
@@ -3118,7 +3119,7 @@ void WCMD_type (WCHAR *command) {
/* Loop through all args */
errorlevel
=
0
;
while
(
argN
)
{
WCHAR
*
thisArg
=
WCMD_parameter
(
command
,
argno
++
,
&
argN
,
NULL
,
FALSE
);
WCHAR
*
thisArg
=
WCMD_parameter
(
command
,
argno
++
,
&
argN
,
NULL
,
FALSE
,
FALSE
);
HANDLE
h
;
WCHAR
buffer
[
512
];
...
...
@@ -3212,7 +3213,7 @@ void WCMD_more (WCHAR *command) {
WCMD_enter_paged_mode
(
moreStrPage
);
while
(
argN
)
{
WCHAR
*
thisArg
=
WCMD_parameter
(
command
,
argno
++
,
&
argN
,
NULL
,
FALSE
);
WCHAR
*
thisArg
=
WCMD_parameter
(
command
,
argno
++
,
&
argN
,
NULL
,
FALSE
,
FALSE
);
HANDLE
h
;
if
(
!
argN
)
break
;
...
...
programs/cmd/directory.c
View file @
dccccfc2
...
...
@@ -803,7 +803,7 @@ void WCMD_directory (WCHAR *cmd)
prevEntry
=
NULL
;
while
(
argN
)
{
WCHAR
fullname
[
MAXSTRING
];
WCHAR
*
thisArg
=
WCMD_parameter
(
cmd
,
argno
++
,
&
argN
,
NULL
,
FALSE
);
WCHAR
*
thisArg
=
WCMD_parameter
(
cmd
,
argno
++
,
&
argN
,
NULL
,
FALSE
,
FALSE
);
if
(
argN
&&
argN
[
0
]
!=
'/'
)
{
WINE_TRACE
(
"Found parm '%s'
\n
"
,
wine_dbgstr_w
(
thisArg
));
...
...
programs/cmd/tests/test_cmdline.cmd.exp
View file @
dccccfc2
...
...
@@ -57,7 +57,7 @@ var=33@space@
0@space@
3@space@
3@space@
@todo_wine@
4@space@
4@space@
------ Testing invocation with CMD /C -------------
0@space@
1@space@
...
...
@@ -69,7 +69,7 @@ var=33@space@
2@space@
0@space@
3@space@
@todo_wine@
4@space@
4@space@
---------- Testing CMD /C quoting -----------------
"hi"
1@space@
...
...
@@ -93,7 +93,7 @@ THIS FAILS: cmd "/c"say one
THIS FAILS: cmd ignoreme/c say one
--------- Testing special characters --------------
0@space@
@todo_wine@
0@space@
0@space@
)@space@
[@space@
]@space@
...
...
@@ -113,10 +113,10 @@ THIS FAILS: cmd ignoreme/c say one
1:1,2:@space@
1:(1),2:@space@
1:1(2),2:@space@
@todo_wine@
1:(1),2:@space@
@todo_wine@
1:((1)),2:@space@
@todo_wine@
1:(1)(2),2:@space@
@todo_wine@
1:(1),2:(2)@space@
1:(1),2:@space@
1:((1)),2:@space@
1:(1)(2),2:@space@
1:(1),2:(2)@space@
1:1,2:2@space@
1:1,2:2@space@
1:1,2:2@space@
...
...
@@ -126,7 +126,7 @@ THIS FAILS: cmd ignoreme/c say one
0:tell,1:1,2:2,All:'1 2'@or_broken@0:tell,1:1,2:2,All:' 1 2'
0:tell,1:1,2:2,All:'1 2'@or_broken@0:tell,1:1,2:2,All:' 1 2'
0:tell,1:1,2:2,All:'==1==2'
@todo_wine@
0:tell,1:(1234),2:,All:'(1234)'
@todo_wine@
0:tell,1:(12(34),2:,All:'(12(34)'
@todo_wine@
0:tell,1:(12,2:34),All:'(12;34)'
@todo_wine@
--------- Finished --------------
0:tell,1:(1234),2:,All:'(1234)'
0:tell,1:(12(34),2:,All:'(12(34)'
0:tell,1:(12,2:34),All:'(12;34)'
--------- Finished --------------
programs/cmd/wcmd.h
View file @
dccccfc2
...
...
@@ -107,7 +107,7 @@ static inline BOOL WCMD_is_console_handle(HANDLE h)
return
(((
DWORD_PTR
)
h
)
&
3
)
==
3
;
}
WCHAR
*
WCMD_fgets
(
WCHAR
*
buf
,
DWORD
n
,
HANDLE
stream
);
WCHAR
*
WCMD_parameter
(
WCHAR
*
s
,
int
n
,
WCHAR
**
start
,
WCHAR
**
end
,
BOOL
raw
);
WCHAR
*
WCMD_parameter
(
WCHAR
*
s
,
int
n
,
WCHAR
**
start
,
WCHAR
**
end
,
BOOL
raw
,
BOOL
wholecmdline
);
WCHAR
*
WCMD_skip_leading_spaces
(
WCHAR
*
string
);
BOOL
WCMD_keyword_ws_found
(
const
WCHAR
*
keyword
,
int
len
,
const
WCHAR
*
ptr
);
void
WCMD_HandleTildaModifiers
(
WCHAR
**
start
,
const
WCHAR
*
forVariable
,
const
WCHAR
*
forValue
,
BOOL
justFors
);
...
...
programs/cmd/wcmdmain.c
View file @
dccccfc2
...
...
@@ -837,13 +837,14 @@ static void handleExpansion(WCHAR *cmd, BOOL justFors,
/* Replace use of %0...%9 if in batch program*/
}
else
if
(
!
justFors
&&
context
&&
(
i
>=
0
)
&&
(
i
<=
9
))
{
t
=
WCMD_parameter
(
context
->
command
,
i
+
context
->
shift_count
[
i
],
NULL
,
NULL
,
TRUE
);
t
=
WCMD_parameter
(
context
->
command
,
i
+
context
->
shift_count
[
i
],
NULL
,
NULL
,
TRUE
,
TRUE
);
WCMD_strsubstW
(
p
,
p
+
2
,
t
,
-
1
);
/* Replace use of %* if in batch program*/
}
else
if
(
!
justFors
&&
context
&&
*
(
p
+
1
)
==
'*'
)
{
WCHAR
*
startOfParms
=
NULL
;
WCMD_parameter
(
context
->
command
,
0
,
NULL
,
&
startOfParms
,
TRUE
);
WCMD_parameter
(
context
->
command
,
0
,
NULL
,
&
startOfParms
,
TRUE
,
TRUE
);
if
(
startOfParms
!=
NULL
)
{
startOfParms
++
;
/* Skip to first delimiter then skip whitespace */
while
(
*
startOfParms
==
' '
||
*
startOfParms
==
'\t'
)
startOfParms
++
;
...
...
@@ -1021,7 +1022,7 @@ void WCMD_run_program (WCHAR *command, BOOL called)
/* Quick way to get the filename is to extract the first argument. */
WINE_TRACE
(
"Running '%s' (%d)
\n
"
,
wine_dbgstr_w
(
command
),
called
);
firstParam
=
WCMD_parameter
(
command
,
0
,
NULL
,
NULL
,
FALSE
);
firstParam
=
WCMD_parameter
(
command
,
0
,
NULL
,
NULL
,
FALSE
,
TRUE
);
if
(
!
firstParam
)
return
;
/* Calculate the search path and stem to search for */
...
...
@@ -1359,7 +1360,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
/* Otherwise STDIN could come from a '<' redirect */
}
else
if
((
p
=
strchrW
(
new_redir
,
'<'
))
!=
NULL
)
{
h
=
CreateFileW
(
WCMD_parameter
(
++
p
,
0
,
NULL
,
NULL
,
FALSE
),
GENERIC_READ
,
FILE_SHARE_READ
,
h
=
CreateFileW
(
WCMD_parameter
(
++
p
,
0
,
NULL
,
NULL
,
FALSE
,
FALSE
),
GENERIC_READ
,
FILE_SHARE_READ
,
&
sa
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
h
==
INVALID_HANDLE_VALUE
)
{
WCMD_print_error
();
...
...
@@ -1404,7 +1405,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
WINE_TRACE
(
"Redirect %d (%p) to %d (%p)
\n
"
,
handle
,
GetStdHandle
(
idx_stdhandles
[
idx
]),
idx
,
h
);
}
else
{
WCHAR
*
param
=
WCMD_parameter
(
p
,
0
,
NULL
,
NULL
,
FALSE
);
WCHAR
*
param
=
WCMD_parameter
(
p
,
0
,
NULL
,
NULL
,
FALSE
,
FALSE
);
h
=
CreateFileW
(
param
,
GENERIC_WRITE
,
0
,
&
sa
,
creationDisposition
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
h
==
INVALID_HANDLE_VALUE
)
{
...
...
@@ -2330,14 +2331,14 @@ int wmain (int argc, WCHAR *argvW[])
args
=
1
;
/* start at first arg, skipping cmd.exe itself */
opt_c
=
opt_k
=
opt_q
=
opt_s
=
FALSE
;
WCMD_parameter
(
cmdLine
,
args
,
&
argPos
,
NULL
,
TRUE
);
WCMD_parameter
(
cmdLine
,
args
,
&
argPos
,
NULL
,
TRUE
,
TRUE
);
while
(
argPos
&&
argPos
[
0
]
!=
0x00
)
{
WCHAR
c
;
WINE_TRACE
(
"Command line parm: '%s'
\n
"
,
wine_dbgstr_w
(
argPos
));
if
(
argPos
[
0
]
!=
'/'
||
argPos
[
1
]
==
'\0'
)
{
args
++
;
WCMD_parameter
(
cmdLine
,
args
,
&
argPos
,
NULL
,
TRUE
);
WCMD_parameter
(
cmdLine
,
args
,
&
argPos
,
NULL
,
TRUE
,
TRUE
);
continue
;
}
...
...
@@ -2362,7 +2363,7 @@ int wmain (int argc, WCHAR *argvW[])
if
(
argPos
[
2
]
==
0
||
argPos
[
2
]
==
' '
||
argPos
[
2
]
==
'\t'
)
{
args
++
;
WCMD_parameter
(
cmdLine
,
args
,
&
argPos
,
NULL
,
TRUE
);
WCMD_parameter
(
cmdLine
,
args
,
&
argPos
,
NULL
,
TRUE
,
TRUE
);
}
else
/* handle `cmd /cnotepad.exe` and `cmd /x/c ...` */
{
...
...
@@ -2443,7 +2444,7 @@ int wmain (int argc, WCHAR *argvW[])
/* Finally, we only stay in new mode IF the first parameter is quoted and
is a valid executable, ie must exist, otherwise drop back to old mode */
if
(
!
opt_s
)
{
WCHAR
*
thisArg
=
WCMD_parameter
(
cmd
,
0
,
NULL
,
NULL
,
FALSE
);
WCHAR
*
thisArg
=
WCMD_parameter
(
cmd
,
0
,
NULL
,
NULL
,
FALSE
,
TRUE
);
WCHAR
pathext
[
MAXSTRING
];
BOOL
found
=
FALSE
;
...
...
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