Small hack to check if we need to relocate the TLS directory or not

(some seem to need this pointer relocateable, some already do relocate
it by themselves).
This commit is contained in:
Marcus Meissner 1999-10-13 13:46:24 +00:00 committed by Alexandre Julliard
parent 9607512134
commit a19862fc47

View file

@ -1056,7 +1056,12 @@ void PE_InitTls( void )
if ( pem->tlsindex == -1 ) {
pem->tlsindex = TlsAlloc();
*pdir->AddressOfIndex=pem->tlsindex;
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;
}
datasize= pdir->EndAddressOfRawData-pdir->StartAddressOfRawData;
size = datasize + pdir->SizeOfZeroFill;