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
f51cd0a1
Commit
f51cd0a1
authored
Sep 02, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use the process parameters directly in exec_process().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
52e9badd
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
71 deletions
+51
-71
loader.c
dlls/ntdll/loader.c
+43
-7
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+0
-1
process.c
dlls/ntdll/process.c
+0
-56
process.c
dlls/ntdll/unix/process.c
+5
-4
unix_private.h
dlls/ntdll/unix/unix_private.h
+1
-1
unixlib.h
dlls/ntdll/unixlib.h
+2
-2
No files found.
dlls/ntdll/loader.c
View file @
f51cd0a1
...
...
@@ -70,6 +70,7 @@ const WCHAR system_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
const
WCHAR
syswow64_dir
[]
=
{
'C'
,
':'
,
'\\'
,
'w'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
's'
,
'y'
,
's'
,
'w'
,
'o'
,
'w'
,
'6'
,
'4'
,
'\\'
,
0
};
static
const
BOOL
is_win64
=
(
sizeof
(
void
*
)
>
sizeof
(
int
));
BOOL
is_wow64
=
FALSE
;
/* system search path */
...
...
@@ -3931,6 +3932,29 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
/***********************************************************************
* restart_winevdm
*/
static
void
restart_winevdm
(
RTL_USER_PROCESS_PARAMETERS
*
params
)
{
DWORD
len
;
WCHAR
*
appname
,
*
cmdline
;
len
=
wcslen
(
system_dir
)
+
wcslen
(
L"winevdm.exe"
)
+
1
;
appname
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
wcscpy
(
appname
,
(
is_win64
||
is_wow64
)
?
syswow64_dir
:
system_dir
);
wcscat
(
appname
,
L"winevdm.exe"
);
len
+=
16
+
wcslen
(
params
->
ImagePathName
.
Buffer
)
+
wcslen
(
params
->
CommandLine
.
Buffer
);
cmdline
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
swprintf
(
cmdline
,
len
,
L"%s --app-name
\"
%s
\"
%s"
,
appname
,
params
->
ImagePathName
.
Buffer
,
params
->
CommandLine
.
Buffer
);
RtlInitUnicodeString
(
&
params
->
ImagePathName
,
appname
);
RtlInitUnicodeString
(
&
params
->
CommandLine
,
cmdline
);
}
/***********************************************************************
* process_init
*/
static
void
process_init
(
void
)
...
...
@@ -4024,21 +4048,33 @@ static void process_init(void)
}
else
{
status
=
restart_process
(
params
,
status
);
switch
(
status
)
{
case
STATUS_INVALID_IMAGE_WIN_64
:
ERR
(
"%s 64-bit application not supported in 32-bit prefix
\n
"
,
debugstr_us
(
&
params
->
ImagePathName
)
);
case
STATUS_INVALID_IMAGE_NOT_MZ
:
{
WCHAR
*
p
=
wcsrchr
(
params
->
ImagePathName
.
Buffer
,
'.'
);
if
(
p
&&
(
!
wcsicmp
(
p
,
L".com"
)
||
!
wcsicmp
(
p
,
L".pif"
)))
{
restart_winevdm
(
params
);
status
=
STATUS_INVALID_IMAGE_WIN_16
;
}
status
=
unix_funcs
->
exec_process
(
status
);
break
;
}
case
STATUS_INVALID_IMAGE_WIN_16
:
case
STATUS_INVALID_IMAGE_NE_FORMAT
:
case
STATUS_INVALID_IMAGE_PROTECT
:
ERR
(
"%s 16-bit application not supported on this system
\n
"
,
debugstr_us
(
&
params
->
ImagePathName
)
);
restart_winevdm
(
params
);
status
=
unix_funcs
->
exec_process
(
status
);
break
;
case
STATUS_CONFLICTING_ADDRESSES
:
case
STATUS_NO_MEMORY
:
case
STATUS_INVALID_IMAGE_FORMAT
:
ERR
(
"%s not supported on this system
\n
"
,
debugstr_us
(
&
params
->
ImagePathName
)
);
status
=
unix_funcs
->
exec_process
(
status
);
break
;
case
STATUS_INVALID_IMAGE_WIN_64
:
ERR
(
"%s 64-bit application not supported in 32-bit prefix
\n
"
,
debugstr_us
(
&
params
->
ImagePathName
)
);
break
;
case
STATUS_DLL_NOT_FOUND
:
ERR
(
"%s not found
\n
"
,
debugstr_us
(
&
params
->
ImagePathName
)
);
...
...
dlls/ntdll/ntdll_misc.h
View file @
f51cd0a1
...
...
@@ -64,7 +64,6 @@ extern void heap_set_debug_flags( HANDLE handle ) DECLSPEC_HIDDEN;
extern
void
init_unix_codepage
(
void
)
DECLSPEC_HIDDEN
;
extern
void
init_locale
(
HMODULE
module
)
DECLSPEC_HIDDEN
;
extern
void
init_user_process_params
(
void
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
restart_process
(
RTL_USER_PROCESS_PARAMETERS
*
params
,
NTSTATUS
status
)
DECLSPEC_HIDDEN
;
extern
void
CDECL
DECLSPEC_NORETURN
signal_start_thread
(
CONTEXT
*
ctx
)
DECLSPEC_HIDDEN
;
/* server support */
...
...
dlls/ntdll/process.c
View file @
f51cd0a1
...
...
@@ -38,12 +38,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
process
);
static
const
BOOL
is_win64
=
(
sizeof
(
void
*
)
>
sizeof
(
int
));
/*
* Process object
*/
/******************************************************************************
* RtlGetCurrentPeb [NTDLL.@]
...
...
@@ -54,56 +48,6 @@ PEB * WINAPI RtlGetCurrentPeb(void)
return
NtCurrentTeb
()
->
Peb
;
}
/***********************************************************************
* restart_process
*/
NTSTATUS
restart_process
(
RTL_USER_PROCESS_PARAMETERS
*
params
,
NTSTATUS
status
)
{
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
,
*
appname
,
*
cmdline
;
UNICODE_STRING
pathW
,
cmdW
;
/* check for .com or .pif extension */
if
(
status
==
STATUS_INVALID_IMAGE_NOT_MZ
&&
(
p
=
wcsrchr
(
params
->
ImagePathName
.
Buffer
,
'.'
))
&&
(
!
wcsicmp
(
p
,
comW
)
||
!
wcsicmp
(
p
,
pifW
)))
status
=
STATUS_INVALID_IMAGE_WIN_16
;
switch
(
status
)
{
case
STATUS_CONFLICTING_ADDRESSES
:
case
STATUS_NO_MEMORY
:
case
STATUS_INVALID_IMAGE_FORMAT
:
case
STATUS_INVALID_IMAGE_NOT_MZ
:
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
)
+
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
,
appname
,
params
->
ImagePathName
.
Buffer
,
params
->
CommandLine
.
Buffer
);
RtlInitUnicodeString
(
&
pathW
,
appname
);
RtlInitUnicodeString
(
&
cmdW
,
cmdline
);
status
=
unix_funcs
->
exec_process
(
&
pathW
,
&
cmdW
,
status
);
break
;
}
return
status
;
}
/**********************************************************************
* RtlCreateUserProcess (NTDLL.@)
...
...
dlls/ntdll/unix/process.c
View file @
f51cd0a1
...
...
@@ -613,8 +613,9 @@ static NTSTATUS spawn_process( const RTL_USER_PROCESS_PARAMETERS *params, int so
/***********************************************************************
* exec_process
*/
NTSTATUS
CDECL
exec_process
(
UNICODE_STRING
*
path
,
UNICODE_STRING
*
cmdline
,
NTSTATUS
status
)
NTSTATUS
CDECL
exec_process
(
NTSTATUS
status
)
{
RTL_USER_PROCESS_PARAMETERS
*
params
=
NtCurrentTeb
()
->
Peb
->
ProcessParameters
;
pe_image_info_t
pe_info
;
int
unixdir
,
socketfd
[
2
];
char
**
argv
;
...
...
@@ -631,7 +632,7 @@ NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTST
{
UNICODE_STRING
image
;
if
(
getenv
(
"WINEPRELOADRESERVE"
))
return
status
;
image
.
Buffer
=
get_nt_pathname
(
path
);
image
.
Buffer
=
get_nt_pathname
(
&
params
->
ImagePathName
);
image
.
Length
=
wcslen
(
image
.
Buffer
)
*
sizeof
(
WCHAR
);
if
((
status
=
get_pe_file_info
(
&
image
,
&
handle
,
&
pe_info
)))
return
status
;
break
;
...
...
@@ -647,7 +648,7 @@ NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTST
return
status
;
}
unixdir
=
get_unix_curdir
(
NtCurrentTeb
()
->
Peb
->
ProcessParameter
s
);
unixdir
=
get_unix_curdir
(
param
s
);
if
(
socketpair
(
PF_UNIX
,
SOCK_STREAM
,
0
,
socketfd
)
==
-
1
)
return
STATUS_TOO_MANY_OPENED_FILES
;
#ifdef SO_PASSCRED
...
...
@@ -670,7 +671,7 @@ NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTST
if
(
!
status
)
{
if
(
!
(
argv
=
build_argv
(
cmdl
ine
,
2
)))
return
STATUS_NO_MEMORY
;
if
(
!
(
argv
=
build_argv
(
&
params
->
CommandL
ine
,
2
)))
return
STATUS_NO_MEMORY
;
fchdir
(
unixdir
);
do
{
...
...
dlls/ntdll/unix/unix_private.h
View file @
f51cd0a1
...
...
@@ -117,7 +117,7 @@ extern USHORT * CDECL get_unix_codepage_data(void) DECLSPEC_HIDDEN;
extern
void
CDECL
get_locales
(
WCHAR
*
sys
,
WCHAR
*
user
)
DECLSPEC_HIDDEN
;
extern
void
CDECL
virtual_release_address_space
(
void
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
exec_process
(
UNICODE_STRING
*
path
,
UNICODE_STRING
*
cmdline
,
NTSTATUS
status
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
exec_process
(
NTSTATUS
status
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
unwind_builtin_dll
(
ULONG
type
,
struct
_DISPATCHER_CONTEXT
*
dispatch
,
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/unixlib.h
View file @
f51cd0a1
...
...
@@ -27,7 +27,7 @@
struct
_DISPATCHER_CONTEXT
;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 10
2
#define NTDLL_UNIXLIB_VERSION 10
3
struct
unix_funcs
{
...
...
@@ -82,7 +82,7 @@ struct unix_funcs
void
(
CDECL
*
virtual_release_address_space
)(
void
);
/* thread/process functions */
NTSTATUS
(
CDECL
*
exec_process
)(
UNICODE_STRING
*
path
,
UNICODE_STRING
*
cmdline
,
NTSTATUS
status
);
NTSTATUS
(
CDECL
*
exec_process
)(
NTSTATUS
status
);
/* file functions */
void
(
CDECL
*
set_show_dot_files
)(
BOOL
enable
);
...
...
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