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
25cf0aa0
Commit
25cf0aa0
authored
Oct 13, 2012
by
Jason Edmeades
Committed by
Alexandre Julliard
Oct 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: cmd /c "pgmname" searches all extensions on PATHEXT.
parent
50bdb257
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
32 deletions
+57
-32
test_cmdline.cmd.exp
programs/cmd/tests/test_cmdline.cmd.exp
+4
-4
wcmdmain.c
programs/cmd/wcmdmain.c
+53
-28
No files found.
programs/cmd/tests/test_cmdline.cmd.exp
View file @
25cf0aa0
...
...
@@ -60,7 +60,7 @@ var=33@space@
@todo_wine@4@space@
------ Testing invocation with CMD /C -------------
0@space@
@todo_wine@
1@space@
1@space@
@todo_wine@0@space@
0@space@
@todo_wine@1@space@
...
...
@@ -74,7 +74,7 @@ var=33@space@
"hi"
@todo_wine@1@space@
"\"\\"\\\"\\\\"@space@"\"\\"\\\"\\\\"
@todo_wine@
1@space@
1@space@
0@space@
1@space@
0@space@
...
...
@@ -85,10 +85,10 @@ var=33@space@
2@space@
2@space@
0@space@
@todo_wine@
5@space@
5@space@
------- Testing CMD /C qualifier treatment ------------
0@space@
@todo_wine@
1@space@
1@space@
THIS FAILS: cmd "/c"say one
THIS FAILS: cmd ignoreme/c say one
--------- Testing special characters --------------
...
...
programs/cmd/wcmdmain.c
View file @
25cf0aa0
...
...
@@ -47,6 +47,11 @@ BOOL echo_mode = TRUE;
WCHAR
anykey
[
100
],
version_string
[
100
];
const
WCHAR
newlineW
[]
=
{
'\r'
,
'\n'
,
'\0'
};
const
WCHAR
spaceW
[]
=
{
' '
,
'\0'
};
static
const
WCHAR
envPathExt
[]
=
{
'P'
,
'A'
,
'T'
,
'H'
,
'E'
,
'X'
,
'T'
,
'\0'
};
static
const
WCHAR
dfltPathExt
[]
=
{
'.'
,
'b'
,
'a'
,
't'
,
';'
,
'.'
,
'c'
,
'o'
,
'm'
,
';'
,
'.'
,
'c'
,
'm'
,
'd'
,
';'
,
'.'
,
'e'
,
'x'
,
'e'
,
'\0'
};
static
BOOL
opt_c
,
opt_k
,
opt_s
,
unicodeOutput
=
FALSE
;
...
...
@@ -1009,7 +1014,6 @@ void WCMD_run_program (WCHAR *command, BOOL called)
BOOL
assumeInternal
=
FALSE
;
DWORD
len
;
static
const
WCHAR
envPath
[]
=
{
'P'
,
'A'
,
'T'
,
'H'
,
'\0'
};
static
const
WCHAR
envPathExt
[]
=
{
'P'
,
'A'
,
'T'
,
'H'
,
'E'
,
'X'
,
'T'
,
'\0'
};
static
const
WCHAR
delims
[]
=
{
'/'
,
'\\'
,
':'
,
'\0'
};
/* Quick way to get the filename
...
...
@@ -1055,10 +1059,6 @@ void WCMD_run_program (WCHAR *command, BOOL called)
/* Now extract PATHEXT */
len
=
GetEnvironmentVariableW
(
envPathExt
,
pathext
,
sizeof
(
pathext
)
/
sizeof
(
WCHAR
));
if
((
len
==
0
)
||
(
len
>=
(
sizeof
(
pathext
)
/
sizeof
(
WCHAR
))))
{
static
const
WCHAR
dfltPathExt
[]
=
{
'.'
,
'b'
,
'a'
,
't'
,
';'
,
'.'
,
'c'
,
'o'
,
'm'
,
';'
,
'.'
,
'c'
,
'm'
,
'd'
,
';'
,
'.'
,
'e'
,
'x'
,
'e'
,
'\0'
};
strcpyW
(
pathext
,
dfltPathExt
);
}
...
...
@@ -2445,10 +2445,15 @@ int wmain (int argc, WCHAR *argvW[])
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
);
static
const
WCHAR
extEXEW
[]
=
{
'.'
,
'e'
,
'x'
,
'e'
,
'\0'
};
static
const
WCHAR
extCOMW
[]
=
{
'.'
,
'c'
,
'o'
,
'm'
,
'\0'
};
WCHAR
pathext
[
MAXSTRING
];
BOOL
found
=
FALSE
;
/* Now extract PATHEXT */
len
=
GetEnvironmentVariableW
(
envPathExt
,
pathext
,
sizeof
(
pathext
)
/
sizeof
(
WCHAR
));
if
((
len
==
0
)
||
(
len
>=
(
sizeof
(
pathext
)
/
sizeof
(
WCHAR
))))
{
strcpyW
(
pathext
,
dfltPathExt
);
}
/* If the supplied parameter has any directory information, look there */
WINE_TRACE
(
"First parameter is '%s'
\n
"
,
wine_dbgstr_w
(
thisArg
));
if
(
strchrW
(
thisArg
,
'\\'
)
!=
NULL
)
{
...
...
@@ -2461,18 +2466,28 @@ int wmain (int argc, WCHAR *argvW[])
if
(
GetFileAttributesW
(
string
)
!=
INVALID_FILE_ATTRIBUTES
)
{
WINE_TRACE
(
"Found file as '%s'
\n
"
,
wine_dbgstr_w
(
string
));
found
=
TRUE
;
}
else
strcpyW
(
p
,
extEXEW
);
/* Does file exist with .exe appended */
if
(
!
found
&&
GetFileAttributesW
(
string
)
!=
INVALID_FILE_ATTRIBUTES
)
{
WINE_TRACE
(
"Found file as '%s'
\n
"
,
wine_dbgstr_w
(
string
));
found
=
TRUE
;
}
else
strcpyW
(
p
,
extCOMW
);
}
else
{
WCHAR
*
thisExt
=
pathext
;
/* No - try with each of the PATHEXT extensions */
while
(
!
found
&&
thisExt
)
{
WCHAR
*
nextExt
=
strchrW
(
thisExt
,
';'
);
if
(
nextExt
)
{
memcpy
(
p
,
thisExt
,
(
nextExt
-
thisExt
)
*
sizeof
(
WCHAR
));
p
[(
nextExt
-
thisExt
)]
=
0x00
;
thisExt
=
nextExt
+
1
;
}
else
{
strcpyW
(
p
,
thisExt
);
thisExt
=
NULL
;
}
/* Does file exist with .com appended */
if
(
!
found
&&
GetFileAttributesW
(
string
)
!=
INVALID_FILE_ATTRIBUTES
)
{
WINE_TRACE
(
"Found file as '%s'
\n
"
,
wine_dbgstr_w
(
string
));
found
=
TRUE
;
/* Does file exist with this extension appended? */
if
(
GetFileAttributesW
(
string
)
!=
INVALID_FILE_ATTRIBUTES
)
{
WINE_TRACE
(
"Found file as '%s'
\n
"
,
wine_dbgstr_w
(
string
));
found
=
TRUE
;
}
}
}
/* Otherwise we now need to look in the path to see if we can find it */
...
...
@@ -2483,18 +2498,28 @@ int wmain (int argc, WCHAR *argvW[])
if
(
SearchPathW
(
NULL
,
thisArg
,
NULL
,
sizeof
(
string
)
/
sizeof
(
WCHAR
),
string
,
NULL
)
!=
0
)
{
WINE_TRACE
(
"Found on path as '%s'
\n
"
,
wine_dbgstr_w
(
string
));
found
=
TRUE
;
}
}
else
{
WCHAR
*
thisExt
=
pathext
;
/* Does file exist plus an extension of .exe? */
if
(
SearchPathW
(
NULL
,
thisArg
,
extEXEW
,
sizeof
(
string
)
/
sizeof
(
WCHAR
),
string
,
NULL
)
!=
0
)
{
WINE_TRACE
(
"Found on path as '%s'
\n
"
,
wine_dbgstr_w
(
string
));
found
=
TRUE
;
}
/* No - try with each of the PATHEXT extensions */
while
(
!
found
&&
thisExt
)
{
WCHAR
*
nextExt
=
strchrW
(
thisExt
,
';'
);
/* Does file exist plus an extension of .com? */
if
(
SearchPathW
(
NULL
,
thisArg
,
extCOMW
,
sizeof
(
string
)
/
sizeof
(
WCHAR
),
string
,
NULL
)
!=
0
)
{
WINE_TRACE
(
"Found on path as '%s'
\n
"
,
wine_dbgstr_w
(
string
));
found
=
TRUE
;
if
(
nextExt
)
{
*
nextExt
=
0
;
nextExt
=
nextExt
+
1
;
}
else
{
nextExt
=
NULL
;
}
/* Does file exist with this extension? */
if
(
SearchPathW
(
NULL
,
thisArg
,
thisExt
,
sizeof
(
string
)
/
sizeof
(
WCHAR
),
string
,
NULL
)
!=
0
)
{
WINE_TRACE
(
"Found on path as '%s' with extension '%s'
\n
"
,
wine_dbgstr_w
(
string
),
wine_dbgstr_w
(
thisExt
));
found
=
TRUE
;
}
thisExt
=
nextExt
;
}
}
}
...
...
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