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
38eae846
Commit
38eae846
authored
Nov 07, 1999
by
Marcus Meissner
Committed by
Alexandre Julliard
Nov 07, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the relocation hack in PE_InitTls. Added some more for the other
pointerfields in the TLS entry. (With testing help from Jussi Jumppanen <jussij@zeusedit.com>).
parent
5e2f50f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
+19
-9
pe_image.c
loader/pe_image.c
+19
-9
No files found.
loader/pe_image.c
View file @
38eae846
...
...
@@ -1034,6 +1034,17 @@ BOOL PE_InitDLL( WINE_MODREF *wm, DWORD type, LPVOID lpReserved )
* Pointers in those structs are not RVAs but real pointers which have been
* relocated by do_relocations() already.
*/
static
LPVOID
_fixup_address
(
PIMAGE_OPTIONAL_HEADER
opt
,
int
delta
,
LPVOID
addr
)
{
if
(
((
DWORD
)
addr
>
opt
->
ImageBase
)
&&
((
DWORD
)
addr
<
opt
->
ImageBase
+
opt
->
SizeOfImage
)
)
/* the address has not been relocated! */
return
(
LPVOID
)(((
DWORD
)
addr
)
+
delta
);
else
/* the address has been relocated already */
return
addr
;
}
void
PE_InitTls
(
void
)
{
WINE_MODREF
*
wm
;
...
...
@@ -1057,22 +1068,21 @@ void PE_InitTls( void )
if
(
pem
->
tlsindex
==
-
1
)
{
LPDWORD
xaddr
;
pem
->
tlsindex
=
TlsAlloc
();
if
((((
DWORD
)
pdir
->
AddressOfIndex
)
>
peh
->
OptionalHeader
.
ImageBase
)
&&
(((
DWORD
)
pdir
->
AddressOfIndex
)
<
peh
->
OptionalHeader
.
ImageBase
+
peh
->
OptionalHeader
.
SizeOfImage
)
)
*
pdir
->
AddressOfIndex
=
pem
->
tlsindex
;
else
*
(
LPDWORD
)((((
char
*
)
pdir
->
AddressOfIndex
)
+
delta
))
=
pem
->
tlsindex
;
xaddr
=
_fixup_address
(
&
(
peh
->
OptionalHeader
),
delta
,
pdir
->
AddressOfIndex
);
*
xaddr
=
pem
->
tlsindex
;
}
datasize
=
pdir
->
EndAddressOfRawData
-
pdir
->
StartAddressOfRawData
;
size
=
datasize
+
pdir
->
SizeOfZeroFill
;
mem
=
VirtualAlloc
(
0
,
size
,
MEM_RESERVE
|
MEM_COMMIT
,
PAGE_READWRITE
);
memcpy
(
mem
,
(
LPVOID
)
pdir
->
StartAddressOfRawData
,
datasize
);
memcpy
(
mem
,
_fixup_address
(
&
(
peh
->
OptionalHeader
),
delta
,(
LPVOID
)
pdir
->
StartAddressOfRawData
)
,
datasize
);
if
(
pdir
->
AddressOfCallBacks
)
{
PIMAGE_TLS_CALLBACK
*
cbs
=
(
PIMAGE_TLS_CALLBACK
*
)
pdir
->
AddressOfCallBacks
;
PIMAGE_TLS_CALLBACK
*
cbs
;
cbs
=
_fixup_address
(
&
(
peh
->
OptionalHeader
),
delta
,
pdir
->
AddressOfCallBacks
);
if
(
*
cbs
)
FIXME_
(
win32
)(
"TLS Callbacks aren't going to be called
\n
"
);
}
...
...
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