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
0810e6a6
Commit
0810e6a6
authored
Jan 30, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Implement the ImageContainsCode flag for image mappings.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
41275cba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
loader.c
dlls/kernel32/tests/loader.c
+6
-7
mapping.c
server/mapping.c
+10
-2
No files found.
dlls/kernel32/tests/loader.c
View file @
0810e6a6
...
...
@@ -49,6 +49,7 @@ struct PROCESS_BASIC_INFORMATION_PRIVATE
static
LONG
*
child_failures
;
static
WORD
cb_count
;
static
DWORD
page_size
;
static
BOOL
is_win64
=
sizeof
(
void
*
)
>
sizeof
(
int
);
static
BOOL
is_wow64
;
static
NTSTATUS
(
WINAPI
*
pNtCreateSection
)(
HANDLE
*
,
ACCESS_MASK
,
const
OBJECT_ATTRIBUTES
*
,
...
...
@@ -267,8 +268,8 @@ static BOOL query_image_section( int id, const char *dll_name, const IMAGE_NT_HE
status
=
pNtQuerySection
(
mapping
,
SectionImageInformation
,
&
image
,
sizeof
(
image
),
&
info_size
);
ok
(
!
status
,
"%u: NtQuerySection failed err %x
\n
"
,
id
,
status
);
ok
(
info_size
==
sizeof
(
image
),
"%u: NtQuerySection wrong size %lu
\n
"
,
id
,
info_size
);
if
(
nt_header
->
OptionalHeader
.
Magic
==
(
sizeof
(
void
*
)
>
sizeof
(
int
)
?
IMAGE_NT_OPTIONAL_HDR64_MAGIC
:
IMAGE_NT_OPTIONAL_HDR32_MAGIC
))
if
(
nt_header
->
OptionalHeader
.
Magic
==
(
is_win64
?
IMAGE_NT_OPTIONAL_HDR64_MAGIC
:
IMAGE_NT_OPTIONAL_HDR32_MAGIC
))
{
max_stack
=
nt_header
->
OptionalHeader
.
SizeOfStackReserve
;
commit_stack
=
nt_header
->
OptionalHeader
.
SizeOfStackCommit
;
...
...
@@ -327,13 +328,11 @@ static BOOL query_image_section( int id, const char *dll_name, const IMAGE_NT_HE
ok
(
image
.
CheckSum
==
nt_header
->
OptionalHeader
.
CheckSum
,
"%u: CheckSum wrong %08x / %08x
\n
"
,
id
,
image
.
CheckSum
,
nt_header
->
OptionalHeader
.
CheckSum
);
if
(
nt_header
->
OptionalHeader
.
SizeOfCode
||
nt_header
->
OptionalHeader
.
AddressOfEntryPoint
)
todo_wine
ok
(
image
.
ImageContainsCode
==
TRUE
,
"%u: ImageContainsCode wrong %u
\n
"
,
id
,
image
.
ImageContainsCode
);
else
if
((
nt_header
->
OptionalHeader
.
SectionAlignment
%
page_size
)
||
(
nt_header
->
FileHeader
.
NumberOfSections
==
1
&&
(
section
.
Characteristics
&
IMAGE_SCN_MEM_EXECUTE
)))
todo_wine
ok
(
image
.
ImageContainsCode
==
TRUE
||
broken
(
!
image
.
ImageContainsCode
),
/* <= win8 */
"%u: ImageContainsCode wrong %u
\n
"
,
id
,
image
.
ImageContainsCode
);
else
...
...
@@ -416,8 +415,8 @@ static NTSTATUS map_image_section( const IMAGE_NT_HEADERS *nt_header, int line )
info
.
Size
.
u
.
HighPart
,
info
.
Size
.
u
.
LowPart
,
file_size
);
has_code
=
query_image_section
(
line
,
dll_name
,
nt_header
);
/* test loading dll of wrong 32/64 bitness */
if
(
nt_header
->
OptionalHeader
.
Magic
==
(
sizeof
(
void
*
)
>
sizeof
(
int
)
?
IMAGE_NT_OPTIONAL_HDR32_MAGIC
:
IMAGE_NT_OPTIONAL_HDR64_MAGIC
))
if
(
nt_header
->
OptionalHeader
.
Magic
==
(
is_win64
?
IMAGE_NT_OPTIONAL_HDR32_MAGIC
:
IMAGE_NT_OPTIONAL_HDR64_MAGIC
))
{
SetLastError
(
0xdeadbeef
);
mod
=
LoadLibraryExA
(
dll_name
,
0
,
DONT_RESOLVE_DLL_REFERENCES
);
...
...
@@ -425,7 +424,7 @@ static NTSTATUS map_image_section( const IMAGE_NT_HEADERS *nt_header, int line )
{
ok
(
mod
!=
NULL
,
"%u: loading failed err %u
\n
"
,
line
,
GetLastError
()
);
}
else
todo_wine_if
(
is_wow64
)
else
todo_wine_if
(
is_w
in64
||
is_w
ow64
)
{
ok
(
!
mod
,
"%u: loading succeeded
\n
"
,
line
);
ok
(
GetLastError
()
==
ERROR_BAD_EXE_FORMAT
,
"%u: wrong error %u
\n
"
,
line
,
GetLastError
()
);
...
...
server/mapping.c
View file @
0810e6a6
...
...
@@ -539,7 +539,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
}
nt
;
off_t
pos
;
int
size
;
unsigned
int
cpu_mask
=
get_supported_cpu_mask
();
unsigned
int
i
,
cpu_mask
=
get_supported_cpu_mask
();
/* load the headers */
...
...
@@ -587,6 +587,9 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
mapping
->
image
.
subsystem_low
=
nt
.
opt
.
hdr32
.
MinorSubsystemVersion
;
mapping
->
image
.
subsystem_high
=
nt
.
opt
.
hdr32
.
MajorSubsystemVersion
;
mapping
->
image
.
dll_charact
=
nt
.
opt
.
hdr32
.
DllCharacteristics
;
mapping
->
image
.
contains_code
=
(
nt
.
opt
.
hdr32
.
SizeOfCode
||
nt
.
opt
.
hdr32
.
AddressOfEntryPoint
||
nt
.
opt
.
hdr32
.
SectionAlignment
&
page_mask
);
mapping
->
image
.
loader_flags
=
nt
.
opt
.
hdr32
.
LoaderFlags
;
mapping
->
image
.
header_size
=
nt
.
opt
.
hdr32
.
SizeOfHeaders
;
mapping
->
image
.
checksum
=
nt
.
opt
.
hdr32
.
CheckSum
;
...
...
@@ -614,6 +617,9 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
mapping
->
image
.
subsystem_low
=
nt
.
opt
.
hdr64
.
MinorSubsystemVersion
;
mapping
->
image
.
subsystem_high
=
nt
.
opt
.
hdr64
.
MajorSubsystemVersion
;
mapping
->
image
.
dll_charact
=
nt
.
opt
.
hdr64
.
DllCharacteristics
;
mapping
->
image
.
contains_code
=
(
nt
.
opt
.
hdr64
.
SizeOfCode
||
nt
.
opt
.
hdr64
.
AddressOfEntryPoint
||
nt
.
opt
.
hdr64
.
SectionAlignment
&
page_mask
);
mapping
->
image
.
loader_flags
=
nt
.
opt
.
hdr64
.
LoaderFlags
;
mapping
->
image
.
header_size
=
nt
.
opt
.
hdr64
.
SizeOfHeaders
;
mapping
->
image
.
checksum
=
nt
.
opt
.
hdr64
.
CheckSum
;
...
...
@@ -627,7 +633,6 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
mapping
->
image
.
machine
=
nt
.
FileHeader
.
Machine
;
mapping
->
image
.
zerobits
=
0
;
/* FIXME */
mapping
->
image
.
gp
=
0
;
/* FIXME */
mapping
->
image
.
contains_code
=
0
;
/* FIXME */
mapping
->
image
.
image_flags
=
0
;
/* FIXME */
mapping
->
image
.
file_size
=
file_size
;
...
...
@@ -642,6 +647,9 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
if
(
!
(
sec
=
malloc
(
size
)))
goto
error
;
if
(
pread
(
unix_fd
,
sec
,
size
,
pos
)
!=
size
)
goto
error
;
for
(
i
=
0
;
i
<
nt
.
FileHeader
.
NumberOfSections
&&
!
mapping
->
image
.
contains_code
;
i
++
)
if
(
sec
[
i
].
Characteristics
&
IMAGE_SCN_MEM_EXECUTE
)
mapping
->
image
.
contains_code
=
1
;
if
(
!
build_shared_mapping
(
mapping
,
unix_fd
,
sec
,
nt
.
FileHeader
.
NumberOfSections
))
goto
error
;
free
(
sec
);
...
...
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