Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Münchhalfen
wine
Commits
e518f474
Commit
e518f474
authored
26 years ago
by
Andreas Mohr
Committed by
Alexandre Julliard
26 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added support for quoted file names in CreateProcess().
parent
3f09ec52
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
loader/module.c
+70
-33
70 additions, 33 deletions
loader/module.c
with
70 additions
and
33 deletions
loader/module.c
+
70
−
33
View file @
e518f474
...
...
@@ -749,6 +749,56 @@ HINSTANCE WINAPI LoadModule( LPCSTR name, LPVOID paramBlock )
return
hInstance
;
}
static
void
get_executable_name
(
LPCSTR
line
,
LPSTR
name
,
int
namelen
,
LPCSTR
*
after
,
BOOL
extension
)
{
int
len
=
0
;
LPCSTR
p
=
NULL
,
pcmd
=
NULL
;
if
((
p
=
strchr
(
line
,
'"'
)))
{
p
++
;
/* skip '"' */
line
=
p
;
if
((
pcmd
=
strchr
(
p
,
'"'
)))
{
/* closing '"' available, too ? */
pcmd
++
;
len
=
(
int
)
pcmd
-
(
int
)
p
;
}
}
if
(
!
len
)
{
p
=
strchr
(
line
,
' '
);
do
{
len
=
(
p
?
p
-
line
:
strlen
(
line
))
+
1
;
if
(
len
>
namelen
-
4
)
len
=
namelen
-
4
;
lstrcpynA
(
name
,
line
,
len
);
if
(
extension
&&
!
strchr
(
name
,
'\\'
)
&&
!
strchr
(
name
,
'.'
))
strcat
(
name
,
".exe"
);
if
(
GetFileAttributesA
(
name
)
!=
-
1
)
{
pcmd
=
p
?
p
:
line
+
strlen
(
line
);
break
;
}
/* if there is a space and no file found yet, include the word
* up to the next space too. If there is no next space, just
* use the first word.
*/
if
(
p
)
{
p
=
strchr
(
p
+
1
,
' '
);
}
else
{
p
=
strchr
(
line
,
' '
);
len
=
(
p
?
p
-
line
:
strlen
(
line
))
+
1
;
if
(
len
>
namelen
-
4
)
len
=
namelen
-
4
;
pcmd
=
p
?
p
+
1
:
line
+
strlen
(
line
);
break
;
}
}
while
(
1
);
}
lstrcpynA
(
name
,
line
,
len
);
if
(
after
)
*
after
=
pcmd
;
}
/**********************************************************************
* CreateProcessA (KERNEL32.171)
*/
...
...
@@ -764,8 +814,8 @@ BOOL WINAPI CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine,
HFILE
hFile
;
OFSTRUCT
ofs
;
DWORD
type
;
LPCSTR
cmdline
;
char
name
[
256
]
;
char
name
[
256
],
cmdline
[
256
]
;
LPCSTR
p
=
NULL
;
/* Get name and command line */
...
...
@@ -775,38 +825,25 @@ BOOL WINAPI CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine,
return
FALSE
;
}
cmdline
=
lpCommandLine
?
lpCommandLine
:
lpApplicationName
;
if
(
lpApplicationName
)
lstrcpynA
(
name
,
lpApplicationName
,
sizeof
(
name
)
-
4
);
else
{
char
*
ptr
;
int
len
;
/* Take care off .exes with spaces in their names */
ptr
=
strchr
(
lpCommandLine
,
' '
);
do
{
len
=
(
ptr
?
ptr
-
lpCommandLine
:
strlen
(
lpCommandLine
))
+
1
;
if
(
len
>
sizeof
(
name
)
-
4
)
len
=
sizeof
(
name
)
-
4
;
lstrcpynA
(
name
,
lpCommandLine
,
len
);
if
(
!
strchr
(
name
,
'\\'
)
&&
!
strchr
(
name
,
'.'
))
strcat
(
name
,
".exe"
);
if
(
GetFileAttributesA
(
name
)
!=-
1
)
break
;
/* if there is a space and no file found yet, include the word
* up to the next space too. If there is no next space, just
* use the first word.
*/
if
(
ptr
)
{
ptr
=
strchr
(
ptr
+
1
,
' '
);
name
[
0
]
=
'\0'
;
cmdline
[
0
]
=
'\0'
;
if
(
lpApplicationName
)
{
get_executable_name
(
lpApplicationName
,
name
,
sizeof
(
name
),
NULL
,
FALSE
);
strcpy
(
cmdline
,
name
);
#if 0
p = strrchr(name, '.');
if (p >= name+strlen(name)-4) /* FIXME */
*p = '\0';
#endif
}
if
(
strlen
(
name
))
{
get_executable_name
(
lpCommandLine
,
cmdline
,
sizeof
(
cmdline
),
&
p
,
TRUE
);
strcat
(
cmdline
,
p
);
}
else
{
ptr
=
strchr
(
lpCommandLine
,
' '
);
len
=
(
ptr
?
ptr
-
lpCommandLine
:
strlen
(
lpCommandLine
))
+
1
;
if
(
len
>
sizeof
(
name
)
-
4
)
len
=
sizeof
(
name
)
-
4
;
lstrcpynA
(
name
,
lpCommandLine
,
len
);
break
;
}
}
while
(
1
);
get_executable_name
(
lpCommandLine
,
name
,
sizeof
(
name
),
&
p
,
TRUE
);
strcpy
(
cmdline
,
name
);
strcat
(
cmdline
,
p
);
}
if
(
!
strchr
(
name
,
'\\'
)
&&
!
strchr
(
name
,
'.'
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment