Changeset 4357 for trunk/src/kernel32/winimagepe2lx.cpp
- Timestamp:
- Oct 2, 2000, 6:00:36 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagepe2lx.cpp
r4304 r4357 1 /* $Id: winimagepe2lx.cpp,v 1.1 5 2000-09-22 04:35:09bird Exp $ */1 /* $Id: winimagepe2lx.cpp,v 1.16 2000-10-02 04:00:35 bird Exp $ */ 2 2 3 3 /* … … 270 270 * And we'll have to make the pages before it readable. 271 271 */ 272 ULONG iSection = getSectionIndexFromRVA(ulRVAResourceSection);272 LONG iSection = getSectionIndexFromRVA(ulRVAResourceSection); 273 273 if (iSection >= 0) 274 274 { … … 313 313 { 314 314 PIMAGE_TLS_DIRECTORY pTLSDir; 315 LONG iSection; 316 iSection = getSectionIndexFromRVA(pNtHdrs->OptionalHeader. 317 DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS]. 318 VirtualAddress); 315 319 pTLSDir = (PIMAGE_TLS_DIRECTORY)getPointerFromRVA(pNtHdrs->OptionalHeader. 316 320 DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS]. 317 321 VirtualAddress); 318 322 319 if (pTLSDir != NULL )323 if (pTLSDir != NULL && iSection != -1) 320 324 { 321 325 PVOID pv; 322 326 ULONG ulBorlandRVAFix = 0UL; 323 327 324 pv = getPointerFromRVA(pTLSDir->StartAddressOfRawData);325 328 /* 326 329 * Borland seems to have problems getting things right... 327 * Needs to subtract image base to make the TLSDir "RVA"s real 328 * RVAs before converting them to pointers. 330 * Uses real pointers with baserelocations. 331 * Needs to subtract image loadaddress to make the TLSDir them RVAs. 332 * 333 * We'll check if the StartAddressOfRawData pointer is an RVA or an real address by 334 * check if it is within the TLS section or not. 335 * ASSUMES: StartAddressOfRawData is in the same section as the TLS Directory. 329 336 */ 330 if ( (pv == NULL || pTLSDir->StartAddressOfRawData == 0UL)331 && pTLSDir->StartAddressOfRawData > this->pNtHdrs->OptionalHeader.ImageBase)332 { 333 ulBorlandRVAFix = this->pNtHdrs->OptionalHeader.ImageBase;334 pv = getPointerFromRVA(pTLSDir->StartAddressOfRawData - ulBorlandRVAFix);335 }337 if (paSections[iSection].ulRVA > pTLSDir->StartAddressOfRawData || 338 paSections[iSection].ulRVA + paSections[iSection].cbVirtual <= pTLSDir->StartAddressOfRawData) 339 { /* StartAddressOfRawData was not an RVA within the same section as the TLS directory */ 340 ulBorlandRVAFix = paSections[iSection].ulAddress - paSections[iSection].ulRVA; 341 } 342 pv = getPointerFromRVA(pTLSDir->StartAddressOfRawData - ulBorlandRVAFix); 336 343 if (pv == NULL || pTLSDir->StartAddressOfRawData == 0UL) 337 344 { … … 729 736 * RVA == 0 is ignored. 730 737 */ 731 ULONG Win32Pe2LxImage::getSectionIndexFromRVA(ULONG ulRVA)732 { 733 inti;738 LONG Win32Pe2LxImage::getSectionIndexFromRVA(ULONG ulRVA) 739 { 740 LONG i; 734 741 #ifdef DEBUG 735 742 if (paSections == NULL)
Note:
See TracChangeset
for help on using the changeset viewer.