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
7b91b826
Commit
7b91b826
authored
Mar 21, 2003
by
Eric Pouech
Committed by
Alexandre Julliard
Mar 21, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrote mapping of module into memory using only NTDLL APIs.
parent
2d04be72
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
pe_image.c
loader/pe_image.c
+28
-7
No files found.
loader/pe_image.c
View file @
7b91b826
...
...
@@ -375,15 +375,34 @@ HMODULE PE_LoadImage( HANDLE hFile, LPCSTR filename, DWORD flags )
IMAGE_NT_HEADERS
*
nt
;
HMODULE
hModule
;
HANDLE
mapping
;
void
*
base
;
void
*
base
=
NULL
;
OBJECT_ATTRIBUTES
attr
;
LARGE_INTEGER
lg_int
;
DWORD
len
=
0
;
NTSTATUS
nts
;
TRACE_
(
module
)(
"loading %s
\n
"
,
filename
);
mapping
=
CreateFileMappingA
(
hFile
,
NULL
,
SEC_IMAGE
,
0
,
0
,
NULL
);
if
(
!
mapping
)
return
0
;
base
=
MapViewOfFile
(
mapping
,
FILE_MAP_READ
,
0
,
0
,
0
);
CloseHandle
(
mapping
);
if
(
!
base
)
return
0
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
NULL
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
lg_int
.
QuadPart
=
0
;
if
(
NtCreateSection
(
&
mapping
,
STANDARD_RIGHTS_REQUIRED
|
SECTION_QUERY
|
SECTION_MAP_READ
,
&
attr
,
&
lg_int
,
0
,
SEC_IMAGE
,
hFile
)
!=
STATUS_SUCCESS
)
return
0
;
nts
=
NtMapViewOfSection
(
mapping
,
GetCurrentProcess
(),
&
base
,
0
,
0
,
&
lg_int
,
&
len
,
ViewShare
,
0
,
PAGE_READONLY
);
NtClose
(
mapping
);
if
(
nts
!=
STATUS_SUCCESS
)
return
0
;
/* virus check */
...
...
@@ -662,6 +681,7 @@ _fixup_address(PIMAGE_OPTIONAL_HEADER opt,int delta,LPVOID addr) {
/* the address has been relocated already */
return
addr
;
}
void
PE_InitTls
(
void
)
{
WINE_MODREF
*
wm
;
...
...
@@ -688,7 +708,8 @@ void PE_InitTls( void )
}
datasize
=
pdir
->
EndAddressOfRawData
-
pdir
->
StartAddressOfRawData
;
size
=
datasize
+
pdir
->
SizeOfZeroFill
;
mem
=
VirtualAlloc
(
0
,
size
,
MEM_RESERVE
|
MEM_COMMIT
,
PAGE_READWRITE
);
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
mem
,
NULL
,
&
size
,
MEM_RESERVE
|
MEM_COMMIT
,
PAGE_READWRITE
);
memcpy
(
mem
,
_fixup_address
(
&
(
peh
->
OptionalHeader
),
delta
,(
LPVOID
)
pdir
->
StartAddressOfRawData
),
datasize
);
if
(
pdir
->
AddressOfCallBacks
)
{
PIMAGE_TLS_CALLBACK
*
cbs
;
...
...
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