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
52e9badd
Commit
52e9badd
authored
Sep 02, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move the NT path conversion for exec process to the Unix library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
74dc9aa3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
29 deletions
+49
-29
process.c
dlls/ntdll/process.c
+13
-10
process.c
dlls/ntdll/unix/process.c
+36
-19
No files found.
dlls/ntdll/process.c
View file @
52e9badd
...
...
@@ -59,13 +59,13 @@ PEB * WINAPI RtlGetCurrentPeb(void)
*/
NTSTATUS
restart_process
(
RTL_USER_PROCESS_PARAMETERS
*
params
,
NTSTATUS
status
)
{
static
const
WCHAR
argsW
[]
=
{
'%'
,
's'
,
'
%'
,
's'
,
'
'
,
'-'
,
'-'
,
'a'
,
'p'
,
'p'
,
'-'
,
'n'
,
'a'
,
'm'
,
'e'
,
' '
,
'"'
,
'%'
,
's'
,
'"'
,
' '
,
'%'
,
's'
,
0
};
static
const
WCHAR
argsW
[]
=
{
'%'
,
's'
,
' '
,
'-'
,
'-'
,
'a'
,
'p'
,
'p'
,
'-'
,
'n'
,
'a'
,
'm'
,
'e'
,
' '
,
'"'
,
'%'
,
's'
,
'"'
,
' '
,
'%'
,
's'
,
0
};
static
const
WCHAR
winevdm
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
'v'
,
'd'
,
'm'
,
'.'
,
'e'
,
'x'
,
'e'
,
0
};
static
const
WCHAR
comW
[]
=
{
'.'
,
'c'
,
'o'
,
'm'
,
0
};
static
const
WCHAR
pifW
[]
=
{
'.'
,
'p'
,
'i'
,
'f'
,
0
};
DWORD
len
;
WCHAR
*
p
,
*
cmdline
;
WCHAR
*
p
,
*
appname
,
*
cmdline
;
UNICODE_STRING
pathW
,
cmdW
;
/* check for .com or .pif extension */
...
...
@@ -80,20 +80,23 @@ NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status )
case
STATUS_NO_MEMORY
:
case
STATUS_INVALID_IMAGE_FORMAT
:
case
STATUS_INVALID_IMAGE_NOT_MZ
:
if
(
!
RtlDosPathNameToNtPathName_U
(
params
->
ImagePathName
.
Buffer
,
&
pathW
,
NULL
,
NULL
))
return
status
;
status
=
unix_funcs
->
exec_process
(
&
pathW
,
&
params
->
CommandLine
,
status
);
status
=
unix_funcs
->
exec_process
(
&
params
->
ImagePathName
,
&
params
->
CommandLine
,
status
);
break
;
case
STATUS_INVALID_IMAGE_WIN_16
:
case
STATUS_INVALID_IMAGE_NE_FORMAT
:
case
STATUS_INVALID_IMAGE_PROTECT
:
len
=
(
wcslen
(
system_dir
)
+
wcslen
(
winevdm
)
+
16
+
wcslen
(
params
->
ImagePathName
.
Buffer
)
+
wcslen
(
params
->
CommandLine
.
Buffer
));
len
=
wcslen
(
system_dir
)
+
wcslen
(
winevdm
)
+
1
;
if
(
!
(
appname
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
return
STATUS_NO_MEMORY
;
wcscpy
(
appname
,
(
is_win64
||
is_wow64
)
?
syswow64_dir
:
system_dir
);
wcscat
(
appname
,
winevdm
);
len
+=
16
+
wcslen
(
params
->
ImagePathName
.
Buffer
)
+
wcslen
(
params
->
CommandLine
.
Buffer
);
if
(
!
(
cmdline
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
return
STATUS_NO_MEMORY
;
swprintf
(
cmdline
,
len
,
argsW
,
(
is_win64
||
is_wow64
)
?
syswow64_dir
:
system_dir
,
winevdm
,
params
->
ImagePathName
.
Buffer
,
params
->
CommandLine
.
Buffer
);
RtlInitUnicodeString
(
&
pathW
,
winevdm
);
swprintf
(
cmdline
,
len
,
argsW
,
appname
,
params
->
ImagePathName
.
Buffer
,
params
->
CommandLine
.
Buffer
);
RtlInitUnicodeString
(
&
pathW
,
appname
);
RtlInitUnicodeString
(
&
cmdW
,
cmdline
);
status
=
unix_funcs
->
exec_process
(
&
pathW
,
&
cmdW
,
status
);
break
;
...
...
dlls/ntdll/unix/process.c
View file @
52e9badd
...
...
@@ -474,35 +474,47 @@ static ULONG get_env_size( const RTL_USER_PROCESS_PARAMETERS *params, char **win
/***********************************************************************
* get_unix_curdir
* get_nt_pathname
*
* Simplified version of RtlDosPathNameToNtPathName_U.
*/
static
int
get_unix_curdir
(
const
RTL_USER_PROCESS_PARAMETERS
*
params
)
static
WCHAR
*
get_nt_pathname
(
const
UNICODE_STRING
*
str
)
{
static
const
WCHAR
ntprefixW
[]
=
{
'\\'
,
'?'
,
'?'
,
'\\'
,
0
};
static
const
WCHAR
uncprefixW
[]
=
{
'U'
,
'N'
,
'C'
,
'\\'
,
0
};
const
UNICODE_STRING
*
curdir
=
&
params
->
CurrentDirectory
.
DosPath
;
const
WCHAR
*
dir
=
curdir
->
Buffer
;
UNICODE_STRING
nt_name
;
OBJECT_ATTRIBUTES
attr
;
IO_STATUS_BLOCK
io
;
NTSTATUS
status
;
HANDLE
handle
;
int
fd
=
-
1
;
const
WCHAR
*
name
=
str
->
Buffer
;
WCHAR
*
ret
;
if
(
!
(
nt_name
.
Buffer
=
malloc
(
curdir
->
Length
+
8
*
sizeof
(
WCHAR
)
)))
return
-
1
;
if
(
!
(
ret
=
malloc
(
str
->
Length
+
8
*
sizeof
(
WCHAR
)
)))
return
NULL
;
/* simplified version of RtlDosPathNameToNtPathName_U */
wcscpy
(
nt_name
.
Buffer
,
ntprefixW
);
if
(
dir
[
0
]
==
'\\'
&&
dir
[
1
]
==
'\\'
)
wcscpy
(
ret
,
ntprefixW
);
if
(
name
[
0
]
==
'\\'
&&
name
[
1
]
==
'\\'
)
{
if
((
dir
[
2
]
==
'.'
||
dir
[
2
]
==
'?'
)
&&
dir
[
3
]
==
'\\'
)
dir
+=
4
;
if
((
name
[
2
]
==
'.'
||
name
[
2
]
==
'?'
)
&&
name
[
3
]
==
'\\'
)
name
+=
4
;
else
{
wcscat
(
nt_name
.
Buffer
,
uncprefixW
);
dir
+=
2
;
wcscat
(
ret
,
uncprefixW
);
name
+=
2
;
}
}
wcscat
(
nt_name
.
Buffer
,
dir
);
wcscat
(
ret
,
name
);
return
ret
;
}
/***********************************************************************
* get_unix_curdir
*/
static
int
get_unix_curdir
(
const
RTL_USER_PROCESS_PARAMETERS
*
params
)
{
UNICODE_STRING
nt_name
;
OBJECT_ATTRIBUTES
attr
;
IO_STATUS_BLOCK
io
;
NTSTATUS
status
;
HANDLE
handle
;
int
fd
=
-
1
;
if
(
!
(
nt_name
.
Buffer
=
get_nt_pathname
(
&
params
->
CurrentDirectory
.
DosPath
)))
return
-
1
;
nt_name
.
Length
=
wcslen
(
nt_name
.
Buffer
)
*
sizeof
(
WCHAR
);
InitializeObjectAttributes
(
&
attr
,
&
nt_name
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
...
...
@@ -616,9 +628,14 @@ NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTST
case
STATUS_NO_MEMORY
:
case
STATUS_INVALID_IMAGE_FORMAT
:
case
STATUS_INVALID_IMAGE_NOT_MZ
:
{
UNICODE_STRING
image
;
if
(
getenv
(
"WINEPRELOADRESERVE"
))
return
status
;
if
((
status
=
get_pe_file_info
(
path
,
&
handle
,
&
pe_info
)))
return
status
;
image
.
Buffer
=
get_nt_pathname
(
path
);
image
.
Length
=
wcslen
(
image
.
Buffer
)
*
sizeof
(
WCHAR
);
if
((
status
=
get_pe_file_info
(
&
image
,
&
handle
,
&
pe_info
)))
return
status
;
break
;
}
case
STATUS_INVALID_IMAGE_WIN_16
:
case
STATUS_INVALID_IMAGE_NE_FORMAT
:
case
STATUS_INVALID_IMAGE_PROTECT
:
...
...
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