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
9e1c48b8
Commit
9e1c48b8
authored
Apr 29, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clear the remainder of the page when mapping a section whose size on
disk is not a full page multiple. Temporarily commented out the VirtualFree call in PE_UnloadLibrary.
parent
00d5d77d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
pe_image.c
loader/pe_image.c
+19
-7
No files found.
loader/pe_image.c
View file @
9e1c48b8
...
...
@@ -481,6 +481,7 @@ HMODULE PE_LoadImage( HANDLE hFile, LPCSTR filename, WORD *version )
DWORD
load_addr
=
0
,
aoep
,
reloc
=
0
;
struct
get_read_fd_request
*
req
=
get_req_buffer
();
int
unix_handle
=
-
1
;
int
page_size
=
VIRTUAL_GetPageSize
();
/* Retrieve file size */
if
(
GetFileInformationByHandle
(
hFile
,
&
bhfi
)
)
...
...
@@ -658,7 +659,7 @@ HMODULE PE_LoadImage( HANDLE hFile, LPCSTR filename, WORD *version )
/* Map the header */
if
(
FILE_dommap
(
unix_handle
,
(
void
*
)
load_addr
,
0
,
nt
->
OptionalHeader
.
SizeOfHeaders
,
0
,
0
,
PROT_EXEC
|
PROT_WRITE
|
PROT_READ
,
MAP_PRIVATE
|
MAP_FIXED
)
!=
load_addr
)
MAP_PRIVATE
|
MAP_FIXED
)
!=
(
void
*
)
load_addr
)
{
ERR_
(
win32
)(
"Critical Error: failed to map PE header to necessary address.
\n
"
);
goto
error
;
...
...
@@ -668,19 +669,30 @@ HMODULE PE_LoadImage( HANDLE hFile, LPCSTR filename, WORD *version )
pe_sec
=
PE_SECTIONS
(
hModule
);
for
(
i
=
0
;
i
<
nt
->
FileHeader
.
NumberOfSections
;
i
++
,
pe_sec
++
)
{
if
(
!
pe_sec
->
SizeOfRawData
)
continue
;
TRACE
(
"%s: mmaping section %s at %p off %lx
\n
"
,
if
(
!
pe_sec
->
SizeOfRawData
||
!
pe_sec
->
PointerToRawData
)
continue
;
TRACE
(
"%s: mmaping section %s at %p off %lx
size %lx/%lx
\n
"
,
filename
,
pe_sec
->
Name
,
(
void
*
)
RVA
(
pe_sec
->
VirtualAddress
),
pe_sec
->
PointerToRawData
);
pe_sec
->
PointerToRawData
,
pe_sec
->
SizeOfRawData
,
pe_sec
->
Misc
.
VirtualSize
);
if
(
FILE_dommap
(
unix_handle
,
(
void
*
)
RVA
(
pe_sec
->
VirtualAddress
),
0
,
min
(
pe_sec
->
Misc
.
VirtualSize
,
pe_sec
->
SizeOfRawData
),
0
,
pe_sec
->
PointerToRawData
,
PROT_EXEC
|
PROT_WRITE
|
PROT_READ
,
0
,
pe_sec
->
SizeOfRawData
,
0
,
pe_sec
->
PointerToRawData
,
PROT_EXEC
|
PROT_WRITE
|
PROT_READ
,
MAP_PRIVATE
|
MAP_FIXED
)
!=
(
void
*
)
RVA
(
pe_sec
->
VirtualAddress
))
{
/* We failed to map to the right place (huh?) */
ERR_
(
win32
)(
"Critical Error: failed to map PE section to necessary address.
\n
"
);
goto
error
;
}
if
((
pe_sec
->
SizeOfRawData
<
pe_sec
->
Misc
.
VirtualSize
)
&&
(
pe_sec
->
SizeOfRawData
&
(
page_size
-
1
)))
{
DWORD
end
=
(
pe_sec
->
SizeOfRawData
&
~
(
page_size
-
1
))
+
page_size
;
if
(
end
>
pe_sec
->
Misc
.
VirtualSize
)
end
=
pe_sec
->
Misc
.
VirtualSize
;
TRACE
(
"clearing %p - %p
\n
"
,
RVA
(
pe_sec
->
VirtualAddress
)
+
pe_sec
->
SizeOfRawData
,
RVA
(
pe_sec
->
VirtualAddress
)
+
end
);
memset
(
(
char
*
)
RVA
(
pe_sec
->
VirtualAddress
)
+
pe_sec
->
SizeOfRawData
,
0
,
end
-
pe_sec
->
SizeOfRawData
);
}
}
/* Perform base relocation, if necessary */
...
...
@@ -965,7 +977,7 @@ WINE_MODREF *PE_LoadLibraryExA (LPCSTR name, DWORD flags)
void
PE_UnloadLibrary
(
WINE_MODREF
*
wm
)
{
TRACE
(
" unloading %s
\n
"
,
wm
->
filename
);
VirtualFree
(
(
LPVOID
)
wm
->
module
,
0
,
MEM_RELEASE
);
/* VirtualFree( (LPVOID)wm->module, 0, MEM_RELEASE ); */
/* FIXME */
HeapFree
(
GetProcessHeap
(),
0
,
wm
->
filename
);
HeapFree
(
GetProcessHeap
(),
0
,
wm
->
short_filename
);
HeapFree
(
GetProcessHeap
(),
0
,
wm
);
...
...
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