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
3dd58d8b
Commit
3dd58d8b
authored
Mar 07, 2012
by
Erich Hoover
Committed by
Alexandre Julliard
Mar 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Fix mapping sections for applications that map over the section headers.
parent
fbe67233
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
virtual.c
dlls/ntdll/virtual.c
+15
-4
No files found.
dlls/ntdll/virtual.c
View file @
3dd58d8b
...
...
@@ -1122,7 +1122,7 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
{
IMAGE_DOS_HEADER
*
dos
;
IMAGE_NT_HEADERS
*
nt
;
IMAGE_SECTION_HEADER
*
sec
;
IMAGE_SECTION_HEADER
*
sec
=
NULL
;
IMAGE_DATA_DIRECTORY
*
imports
;
NTSTATUS
status
=
STATUS_CONFLICTING_ADDRESSES
;
int
i
;
...
...
@@ -1130,7 +1130,7 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
sigset_t
sigset
;
struct
stat
st
;
struct
file_view
*
view
=
NULL
;
char
*
ptr
,
*
header_end
;
char
*
ptr
,
*
header_end
,
*
header_start
;
INT_PTR
delta
=
0
;
/* zero-map the whole range */
...
...
@@ -1167,8 +1167,17 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
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
;
header_start
=
(
char
*
)
&
nt
->
OptionalHeader
+
nt
->
FileHeader
.
SizeOfOptionalHeader
;
if
(
header_start
+
sizeof
(
*
sec
)
*
nt
->
FileHeader
.
NumberOfSections
>
header_end
)
goto
error
;
/* Some applications (e.g. the Steam version of Borderlands) map over the top of the section headers,
* copying the headers into local memory is necessary to properly load such applications. */
sec
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
*
sec
)
*
nt
->
FileHeader
.
NumberOfSections
);
if
(
!
sec
)
{
status
=
STATUS_NO_MEMORY
;
goto
error
;
}
memcpy
(
sec
,
header_start
,
sizeof
(
*
sec
)
*
nt
->
FileHeader
.
NumberOfSections
);
imports
=
nt
->
OptionalHeader
.
DataDirectory
+
IMAGE_DIRECTORY_ENTRY_IMPORT
;
if
(
!
imports
->
Size
||
!
imports
->
VirtualAddress
)
imports
=
NULL
;
...
...
@@ -1364,6 +1373,7 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
}
done:
RtlFreeHeap
(
GetProcessHeap
(),
0
,
sec
);
view
->
mapping
=
dup_mapping
;
view
->
map_protect
=
map_vprot
;
server_leave_uninterrupted_section
(
&
csVirtual
,
&
sigset
);
...
...
@@ -1376,6 +1386,7 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
return
STATUS_SUCCESS
;
error:
RtlFreeHeap
(
GetProcessHeap
(),
0
,
sec
);
if
(
view
)
delete_view
(
view
);
server_leave_uninterrupted_section
(
&
csVirtual
,
&
sigset
);
if
(
dup_mapping
)
NtClose
(
dup_mapping
);
...
...
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