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
4356fe0d
Commit
4356fe0d
authored
May 24, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Support the PS_ATTRIBUTE_MACHINE_TYPE attribute for new processes.
parent
bce5a791
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
30 additions
and
15 deletions
+30
-15
env.c
dlls/ntdll/unix/env.c
+5
-3
loader.c
dlls/ntdll/unix/loader.c
+7
-6
process.c
dlls/ntdll/unix/process.c
+8
-2
unix_private.h
dlls/ntdll/unix/unix_private.h
+2
-2
server_protocol.h
include/wine/server_protocol.h
+3
-2
process.c
server/process.c
+2
-0
protocol.def
server/protocol.def
+1
-0
request.h
server/request.h
+1
-0
trace.c
server/trace.c
+1
-0
No files found.
dlls/ntdll/unix/env.c
View file @
4356fe0d
...
...
@@ -1937,7 +1937,7 @@ static RTL_USER_PROCESS_PARAMETERS *build_initial_params( void **module )
add_registry_environment
(
&
env
,
&
env_pos
,
&
env_size
);
env
[
env_pos
++
]
=
0
;
status
=
load_main_exe
(
NULL
,
main_argv
[
1
],
curdir
,
&
image
,
module
);
status
=
load_main_exe
(
NULL
,
main_argv
[
1
],
curdir
,
0
,
&
image
,
module
);
if
(
!
status
)
{
char
*
loader
;
...
...
@@ -2017,6 +2017,7 @@ void init_startup_info(void)
SIZE_T
size
,
info_size
,
env_size
,
env_pos
;
RTL_USER_PROCESS_PARAMETERS
*
params
=
NULL
;
startup_info_t
*
info
;
USHORT
machine
;
if
(
!
startup_info_size
)
{
...
...
@@ -2031,6 +2032,7 @@ void init_startup_info(void)
{
wine_server_set_reply
(
req
,
info
,
startup_info_size
);
status
=
wine_server_call
(
req
);
machine
=
reply
->
machine
;
info_size
=
reply
->
info_size
;
env_size
=
(
wine_server_reply_size
(
reply
)
-
info_size
)
/
sizeof
(
WCHAR
);
}
...
...
@@ -2109,8 +2111,8 @@ void init_startup_info(void)
free
(
env
);
free
(
info
);
status
=
load_main_exe
(
params
->
ImagePathName
.
Buffer
,
NULL
,
params
->
CommandLine
.
Buffer
,
&
image
,
&
module
);
status
=
load_main_exe
(
params
->
ImagePathName
.
Buffer
,
NULL
,
params
->
CommandLine
.
Buffer
,
machine
,
&
image
,
&
module
);
if
(
status
)
{
MESSAGE
(
"wine: failed to start %s
\n
"
,
debugstr_us
(
&
params
->
ImagePathName
)
);
...
...
dlls/ntdll/unix/loader.c
View file @
4356fe0d
...
...
@@ -1718,7 +1718,7 @@ static NTSTATUS open_main_image( WCHAR *image, void **module, SECTION_IMAGE_INFO
* load_main_exe
*/
NTSTATUS
load_main_exe
(
const
WCHAR
*
dos_name
,
const
char
*
unix_name
,
const
WCHAR
*
curdir
,
WCHAR
**
image
,
void
**
module
)
USHORT
load_machine
,
WCHAR
**
image
,
void
**
module
)
{
enum
loadorder
loadorder
=
LO_INVALID
;
UNICODE_STRING
nt_name
;
...
...
@@ -1727,7 +1727,7 @@ NTSTATUS load_main_exe( const WCHAR *dos_name, const char *unix_name, const WCHA
unsigned
int
status
;
SIZE_T
size
;
struct
stat
st
;
WORD
machine
;
USHORT
search_
machine
;
/* special case for Unix file name */
if
(
unix_name
&&
unix_name
[
0
]
==
'/'
&&
!
stat
(
unix_name
,
&
st
))
...
...
@@ -1735,7 +1735,7 @@ NTSTATUS load_main_exe( const WCHAR *dos_name, const char *unix_name, const WCHA
if
((
status
=
unix_to_nt_file_name
(
unix_name
,
image
)))
goto
failed
;
init_unicode_string
(
&
nt_name
,
*
image
);
loadorder
=
get_load_order
(
&
nt_name
);
status
=
open_main_image
(
*
image
,
module
,
&
main_image_info
,
loadorder
,
0
);
status
=
open_main_image
(
*
image
,
module
,
&
main_image_info
,
loadorder
,
load_machine
);
if
(
status
!=
STATUS_DLL_NOT_FOUND
)
return
status
;
free
(
*
image
);
}
...
...
@@ -1755,13 +1755,14 @@ NTSTATUS load_main_exe( const WCHAR *dos_name, const char *unix_name, const WCHA
init_unicode_string
(
&
nt_name
,
*
image
);
if
(
loadorder
==
LO_INVALID
)
loadorder
=
get_load_order
(
&
nt_name
);
status
=
open_main_image
(
*
image
,
module
,
&
main_image_info
,
loadorder
,
0
);
status
=
open_main_image
(
*
image
,
module
,
&
main_image_info
,
loadorder
,
load_machine
);
if
(
status
!=
STATUS_DLL_NOT_FOUND
)
return
status
;
/* if path is in system dir, we can load the builtin even if the file itself doesn't exist */
if
(
loadorder
!=
LO_NATIVE
&&
is_builtin_path
(
&
nt_name
,
&
machine
))
if
(
loadorder
!=
LO_NATIVE
&&
is_builtin_path
(
&
nt_name
,
&
search_
machine
))
{
status
=
find_builtin_dll
(
&
nt_name
,
module
,
&
size
,
&
main_image_info
,
0
,
machine
,
0
,
FALSE
);
status
=
find_builtin_dll
(
&
nt_name
,
module
,
&
size
,
&
main_image_info
,
0
,
search_machine
,
load_machine
,
FALSE
);
if
(
status
!=
STATUS_DLL_NOT_FOUND
)
return
status
;
}
if
(
!
contains_path
)
return
STATUS_DLL_NOT_FOUND
;
...
...
dlls/ntdll/unix/process.c
View file @
4356fe0d
...
...
@@ -729,6 +729,7 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
int
unixdir
,
socketfd
[
2
]
=
{
-
1
,
-
1
};
pe_image_info_t
pe_info
;
CLIENT_ID
id
;
USHORT
machine
=
0
;
HANDLE
parent
=
0
,
debug
=
0
,
token
=
0
;
UNICODE_STRING
redir
,
path
=
{
0
};
OBJECT_ATTRIBUTES
attr
,
empty_attr
=
{
sizeof
(
empty_attr
)
};
...
...
@@ -771,6 +772,9 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
case
PS_ATTRIBUTE_JOB_LIST
:
jobs_attr
=
&
ps_attr
->
Attributes
[
i
];
break
;
case
PS_ATTRIBUTE_MACHINE_TYPE
:
machine
=
ps_attr
->
Attributes
[
i
].
Value
;
break
;
default:
if
(
ps_attr
->
Attributes
[
i
].
Attribute
&
PS_ATTRIBUTE_INPUT
)
FIXME
(
"unhandled input attribute %lx
\n
"
,
ps_attr
->
Attributes
[
i
].
Attribute
);
...
...
@@ -779,8 +783,8 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
}
if
(
!
process_attr
)
process_attr
=
&
empty_attr
;
TRACE
(
"%s image %s cmdline %s parent %p
\n
"
,
debugstr_us
(
&
path
),
debugstr_us
(
&
params
->
ImagePathName
),
debugstr_us
(
&
params
->
CommandLine
),
parent
);
TRACE
(
"%s image %s cmdline %s parent %p
machine %x
\n
"
,
debugstr_us
(
&
path
),
debugstr_us
(
&
params
->
ImagePathName
),
debugstr_us
(
&
params
->
CommandLine
),
parent
,
machine
);
unixdir
=
get_unix_curdir
(
params
);
...
...
@@ -797,6 +801,7 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
}
goto
done
;
}
if
(
!
machine
)
machine
=
(
pe_info
.
image_flags
&
IMAGE_FLAGS_ComPlusNativeReady
)
?
native_machine
:
pe_info
.
machine
;
if
(
!
(
startup_info
=
create_startup_info
(
attr
.
ObjectName
,
params
,
&
startup_info_size
)))
goto
done
;
env_size
=
get_env_size
(
params
,
&
winedebug
);
...
...
@@ -846,6 +851,7 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
req
->
flags
=
process_flags
;
req
->
socket_fd
=
socketfd
[
1
];
req
->
access
=
process_access
;
req
->
machine
=
machine
;
req
->
info_size
=
startup_info_size
;
req
->
handles_size
=
handles_size
;
req
->
jobs_size
=
jobs_size
;
...
...
dlls/ntdll/unix/unix_private.h
View file @
4356fe0d
...
...
@@ -177,8 +177,8 @@ extern NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_
extern
NTSTATUS
load_builtin
(
const
pe_image_info_t
*
image_info
,
WCHAR
*
filename
,
USHORT
machine
,
void
**
addr_ptr
,
SIZE_T
*
size_ptr
,
ULONG_PTR
limit
)
DECLSPEC_HIDDEN
;
extern
BOOL
is_builtin_path
(
const
UNICODE_STRING
*
path
,
WORD
*
machine
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
load_main_exe
(
const
WCHAR
*
name
,
const
char
*
unix_name
,
const
WCHAR
*
curdir
,
WCHAR
**
image
,
void
**
module
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
load_main_exe
(
const
WCHAR
*
name
,
const
char
*
unix_name
,
const
WCHAR
*
curdir
,
USHORT
load_machine
,
WCHAR
**
image
,
void
**
module
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
load_start_exe
(
WCHAR
**
image
,
void
**
module
)
DECLSPEC_HIDDEN
;
extern
void
start_server
(
BOOL
debug
)
DECLSPEC_HIDDEN
;
...
...
include/wine/server_protocol.h
View file @
4356fe0d
...
...
@@ -948,9 +948,10 @@ struct get_startup_info_reply
{
struct
reply_header
__header
;
data_size_t
info_size
;
unsigned
short
machine
;
/* VARARG(info,startup_info,info_size); */
/* VARARG(env,unicode_str); */
char
__pad_1
2
[
4
];
char
__pad_1
4
[
2
];
};
...
...
@@ -6394,7 +6395,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 76
7
#define SERVER_PROTOCOL_VERSION 76
8
/* ### protocol_version end ### */
...
...
server/process.c
View file @
4356fe0d
...
...
@@ -1296,6 +1296,7 @@ DECL_HANDLER(new_process)
handles
,
req
->
handles_size
/
sizeof
(
*
handles
),
token
)))
goto
done
;
process
->
machine
=
req
->
machine
;
process
->
startup_info
=
(
struct
startup_info
*
)
grab_object
(
info
);
job
=
parent
->
job
;
...
...
@@ -1396,6 +1397,7 @@ DECL_HANDLER(get_startup_info)
if
(
!
info
)
return
;
/* we return the data directly without making a copy so this can only be called once */
reply
->
machine
=
process
->
machine
;
reply
->
info_size
=
info
->
info_size
;
size
=
info
->
data_size
;
if
(
size
>
get_reply_max_size
())
size
=
get_reply_max_size
();
...
...
server/protocol.def
View file @
4356fe0d
...
...
@@ -939,6 +939,7 @@ typedef struct
@REQ(get_startup_info)
@REPLY
data_size_t info_size; /* size of startup info */
unsigned short machine; /* architecture for the new process */
VARARG(info,startup_info,info_size); /* startup information */
VARARG(env,unicode_str); /* environment */
@END
...
...
server/request.h
View file @
4356fe0d
...
...
@@ -745,6 +745,7 @@ C_ASSERT( FIELD_OFFSET(struct new_thread_reply, handle) == 12 );
C_ASSERT
(
sizeof
(
struct
new_thread_reply
)
==
16
);
C_ASSERT
(
sizeof
(
struct
get_startup_info_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_startup_info_reply
,
info_size
)
==
8
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_startup_info_reply
,
machine
)
==
12
);
C_ASSERT
(
sizeof
(
struct
get_startup_info_reply
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
init_process_done_request
,
teb
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
init_process_done_request
,
peb
)
==
24
);
...
...
server/trace.c
View file @
4356fe0d
...
...
@@ -1431,6 +1431,7 @@ static void dump_get_startup_info_request( const struct get_startup_info_request
static
void
dump_get_startup_info_reply
(
const
struct
get_startup_info_reply
*
req
)
{
fprintf
(
stderr
,
" info_size=%u"
,
req
->
info_size
);
fprintf
(
stderr
,
", machine=%04x"
,
req
->
machine
);
dump_varargs_startup_info
(
", info="
,
min
(
cur_size
,
req
->
info_size
)
);
dump_varargs_unicode_str
(
", env="
,
cur_size
);
}
...
...
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