- Timestamp:
- Sep 16, 1999, 1:39:08 AM (26 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 12 added
- 5 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/KERNEL32.DEF
r922 r956 1 ; $Id: KERNEL32.DEF,v 1.3 7 1999-09-13 14:57:07 phallerExp $1 ; $Id: KERNEL32.DEF,v 1.38 1999-09-15 23:38:01 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 943 943 memmove = _OS2memmove @906 944 944 945 ConvertNameId = ConvertNameId @1200 945 946 946 DebugErrorBox = DebugErrorBox @1201 947 947 WriteLog = WriteLog @1202 … … 949 949 950 950 ;Used by tibfix page in exe (change ordinal in lx.cpp too!!) 951 RegisterExe = _RegisterExe@48 @1203 951 _RegisterPe2LxExe@48 @1203 952 _RegisterPe2LxDll@48 @1209 953 954 _CreateWin32PeLdrExe@8 @1236 955 956 _RegisterLxExe@8 @1237 957 _RegisterLxDll@12 @1238 958 _UnregisterLxDll@4 @1239 959 952 960 ;VMutex 953 961 enter__6VMutexFUl @1204 … … 955 963 __ct__6VMutexFi @1206 956 964 __dt__6VMutexFv @1207 957 ;Used by tibfix page in dll (change ordinal in lx.cpp too!!) 958 ; DLLExitList = _DLLExitList@4 @1208 959 RegisterDll = _RegisterDll@48 @1209 965 960 966 ;Unicode 961 967 UnicodeToAsciiString = _UnicodeToAsciiString@4 @1210 … … 966 972 AsciiToUnicodeN = _AsciiToUnicodeN@12 @1216 967 973 968 ;Win32Exe constructor969 __ct__8Win32ExeFPc @1220970 971 974 ;Get version resource 972 975 GetVersionStruct = GetVersionStruct @1221 … … 993 996 GetThreadTEB = _GetThreadTEB@0 @1234 994 997 GetThreadTHDB = _GetThreadTHDB@0 @1235 995 996 CreateWin32Exe = _CreateWin32Exe@4 @1236997 998 998 999 ; HEAP Management (heap.cpp, heapstring.cpp) … … 1015 1016 OS2UnsetExceptionHandler @1254 1016 1017 1017 __ct__12Win32MenuResFP1 0Win32ImageUlN22@12601018 __ct__12Win32MenuResFP1 0Win32ImageUlN22Pc@12611018 __ct__12Win32MenuResFP14Win32ImageBaseUlN22 @1260 1019 __ct__12Win32MenuResFP14Win32ImageBaseUlN22Pc @1261 1019 1020 __ct__12Win32MenuResFUl @1262 1020 1021 __ct__12Win32MenuResFPv @1263 -
trunk/src/kernel32/cvtcursorgrp.cpp
r816 r956 1 /* $Id: cvtcursorgrp.cpp,v 1. 2 1999-09-04 12:41:45sandervl Exp $ */1 /* $Id: cvtcursorgrp.cpp,v 1.3 1999-09-15 23:38:00 sandervl Exp $ */ 2 2 3 3 /* … … 32 32 //****************************************************************************** 33 33 //****************************************************************************** 34 void *ConvertCursorGroup(CursorHeader *chdr, int size, Win32Image *module)34 void *ConvertCursorGroup(CursorHeader *chdr, int size, Win32ImageBase *module) 35 35 { 36 36 CursorResDir *rdir = (CursorResDir *)(chdr + 1); -
trunk/src/kernel32/cvticongrp.cpp
r816 r956 1 /* $Id: cvticongrp.cpp,v 1. 2 1999-09-04 12:41:46sandervl Exp $ */1 /* $Id: cvticongrp.cpp,v 1.3 1999-09-15 23:38:01 sandervl Exp $ */ 2 2 3 3 /* … … 32 32 //****************************************************************************** 33 33 //****************************************************************************** 34 void *ConvertIconGroup(IconHeader *ihdr, int size, Win32Image *module)34 void *ConvertIconGroup(IconHeader *ihdr, int size, Win32ImageBase *module) 35 35 { 36 36 ResourceDirectory *rdir = (ResourceDirectory *)(ihdr + 1); -
trunk/src/kernel32/cvtresource.h
r816 r956 1 /* $Id: cvtresource.h,v 1. 3 1999-09-04 12:41:46sandervl Exp $ */1 /* $Id: cvtresource.h,v 1.4 1999-09-15 23:38:01 sandervl Exp $ */ 2 2 3 3 #ifndef _CVTRESOURCE_H_ … … 8 8 #include <winaccel.h> 9 9 #include <wincursor.h> 10 #include <winimage .h>10 #include <winimagebase.h> 11 11 12 12 void *ConvertAccelerator(WINACCEL *accdata, int size, int cp = 0); 13 13 void *ConvertBitmap(WINBITMAPINFOHEADER *pBHdr, ULONG ulSize, PULONG pulSize); 14 14 void *ConvertCursor(CursorComponent *curHdr, int size, int *os2size, int offsetBits = 0); 15 void *ConvertCursorGroup(CursorHeader *chdr, int size, Win32Image *module);15 void *ConvertCursorGroup(CursorHeader *chdr, int size, Win32ImageBase *module); 16 16 void *ConvertIcon(WINBITMAPINFOHEADER *bmpHdr, int size, int *os2size, int offsetBits = 0); 17 void *ConvertIconGroup(IconHeader *ihdr, int size, Win32Image *module);17 void *ConvertIconGroup(IconHeader *ihdr, int size, Win32ImageBase *module); 18 18 void *ConvertMenu(MenuHeader *menu, int size, int cp = 0); 19 19 -
trunk/src/kernel32/makefile
r862 r956 1 # $Id: makefile,v 1.4 0 1999-09-07 20:27:44 phallerExp $1 # $Id: makefile,v 1.41 1999-09-15 23:38:01 sandervl Exp $ 2 2 3 3 # … … 23 23 CONBUFFER.OBJ CONOUT.OBJ UNICODE.OBJ network.OBJ DEVIO.OBJ \ 24 24 profile.obj THREAD.OBJ virtual.obj THUNK.OBJ OBSOLETE.OBJ COMM.OBJ\ 25 MESSAGE.OBJ RESOURCE.OBJ NAMEID.OBJ WINRES.OBJ WINMOD.OBJEXCEPTIONS.OBJ \25 MESSAGE.OBJ RESOURCE.OBJ EXCEPTIONS.OBJ \ 26 26 LFILE.OBJ NPIPE.OBJ oslibdos.obj oslibmisc.obj MISC.OBJ EXCEPTUTIL.OBJ \ 27 27 LANG.OBJ ICCIO.OBJ MAP.OBJ WIN32UTIL.OBJ heap.OBJ heapstring.obj \ 28 28 os2heap.OBJ vmutex.OBJ initterm.OBJ handlemanager.OBJ winresmenu.obj \ 29 29 hmdevice.obj hmopen32.obj hmobjects.obj hmevent.obj hmmutex.obj \ 30 hmsemaphore.obj wprocess.OBJ conprop.OBJ \ 31 winimage.OBJ windll.OBJ winexe.OBJ time.obj mmap.obj \ 30 hmsemaphore.obj wprocess.OBJ conprop.OBJ winimagelx.obj \ 31 winimagebase.OBJ windllbase.OBJ winexebase.OBJ time.obj mmap.obj \ 32 winimagepe2lx.obj winimagepeldr.obj windllpe2lx.obj windlllx.obj windllpeldr.obj \ 33 winexepe2lx.obj winexelx.obj winexepeldr.obj WINRES.OBJ \ 32 34 pefile.OBJ winimgres.OBJ wintls.obj async.OBJ fileio.obj \ 33 35 atom.obj disk.obj directory.obj cvtbitmap.obj hmmmap.obj \ … … 79 81 $(PDWIN32_INCLUDE)\unicode.h \ 80 82 $(PDWIN32_INCLUDE)\heap.h \ 81 $(PDWIN32_INCLUDE)\wprocess.h \ 82 $(PDWIN32_INCLUDE)\nameid.h 83 $(PDWIN32_INCLUDE)\wprocess.h 83 84 84 85 kobjects.obj: kobjects.cpp … … 103 104 $(PDWIN32_INCLUDE)\unicode.h 104 105 105 wintls.obj: wintls.cpp $(PDWIN32_INCLUDE)\winimage .h $(PDWIN32_INCLUDE)\winexe.h $(PDWIN32_INCLUDE)\windll.h106 wintls.obj: wintls.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\winexebase.h $(PDWIN32_INCLUDE)\windllbase.h 106 107 107 108 fileio.obj: fileio.cpp \ … … 111 112 .\thread.cpp \ 112 113 $(PDWIN32_INCLUDE)\wprocess.h \ 113 $(PDWIN32_INCLUDE)\winimage .h $(PDWIN32_INCLUDE)\winexe.h $(PDWIN32_INCLUDE)\windll.h \114 $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\winexebase.h $(PDWIN32_INCLUDE)\windllbase.h \ 114 115 thread.h 115 116 … … 161 162 wprocess.OBJ: \ 162 163 .\wprocess.cpp \ 163 $(PDWIN32_INCLUDE)\nameid.h \164 164 $(PDWIN32_INCLUDE)\unicode.h \ 165 $(PDWIN32_INCLUDE)\winexe.h \ 166 $(PDWIN32_INCLUDE)\windll.h \ 167 $(PDWIN32_INCLUDE)\winimage.h \ 165 $(PDWIN32_INCLUDE)\winexebase.h \ 166 $(PDWIN32_INCLUDE)\windllbase.h \ 167 $(PDWIN32_INCLUDE)\winexepeldr.h \ 168 $(PDWIN32_INCLUDE)\windllpeldr.h \ 169 $(PDWIN32_INCLUDE)\winimagebase.h \ 168 170 $(PDWIN32_INCLUDE)\versionos2.h \ 169 171 $(PDWIN32_INCLUDE)\wprocess.h \ … … 230 232 .\obsolete.cpp 231 233 232 nameid.OBJ: \233 .\nameid.cpp \234 $(PDWIN32_INCLUDE)\nameid.h \235 $(PDWIN32_INCLUDE)\win32util.h \236 $(PDWIN32_INCLUDE)\winimage.h \237 $(PDWIN32_INCLUDE)\winexe.h \238 $(PDWIN32_INCLUDE)\windll.h \239 $(PDWIN32_INCLUDE)\misc.h240 241 234 resource.OBJ: \ 242 235 .\resource.cpp \ 243 $(PDWIN32_INCLUDE)\nameid.h \244 236 $(PDWIN32_INCLUDE)\unicode.h \ 245 $(PDWIN32_INCLUDE)\winimage .h \237 $(PDWIN32_INCLUDE)\winimagebase.h \ 246 238 $(PDWIN32_INCLUDE)\winres.h \ 247 239 $(PDWIN32_INCLUDE)\misc.h … … 258 250 $(PDWIN32_INCLUDE)\winresmenu.h \ 259 251 $(PDWIN32_INCLUDE)\winres.h \ 260 $(PDWIN32_INCLUDE)\nameid.h \ 261 $(PDWIN32_INCLUDE)\winimage.h \ 262 $(PDWIN32_INCLUDE)\winexe.h \ 263 $(PDWIN32_INCLUDE)\windll.h \ 264 $(PDWIN32_INCLUDE)\misc.h 265 266 winmod.OBJ: \ 267 .\winmod.cpp \ 268 $(PDWIN32_INCLUDE)\winimage.h \ 269 $(PDWIN32_INCLUDE)\winexe.h \ 270 $(PDWIN32_INCLUDE)\windll.h \ 271 $(PDWIN32_INCLUDE)\winimage.h \ 252 $(PDWIN32_INCLUDE)\winimagebase.h \ 253 $(PDWIN32_INCLUDE)\winexebase.h \ 254 $(PDWIN32_INCLUDE)\windllbase.h \ 272 255 $(PDWIN32_INCLUDE)\misc.h 273 256 … … 334 317 mmap.obj: mmap.cpp mmap.h $(PDWIN32_INCLUDE)\vmutex.h oslibdos.h 335 318 336 pefile.OBJ: pefile.cpp $(PDWIN32_INCLUDE)\pefile.h 337 winimage.OBJ: winimage.cpp $(PDWIN32_INCLUDE)\winimage.h $(PDWIN32_INCLUDE)\windll.h $(PDWIN32_INCLUDE)\pefile.h $(PDWIN32_INCLUDE)\winres.h initterm.h $(PDWIN32_INCLUDE)\win\virtual.h oslibmisc.h 338 winimgres.OBJ: winimgres.cpp $(PDWIN32_INCLUDE)\winimage.h $(PDWIN32_INCLUDE)\windll.h $(PDWIN32_INCLUDE)\pefile.h $(PDWIN32_INCLUDE)\winexe.h $(PDWIN32_INCLUDE)\winres.h 339 windll.OBJ: windll.cpp $(PDWIN32_INCLUDE)\winimage.h $(PDWIN32_INCLUDE)\windll.h oslibmisc.h 340 winexe.OBJ: winexe.cpp $(PDWIN32_INCLUDE)\winimage.h $(PDWIN32_INCLUDE)\windll.h $(PDWIN32_INCLUDE)\winexe.h 319 pefile.OBJ: pefile.cpp $(PDWIN32_INCLUDE)\pefile.h $(PDWIN32_INCLUDE)\winres.h 320 321 winimagebase.obj: winimagebase.cpp $(PDWIN32_INCLUDE)\winimagebase.h 322 winimagepe2lx.obj: winimagepe2lx.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\winimagepe2lx.h 323 winimagepeldr.obj: winimagepeldr.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\winimagepeldr.h 324 winimagelx.obj: winimagelx.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\winimagelx.h 325 windllbase.obj: windllbase.cpp $(PDWIN32_INCLUDE)\windllbase.h $(PDWIN32_INCLUDE)\winimagebase.h 326 windllpe2lx.obj: windllpe2lx.cpp $(PDWIN32_INCLUDE)\windllbase.h $(PDWIN32_INCLUDE)\windllpe2lx.h $(PDWIN32_INCLUDE)\winimagepe2lx.h 327 windlllx.obj: windlllx.cpp $(PDWIN32_INCLUDE)\windllbase.h $(PDWIN32_INCLUDE)\windlllx.h $(PDWIN32_INCLUDE)\winimagelx.h $(PDWIN32_INCLUDE)\odinlx.h 328 windllpeldr.obj: windllpeldr.cpp $(PDWIN32_INCLUDE)\windllbase.h $(PDWIN32_INCLUDE)\windllpeldr.h $(PDWIN32_INCLUDE)\winimagepeldr.h 329 winexebase.obj: winexebase.cpp $(PDWIN32_INCLUDE)\winexebase.h $(PDWIN32_INCLUDE)\winimagebase.h 330 winexepe2lx.obj: winexepe2lx.cpp $(PDWIN32_INCLUDE)\winexebase.h $(PDWIN32_INCLUDE)\winexepe2lx.h $(PDWIN32_INCLUDE)\winimagepe2lx.h 331 winexelx.obj: winexelx.cpp $(PDWIN32_INCLUDE)\winexebase.h $(PDWIN32_INCLUDE)\winexelx.h $(PDWIN32_INCLUDE)\winimagelx.h $(PDWIN32_INCLUDE)\odinlx.h 332 winexepeldr.obj: winexepeldr.cpp $(PDWIN32_INCLUDE)\winexebase.h $(PDWIN32_INCLUDE)\winexepeldr.h $(PDWIN32_INCLUDE)\winimagepeldr.h 333 334 winimgres.OBJ: winimgres.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\pefile.h $(PDWIN32_INCLUDE)\winimagepe2lx.h $(PDWIN32_INCLUDE)\winimagepeldr.h $(PDWIN32_INCLUDE)\winimagelx.h $(PDWIN32_INCLUDE)\winres.h 341 335 stubs.obj: stubs.cpp stubs.h 342 336 -
trunk/src/kernel32/oslibmisc.cpp
r705 r956 1 /* $Id: oslibmisc.cpp,v 1. 1 1999-08-26 12:56:02sandervl Exp $ */1 /* $Id: oslibmisc.cpp,v 1.2 1999-09-15 23:38:01 sandervl Exp $ */ 2 2 3 3 /* … … 59 59 static char modname[CCHMAXPATH] = {0}; 60 60 61 DosQueryModuleName(hModule, CCHMAXPATH, modname); 61 if(DosQueryModuleName(hModule, CCHMAXPATH, modname) != 0) { 62 return NULL; 63 } 62 64 return(modname); 63 65 } -
trunk/src/kernel32/pefile.cpp
r120 r956 1 /* $Id: pefile.cpp,v 1. 4 1999-06-19 10:54:43sandervl Exp $ */1 /* $Id: pefile.cpp,v 1.5 1999-09-15 23:38:01 sandervl Exp $ */ 2 2 3 3 /* … … 18 18 #include <pefile.h> 19 19 #include <misc.h> 20 #include <win image.h>20 #include <winres.h> 21 21 22 22 //****************************************************************************** -
trunk/src/kernel32/resource.cpp
r589 r956 1 /* $Id: resource.cpp,v 1. 8 1999-08-19 19:50:40sandervl Exp $ */1 /* $Id: resource.cpp,v 1.9 1999-09-15 23:38:01 sandervl Exp $ */ 2 2 3 3 /* … … 12 12 */ 13 13 #include <os2win.h> 14 #include "unicode.h"14 #include <unicode.h> 15 15 #include "winres.h" 16 #include "winimage.h" 17 #include "winexe.h" 16 #include <winimagebase.h> 17 #include <winexebase.h> 18 #include <windllbase.h> 18 19 19 20 //****************************************************************************** … … 23 24 HRSRC WIN32API FindResourceA(HINSTANCE hModule, LPCSTR lpszName, LPCSTR lpszType) 24 25 { 25 Win32Image *module;26 Win32ImageBase *module; 26 27 27 28 dprintf(("FindResourceA %X", hModule)); … … 29 30 WinExe->getInstanceHandle())) 30 31 { 31 module = (Win32Image *)WinExe;32 module = (Win32ImageBase *)WinExe; 32 33 } 33 else module = (Win32Image *)Win32Dll::findModule(hModule);34 else module = (Win32ImageBase *)Win32DllBase::findModule(hModule); 34 35 35 36 if(module == NULL) … … 43 44 LPCWSTR lpszType) 44 45 { 45 Win32Image *module;46 Win32ImageBase *module; 46 47 47 48 dprintf(("FindResourceW %X", hModule)); … … 49 50 WinExe->getInstanceHandle())) 50 51 { 51 module = (Win32Image *)WinExe;52 module = (Win32ImageBase *)WinExe; 52 53 } 53 else module = (Win32Image *)Win32Dll::findModule(hModule);54 else module = (Win32ImageBase *)Win32DllBase::findModule(hModule); 54 55 55 56 if(module == NULL) -
trunk/src/kernel32/thread.cpp
r919 r956 1 /* $Id: thread.cpp,v 1.1 3 1999-09-13 13:16:21 phallerExp $ */1 /* $Id: thread.cpp,v 1.14 1999-09-15 23:38:02 sandervl Exp $ */ 2 2 3 3 /* … … 12 12 #include <os2win.h> 13 13 #include <stdarg.h> 14 #include <string.h> 14 15 #include "thread.h" 15 16 #include "exceptutil.h" 16 17 #include <misc.h> 17 18 #include <wprocess.h> 18 #include <windll .h>19 #include <winexe .h>19 #include <windllbase.h> 20 #include <winexebase.h> 20 21 #include <except.h> 21 22 … … 97 98 hThread)); 98 99 99 /* @@@PH: map os/2 priority model to win32 priority model */100 101 100 return O32_GetThreadPriority(hThread); 102 101 } … … 118 117 priority)); 119 118 120 /* @@@PH: map win32 priority model to os/2 priority model */121 122 119 return O32_SetThreadPriority(hThread, priority); 123 120 } … … 147 144 exitcode)); 148 145 149 Win32Dll ::detachThreadFromAllDlls(); //send DLL_THREAD_DETACH message to all dlls150 Win32Dll ::tlsDetachThreadFromAllDlls(); //destroy TLS structures of all dlls146 Win32DllBase::detachThreadFromAllDlls(); //send DLL_THREAD_DETACH message to all dlls 147 Win32DllBase::tlsDetachThreadFromAllDlls(); //destroy TLS structures of all dlls 151 148 WinExe->tlsDetachThread(); //destroy TLS structure of main exe 152 149 DestroyTIB(); … … 200 197 SetWin32TIB(); 201 198 WinExe->tlsAttachThread(); //setup TLS structure of main exe 202 Win32Dll ::tlsAttachThreadToAllDlls(); //setup TLS structures of all dlls203 Win32Dll ::attachThreadToAllDlls(); //send DLL_THREAD_ATTACH message to all dlls199 Win32DllBase::tlsAttachThreadToAllDlls(); //setup TLS structures of all dlls 200 Win32DllBase::attachThreadToAllDlls(); //send DLL_THREAD_ATTACH message to all dlls 204 201 205 202 //Note: The Win32 exception structure references by FS:[0] is the same … … 209 206 OS2UnsetExceptionHandler((void *)&exceptFrame); 210 207 211 Win32Dll ::detachThreadFromAllDlls(); //send DLL_THREAD_DETACH message to all dlls212 Win32Dll ::tlsDetachThreadFromAllDlls(); //destroy TLS structures of all dlls208 Win32DllBase::detachThreadFromAllDlls(); //send DLL_THREAD_DETACH message to all dlls 209 Win32DllBase::tlsDetachThreadFromAllDlls(); //destroy TLS structures of all dlls 213 210 WinExe->tlsDetachThread(); //destroy TLS structure of main exe 214 211 DestroyTIB(); -
trunk/src/kernel32/winimgres.cpp
r752 r956 1 /* $Id: winimgres.cpp,v 1.1 3 1999-08-31 14:36:46sandervl Exp $ */1 /* $Id: winimgres.cpp,v 1.14 1999-09-15 23:38:02 sandervl Exp $ */ 2 2 3 3 /* … … 10 10 * 11 11 * TODO: Check created resource objects before loading the resource! 12 * TODO: Is the name id of the version resource always 1? 13 * TODO: Once the resource handling in PE2LX/win32k is changed, 14 * getVersionStruct/Size can be moved into the Win32ImageBase class 12 15 * 13 16 */ … … 18 21 19 22 #include <misc.h> 20 #include < nameid.h>21 #include <winimage .h>22 #include <win dll.h>23 #include <win exe.h>23 #include <winimagebase.h> 24 #include <winimagepe2lx.h> 25 #include <winimagepeldr.h> 26 #include <winimagelx.h> 24 27 #include <winres.h> 25 28 #include <winresmenu.h> … … 27 30 #include <heapstring.h> 28 31 #include "pefile.h" 29 30 char *ResTypes[MAX_RES] = 31 {"niks", "CURSOR", "BITMAP", "ICON", "MENU", "DIALOG", "STRING", 32 "FONTDIR", "FONT", "ACCELERATOR", "RCDATA", "MESSAGETABLE", 33 "GROUP_CURSOR", "niks", "GROUP_ICON", "niks", "VERSION"}; 34 32 #include "oslibmisc.h" 35 33 36 34 //****************************************************************************** … … 39 37 //****************************************************************************** 40 38 PIMAGE_RESOURCE_DATA_ENTRY 41 Win32 Image::getPEResourceEntry(ULONG id, ULONG type, ULONG lang)39 Win32PeLdrImage::getPEResourceEntry(ULONG id, ULONG type, ULONG lang) 42 40 { 43 41 PIMAGE_RESOURCE_DIRECTORY prdType; … … 126 124 //****************************************************************************** 127 125 PIMAGE_RESOURCE_DATA_ENTRY 128 Win32 Image::ProcessResSubDir(PIMAGE_RESOURCE_DIRECTORY prdType,126 Win32PeLdrImage::ProcessResSubDir(PIMAGE_RESOURCE_DIRECTORY prdType, 129 127 ULONG *nodeData, int level) 130 128 { … … 203 201 //****************************************************************************** 204 202 //****************************************************************************** 205 ULONG Win32 Image::getPEResourceSize(ULONG id, ULONG type, ULONG lang)203 ULONG Win32PeLdrImage::getPEResourceSize(ULONG id, ULONG type, ULONG lang) 206 204 { 207 205 PIMAGE_RESOURCE_DATA_ENTRY pData = NULL; … … 209 207 pData = getPEResourceEntry(id, type, lang); 210 208 if(pData == NULL) { 211 dprintf(("Win32Image ::getPEResourceSize: couldn't find resource %d (type %d, lang %d)", id, type, lang));209 dprintf(("Win32ImageBase::getPEResourceSize: couldn't find resource %d (type %d, lang %d)", id, type, lang)); 212 210 return 0; 213 211 } … … 216 214 //****************************************************************************** 217 215 //****************************************************************************** 218 Win32Resource *Win32Image::getPEResource(ULONG id, ULONG type, ULONG lang)216 HRSRC Win32PeLdrImage::findResourceA(LPCSTR lpszName, LPSTR lpszType, ULONG lang) 219 217 { 220 218 PIMAGE_RESOURCE_DATA_ENTRY pData = NULL; … … 222 220 BOOL fNumType; 223 221 char *winres = NULL; 222 ULONG id, type; 224 223 int i, stringid = -1, j; 225 224 226 225 fNumType = TRUE; //assume numeric 227 if(HIWORD(type) != 0) {//string id? 228 for(i=0;i<MAX_RES;i++) { 229 if(stricmp((char *)type, ResTypes[i]) == 0) 230 break; 231 } 232 if(i == MAX_RES) {//custom resource type 233 fNumType = FALSE; 234 } 235 else type = i; 236 } 226 if(HIWORD(lpszType) != 0) {//string id? 227 for(i=0;i<MAX_RES;i++) { 228 if(stricmp(lpszType, ResTypes[i]) == 0) 229 break; 230 } 231 if(i == MAX_RES) {//custom resource type 232 fNumType = FALSE; 233 type = (ULONG)lpszType; 234 } 235 else type = i; 236 } 237 else type = (ULONG)lpszType; 237 238 238 239 //String format: tables of 16 strings stored as one resource … … 241 242 if(fNumType) { 242 243 if(type == NTRT_STRING) { 243 stringid = id & 0xF; 244 id = (id >> 4)+1; 245 } 244 stringid = (ULONG)lpszName & 0xF; 245 id = (((ULONG)lpszName) >> 4)+1; 246 } 247 else id = (ULONG)lpszName; 246 248 } 247 249 else { 248 250 if(stricmp((char *)type, ResTypes[NTRT_STRING]) == 0) { 249 stringid = id & 0xF; 250 id = (id >> 4)+1; 251 } 251 stringid = (ULONG)lpszName & 0xF; 252 id = (((ULONG)lpszName) >> 4)+1; 253 } 254 else id = (ULONG)lpszName; 252 255 } 253 256 … … 255 258 if(pData == NULL) { 256 259 if(HIWORD(id)) { 257 dprintf(("Win32Image ::getPEResource: couldn't find resource %s (type %d, lang %d)", id, type, lang));260 dprintf(("Win32ImageBase::getPEResource: couldn't find resource %s (type %d, lang %d)", id, type, lang)); 258 261 } 259 else dprintf(("Win32Image ::getPEResource: couldn't find resource %d (type %d, lang %d)", id, type, lang));262 else dprintf(("Win32ImageBase::getPEResource: couldn't find resource %d (type %d, lang %d)", id, type, lang)); 260 263 return 0; 261 264 } … … 287 290 } 288 291 289 return res;290 } 291 //****************************************************************************** 292 //****************************************************************************** 293 HRSRC Win32 Image::findResourceA(LPCSTR lpszName, LPSTR lpszType)292 return (HRSRC) res; 293 } 294 //****************************************************************************** 295 //****************************************************************************** 296 HRSRC Win32Pe2LxImage::findResourceA(LPCSTR lpszName, LPSTR lpszType, ULONG lang) 294 297 { 295 298 Win32Resource *res = NULL; … … 297 300 int i; 298 301 LPSTR szType = (LPSTR)lpszType; 299 300 if(fNativePEImage == TRUE) {301 return (HRSRC) getPEResource((ULONG)lpszName, (ULONG)lpszType);302 }303 //else converted win32 exe/dll304 302 305 303 if(HIWORD(lpszType) != 0) {//type name, translate to id … … 347 345 lpszName = (LPCSTR)atoi(&lpszName[1]); 348 346 } 349 else lpszName = (LPCSTR) ConvertNameId(hinstance,(char *)lpszName);347 else lpszName = (LPCSTR)convertNameId((char *)lpszName); 350 348 } 351 349 else dprintf(("FindResource %d\n", (int)lpszName)); … … 377 375 } 378 376 //****************************************************************************** 379 //****************************************************************************** 380 HRSRC Win32Image::findResourceW(LPWSTR lpszName, LPWSTR lpszType) 381 { 382 Win32Resource *res = NULL; 377 //TODO: 378 //****************************************************************************** 379 HRSRC Win32LxImage::findResourceA(LPCSTR lpszName, LPSTR lpszType, ULONG lang) 380 { 381 return 0; 382 } 383 //****************************************************************************** 384 //****************************************************************************** 385 HRSRC Win32ImageBase::findResourceW(LPWSTR lpszName, LPWSTR lpszType, ULONG lang) 386 { 383 387 HRSRC hres; 384 LPSTR szType = (LPSTR)lpszType;385 int i;386 388 char *astring1 = NULL, *astring2 = NULL; 387 389 388 if(fNativePEImage == TRUE) {//load resources directly from res section 389 if(HIWORD(lpszType) != 0) { 390 char *resname = UnicodeToAsciiString(lpszType); 391 } 392 else astring1 = (char *)lpszType; 393 394 if(HIWORD(lpszName) != 0) { 395 astring2 = UnicodeToAsciiString(lpszName); 396 } 397 else astring2 = (char *)lpszName; 398 399 hres = (HRSRC) getPEResource((ULONG)astring1, (ULONG)astring1); 400 if(astring1) FreeAsciiString(astring1); 401 if(astring2) FreeAsciiString(astring2); 402 403 return(hres); 404 } 405 //else converted win32 exe/dll 406 if(HIWORD(lpszType) != 0) {//type name, translate to id 407 char *resname = UnicodeToAsciiString(lpszType); 408 for(i=0;i<MAX_RES;i++) { 409 if(strcmp(resname, ResTypes[i]) == 0) 410 break; 411 } 412 if(i == MAX_RES) {//custom resource type, stored as rcdata 413 dprintf(("FindResourceW custom type %s\n", resname)); 414 i = NTRT_RCDATA; 415 } 416 FreeAsciiString(resname); 417 lpszType = (LPWSTR)i; 418 419 szType = (LPSTR)lpszType; 420 } 421 switch((int)szType) { 422 case NTRT_GROUP_ICON: 423 szType = (LPSTR)NTRT_ICON; 424 break; 425 case NTRT_GROUP_CURSOR: 426 szType = (LPSTR)NTRT_CURSOR; 427 break; 428 case NTRT_VERSION: 429 szType = (LPSTR)NTRT_RCDATA; 430 break; 431 case NTRT_STRING: 432 case NTRT_MENU: 433 case NTRT_ICON: 434 case NTRT_BITMAP: 435 case NTRT_CURSOR: 436 case NTRT_DIALOG: 437 case NTRT_RCDATA: 438 case NTRT_ACCELERATORS: 439 szType = (LPSTR)lpszType; 440 break; 441 default: //unknown are stored as rcdata 442 szType = (LPSTR)NTRT_RCDATA; 443 break; 444 } 445 dprintf(("FindResourceW type %d\n", szType)); 446 447 if(HIWORD(lpszName) != 0) {//convert string name identifier to numeric id 448 astring1 = UnicodeToAsciiString(lpszName); 449 dprintf(("FindResourceW %X %s\n", hinstance, astring1)); 450 if(astring1[0] == '#') {// #344 451 lpszName = (LPWSTR)atoi(&astring1[1]); 452 } 453 else lpszName = (LPWSTR)ConvertNameId(hinstance, (char *)astring1); 454 } 455 else dprintf(("FindResourceW %X %d\n", hinstance, (int)lpszName)); 456 457 hres = O32_FindResource(hinstance, (LPCSTR)lpszName, (LPCSTR)szType); 458 if(hres) 459 { 460 switch((ULONG)szType) { 461 case NTRT_MENU: 462 res = new Win32MenuRes(this, hres, (ULONG)lpszName, (ULONG)szType); 463 break; 464 default: 465 res = new Win32Resource(this, hres, (ULONG)lpszName, (ULONG)szType); 466 break; 467 } 468 } 469 470 if(hres == NULL && HIWORD(lpszName) == 0 && (int)szType == NTRT_STRING) { 471 hres = O32_FindResource(hinstance, (LPCSTR)(((ULONG)lpszName - 1)*16), (LPCSTR)NTRT_RCDATA); 472 if(hres) 473 { 474 res = new Win32Resource(this, hres, (ULONG)lpszName, (ULONG)szType); 475 } 476 else dprintf(("FindResourceW can't find string %d\n", (int)lpszName)); 477 } 478 if(astring1) FreeAsciiString(astring1); 479 480 dprintf(("FindResourceW returned %X (%X)\n", hres, GetLastError())); 481 482 return (HRSRC)res; 483 } 484 //****************************************************************************** 485 //****************************************************************************** 486 ULONG Win32Image::getResourceSizeA(LPCSTR lpszName, LPSTR lpszType) 487 { 488 if(fNativePEImage == TRUE) { 489 return getPEResourceSize((ULONG)lpszName, (ULONG)lpszType); 490 } 390 if(HIWORD(lpszType) != 0) { 391 astring1 = UnicodeToAsciiString(lpszType); 392 } 393 else astring1 = (char *)lpszType; 394 395 if(HIWORD(lpszName) != 0) { 396 astring2 = UnicodeToAsciiString(lpszName); 397 } 398 else astring2 = (char *)lpszName; 399 400 hres = (HRSRC) findResourceA(astring1, astring2); 401 if(astring1) FreeAsciiString(astring1); 402 if(astring2) FreeAsciiString(astring2); 403 404 return(hres); 405 } 406 //****************************************************************************** 407 //TODO: 408 //****************************************************************************** 409 ULONG Win32Pe2LxImage::getResourceSizeA(LPCSTR lpszName, LPSTR lpszType, ULONG lang) 410 { 491 411 DebugInt3(); 492 412 return 0; 493 413 } 494 414 //****************************************************************************** 495 //****************************************************************************** 496 ULONG Win32Image::getResourceSizeW(LPCWSTR lpszName, LPWSTR lpszType) 415 //TODO: 416 //****************************************************************************** 417 ULONG Win32LxImage::getResourceSizeA(LPCSTR lpszName, LPSTR lpszType, ULONG lang) 418 { 419 DebugInt3(); 420 return 0; 421 } 422 //****************************************************************************** 423 //****************************************************************************** 424 ULONG Win32PeLdrImage::getResourceSizeA(LPCSTR lpszName, LPSTR lpszType, ULONG lang) 425 { 426 return getPEResourceSize((ULONG)lpszName, (ULONG)lpszType, lang); 427 } 428 //****************************************************************************** 429 //****************************************************************************** 430 ULONG Win32ImageBase::getResourceSizeW(LPCWSTR lpszName, LPWSTR lpszType, ULONG lang) 497 431 { 498 432 char *astring1 = NULL, *astring2 = NULL; 499 433 ULONG ressize; 500 434 501 if(fNativePEImage == TRUE) {//load resources directly from res section 502 if(HIWORD(lpszType) != 0) { 435 if(HIWORD(lpszType) != 0) { 503 436 char *resname = UnicodeToAsciiString(lpszType); 504 505 506 507 437 } 438 else astring1 = (char *)lpszType; 439 440 if(HIWORD(lpszName) != 0) { 508 441 astring2 = UnicodeToAsciiString((LPWSTR)lpszName); 509 } 510 else astring2 = (char *)lpszName; 511 512 ressize = getPEResourceSize((ULONG)astring1, (ULONG)astring1); 513 if(astring1) FreeAsciiString(astring1); 514 if(astring2) FreeAsciiString(astring2); 515 516 return(ressize); 517 } 518 DebugInt3(); 519 return 0; 520 } 521 //****************************************************************************** 522 //****************************************************************************** 442 } 443 else astring2 = (char *)lpszName; 444 445 ressize = getResourceSizeA(astring1, astring2, lang); 446 if(astring1) FreeAsciiString(astring1); 447 if(astring2) FreeAsciiString(astring2); 448 449 return(ressize); 450 } 451 //****************************************************************************** 452 //****************************************************************************** 453 ULONG Win32Pe2LxImage::getVersionSize() 454 { 455 if(getVersionId() == -1) { 456 dprintf(("GetVersionSize: %s has no version resource!\n", szModule)); 457 return(0); 458 } 459 return OSLibGetResourceSize(hinstance, getVersionId()); 460 } 461 //****************************************************************************** 462 //****************************************************************************** 463 BOOL Win32Pe2LxImage::getVersionStruct(char *verstruct, ULONG bufLength) 464 { 465 if(getVersionId() == -1) { 466 dprintf(("GetVersionStruct: %s has no version resource!\n", szModule)); 467 return(FALSE); 468 } 469 return OSLibGetResource(hinstance, getVersionId(), verstruct, bufLength); 470 } 471 //****************************************************************************** 472 //****************************************************************************** 473 ULONG Win32PeLdrImage::getVersionSize() 474 { 475 return getResourceSizeA((LPCSTR)1, (LPSTR)NTRT_VERSION); 476 } 477 //****************************************************************************** 478 //****************************************************************************** 479 BOOL Win32PeLdrImage::getVersionStruct(char *verstruct, ULONG bufLength) 480 { 481 PIMAGE_RESOURCE_DATA_ENTRY pData = NULL; 482 483 pData = getPEResourceEntry(1, NTRT_VERSION); 484 if(pData == NULL) { 485 dprintf(("Win32PeLdrImage::getVersionStruct: couldn't find version resource!")); 486 return 0; 487 } 488 return pData->Size; 489 } 490 //****************************************************************************** 491 //****************************************************************************** 492 ULONG Win32LxImage::getVersionSize() 493 { 494 // return getResourceSizeA((LPCSTR)1, (LPSTR)NTRT_VERSION); 495 return 0; 496 } 497 //****************************************************************************** 498 //****************************************************************************** 499 BOOL Win32LxImage::getVersionStruct(char *verstruct, ULONG bufLength) 500 { 501 PIMAGE_RESOURCE_DATA_ENTRY pData = NULL; 502 503 // pData = getPEResourceEntry(1, NTRT_VERSION); 504 if(pData == NULL) { 505 dprintf(("Win32PeLdrImage::getVersionStruct: couldn't find version resource!")); 506 return 0; 507 } 508 return pData->Size; 509 } 510 //****************************************************************************** 511 //****************************************************************************** -
trunk/src/kernel32/winres.cpp
r933 r956 1 /* $Id: winres.cpp,v 1.1 8 1999-09-14 16:56:08sandervl Exp $ */1 /* $Id: winres.cpp,v 1.19 1999-09-15 23:38:02 sandervl Exp $ */ 2 2 3 3 /* … … 28 28 #include <winres.h> 29 29 #include <misc.h> 30 #include < nameid.h>31 #include <win exe.h>30 #include <winexepe2lx.h> 31 #include <windllpe2lx.h> 32 32 #include "cvtresource.h" 33 33 #include <vmutex.h> 34 34 35 35 VMutex resmutex; 36 37 char *ResTypes[MAX_RES] = 38 {"niks", "CURSOR", "BITMAP", "ICON", "MENU", "DIALOG", "STRING", 39 "FONTDIR", "FONT", "ACCELERATOR", "RCDATA", "MESSAGETABLE", 40 "GROUP_CURSOR", "niks", "GROUP_ICON", "niks", "VERSION"}; 36 41 37 42 //****************************************************************************** … … 92 97 os2resdata(NULL), winresdata(NULL), resType(RSRC_CUSTOMNODATA) 93 98 { 94 resmutex.enter(); 95 next = module->winres; 96 module->winres = this; 97 resmutex.leave(); 98 99 next = NULL; 99 100 module = NULL; 101 100 102 id = -1; 101 103 type = -1; … … 109 111 //****************************************************************************** 110 112 //****************************************************************************** 111 Win32Resource::Win32Resource(Win32Image *module, HRSRC hRes, ULONG id, ULONG type) :113 Win32Resource::Win32Resource(Win32ImageBase *module, HRSRC hRes, ULONG id, ULONG type) : 112 114 os2resdata(NULL), winresdata(NULL), resType(RSRC_PE2LX) 113 115 { … … 168 170 //****************************************************************************** 169 171 //****************************************************************************** 170 Win32Resource::Win32Resource(Win32Image *module, ULONG id, ULONG type,172 Win32Resource::Win32Resource(Win32ImageBase *module, ULONG id, ULONG type, 171 173 ULONG size, char *resdata) : hres(NULL), 172 174 os2resdata(NULL), winresdata(NULL), resType(RSRC_PELOADER) … … 246 248 case NTRT_MENU: 247 249 case NTRT_DIALOG: 248 newid = module->getWin32ResourceId(id); 250 { 251 //TODO->!!!! 252 // newid = ((Win32Pe2LxImage *)module)->getWin32ResourceId(id); 253 //TODO->!!!! 249 254 250 255 rc = DosGetResource((HMODULE)module->hinstance, RT_RCDATA, (int)newid, (PPVOID)&resdata); … … 256 261 memcpy(winresdata, resdata, ressize); 257 262 break; 263 } 258 264 259 265 //TODO:not yet implemented … … 329 335 } 330 336 return os2resdata; 337 } 338 //****************************************************************************** 339 //return size of converted win32 resource 340 //****************************************************************************** 341 ULONG Win32Resource::getOS2Size() 342 { 343 switch(type) { 344 case NTRT_NEWBITMAP: 345 case NTRT_BITMAP: 346 return QueryConvertedBitmapSize((WINBITMAPINFOHEADER *)winresdata, ressize); 347 348 case NTRT_CURSOR: 349 return QueryConvertedCursorSize((CursorComponent *)winresdata, ressize); 350 351 case NTRT_ICON: 352 return QueryConvertedIconSize((WINBITMAPINFOHEADER *)winresdata, ressize); 353 354 case NTRT_GROUP_ICON: 355 case NTRT_GROUP_CURSOR: 356 case NTRT_ACCELERATORS: 357 case NTRT_NEWMENU: 358 case NTRT_MENU: 359 case NTRT_NEWDIALOG: 360 case NTRT_DIALOG: 361 case NTRT_FONTDIR: 362 case NTRT_FONT: 363 case NTRT_MESSAGETABLE: 364 case NTRT_RCDATA: 365 case NTRT_VERSION: 366 case NTRT_STRING: 367 default: 368 dprintf(("Win32Resource::getOS2Size SHOULDN'T BE CALLED for this resource type (%d) (NOT IMPLEMENTED)!!", type)); 369 break; 370 } 371 return 0; 331 372 } 332 373 //****************************************************************************** … … 435 476 //****************************************************************************** 436 477 //****************************************************************************** 437 void Win32Resource::destroyAll(Win32Image *module)478 void Win32Resource::destroyAll(Win32ImageBase *module) 438 479 { 439 480 Win32Resource *res = module->winres, *next; -
trunk/src/kernel32/winresmenu.cpp
r761 r956 1 /* $Id: winresmenu.cpp,v 1. 2 1999-08-31 17:15:30sandervl Exp $ */1 /* $Id: winresmenu.cpp,v 1.3 1999-09-15 23:38:02 sandervl Exp $ */ 2 2 3 3 /* … … 23 23 #include <winresmenu.h> 24 24 #include <misc.h> 25 #include <nameid.h> 26 #include <winexe.h> 25 #include <winexebase.h> 27 26 #include "cvtresource.h" 28 27 29 28 //****************************************************************************** 30 29 //****************************************************************************** 31 Win32MenuRes::Win32MenuRes(Win32Image *module, HRSRC hRes, ULONG id, ULONG type)30 Win32MenuRes::Win32MenuRes(Win32ImageBase *module, HRSRC hRes, ULONG id, ULONG type) 32 31 : Win32Resource(module, hRes, id, type) 33 32 { … … 35 34 //****************************************************************************** 36 35 //****************************************************************************** 37 Win32MenuRes::Win32MenuRes(Win32Image *module, ULONG id, ULONG type,36 Win32MenuRes::Win32MenuRes(Win32ImageBase *module, ULONG id, ULONG type, 38 37 ULONG size, char *resdata) 39 38 : Win32Resource(module, id, type, size, resdata) -
trunk/src/kernel32/wintls.cpp
r617 r956 1 /* $Id: wintls.cpp,v 1. 4 1999-08-22 11:11:11sandervl Exp $ */1 /* $Id: wintls.cpp,v 1.5 1999-09-15 23:38:02 sandervl Exp $ */ 2 2 /* 3 3 * Win32 TLS API functions … … 10 10 */ 11 11 #include <os2win.h> 12 #include <winimage.h> 12 #include <string.h> 13 #include <winimagebase.h> 13 14 #include <thread.h> 14 15 #include <wprocess.h> … … 18 19 //****************************************************************************** 19 20 //****************************************************************************** 20 void Win32Image ::tlsAlloc() //Allocate TLS index for this module21 void Win32ImageBase::tlsAlloc() //Allocate TLS index for this module 21 22 { 22 23 if(!tlsAddress) … … 29 30 return; 30 31 } 31 dprintf(("Win32Image ::tlsAlloc (%d) for module %x", tlsIndex, hinstance));32 dprintf(("Win32ImageBase::tlsAlloc (%d) for module %x", tlsIndex, hinstance)); 32 33 } 33 34 //****************************************************************************** 34 35 //****************************************************************************** 35 void Win32Image ::tlsDelete() //Free TLS index for this module36 void Win32ImageBase::tlsDelete() //Free TLS index for this module 36 37 { 37 38 if(!tlsAddress) … … 43 44 return; 44 45 } 45 dprintf(("Win32Image ::tlsDestroy (%d) for module %x", tlsIndex, hinstance));46 dprintf(("Win32ImageBase::tlsDestroy (%d) for module %x", tlsIndex, hinstance)); 46 47 TlsFree(tlsIndex); 47 48 tlsIndex = -1; … … 49 50 //****************************************************************************** 50 51 //****************************************************************************** 51 void Win32Image ::tlsAttachThread() //setup TLS structures for new thread52 void Win32ImageBase::tlsAttachThread() //setup TLS structures for new thread 52 53 { 53 54 EXCEPTION_FRAME exceptFrame; … … 66 67 } 67 68 68 dprintf(("Win32Image ::tlsAttachThread for module %x, thread id %x", hinstance, GetCurrentThreadId()));69 dprintf(("Win32ImageBase::tlsAttachThread for module %x, thread id %x", hinstance, GetCurrentThreadId())); 69 70 dprintf(("tlsAddress: %x", tlsAddress)); 70 71 dprintf(("tlsInitSize: %x", tlsInitSize)); … … 105 106 //****************************************************************************** 106 107 //****************************************************************************** 107 void Win32Image ::tlsDetachThread() //destroy TLS structures108 void Win32ImageBase::tlsDetachThread() //destroy TLS structures 108 109 { 109 110 EXCEPTION_FRAME exceptFrame; … … 115 116 return; 116 117 117 dprintf(("Win32Image ::tlsDetachThread for module %x, thread id %x", hinstance, GetCurrentThreadId()));118 dprintf(("Win32ImageBase::tlsDetachThread for module %x, thread id %x", hinstance, GetCurrentThreadId())); 118 119 119 120 if((ULONG)*tlsCallBackAddr != 0) { -
trunk/src/kernel32/wprocess.cpp
r712 r956 1 /* $Id: wprocess.cpp,v 1.3 0 1999-08-27 16:51:01sandervl Exp $ */1 /* $Id: wprocess.cpp,v 1.31 1999-09-15 23:38:03 sandervl Exp $ */ 2 2 3 3 /* … … 15 15 #include <string.h> 16 16 17 #include "unicode.h" 18 #include "windll.h" 19 #include "winexe.h" 17 #include <unicode.h> 18 #include <windllbase.h> 19 #include <winexebase.h> 20 #include <windllpeldr.h> 20 21 21 22 #ifdef __IBMCPP__ … … 32 33 #include "mmap.h" 33 34 34 BOOL fExeStarted = FALSE;35 35 BOOL fFreeLibrary = FALSE; 36 36 … … 199 199 return GetFS(); 200 200 } 201 /******************************************************************************/202 //******************************************************************************203 void WIN32API RegisterExe(WIN32EXEENTRY EntryPoint, PIMAGE_TLS_CALLBACK *TlsCallbackAddr,204 LPDWORD TlsIndexAddr, ULONG TlsInitSize,205 ULONG TlsTotalSize, LPVOID TlsAddress,206 LONG Win32TableId, LONG NameTableId, LONG VersionResId,207 LONG Pe2lxVersion, HINSTANCE hinstance, ULONG dwReserved)208 {209 if(WinExe != NULL) //should never happen210 delete(WinExe);211 212 CheckVersion(Pe2lxVersion, OSLibGetDllName(hinstance));213 214 if(getenv("WIN32_IOPL2")) {215 io_init1();216 }217 218 Win32Exe *winexe;219 220 winexe = new Win32Exe(hinstance, NameTableId, Win32TableId);221 222 if(winexe) {223 dprintf(("RegisterExe Win32TableId = %x", Win32TableId));224 dprintf(("RegisterExe NameTableId = %x", NameTableId));225 dprintf(("RegisterExe VersionResId = %x", VersionResId));226 dprintf(("RegisterExe Pe2lxVersion = %x", Pe2lxVersion));227 228 winexe->setVersionId(VersionResId);229 winexe->setEntryPoint((ULONG)EntryPoint);230 winexe->setTLSAddress(TlsAddress);231 winexe->setTLSInitSize(TlsInitSize);232 winexe->setTLSTotalSize(TlsTotalSize);233 winexe->setTLSIndexAddr(TlsIndexAddr);234 winexe->setTLSCallBackAddr(TlsCallbackAddr);235 236 winexe->start();237 }238 else {239 eprintf(("Win32Exe creation failed!\n"));240 DebugInt3();241 return;242 }243 }244 //******************************************************************************245 //******************************************************************************246 ULONG WIN32API RegisterDll(WIN32DLLENTRY pfnDllEntry, PIMAGE_TLS_CALLBACK *TlsCallbackAddr,247 LPDWORD TlsIndexAddr, ULONG TlsInitSize,248 ULONG TlsTotalSize, LPVOID TlsAddress,249 LONG Win32TableId, LONG NameTableId, LONG VersionResId,250 LONG Pe2lxVersion, HINSTANCE hinstance, ULONG dwAttachType)251 {252 char *name;253 254 Win32Dll *winmod = Win32Dll::findModule(hinstance);255 if(dwAttachType == 0)256 { //Process attach257 if(getenv("WIN32_IOPL2")) {258 io_init1();259 }260 name = OSLibGetDllName(hinstance);261 CheckVersion(Pe2lxVersion, name);262 263 dprintf(("RegisterDll %X %s reason %d\n", hinstance, name, dwAttachType));264 dprintf(("RegisterDll Win32TableId = %x", Win32TableId));265 dprintf(("RegisterDll NameTableId = %x", NameTableId));266 dprintf(("RegisterDll VersionResId = %x", VersionResId));267 dprintf(("RegisterDll Pe2lxVersion = %x", Pe2lxVersion));268 269 if(winmod != NULL) {270 //dll manually loaded by PE loader (Win32Dll::init)271 winmod->OS2DllInit(hinstance, NameTableId, Win32TableId, pfnDllEntry);272 }273 else {274 //converted win32 dll loaded by OS/2 loader275 winmod = new Win32Dll(hinstance, NameTableId, Win32TableId, pfnDllEntry);276 if(winmod == NULL) {277 eprintf(("Failed to allocate module object!\n"));278 DebugInt3();279 return 0; //fail dll load280 }281 }282 winmod->setTLSAddress(TlsAddress);283 winmod->setTLSInitSize(TlsInitSize);284 winmod->setTLSTotalSize(TlsTotalSize);285 winmod->setTLSIndexAddr(TlsIndexAddr);286 winmod->setTLSCallBackAddr(TlsCallbackAddr);287 288 /* @@@PH 1998/03/17 console devices initialization */289 iConsoleDevicesRegister();290 291 //SvL: 19-8-'98292 winmod->AddRef();293 winmod->setVersionId(VersionResId);294 295 winmod->attachProcess();296 }297 else {//process detach298 if(winmod != NULL && !fFreeLibrary) {299 return 0; //don't unload (OS/2 dll unload bug)300 }301 //Runtime environment could already be gone, so don't do this302 // dprintf(("KERNEL32: Dll Removed by FreeLibrary or ExitProcess\n"));303 }304 return 1; //success305 }306 201 //****************************************************************************** 307 202 //****************************************************************************** … … 346 241 BOOL WIN32API FreeLibrary(HINSTANCE hinstance) 347 242 { 348 Win32Dll *winmod;243 Win32DllBase *winmod; 349 244 BOOL rc; 350 245 351 246 dprintf(("FreeLibrary")); 352 winmod = Win32Dll ::findModule(hinstance);247 winmod = Win32DllBase::findModule(hinstance); 353 248 if(winmod) { 354 winmod->Release();355 return(TRUE);249 winmod->Release(); 250 return(TRUE); 356 251 } 357 252 dprintf(("KERNEL32: FreeLibrary %s %X\n", OSLibGetDllName(hinstance), hinstance)); … … 366 261 /******************************************************************************/ 367 262 /******************************************************************************/ 368 static HINSTANCE iLoadLibraryA(LPCTSTR lpszLibFile )263 static HINSTANCE iLoadLibraryA(LPCTSTR lpszLibFile, DWORD dwFlags) 369 264 { 370 265 char modname[CCHMAXPATH]; 371 266 HINSTANCE hDll; 372 Win32Dll 267 Win32DllBase *module; 373 268 374 269 hDll = O32_LoadLibrary(lpszLibFile); … … 388 283 } 389 284 390 if(Win32Image::isPEImage((char *)modname)) { 391 module = Win32Dll::findModule((char *)modname); 392 if(module) {//don't load it again 393 module->AddRef(); 394 return module->getInstanceHandle(); 395 } 396 397 module = new Win32Dll((char *)modname); 398 if(module == NULL) 399 return(0); 400 401 module->init(0); 402 if(module->getError() != NO_ERROR) { 403 dprintf(("LoadLibary %s failed (::init)\n", lpszLibFile)); 404 delete(module); 405 return(0); 406 } 407 if(module->attachProcess() == FALSE) { 408 dprintf(("LoadLibary %s failed (::attachProcess)\n", lpszLibFile)); 409 delete(module); 410 return(0); 411 } 412 module->AddRef(); 413 return module->getInstanceHandle(); 414 } 415 else 416 return(0); 417 } 418 419 285 if(Win32ImageBase::isPEImage((char *)modname)) 286 { 287 module = Win32DllBase::findModule((char *)modname); 288 if(module) {//don't load it again 289 module->AddRef(); 290 return module->getInstanceHandle(); 291 } 292 293 Win32PeLdrDll *peldrDll = new Win32PeLdrDll((char *)modname); 294 if(peldrDll == NULL) 295 return(0); 296 297 peldrDll->init(0); 298 if(peldrDll->getError() != NO_ERROR) { 299 dprintf(("LoadLibary %s failed (::init)\n", lpszLibFile)); 300 delete(peldrDll); 301 return(0); 302 } 303 if(dwFlags & DONT_RESOLVE_DLL_REFERENCES) { 304 peldrDll->setNoEntryCalls(); 305 } 306 307 if(peldrDll->attachProcess() == FALSE) { 308 dprintf(("LoadLibary %s failed (::attachProcess)\n", lpszLibFile)); 309 delete(peldrDll); 310 return(0); 311 } 312 peldrDll->AddRef(); 313 return peldrDll->getInstanceHandle(); 314 } 315 else return(0); 316 } 317 //****************************************************************************** 318 //****************************************************************************** 420 319 HINSTANCE WIN32API LoadLibraryA(LPCTSTR lpszLibFile) 421 320 { … … 425 324 lpszLibFile)); 426 325 427 hDll = iLoadLibraryA(lpszLibFile );326 hDll = iLoadLibraryA(lpszLibFile, 0); 428 327 if (hDll == 0) 429 328 { … … 438 337 439 338 // now try again without fully qualified path 440 hDll = iLoadLibraryA(pszName );339 hDll = iLoadLibraryA(pszName, 0); 441 340 } 442 341 } … … 448 347 HINSTANCE WIN32API LoadLibraryExA(LPCTSTR lpszLibFile, HANDLE hFile, DWORD dwFlags) 449 348 { 450 Win32Dll *module; 451 HINSTANCE hDll; 349 HINSTANCE hDll; 452 350 453 351 dprintf(("KERNEL32: LoadLibraryExA %s (%X)\n", lpszLibFile, dwFlags)); 454 hDll = O32_LoadLibrary(lpszLibFile); 455 if(hDll) { 456 return hDll; //converted dll or win32k took care of it 457 } 458 459 if(Win32Image::isPEImage((char *)lpszLibFile)) { 460 module = Win32Dll::findModule((char *)lpszLibFile); 461 if(module) {//don't load it again 462 module->AddRef(); 463 return module->getInstanceHandle(); 352 hDll = iLoadLibraryA(lpszLibFile, dwFlags); 353 if (hDll == 0) 354 { 355 char * pszName; 356 357 // remove path from the image name 358 pszName = strrchr((char *)lpszLibFile, 359 '\\'); 360 if (pszName != NULL) 361 { 362 pszName++; // skip backslash 363 364 // now try again without fully qualified path 365 hDll = iLoadLibraryA(pszName, dwFlags); 464 366 } 465 466 module = new Win32Dll((char *)lpszLibFile); 467 468 if(module == NULL) 469 return(0); 470 471 module->init(0); 472 if(module->getError() != NO_ERROR) { 473 dprintf(("LoadLibary %s failed (::init)\n", lpszLibFile)); 474 delete(module); 475 return(0); 476 } 477 if(dwFlags & DONT_RESOLVE_DLL_REFERENCES) { 478 module->setNoEntryCalls(); 479 } 480 if(module->attachProcess() == FALSE) { 481 dprintf(("LoadLibary %s failed (::attachProcess)\n", lpszLibFile)); 482 delete(module); 483 return(0); 484 } 485 module->AddRef(); 486 return module->getInstanceHandle(); 487 } 488 return(0); 367 } 368 369 return hDll; 489 370 } 490 371 //****************************************************************************** … … 562 443 { 563 444 DWORD rc; 564 Win32Image *module;445 Win32ImageBase *module; 565 446 char *fpath = NULL; 566 447 567 448 dprintf(("GetModuleFileName %X", hinstModule)); 568 449 if(hinstModule == 0 || hinstModule == -1 || (WinExe && hinstModule == WinExe->getInstanceHandle())) { 569 module = (Win32Image *)WinExe;450 module = (Win32ImageBase *)WinExe; 570 451 } 571 452 else { 572 module = (Win32Image *)Win32Dll::findModule(hinstModule);453 module = (Win32ImageBase *)Win32DllBase::findModule(hinstModule); 573 454 } 574 455 … … 608 489 { 609 490 HANDLE hMod; 610 Win32Dll *windll;491 Win32DllBase *windll; 611 492 char szModule[CCHMAXPATH]; 612 493 BOOL fDllModule = FALSE; … … 636 517 } 637 518 else { 638 windll = Win32Dll ::findModule(szModule);519 windll = Win32DllBase::findModule(szModule); 639 520 if(windll) { 640 521 hMod = windll->getInstanceHandle(); … … 722 603 FARPROC WIN32API GetProcAddress(HMODULE hModule, LPCSTR lpszProc) 723 604 { 724 Win32Dll *winmod;605 Win32DllBase *winmod; 725 606 FARPROC proc; 726 607 ULONG ulAPIOrdinal; 727 608 728 winmod = Win32Dll ::findModule((HINSTANCE)hModule);609 winmod = Win32DllBase::findModule((HINSTANCE)hModule); 729 610 if(winmod) { 730 ulAPIOrdinal = (ULONG)lpszProc; 731 if (ulAPIOrdinal <= 0x0000FFFF) { 732 return (FARPROC)winmod->getApi((int)ulAPIOrdinal); 733 } 734 else return (FARPROC)winmod->getApi((char *)lpszProc); 611 ulAPIOrdinal = (ULONG)lpszProc; 612 if (ulAPIOrdinal <= 0x0000FFFF) { 613 proc = (FARPROC)winmod->getApi((int)ulAPIOrdinal); 614 } 615 else proc = (FARPROC)winmod->getApi((char *)lpszProc); 616 if(proc == 0) { 617 SetLastError(ERROR_PROC_NOT_FOUND); 618 } 619 return proc; 735 620 } 736 621 proc = O32_GetProcAddress(hModule, lpszProc); … … 743 628 BOOL SYSTEM GetVersionStruct(char *modname, char *verstruct, ULONG bufLength) 744 629 { 745 HINSTANCE hinstance;746 Win32Image *winimage;630 HINSTANCE hinstance; 631 Win32ImageBase *winimage; 747 632 748 633 dprintf(("GetVersionStruct")); … … 753 638 } 754 639 if(WinExe && WinExe->getInstanceHandle() == hinstance) { 755 winimage = (Win32Image *)WinExe;640 winimage = (Win32ImageBase *)WinExe; 756 641 } 757 642 else { 758 winimage = (Win32Image *)Win32Dll::findModule(hinstance);643 winimage = (Win32ImageBase *)Win32DllBase::findModule(hinstance); 759 644 if(winimage == NULL) { 760 645 dprintf(("GetVersionStruct can't find Win32Image for %s\n", modname)); … … 762 647 } 763 648 } 764 if(winimage->getVersionId() == -1) { 765 dprintf(("GetVersionStruct: %s has no version resource!\n", modname)); 766 return(FALSE); 767 } 768 return OSLibGetResource(hinstance, winimage->getVersionId(), verstruct, bufLength); 649 return winimage->getVersionStruct(verstruct, bufLength); 769 650 } 770 651 //****************************************************************************** … … 772 653 ULONG SYSTEM GetVersionSize(char *modname) 773 654 { 774 HINSTANCE hinstance;775 Win32Image *winimage;655 HINSTANCE hinstance; 656 Win32ImageBase *winimage; 776 657 777 658 dprintf(("GetVersionSize of %s\n", modname)); 778 659 hinstance = OSLibQueryModuleHandle(modname); 779 660 if(hinstance == 0) { 780 dprintf(("GetVersionSize can't find handle for %s\n", modname));781 return(FALSE);661 dprintf(("GetVersionSize can't find handle for %s\n", modname)); 662 return(FALSE); 782 663 } 783 664 784 665 if(WinExe && WinExe->getInstanceHandle() == hinstance) { 785 winimage = (Win32Image *)WinExe;666 winimage = (Win32ImageBase *)WinExe; 786 667 } 787 668 else { 788 winimage = (Win32Image *)Win32Dll::findModule(hinstance);669 winimage = (Win32ImageBase *)Win32DllBase::findModule(hinstance); 789 670 if(winimage == NULL) { 790 671 dprintf(("GetVersionSize can't find Win32Image for %s\n", modname)); … … 792 673 } 793 674 } 794 if(winimage->getVersionId() == -1) { 795 dprintf(("GetVersionSize: %s has no version resource!\n", modname)); 796 return(FALSE); 797 } 798 ULONG size = OSLibGetResourceSize(hinstance, winimage->getVersionId()); 799 800 dprintf(("Version resource size = %d, id %d\n", size, winimage->getVersionId())); 801 return(size); 675 return winimage->getVersionSize(); 802 676 } 803 677 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.