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
3dc21d38
Commit
3dc21d38
authored
Dec 13, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Map the PE header up to the specified size, and clear the rest of the page.
parent
64b2ca25
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
11 deletions
+8
-11
loader.c
dlls/kernel32/tests/loader.c
+0
-6
virtual.c
dlls/ntdll/virtual.c
+6
-3
mapping.c
server/mapping.c
+2
-2
No files found.
dlls/kernel32/tests/loader.c
View file @
3dc21d38
...
...
@@ -360,12 +360,6 @@ START_TEST(loader)
start
=
(
const
char
*
)
hlib
+
nt_header
.
OptionalHeader
.
SizeOfHeaders
;
size
=
ALIGN_SIZE
((
ULONG_PTR
)
start
,
si
.
dwPageSize
)
-
(
ULONG_PTR
)
start
;
/* remove next 'if' and todo_wine once Wine is fixed */
if
(
nt_header
.
OptionalHeader
.
SizeOfHeaders
<
nt_header
.
OptionalHeader
.
FileAlignment
)
{
todo_wine
ok
(
!
memcmp
(
start
,
filler
,
size
),
"%d: header alignment is not cleared
\n
"
,
i
);
}
else
ok
(
!
memcmp
(
start
,
filler
,
size
),
"%d: header alignment is not cleared
\n
"
,
i
);
}
...
...
dlls/ntdll/virtual.c
View file @
3dc21d38
...
...
@@ -974,11 +974,12 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
status
=
STATUS_INVALID_IMAGE_FORMAT
;
/* generic error */
if
(
!
st
.
st_size
)
goto
error
;
header_size
=
min
(
header_size
,
st
.
st_size
);
if
(
map_file_into_view
(
view
,
fd
,
0
,
header_size
,
0
,
VPROT_COMMITTED
|
VPROT_READ
,
if
(
map_file_into_view
(
view
,
fd
,
0
,
header_size
,
0
,
VPROT_COMMITTED
|
VPROT_READ
|
VPROT_WRITECOPY
,
removable
)
!=
STATUS_SUCCESS
)
goto
error
;
dos
=
(
IMAGE_DOS_HEADER
*
)
ptr
;
nt
=
(
IMAGE_NT_HEADERS
*
)(
ptr
+
dos
->
e_lfanew
);
header_end
=
ptr
+
ROUND_SIZE
(
0
,
header_size
);
memset
(
ptr
+
header_size
,
0
,
header_end
-
(
ptr
+
header_size
)
);
if
((
char
*
)(
nt
+
1
)
>
header_end
)
goto
error
;
sec
=
(
IMAGE_SECTION_HEADER
*
)((
char
*
)
&
nt
->
OptionalHeader
+
nt
->
FileHeader
.
SizeOfOptionalHeader
);
if
((
char
*
)(
sec
+
nt
->
FileHeader
.
NumberOfSections
)
>
header_end
)
goto
error
;
...
...
@@ -1067,8 +1068,8 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
end
=
sec
->
VirtualAddress
+
ROUND_SIZE
(
sec
->
VirtualAddress
,
map_size
);
if
(
sec
->
VirtualAddress
>
total_size
||
end
>
total_size
||
end
<
sec
->
VirtualAddress
)
{
ERR
_
(
module
)(
"Section %.8s too large (%x+%lx/%lx)
\n
"
,
sec
->
Name
,
sec
->
VirtualAddress
,
map_size
,
total_size
);
WARN
_
(
module
)(
"Section %.8s too large (%x+%lx/%lx)
\n
"
,
sec
->
Name
,
sec
->
VirtualAddress
,
map_size
,
total_size
);
goto
error
;
}
...
...
@@ -1166,6 +1167,8 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
/* set the image protections */
VIRTUAL_SetProt
(
view
,
ptr
,
ROUND_SIZE
(
0
,
header_size
),
VPROT_COMMITTED
|
VPROT_READ
);
sec
=
(
IMAGE_SECTION_HEADER
*
)((
char
*
)
&
nt
->
OptionalHeader
+
nt
->
FileHeader
.
SizeOfOptionalHeader
);
for
(
i
=
0
;
i
<
nt
->
FileHeader
.
NumberOfSections
;
i
++
,
sec
++
)
{
...
...
server/mapping.c
View file @
3dc21d38
...
...
@@ -243,11 +243,11 @@ static int get_image_params( struct mapping *mapping )
mapping
->
size
=
ROUND_SIZE
(
nt
.
OptionalHeader
.
SizeOfImage
);
mapping
->
base
=
(
void
*
)
nt
.
OptionalHeader
.
ImageBase
;
mapping
->
header_size
=
pos
+
size
;
mapping
->
header_size
=
max
(
pos
+
size
,
nt
.
OptionalHeader
.
SizeOfHeaders
)
;
mapping
->
protect
=
VPROT_IMAGE
;
/* sanity check */
if
(
mapping
->
header_
size
>
mapping
->
size
)
goto
error
;
if
(
pos
+
size
>
mapping
->
size
)
goto
error
;
free
(
sec
);
release_object
(
fd
);
...
...
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