- Timestamp:
- Nov 26, 1999, 1:05:20 AM (26 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/oslibdos.cpp
r1811 r1844 1 /* $Id: oslibdos.cpp,v 1. 9 1999-11-22 20:35:50sandervl Exp $ */1 /* $Id: oslibdos.cpp,v 1.10 1999-11-26 00:05:18 sandervl Exp $ */ 2 2 3 3 /* … … 47 47 if(size != cb) { 48 48 dprintf(("ERROR: OSLibDosAliasMem: size != cb (%x!=%x)!!!!!!!!", size, cb)); 49 return 5; 49 //ignore this and continue return 5; 50 attr = fl; //just use original protection flags (NOT CORRECT) 50 51 } 51 52 attr &= (PAG_READ|PAG_WRITE|PAG_EXECUTE|PAG_GUARD|PAG_DEFAULT); -
trunk/src/kernel32/windlllx.cpp
r1423 r1844 1 /* $Id: windlllx.cpp,v 1. 4 1999-10-23 23:02:17sandervl Exp $ */1 /* $Id: windlllx.cpp,v 1.5 1999-11-26 00:05:19 sandervl Exp $ */ 2 2 3 3 /* … … 114 114 //****************************************************************************** 115 115 //****************************************************************************** 116 ULONG Win32LxDll::getApi(char *name)117 {118 APIRET rc;119 ULONG apiaddr;120 121 rc = DosQueryProcAddr(hinstance, 0, name, (PFN *)&apiaddr);122 if(rc)123 {124 if(rc == ERROR_INVALID_HANDLE)125 {//handle invalid for some silly reason, so load module again (initterm entrypoint not called twice)126 char szErrName[CCHMAXPATH];127 128 rc = DosLoadModule(szErrName, sizeof(szErrName), szFileName, &hinstance);129 if(!rc)130 rc = DosQueryProcAddr(hinstance, 0, name, (PFN *)&apiaddr);131 }132 if(rc) return(0);133 }134 return(apiaddr);135 }136 //******************************************************************************137 //******************************************************************************138 ULONG Win32LxDll::getApi(int ordinal)139 {140 APIRET rc;141 ULONG apiaddr;142 143 rc = DosQueryProcAddr(hinstance, ordinal, NULL, (PFN *)&apiaddr);144 if(rc) {145 if(rc == ERROR_INVALID_HANDLE)146 {//handle invalid for some silly reason, so load module again (initterm entrypoint not called twice)147 char szErrName[CCHMAXPATH];148 149 rc = DosLoadModule(szErrName, sizeof(szErrName), szFileName, &hinstance);150 if(!rc)151 rc = DosQueryProcAddr(hinstance, ordinal, NULL, (PFN *)&apiaddr);152 }153 if(rc) return(0);154 }155 return(apiaddr);156 }157 //******************************************************************************158 //******************************************************************************159 116 BOOL Win32LxDll::isLxDll() 160 117 { -
trunk/src/kernel32/windllpe2lx.cpp
r1325 r1844 1 /* $Id: windllpe2lx.cpp,v 1. 3 1999-10-17 01:49:08 birdExp $ */1 /* $Id: windllpe2lx.cpp,v 1.4 1999-11-26 00:05:19 sandervl Exp $ */ 2 2 3 3 /* … … 168 168 169 169 /** 170 * Gets pointer to an exported procedure by procedure name.171 * @returns Address of exported procedure. 0UL if not found.172 * @param name Exported procedure name.173 * @status completely implemented.174 * @author Sander van Leeuwen175 * @remark176 */177 ULONG Win32Pe2LxDll::getApi(char *name)178 {179 APIRET rc;180 ULONG ulApiAddr;181 182 rc = DosQueryProcAddr(hinstance, 0, name, (PFN *)&ulApiAddr);183 return rc == NO_ERROR ? ulApiAddr : 0;184 }185 186 187 /**188 * Gets pointer to an exported procedure by ordinal.189 * @returns Pointer to an exported procedure. 0UL if not found.190 * @param ordinal Export ordinal number.191 * @status completely implemented.192 * @author Sander van Leeuwen193 * @remark FIXME:194 * This function should be implemented for both Exe and Dll images!195 * It could be done similar in both peldr image and pe2lx images by196 * accessing PE structures.197 */198 ULONG Win32Pe2LxDll::getApi(int ordinal)199 {200 APIRET rc;201 ULONG ulApiAddr;202 203 rc = DosQueryProcAddr(hinstance, ordinal, NULL, (PFN *)&ulApiAddr);204 205 return rc == NO_ERROR ? ulApiAddr : 0;206 }207 208 209 /**210 170 * Simple question: -Native LX dll? 211 171 * -No! -
trunk/src/kernel32/windllpeldr.cpp
r1833 r1844 1 /* $Id: windllpeldr.cpp,v 1. 3 1999-11-24 19:31:23sandervl Exp $ */1 /* $Id: windllpeldr.cpp,v 1.4 1999-11-26 00:05:19 sandervl Exp $ */ 2 2 3 3 /* … … 81 81 //****************************************************************************** 82 82 //****************************************************************************** 83 ULONG Win32PeLdrDll::getApi(char *name)84 {85 ULONG apiaddr, i, apilen;86 char *apiname;87 char tmp[4];88 NameExport *curexport;89 ULONG ulAPIOrdinal; /* api requested by ordinal */90 91 apilen = strlen(name) + 1;92 if(apilen < 4)93 {94 *(ULONG *)tmp = 0;95 strcpy(tmp, name);96 apiname = tmp;97 }98 else apiname = name;99 100 curexport = nameexports;101 for(i=0; i<nrNameExports; i++)102 {103 if(apilen == curexport->nlength &&104 *(ULONG *)curexport->name == *(ULONG *)name)105 {106 if(strcmp(curexport->name, name) == 0)107 return(curexport->virtaddr);108 }109 curexport = (NameExport *)((ULONG)curexport->name + curexport->nlength);110 }111 return(0);112 }113 //******************************************************************************114 //******************************************************************************115 ULONG Win32PeLdrDll::getApi(int ordinal)116 {117 ULONG apiaddr, i;118 OrdExport *curexport;119 NameExport *nexport;120 121 curexport = ordexports;122 for(i=0;i<nrOrdExports;i++) {123 if(curexport->ordinal == ordinal)124 return(curexport->virtaddr);125 curexport++;126 }127 //Name exports also contain an ordinal, so check this128 nexport = nameexports;129 for(i=0;i<nrNameExports;i++) {130 if(nexport->ordinal == ordinal)131 return(nexport->virtaddr);132 133 nexport = (NameExport *)((ULONG)nexport->name + nexport->nlength);134 }135 return(0);136 }137 //******************************************************************************138 //******************************************************************************139 83 BOOL Win32PeLdrDll::isLxDll() 140 84 { -
trunk/src/kernel32/winfakepeldr.cpp
r1833 r1844 1 /* $Id: winfakepeldr.cpp,v 1. 2 1999-11-24 19:31:23sandervl Exp $ */1 /* $Id: winfakepeldr.cpp,v 1.3 1999-11-26 00:05:19 sandervl Exp $ */ 2 2 3 3 /* … … 49 49 //****************************************************************************** 50 50 //****************************************************************************** 51 ULONG Win32PeLdrRsrcImg::getApi(char *name) 52 { 53 DebugInt3(); 54 return 0; 55 } 56 //****************************************************************************** 57 //****************************************************************************** 58 ULONG Win32PeLdrRsrcImg::getApi(int ordinal) 59 { 60 DebugInt3(); 61 return 0; 62 } 63 //****************************************************************************** 64 //****************************************************************************** -
trunk/src/kernel32/winimagelx.cpp
r1131 r1844 1 /* $Id: winimagelx.cpp,v 1. 3 1999-10-04 20:52:33sandervl Exp $ */1 /* $Id: winimagelx.cpp,v 1.4 1999-11-26 00:05:19 sandervl Exp $ */ 2 2 3 3 /* … … 68 68 //****************************************************************************** 69 69 //****************************************************************************** 70 ULONG Win32LxImage::getApi(char *name) 71 { 72 APIRET rc; 73 ULONG apiaddr; 70 74 75 rc = DosQueryProcAddr(hinstance, 0, name, (PFN *)&apiaddr); 76 if(rc) 77 { 78 if(rc == ERROR_INVALID_HANDLE) 79 {//handle invalid for some silly reason, so load module again (initterm entrypoint not called twice) 80 char szErrName[CCHMAXPATH]; 81 82 rc = DosLoadModule(szErrName, sizeof(szErrName), szFileName, &hinstance); 83 if(!rc) 84 rc = DosQueryProcAddr(hinstance, 0, name, (PFN *)&apiaddr); 85 } 86 if(rc) return(0); 87 } 88 return(apiaddr); 89 } 90 //****************************************************************************** 91 //****************************************************************************** 92 ULONG Win32LxImage::getApi(int ordinal) 93 { 94 APIRET rc; 95 ULONG apiaddr; 96 97 rc = DosQueryProcAddr(hinstance, ordinal, NULL, (PFN *)&apiaddr); 98 if(rc) { 99 if(rc == ERROR_INVALID_HANDLE) 100 {//handle invalid for some silly reason, so load module again (initterm entrypoint not called twice) 101 char szErrName[CCHMAXPATH]; 102 103 rc = DosLoadModule(szErrName, sizeof(szErrName), szFileName, &hinstance); 104 if(!rc) 105 rc = DosQueryProcAddr(hinstance, ordinal, NULL, (PFN *)&apiaddr); 106 } 107 if(rc) return(0); 108 } 109 return(apiaddr); 110 } 111 //****************************************************************************** 112 //****************************************************************************** 113 -
trunk/src/kernel32/winimagepe2lx.cpp
r1767 r1844 1 /* $Id: winimagepe2lx.cpp,v 1. 5 1999-11-18 08:55:06 birdExp $ */1 /* $Id: winimagepe2lx.cpp,v 1.6 1999-11-26 00:05:19 sandervl Exp $ */ 2 2 3 3 /* … … 16 16 #define INCL_DOSERRORS /* DOS Error values */ 17 17 #define INCL_DOSPROFILE /* DosQuerySysState (Toolkit 4.5) */ 18 #define INCL_DOSMODULEMGR /* DOS Module management */ 18 19 19 20 #define ALIGN(a, alignment) (((a) + (alignment - 1UL)) & ~(alignment - 1UL)) … … 524 525 } 525 526 527 /** 528 * Gets pointer to an exported procedure by procedure name. 529 * @returns Address of exported procedure. 0UL if not found. 530 * @param name Exported procedure name. 531 * @status completely implemented. 532 * @author Sander van Leeuwen 533 * @remark 534 */ 535 ULONG Win32Pe2LxImage::getApi(char *name) 536 { 537 APIRET rc; 538 ULONG ulApiAddr; 539 540 rc = DosQueryProcAddr(hinstance, 0, name, (PFN *)&ulApiAddr); 541 return rc == NO_ERROR ? ulApiAddr : 0; 542 } 543 544 545 /** 546 * Gets pointer to an exported procedure by ordinal. 547 * @returns Pointer to an exported procedure. 0UL if not found. 548 * @param ordinal Export ordinal number. 549 * @status completely implemented. 550 * @author Sander van Leeuwen 551 * @remark FIXME: 552 * This function should be implemented for both Exe and Dll images! 553 * It could be done similar in both peldr image and pe2lx images by 554 * accessing PE structures. 555 */ 556 ULONG Win32Pe2LxImage::getApi(int ordinal) 557 { 558 APIRET rc; 559 ULONG ulApiAddr; 560 561 rc = DosQueryProcAddr(hinstance, ordinal, NULL, (PFN *)&ulApiAddr); 562 563 return rc == NO_ERROR ? ulApiAddr : 0; 564 } -
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 { -
trunk/src/kernel32/wprocess.cpp
r1811 r1844 1 /* $Id: wprocess.cpp,v 1.5 0 1999-11-22 20:35:52sandervl Exp $ */1 /* $Id: wprocess.cpp,v 1.51 1999-11-26 00:05:20 sandervl Exp $ */ 2 2 3 3 /* … … 684 684 FARPROC WIN32API GetProcAddress(HMODULE hModule, LPCSTR lpszProc) 685 685 { 686 Win32 DllBase *winmod;686 Win32ImageBase *winmod; 687 687 FARPROC proc; 688 688 ULONG ulAPIOrdinal; 689 689 690 winmod = Win32DllBase::findModule((HINSTANCE)hModule); 690 if(hModule == 0 || hModule == -1 || (WinExe && hModule == WinExe->getInstanceHandle())) { 691 winmod = WinExe; 692 } 693 else winmod = (Win32ImageBase *)Win32DllBase::findModule((HINSTANCE)hModule); 694 691 695 if(winmod) { 692 696 ulAPIOrdinal = (ULONG)lpszProc;
Note:
See TracChangeset
for help on using the changeset viewer.