- Timestamp:
- Oct 10, 2000, 7:14:09 PM (25 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/dbglocal.cpp
r4372 r4474 1 /* $Id: dbglocal.cpp,v 1.1 1 2000-10-02 13:38:55sandervl Exp $ */1 /* $Id: dbglocal.cpp,v 1.12 2000-10-10 17:14:02 sandervl Exp $ */ 2 2 3 3 /* … … 98 98 "cvtbitmap", 99 99 "hmmmap", 100 "winfakepeldr",101 100 "cvtaccel", 102 101 "cvticon", -
trunk/src/kernel32/dbglocal.h
r4372 r4474 1 /* $Id: dbglocal.h,v 1.1 1 2000-10-02 13:38:56sandervl Exp $ */1 /* $Id: dbglocal.h,v 1.12 2000-10-10 17:14:03 sandervl Exp $ */ 2 2 3 3 /* … … 97 97 #define DBG_cvtbitmap 75 98 98 #define DBG_hmmmap 76 99 #define DBG_winfakepeldr 77 100 #define DBG_cvtaccel 78 101 #define DBG_cvticon 79 102 #define DBG_cvticongrp 80 103 #define DBG_oslibexcept 81 104 #define DBG_cpu 82 105 #define DBG_process 83 106 #define DBG_cvtcursor 84 107 #define DBG_cvtcursorgrp 85 108 #define DBG_stubs 86 109 #define DBG_interlock 87 110 #define DBG_toolhelp 88 111 #define DBG_codepage 89 112 #define DBG_debug 90 113 #define DBG_oslibdebug 91 114 #define DBG_registry 92 115 #define DBG_queue 93 116 #define DBG_hmthread 94 117 #define DBG_hmprocess 95 118 #define DBG_VSemaphore 96 119 #define DBG_exceptstackdump 97 120 #define DBG_hmfile 98 121 #define DBG_hmnpipe 99 122 #define DBG_hmdisk 100 123 #define DBG_version 101 124 #define DBG_MAXFILES 102 99 #define DBG_cvtaccel 77 100 #define DBG_cvticon 78 101 #define DBG_cvticongrp 79 102 #define DBG_oslibexcept 80 103 #define DBG_cpu 81 104 #define DBG_process 82 105 #define DBG_cvtcursor 83 106 #define DBG_cvtcursorgrp 84 107 #define DBG_stubs 85 108 #define DBG_interlock 86 109 #define DBG_toolhelp 87 110 #define DBG_codepage 88 111 #define DBG_debug 89 112 #define DBG_oslibdebug 90 113 #define DBG_registry 91 114 #define DBG_queue 92 115 #define DBG_hmthread 93 116 #define DBG_hmprocess 94 117 #define DBG_VSemaphore 95 118 #define DBG_exceptstackdump 96 119 #define DBG_hmfile 97 120 #define DBG_hmnpipe 98 121 #define DBG_hmdisk 99 122 #define DBG_version 100 123 #define DBG_MAXFILES 101 125 124 126 125 extern USHORT DbgEnabled[DBG_MAXFILES]; -
trunk/src/kernel32/hmfile.cpp
r4256 r4474 1 /* $Id: hmfile.cpp,v 1.2 1 2000-09-13 21:10:59sandervl Exp $ */1 /* $Id: hmfile.cpp,v 1.22 2000-10-10 17:14:03 sandervl Exp $ */ 2 2 3 3 /* … … 597 597 // } 598 598 599 //testestest!!!! 600 dprintf(("%s", lpRealBuf)); 601 //testestest!!!! 602 603 599 604 dprintf(("KERNEL32: HMDeviceFileClass::WriteFile returned %08xh\n", 600 605 bRC)); -
trunk/src/kernel32/initsystem.cpp
r4407 r4474 1 /* $Id: initsystem.cpp,v 1.1 7 2000-10-03 17:28:30sandervl Exp $ */1 /* $Id: initsystem.cpp,v 1.18 2000-10-10 17:14:04 sandervl Exp $ */ 2 2 /* 3 3 * Odin system initialization (registry, directories & environment) … … 7 7 * 8 8 * InitSystemAndRegistry creates: 9 * - SYSTEMDIR\drivers 9 10 * - WINDOWSDIR\SYSTEM 10 11 * - WINDOWSDIR\AppData … … 192 193 // if(RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey) != ERROR_SUCCESS) 193 194 // { 195 //system32\drivers dir 196 strcpy(shellpath, InternalGetSystemDirectoryA()); 197 strcat(shellpath, "\\Drivers"); 198 CreateDirectoryA(shellpath, NULL); 199 194 200 //SYSTEM dir 195 201 strcpy(shellpath, InternalGetWindowsDirectoryA()); -
trunk/src/kernel32/initterm.cpp
r4396 r4474 1 /* $Id: initterm.cpp,v 1.4 7 2000-10-02 21:40:57 phallerExp $ */1 /* $Id: initterm.cpp,v 1.48 2000-10-10 17:14:04 sandervl Exp $ */ 2 2 3 3 /* … … 120 120 char *endofpath = strrchr(kernel32Path, '\\'); 121 121 *(endofpath+1) = 0; 122 dprintf(("kernel32 init \n"));122 dprintf(("kernel32 init %s %s", __DATE__, __TIME__)); 123 123 _ctordtorInit(); 124 124 -
trunk/src/kernel32/makefile
r4372 r4474 1 # $Id: makefile,v 1.10 2 2000-10-02 13:38:56sandervl Exp $1 # $Id: makefile,v 1.103 2000-10-10 17:14:04 sandervl Exp $ 2 2 3 3 # … … 107 107 $(OBJDIR)\cvtbitmap.obj \ 108 108 $(OBJDIR)\hmmmap.obj \ 109 $(OBJDIR)\winfakepeldr.obj \110 109 $(OBJDIR)\cvtaccel.obj \ 111 110 $(OBJDIR)\cvticon.obj \ -
trunk/src/kernel32/oslibdos.cpp
r4473 r4474 1 /* $Id: oslibdos.cpp,v 1.4 8 2000-10-09 22:51:18sandervl Exp $ */1 /* $Id: oslibdos.cpp,v 1.49 2000-10-10 17:14:04 sandervl Exp $ */ 2 2 /* 3 3 * Wrappers for OS/2 Dos* API … … 1744 1744 DosFindClose(hDir); 1745 1745 SetLastError(error2WinError(rc)); 1746 return INVALID_HANDLE_VALUE_W;1746 return INVALID_HANDLE_VALUE_W; 1747 1747 } 1748 1748 translateFindResults(&result,lpFindFileData); 1749 SetLastError(ERROR_SUCCESS_W); 1749 1750 return hDir; 1750 1751 } … … 1783 1784 *count = searchCount; 1784 1785 1786 SetLastError(ERROR_SUCCESS_W); 1785 1787 return hDir; 1786 1788 } … … 1801 1803 1802 1804 translateFindResults(&result,lpFindFileData); 1803 1805 SetLastError(ERROR_SUCCESS_W); 1804 1806 return TRUE; 1805 1807 } … … 1831 1833 *count = searchCount; 1832 1834 1835 SetLastError(ERROR_SUCCESS_W); 1833 1836 return TRUE; 1834 1837 } … … 1841 1844 { 1842 1845 SetLastError(error2WinError(rc)); 1843 1844 1846 return FALSE; 1845 1847 } 1846 1848 1849 SetLastError(ERROR_SUCCESS_W); 1847 1850 return TRUE; 1848 1851 } … … 1859 1862 1860 1863 if(lpFileSystemNameBuffer == NULL) { 1861 DebugInt3();1862 return ERROR_INVALID_PARAMETER_W;1864 DebugInt3(); 1865 return ERROR_INVALID_PARAMETER_W; 1863 1866 } 1864 1867 drv[0] = (char)('A' + drive - 1); … … 1870 1873 switch(rc) { 1871 1874 case ERROR_INVALID_DRIVE: 1872 return ERROR_INVALID_DRIVE_W;1875 return ERROR_INVALID_DRIVE_W; 1873 1876 case ERROR_NO_VOLUME_LABEL: 1874 return ERROR_NO_VOLUME_LABEL_W;1877 return ERROR_NO_VOLUME_LABEL_W; 1875 1878 case NO_ERROR: 1876 break;1879 break; 1877 1880 default: 1878 return ERROR_NOT_ENOUGH_MEMORY; //whatever1881 return ERROR_NOT_ENOUGH_MEMORY; //whatever 1879 1882 } 1880 1883 … … 1889 1892 /* 1890 1893 if(strlen(fsname) < nFileSystemNameSize) { 1891 strcpy(lpFileSystemNameBuffer, fsname);1894 strcpy(lpFileSystemNameBuffer, fsname); 1892 1895 } 1893 1896 else return ERROR_BUFFER_OVERFLOW_W; … … 2000 2003 return -1; // INVALID_HANDLE_VALUE 2001 2004 } 2005 SetLastError(ERROR_SUCCESS_W); 2002 2006 return NO_ERROR; 2003 2007 } … … 2075 2079 } 2076 2080 else len += 3; // + 3 since DosQueryCurDir doesn't include drive 2081 2082 SetLastError(ERROR_SUCCESS_W); 2077 2083 return len; 2078 2084 } -
trunk/src/kernel32/windllbase.cpp
r4387 r4474 1 /* $Id: windllbase.cpp,v 1.1 7 2000-10-02 18:39:36 sandervl Exp $ */1 /* $Id: windllbase.cpp,v 1.18 2000-10-10 17:14:06 sandervl Exp $ */ 2 2 3 3 /* … … 53 53 referenced(0), fSkipThreadEntryCalls(FALSE), next(NULL), fInserted(FALSE), 54 54 fAttachedToProcess(FALSE), fUnloaded(FALSE), 55 nrDynamicLibRef(0), fDisableUnload(FALSE) 55 nrDynamicLibRef(0), fDisableUnload(FALSE), fSkipEntryCalls(FALSE) 56 56 { 57 57 dllEntryPoint = DllEntryPoint; … … 395 395 BOOL rc, fSetExceptionHandler; 396 396 397 if(fAttachedToProcess )397 if(fAttachedToProcess || fSkipEntryCalls) 398 398 return TRUE; 399 399 … … 460 460 USHORT sel; 461 461 BOOL rc; 462 463 if(fSkipEntryCalls) { 464 fUnloaded = TRUE; 465 return TRUE; 466 } 462 467 463 468 if(dllEntryPoint == NULL) { -
trunk/src/kernel32/windllbase.h
r3993 r4474 1 /* $Id: windllbase.h,v 1. 5 2000-08-11 10:56:18sandervl Exp $ */1 /* $Id: windllbase.h,v 1.6 2000-10-10 17:14:06 sandervl Exp $ */ 2 2 3 3 /* … … 53 53 //do not call the ATTACH_THREAD, DETACH_THREAD functions 54 54 void disableThreadLibraryCalls() { fSkipThreadEntryCalls = TRUE; }; 55 void disableLibraryCalls() { fSkipEntryCalls = fSkipThreadEntryCalls = TRUE; }; 55 56 56 57 Win32DllBase *getNext() { return next; }; … … 114 115 #endif 115 116 116 BOOL fSkipThreadEntryCalls, fUnloaded, fAttachedToProcess ;117 BOOL fSkipThreadEntryCalls, fUnloaded, fAttachedToProcess, fSkipEntryCalls; 117 118 118 119 WIN32DLLENTRY dllEntryPoint; -
trunk/src/kernel32/winimagebase.cpp
r4440 r4474 1 /* $Id: winimagebase.cpp,v 1.2 8 2000-10-06 11:04:02sandervl Exp $ */1 /* $Id: winimagebase.cpp,v 1.29 2000-10-10 17:14:07 sandervl Exp $ */ 2 2 3 3 /* … … 202 202 203 203 //****************************************************************************** 204 //returns ERROR_SUCCESS or error code 205 //****************************************************************************** 206 ULONG Win32ImageBase::isPEImage(char *szFileName) 204 //returns ERROR_SUCCESS or error code (Characteristics will contain 205 //the Characteristics member of the file header structure) 206 //****************************************************************************** 207 ULONG Win32ImageBase::isPEImage(char *szFileName, DWORD *Characteristics) 207 208 { 208 209 char filename[CCHMAXPATH]; … … 291 292 if(fh.Characteristics & IMAGE_FILE_SYSTEM) { 292 293 goto failure; 294 } 295 if(Characteristics) { 296 *Characteristics = fh.Characteristics; 293 297 } 294 298 DosClose(win32handle); -
trunk/src/kernel32/winimagebase.h
r4249 r4474 1 /* $Id: winimagebase.h,v 1.1 6 2000-09-12 22:45:19 birdExp $ */1 /* $Id: winimagebase.h,v 1.17 2000-10-10 17:14:07 sandervl Exp $ */ 2 2 3 3 /* … … 95 95 ULONG getResourceSize(HRSRC hResource); 96 96 97 //returns ERROR_SUCCESS or error code 98 static ULONG isPEImage(char *szFileName); 97 //returns ERROR_SUCCESS or error code (Characteristics will contain 98 //the Characteristics member of the file header structure) 99 static ULONG isPEImage(char *szFileName, DWORD *Characteristics = NULL); 99 100 static BOOL findDll(const char *pszFileName, char *pszFullName, 100 101 int cchFullName, const char *pszAltPath = NULL); -
trunk/src/kernel32/winimagepeldr.cpp
r4471 r4474 1 /* $Id: winimagepeldr.cpp,v 1. 59 2000-10-09 18:35:26sandervl Exp $ */1 /* $Id: winimagepeldr.cpp,v 1.60 2000-10-10 17:14:08 sandervl Exp $ */ 2 2 3 3 /* … … 14 14 * (circular dependencies; have to check what NT does) 15 15 * 16 * NOTE: RSRC_LOADis a special flag to only load the resource directory16 * NOTE: FLAG_PELDR_LOADASDATAFILE is a special flag to only load the resource directory 17 17 * of a PE image. Processing imports, sections etc is not done. 18 * Nor is it put into the linked list of dlls (if it's a dll).19 18 * This is useful for GetVersionSize/Resource in case it wants to 20 19 * get version info of an image that is not loaded. … … 103 102 //****************************************************************************** 104 103 //****************************************************************************** 105 Win32PeLdrImage::Win32PeLdrImage(char *pszFileName, BOOL isExe , int loadtype) :104 Win32PeLdrImage::Win32PeLdrImage(char *pszFileName, BOOL isExe) : 106 105 Win32ImageBase(-1), 107 nrsections(0), imageSize(0), 106 nrsections(0), imageSize(0), dwFlags(0), 108 107 imageVirtBase(-1), realBaseAddress(0), imageVirtEnd(0), 109 108 nrNameExports(0), nrOrdExports(0), nameexports(NULL), ordexports(NULL), … … 111 110 { 112 111 HFILE dllfile; 113 114 loadType = loadtype;115 112 116 113 strcpy(szFileName, pszFileName); … … 282 279 nSections = NR_SECTIONS(win32file); 283 280 284 if( loadType == REAL_LOAD)281 if(!(dwFlags & FLAG_PELDR_LOADASDATAFILE)) 285 282 { 286 283 imageSize = 0; … … 307 304 if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_EXPORT)) 308 305 { 309 dprintf((LOG, ".edata" )); 310 addSection(SECTION_EXPORT, psh[i].PointerToRawData, 311 psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase, 312 psh[i].Misc.VirtualSize, psh[i].Characteristics); 313 continue; 306 //SvL: Angus.exe has empty export section that's really an 307 // uninitialized data section 308 if(psh[i].SizeOfRawData) { 309 dprintf((LOG, ".edata" )); 310 addSection(SECTION_EXPORT, psh[i].PointerToRawData, 311 psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase, 312 psh[i].Misc.VirtualSize, psh[i].Characteristics); 313 continue; 314 } 314 315 } 315 316 if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_RESOURCE)) … … 439 440 } 440 441 441 if( loadType == REAL_LOAD)442 if(!(dwFlags & FLAG_PELDR_LOADASDATAFILE)) 442 443 { 443 444 if(tlsDir = (IMAGE_TLS_DIRECTORY *)ImageDirectoryOffset(win32file, IMAGE_DIRECTORY_ENTRY_TLS)) … … 554 555 } 555 556 556 if (loadType == REAL_LOAD)557 if(!(dwFlags & (FLAG_PELDR_LOADASDATAFILE | FLAG_PELDR_SKIPIMPORTS))) 557 558 { 558 if(processImports((char *)win32file) == FALSE) { 559 dprintf((LOG, "Failed to process imports!" )); 560 goto failure; 561 } 562 } 563 559 if(processImports((char *)win32file) == FALSE) { 560 dprintf((LOG, "Failed to process imports!" )); 561 goto failure; 562 } 563 } 564 564 return(TRUE); 565 565 566 failure: 566 567 if(memmap) { … … 730 731 731 732 //SvL: We don't care where the image is loaded for resource lookup 732 if(fh.Characteristics & IMAGE_FILE_RELOCS_STRIPPED && loadType == REAL_LOAD) {733 if(fh.Characteristics & IMAGE_FILE_RELOCS_STRIPPED && !(dwFlags & FLAG_PELDR_LOADASDATAFILE)) { 733 734 return allocFixedMem(reservedMem); 734 735 } … … 898 899 899 900 case SECTION_READONLYDATA: 901 case SECTION_EXPORT: 900 902 default: 901 903 section[i].pageflags = PAG_READ; 902 904 break; 903 905 } 906 if(section[i].flags & (IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_CNT_UNINITIALIZED_DATA)) { 907 //SvL: sometimes i.e. import/export sections also contain data 908 // must make them read/write 909 section[i].pageflags = PAG_WRITE; 910 } 911 904 912 } 905 913 return(TRUE); … … 1486 1494 { 1487 1495 dprintf((LOG, "Module %s", pszCurModule )); 1488 dprintf((LOG, "ForwarderChain: %x", pID[i].ForwarderChain)); 1496 if(pID[i].ForwarderChain) { 1497 dprintf((LOG, "ForwarderChain: %x", pID[i].ForwarderChain)); 1498 } 1489 1499 // a) check that OriginalFirstThunk not is 0 and look for Borland-styled PE 1490 1500 if (i == 0) -
trunk/src/kernel32/winimagepeldr.h
r4422 r4474 1 /* $Id: winimagepeldr.h,v 1. 5 2000-10-04 19:36:25sandervl Exp $ */1 /* $Id: winimagepeldr.h,v 1.6 2000-10-10 17:14:09 sandervl Exp $ */ 2 2 3 3 /* … … 22 22 23 23 //SvL: To load a dll/exe for i.e. getting a single resource (GetVersionSize/Resource) 24 #define REAL_LOAD 025 #define RSRC_LOAD 124 #define FLAG_PELDR_LOADASDATAFILE 1 //also implies FLAG_PELDR_SKIPIMPORTS 25 #define FLAG_PELDR_SKIPIMPORTS 2 26 26 27 27 //SvL: Amount of memory the peldr dll reserves for win32 exes without fixups … … 75 75 { 76 76 public: 77 Win32PeLdrImage(char *szFileName, BOOL isExe , int loadtype = REAL_LOAD);77 Win32PeLdrImage(char *szFileName, BOOL isExe); 78 78 virtual ~Win32PeLdrImage(); 79 79 … … 93 93 //Returns required OS version for this image 94 94 virtual ULONG getVersion(); 95 96 //tell loader to only process resources and ignore the rest 97 void setLoadAsDataFile() { dwFlags |= FLAG_PELDR_LOADASDATAFILE; }; 98 void disableImportHandling() { dwFlags |= FLAG_PELDR_SKIPIMPORTS; }; 95 99 96 100 //commits image page(s) when an access violation exception is dispatched … … 137 141 Section section[MAX_SECTION]; 138 142 139 ULONG loadType; 143 //internal flags (see FLAGS_PELDR_*) 144 DWORD dwFlags; 140 145 141 146 HFILE hFile; -
trunk/src/kernel32/wprocess.cpp
r4445 r4474 1 /* $Id: wprocess.cpp,v 1.10 2 2000-10-06 15:16:07sandervl Exp $ */1 /* $Id: wprocess.cpp,v 1.103 2000-10-10 17:14:09 sandervl Exp $ */ 2 2 3 3 /* … … 9 9 * NOTE: Even though Odin32 OS/2 apps don't switch FS selectors, 10 10 * we still allocate a TEB to store misc information. 11 * 12 * TODO: What happens when a dll is first loaded as LOAD_LIBRARY_AS_DATAFILE 13 * and then for real? (first one not freed of course) 11 14 * 12 15 * Project Odin Software License can be found in LICENSE.TXT … … 25 28 #include "windllpeldr.h" 26 29 #include "winexepeldr.h" 27 #include "winfakepeldr.h"28 30 #include "windlllx.h" 29 31 #include <vmutex.h> … … 443 445 BOOL rc; 444 446 447 SetLastError(ERROR_SUCCESS); 445 448 //SvL: Ignore FreeLibary for executable 446 449 if(WinExe && hinstance == WinExe->getInstanceHandle()) { … … 633 636 * by the module). 634 637 * 635 * partially implemented yet - imports are resolved it seems.636 638 * 637 639 * LOAD_LIBRARY_AS_DATAFILE … … 648 650 * LoadCursor, LoadIcon, LoadImage, LoadMenu.) 649 651 * 650 * not implemented yet.651 652 * 652 653 * LOAD_WITH_ALTERED_SEARCH_PATH … … 677 678 /* lpszLibFile contains a path. */ 678 679 ULONG fPE; /* isPEImage return value. */ 680 DWORD Characteristics; //file header's Characteristics 679 681 680 682 /** @sketch … … 720 722 if (WinExe != NULL && WinExe->matchModName(lpszLibFile)) 721 723 return WinExe->getInstanceHandle(); 724 722 725 pModule = Win32DllBase::findModule((LPSTR)lpszLibFile); 723 726 if (pModule) … … 760 763 761 764 //test if dll is in PE or LX format 762 fPE = Win32ImageBase::isPEImage(szModname );765 fPE = Win32ImageBase::isPEImage(szModname, &Characteristics); 763 766 764 767 /** @sketch … … 785 788 if(pModule) 786 789 { 787 788 790 if(pModule->isLxDll()) 789 791 { … … 829 831 if(fPE == ERROR_SUCCESS) 830 832 { 831 Win32PeLdrDll * peldrDll; 832 /* TODO! 833 * We might use the fake loader class to do the LOAD_LIBRARY_AS_DATAFILE and 834 * executable image loading. These are both loaded for accessing resource. 835 * But this requires that they behaves like Dlls... 836 if (dwFlags & LOAD_LIBRARY_AS_DATAFILE || fPE == 2) 837 { 838 peldrDll = new Win32PeLdrRsrcImg(szModname); 839 } 840 else 841 */ 833 Win32PeLdrDll *peldrDll; 834 835 //SvL: If executable -> load as data file (only resources) 836 if(!(Characteristics & IMAGE_FILE_DLL)) 837 { 838 dwFlags |= (LOAD_LIBRARY_AS_DATAFILE | DONT_RESOLVE_DLL_REFERENCES); 839 } 842 840 843 841 peldrDll = new Win32PeLdrDll(szModname); … … 853 851 * Process dwFlags 854 852 */ 855 if (dwFlags & (DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE)) 856 { 857 peldrDll->disableThreadLibraryCalls(); 858 //peldrDll->setDontProcessImports(); not implemented? 853 if (dwFlags & LOAD_LIBRARY_AS_DATAFILE) 854 { 855 dprintf(("KERNEL32: LoadLibraryExA(%s, 0x%x, 0x%x): LOAD_LIBRARY_AS_DATAFILE", 856 lpszLibFile, hFile, dwFlags)); 857 peldrDll->setLoadAsDataFile(); 858 peldrDll->disableLibraryCalls(); 859 } 860 if (dwFlags & DONT_RESOLVE_DLL_REFERENCES) 861 { 862 dprintf(("KERNEL32: LoadLibraryExA(%s, 0x%x, 0x%x): DONT_RESOLVE_DLL_REFERENCES", 863 lpszLibFile, hFile, dwFlags)); 864 peldrDll->disableLibraryCalls(); 865 peldrDll->disableImportHandling(); 859 866 } 860 867 if (dwFlags & LOAD_WITH_ALTERED_SEARCH_PATH) … … 863 870 lpszLibFile, hFile, dwFlags)); 864 871 //peldrDll->setLoadWithAlteredSearchPath(); 865 }866 if (dwFlags & LOAD_LIBRARY_AS_DATAFILE)867 {868 dprintf(("KERNEL32: LoadLibraryExA(%s, 0x%x, 0x%x): Warning dwFlags LOAD_LIBRARY_AS_DATAFILE is not implemented.",869 lpszLibFile, hFile, dwFlags));870 //peldrDll->setLoadAsDatafile();871 872 } 872 873 … … 918 919 SetLastError(ERROR_INVALID_EXE_SIGNATURE); 919 920 delete peldrDll; 920 921 return NULL; 921 922 } 922 923 } … … 1812 1813 { 1813 1814 Win32ImageBase *winimage; 1814 Win32PeLdrRsrcImg *rsrcimg; 1815 1816 dprintf(("GetVersionStruct of module %s", lpszModName)); 1815 HINSTANCE hDll; 1816 1817 dprintf(("GetVersionStruct of module %s %x %d", lpszModName, verstruct, bufLength)); 1818 if(verstruct == NULL) { 1819 SetLastError(ERROR_INVALID_PARAMETER); 1820 return FALSE; 1821 } 1822 if(WinExe && !stricmp(WinExe->getFullPath(), lpszModName)) 1823 { 1824 winimage = (Win32ImageBase *)WinExe; 1825 } 1826 else 1827 { 1828 winimage = (Win32ImageBase *)Win32DllBase::findModule(lpszModName); 1829 if(winimage == NULL) 1830 { 1831 char modname[CCHMAXPATH]; 1832 1833 strcpy(modname, lpszModName); 1834 //rename dll if necessary (i.e. OLE32 -> OLE32OS2) 1835 Win32DllBase::renameDll(modname); 1836 1837 if(Win32ImageBase::isPEImage(modname) != ERROR_SUCCESS) 1838 { 1839 HINSTANCE hInstance; 1840 1841 //must be an LX dll, just load it (app will probably load it anyway) 1842 hInstance = LoadLibraryA(modname); 1843 if(hInstance == 0) 1844 return 0; 1845 1846 winimage = (Win32ImageBase *)Win32DllBase::findModule(hInstance); 1847 if(winimage) { 1848 return winimage->getVersionStruct(verstruct, bufLength); 1849 } 1850 dprintf(("GetVersionStruct; just loaded dll %s, but can't find it now!", modname)); 1851 return 0; 1852 } 1853 BOOL rc = FALSE; 1854 1855 hDll = LoadLibraryExA(lpszModName, 0, LOAD_LIBRARY_AS_DATAFILE); 1856 if(hDll == 0) 1857 return 0; 1858 1859 winimage = (Win32ImageBase *)Win32DllBase::findModule(lpszModName); 1860 if(winimage != NULL) { 1861 rc = winimage->getVersionStruct(verstruct, bufLength); 1862 } 1863 else dprintf(("GetVersionSize; just loaded dll %s, but can't find it now!", lpszModName)); 1864 FreeLibrary(hDll); 1865 return rc; 1866 } 1867 } 1868 return winimage->getVersionStruct(verstruct, bufLength); 1869 } 1870 //****************************************************************************** 1871 //****************************************************************************** 1872 ULONG SYSTEM GetVersionSize(char *lpszModName) 1873 { 1874 Win32ImageBase *winimage; 1875 HINSTANCE hDll; 1876 1877 dprintf(("GetVersionSize of %s\n", lpszModName)); 1878 1817 1879 if(WinExe && !stricmp(WinExe->getFullPath(), lpszModName)) { 1818 1880 winimage = (Win32ImageBase *)WinExe; … … 1822 1884 if(winimage == NULL) 1823 1885 { 1824 char modname[CCHMAXPATH];1825 1826 strcpy(modname, lpszModName);1827 //rename dll if necessary (i.e. OLE32 -> OLE32OS2)1828 Win32DllBase::renameDll(modname);1829 1830 if(Win32ImageBase::isPEImage(modname) != ERROR_SUCCESS)1831 {1832 HINSTANCE hInstance;1886 char modname[CCHMAXPATH]; 1887 1888 strcpy(modname, lpszModName); 1889 //rename dll if necessary (i.e. OLE32 -> OLE32OS2) 1890 Win32DllBase::renameDll(modname); 1891 1892 if(Win32ImageBase::isPEImage(modname) != ERROR_SUCCESS) 1893 { 1894 HINSTANCE hInstance; 1833 1895 1834 1896 //must be an LX dll, just load it (app will probably load it anyway) … … 1836 1898 if(hInstance == 0) 1837 1899 return 0; 1838 winimage = (Win32ImageBase *)Win32DllBase::findModule(hInstance); 1839 if(winimage) { 1840 return winimage->getVersionStruct(verstruct, bufLength); 1841 } 1842 return 0; 1843 } 1844 //SvL: Try to load it 1845 rsrcimg = new Win32PeLdrRsrcImg(modname); 1846 if(rsrcimg == NULL) 1847 return 0; 1848 1849 rsrcimg->init(0); 1850 if(rsrcimg->getError() != NO_ERROR) 1851 { 1852 dprintf(("GetVersionStruct can't load %s\n", modname)); 1853 delete rsrcimg; 1854 return(FALSE); 1855 } 1856 BOOL rc = rsrcimg->getVersionStruct(verstruct, bufLength); 1857 delete rsrcimg; 1858 return rc; 1859 } 1860 } 1861 return winimage->getVersionStruct(verstruct, bufLength); 1862 } 1863 //****************************************************************************** 1864 //****************************************************************************** 1865 ULONG SYSTEM GetVersionSize(char *lpszModName) 1866 { 1867 Win32ImageBase *winimage; 1868 Win32PeLdrRsrcImg *rsrcimg; 1869 1870 dprintf(("GetVersionSize of %s\n", lpszModName)); 1871 1872 if(WinExe && !stricmp(WinExe->getFullPath(), lpszModName)) { 1873 winimage = (Win32ImageBase *)WinExe; 1874 } 1875 else { 1876 winimage = (Win32ImageBase *)Win32DllBase::findModule(lpszModName); 1877 if(winimage == NULL) 1878 { 1879 char modname[CCHMAXPATH]; 1880 1881 strcpy(modname, lpszModName); 1882 //rename dll if necessary (i.e. OLE32 -> OLE32OS2) 1883 Win32DllBase::renameDll(modname); 1884 1885 if(Win32ImageBase::isPEImage(modname) != ERROR_SUCCESS) 1886 { 1887 HINSTANCE hInstance; 1888 1889 //must be an LX dll, just load it (app will probably load it anyway) 1890 hInstance = LoadLibraryA(modname); 1891 if(hInstance == 0) 1892 return 0; 1893 winimage = (Win32ImageBase *)Win32DllBase::findModule(hInstance); 1894 if(winimage) { 1900 1901 winimage = (Win32ImageBase *)Win32DllBase::findModule(hInstance); 1902 if(winimage) { 1895 1903 return winimage->getVersionSize(); 1896 1904 } 1905 dprintf(("GetVersionSize; just loaded dll %s, but can't find it now!", modname)); 1897 1906 return 0; 1898 1907 } 1899 1900 //SvL: Try to load it 1901 rsrcimg = new Win32PeLdrRsrcImg(modname);1902 if( rsrcimg == NULL)1908 int size = 0; 1909 1910 hDll = LoadLibraryExA(lpszModName, 0, LOAD_LIBRARY_AS_DATAFILE); 1911 if(hDll == 0) 1903 1912 return 0; 1904 1913 1905 rsrcimg->init(0); 1906 if(rsrcimg->getError() != NO_ERROR) 1907 { 1908 dprintf(("GetVersionSize can't load %s\n", modname)); 1909 delete rsrcimg; 1910 return(FALSE); 1911 } 1912 int size = rsrcimg->getVersionSize(); 1913 delete rsrcimg; 1914 winimage = (Win32ImageBase *)Win32DllBase::findModule(lpszModName); 1915 if(winimage != NULL) { 1916 size = winimage->getVersionSize(); 1917 } 1918 else dprintf(("GetVersionSize; just loaded dll %s, but can't find it now!", lpszModName)); 1919 FreeLibrary(hDll); 1914 1920 return size; 1915 1921 } 1916 1922 } 1917 1923 return winimage->getVersionSize(); 1918 1924 } 1919 1925 //****************************************************************************** 1920 //TODO:What does this do exactly??1921 1926 //****************************************************************************** 1922 1927 ODINFUNCTION1(BOOL,DisableThreadLibraryCalls,HMODULE,hModule)
Note:
See TracChangeset
for help on using the changeset viewer.