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
8d50c346
Commit
8d50c346
authored
Apr 27, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Check the supported machines list to validate an image mapping.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d7fecebe
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
31 deletions
+23
-31
mapping.c
server/mapping.c
+8
-24
object.h
server/object.h
+15
-0
thread.c
server/thread.c
+0
-6
thread.h
server/thread.h
+0
-1
No files found.
server/mapping.c
View file @
8d50c346
...
...
@@ -642,7 +642,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
off_t
pos
;
int
size
,
opt_size
;
size_t
mz_size
,
clr_va
,
clr_size
;
unsigned
int
i
,
cpu_mask
=
get_supported_cpu_mask
()
;
unsigned
int
i
;
/* load the headers */
...
...
@@ -671,17 +671,9 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
switch
(
nt
.
opt
.
hdr32
.
Magic
)
{
case
IMAGE_NT_OPTIONAL_HDR32_MAGIC
:
switch
(
nt
.
FileHeader
.
Machine
)
{
case
IMAGE_FILE_MACHINE_I386
:
if
(
cpu_mask
&
(
CPU_FLAG
(
CPU_x86
)
|
CPU_FLAG
(
CPU_x86_64
)))
break
;
return
STATUS_INVALID_IMAGE_FORMAT
;
case
IMAGE_FILE_MACHINE_ARMNT
:
if
(
cpu_mask
&
(
CPU_FLAG
(
CPU_ARM
)
|
CPU_FLAG
(
CPU_ARM64
)))
break
;
return
STATUS_INVALID_IMAGE_FORMAT
;
default:
return
STATUS_INVALID_IMAGE_FORMAT
;
}
if
(
!
is_machine_32bit
(
nt
.
FileHeader
.
Machine
))
return
STATUS_INVALID_IMAGE_FORMAT
;
if
(
!
is_machine_supported
(
nt
.
FileHeader
.
Machine
))
return
STATUS_INVALID_IMAGE_FORMAT
;
clr_va
=
nt
.
opt
.
hdr32
.
DataDirectory
[
IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR
].
VirtualAddress
;
clr_size
=
nt
.
opt
.
hdr32
.
DataDirectory
[
IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR
].
Size
;
...
...
@@ -710,18 +702,10 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
break
;
case
IMAGE_NT_OPTIONAL_HDR64_MAGIC
:
if
(
!
(
cpu_mask
&
CPU_64BIT_MASK
))
return
STATUS_INVALID_IMAGE_WIN_64
;
switch
(
nt
.
FileHeader
.
Machine
)
{
case
IMAGE_FILE_MACHINE_AMD64
:
if
(
cpu_mask
&
(
CPU_FLAG
(
CPU_x86
)
|
CPU_FLAG
(
CPU_x86_64
)))
break
;
return
STATUS_INVALID_IMAGE_FORMAT
;
case
IMAGE_FILE_MACHINE_ARM64
:
if
(
cpu_mask
&
(
CPU_FLAG
(
CPU_ARM
)
|
CPU_FLAG
(
CPU_ARM64
)))
break
;
return
STATUS_INVALID_IMAGE_FORMAT
;
default:
return
STATUS_INVALID_IMAGE_FORMAT
;
}
if
(
!
is_machine_64bit
(
supported_machines
[
0
]
))
return
STATUS_INVALID_IMAGE_WIN_64
;
if
(
!
is_machine_64bit
(
nt
.
FileHeader
.
Machine
))
return
STATUS_INVALID_IMAGE_FORMAT
;
if
(
!
is_machine_supported
(
nt
.
FileHeader
.
Machine
))
return
STATUS_INVALID_IMAGE_FORMAT
;
clr_va
=
nt
.
opt
.
hdr64
.
DataDirectory
[
IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR
].
VirtualAddress
;
clr_size
=
nt
.
opt
.
hdr64
.
DataDirectory
[
IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR
].
Size
;
...
...
server/object.h
View file @
8d50c346
...
...
@@ -244,6 +244,21 @@ extern unsigned short supported_machines[8];
extern
void
init_registry
(
void
);
extern
void
flush_registry
(
void
);
static
inline
int
is_machine_32bit
(
unsigned
short
machine
)
{
return
machine
==
IMAGE_FILE_MACHINE_I386
||
machine
==
IMAGE_FILE_MACHINE_ARMNT
;
}
static
inline
int
is_machine_64bit
(
unsigned
short
machine
)
{
return
machine
==
IMAGE_FILE_MACHINE_AMD64
||
machine
==
IMAGE_FILE_MACHINE_ARM64
;
}
static
inline
int
is_machine_supported
(
unsigned
short
machine
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
supported_machines_count
;
i
++
)
if
(
supported_machines
[
i
]
==
machine
)
return
1
;
return
0
;
}
/* signal functions */
extern
void
start_watchdog
(
void
);
...
...
server/thread.c
View file @
8d50c346
...
...
@@ -1341,12 +1341,6 @@ int is_cpu_supported( enum cpu_type cpu )
return
0
;
}
/* return the cpu mask for supported cpus */
unsigned
int
get_supported_cpu_mask
(
void
)
{
return
supported_cpus
&
get_prefix_cpu_mask
();
}
/* create a new thread */
DECL_HANDLER
(
new_thread
)
{
...
...
server/thread.h
View file @
8d50c346
...
...
@@ -120,7 +120,6 @@ extern int thread_get_inflight_fd( struct thread *thread, int client );
extern
struct
token
*
thread_get_impersonation_token
(
struct
thread
*
thread
);
extern
int
set_thread_affinity
(
struct
thread
*
thread
,
affinity_t
affinity
);
extern
int
is_cpu_supported
(
enum
cpu_type
cpu
);
extern
unsigned
int
get_supported_cpu_mask
(
void
);
extern
int
suspend_thread
(
struct
thread
*
thread
);
extern
int
resume_thread
(
struct
thread
*
thread
);
...
...
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