Changeset 1844 for trunk/src/kernel32/winimagepeldr.cpp
- Timestamp:
- Nov 26, 1999, 1:05:20 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagepeldr.cpp
r1835 r1844 1 /* $Id: winimagepeldr.cpp,v 1.1 6 1999-11-24 19:52:34sandervl Exp $ */1 /* $Id: winimagepeldr.cpp,v 1.17 1999-11-26 00:05:19 sandervl Exp $ */ 2 2 3 3 /* … … 315 315 tlsDir = (IMAGE_TLS_DIRECTORY *)ImageDirectoryOffset(win32file, IMAGE_DIRECTORY_ENTRY_TLS); 316 316 if(tlsDir) { 317 fout << "TLS Directory" << endl;318 fout << "TLS Address of Index " << hex((ULONG)tlsDir->AddressOfIndex) << endl;319 fout << "TLS Address of Callbacks " << hex((ULONG)tlsDir->AddressOfCallBacks) << endl;320 fout << "TLS SizeOfZeroFill " << hex(tlsDir->SizeOfZeroFill) << endl;321 fout << "TLS Characteristics " << hex(tlsDir->Characteristics) << endl;322 317 addSection(SECTION_TLS, psh[i].PointerToRawData, 323 318 psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase, … … 440 435 goto failure; 441 436 } 437 fout << "TLS Directory" << endl; 438 fout << "TLS Address of Index " << hex((ULONG)tlsDir->AddressOfIndex) << endl; 439 fout << "TLS Address of Callbacks " << hex((ULONG)tlsDir->AddressOfCallBacks) << endl; 440 fout << "TLS SizeOfZeroFill " << hex(tlsDir->SizeOfZeroFill) << endl; 441 fout << "TLS Characteristics " << hex(tlsDir->Characteristics) << endl; 442 442 setTLSAddress((char *)sect->realvirtaddr); 443 443 setTLSInitSize(tlsDir->EndAddressOfRawData - tlsDir->StartAddressOfRawData); … … 463 463 commitPage((ULONG)pFixups, FALSE); 464 464 } 465 if(fh.Characteristics & IMAGE_FILE_DLL) {465 // if(fh.Characteristics & IMAGE_FILE_DLL) { 466 466 if(processExports((char *)win32file) == FALSE) { 467 467 fout << "Failed to process exported apis" << endl; 468 468 goto failure; 469 469 } 470 }470 // } 471 471 } 472 472 … … 1432 1432 //****************************************************************************** 1433 1433 //****************************************************************************** 1434 ULONG Win32PeLdrImage::getApi(char *name) 1435 { 1436 ULONG apiaddr, i, apilen; 1437 char *apiname; 1438 char tmp[4]; 1439 NameExport *curexport; 1440 ULONG ulAPIOrdinal; /* api requested by ordinal */ 1441 1442 apilen = strlen(name) + 1; 1443 if(apilen < 4) 1444 { 1445 *(ULONG *)tmp = 0; 1446 strcpy(tmp, name); 1447 apiname = tmp; 1448 } 1449 else apiname = name; 1450 1451 curexport = nameexports; 1452 for(i=0; i<nrNameExports; i++) 1453 { 1454 if(apilen == curexport->nlength && 1455 *(ULONG *)curexport->name == *(ULONG *)name) 1456 { 1457 if(strcmp(curexport->name, name) == 0) 1458 return(curexport->virtaddr); 1459 } 1460 curexport = (NameExport *)((ULONG)curexport->name + curexport->nlength); 1461 } 1462 return(0); 1463 } 1464 //****************************************************************************** 1465 //****************************************************************************** 1466 ULONG Win32PeLdrImage::getApi(int ordinal) 1467 { 1468 ULONG apiaddr, i; 1469 OrdExport *curexport; 1470 NameExport *nexport; 1471 1472 curexport = ordexports; 1473 for(i=0;i<nrOrdExports;i++) { 1474 if(curexport->ordinal == ordinal) 1475 return(curexport->virtaddr); 1476 curexport++; 1477 } 1478 //Name exports also contain an ordinal, so check this 1479 nexport = nameexports; 1480 for(i=0;i<nrNameExports;i++) { 1481 if(nexport->ordinal == ordinal) 1482 return(nexport->virtaddr); 1483 1484 nexport = (NameExport *)((ULONG)nexport->name + nexport->nlength); 1485 } 1486 return(0); 1487 } 1488 //****************************************************************************** 1489 //****************************************************************************** 1434 1490 ULONG MissingApi() 1435 1491 {
Note:
See TracChangeset
for help on using the changeset viewer.