Changeset 13952
- Timestamp:
- Apr 15, 2000, 12:35:29 AM (25 years ago)
- Location:
- tags/trunk/src/kernel32
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tags/trunk/src/kernel32/Fileio.cpp ¶
r13846 r13952 1 /* $Id: Fileio.cpp,v 1.2 7 2000-03-29 15:17:27 cbratschiExp $ */1 /* $Id: Fileio.cpp,v 1.28 2000-04-14 22:35:25 sandervl Exp $ */ 2 2 3 3 /* … … 398 398 if((NULL!=lpszFileName) && strlen(lpszFileName)==2 && lpszFileName[1] == ':') 399 399 { 400 401 402 403 404 405 400 char szDrive[4]; 401 szDrive[0] = lpszFileName[0]; 402 szDrive[1] = lpszFileName[1]; 403 szDrive[2] = '\\'; 404 szDrive[3] = 0x00; 405 rc = O32_GetFileAttributes((LPSTR)szDrive); 406 406 } 407 else rc = O32_GetFileAttributes((LPSTR)lpszFileName); 407 else { 408 rc = O32_GetFileAttributes((LPSTR)lpszFileName); 409 if(rc == -1 && lpszFileName[strlen(lpszFileName)-1] != '\\') { 410 char *filename = (char *)alloca(strlen(lpszFileName)+1); 411 strcpy(filename, lpszFileName); 412 strcat(filename, "\\"); 413 rc = O32_GetFileAttributes((LPSTR)filename); 414 } 415 } 408 416 409 417 #if 0 // need more tests, maybe there is also a better way to hide simulated b: -
TabularUnified tags/trunk/src/kernel32/directory.cpp ¶
r13924 r13952 1 /* $Id: directory.cpp,v 1.1 8 2000-04-07 19:43:46 sandervl Exp $ */1 /* $Id: directory.cpp,v 1.19 2000-04-14 22:35:26 sandervl Exp $ */ 2 2 3 3 /* … … 13 13 * 14 14 * Copyright 1995 Alexandre Julliard 15 * 16 * TODO: System/window directories should be created by install program! 15 17 * 16 18 * Project Odin Software License can be found in LICENSE.TXT … … 229 231 UINT,uSize) 230 232 { 231 LPSTR lpstrEnv = getenv("WIN32.DIR.SYSTEM"); /* query environment */ 232 CHAR buf[255]; 233 234 if (lpstrEnv != NULL) 235 { 236 if(lpBuffer) 237 lstrcpynA(lpBuffer, lpstrEnv, uSize); 238 239 return (lstrlenA(lpstrEnv)); /* return number of copies bytes */ 240 } 241 else 242 { 243 int len; 244 245 len = ODIN_PROFILE_GetOdinIniString(ODINDIRECTORIES,"SYSTEM","",buf,sizeof(buf)); 246 if (len > 2) { 247 if(buf[len-1] == '\\') { 248 buf[len-1] = 0; 249 len--; 250 } 251 if(lpBuffer) 252 lstrcpynA(lpBuffer, buf, uSize); 253 254 return len; 255 } 256 else {//SvL: Use path of kernel32.dll instead of calling Open32 api (which returns \OS2\SYSTEM) 257 lstrcpynA(buf, kernel32Path, sizeof(buf)-1); 233 char buf[255]; 234 int len; 235 236 lstrcpynA(buf, kernel32Path, sizeof(buf)-1); 258 237 len = lstrlenA(buf);; 259 238 if(buf[len-1] == '\\') { … … 264 243 lstrcpynA(lpBuffer, buf, uSize); 265 244 return len; 266 }267 }268 245 } 269 246 … … 315 292 UINT,uSize) 316 293 { 317 LPSTR lpstrEnv = getenv("WIN32.DIR.WINDOWS"); /* query environment */294 static int fWindirExists = FALSE; 318 295 CHAR buf[255]; 319 320 if (lpstrEnv != NULL) 321 { 322 if(lpBuffer) 323 lstrcpynA(lpBuffer, lpstrEnv, uSize); 324 325 return (lstrlenA(lpstrEnv)); /* return number of copies bytes */ 326 } 327 else 328 { 329 int len; 330 331 len = ODIN_PROFILE_GetOdinIniString(ODINDIRECTORIES,"WINDOWS","",buf,sizeof(buf)); 332 if (len > 2) { 333 if(buf[len-1] == '\\') { 334 buf[len-1] = 0; 335 len--; 336 } 337 if(lpBuffer) 338 lstrcpynA(lpBuffer, buf, uSize); 339 340 return len; 341 } 342 else {//SvL: Use path of kernel32.dll instead of calling Open32 api (which returns \OS2\SYSTEM) 343 296 int len; 297 298 //SvL: Use path of kernel32.dll instead of calling Open32 api (which returns \OS2\SYSTEM) 344 299 lstrcpynA(buf, kernel32Path, sizeof(buf)-1); 345 300 strcat(buf, "WIN"); 346 O32_CreateDirectory(buf, NULL); 301 if(!fWindirExists) { 302 O32_CreateDirectory(buf, NULL); 303 fWindirExists = TRUE; 304 } 347 305 348 306 len = lstrlenA(buf);; … … 354 312 lstrcpynA(lpBuffer, buf, uSize); 355 313 return len; 356 }357 }358 314 } 359 315 -
TabularUnified tags/trunk/src/kernel32/exceptions.cpp ¶
r13751 r13952 1 /* $Id: exceptions.cpp,v 1.3 8 2000-03-20 20:32:40sandervl Exp $ */1 /* $Id: exceptions.cpp,v 1.39 2000-04-14 22:35:27 sandervl Exp $ */ 2 2 3 3 /* … … 967 967 pCtxRec->ctx_stack[0].signexp = 0; 968 968 } 969 dprintf(("KERNEL32: OS2ExceptionHandler: fix and continue\n"));969 dprintf(("KERNEL32: OS2ExceptionHandler: fix and continue\n")); 970 970 return (XCPT_CONTINUE_EXECUTION); 971 971 } 972 972 else 973 973 { 974 dprintf(("KERNEL32: OS2ExceptionHandler: continue search\n"));975 return (XCPT_CONTINUE_SEARCH);974 dprintf(("KERNEL32: OS2ExceptionHandler: continue search\n")); 975 return (XCPT_CONTINUE_SEARCH); 976 976 } 977 977 -
TabularUnified tags/trunk/src/kernel32/initterm.cpp ¶
r13707 r13952 1 /* $Id: initterm.cpp,v 1. 39 2000-03-16 19:20:39sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.40 2000-04-14 22:35:27 sandervl Exp $ */ 2 2 3 3 /* … … 133 133 // the reference count here 134 134 Win32DllBase *module = Win32DllBase::findModule(hModule); 135 if(module && !fPe2Lx) {135 if(module) { 136 136 module->AddRef(); 137 137 module->DisableUnload(); -
TabularUnified tags/trunk/src/kernel32/kernel32.def ¶
r13858 r13952 1 ; $Id: kernel32.def,v 1.7 8 2000-03-30 15:37:14 cbratschiExp $1 ; $Id: kernel32.def,v 1.79 2000-04-14 22:35:26 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 972 972 _RegisterPe2LxDll@12 @1209 973 973 974 _CreateWin32PeLdrExe@ 8@1236974 _CreateWin32PeLdrExe@12 @1236 975 975 976 976 _RegisterLxExe@8 @1237 -
TabularUnified tags/trunk/src/kernel32/windlllx.cpp ¶
r13638 r13952 1 /* $Id: windlllx.cpp,v 1. 9 2000-03-09 19:03:21sandervl Exp $ */1 /* $Id: windlllx.cpp,v 1.10 2000-04-14 22:35:27 sandervl Exp $ */ 2 2 3 3 /* … … 30 30 #include <windlllx.h> 31 31 #include "winexepe2lx.h" 32 #include "winexepeldr.h" 32 33 #include <odinlx.h> 33 34 #include "oslibmisc.h" … … 60 61 return FALSE; 61 62 } 62 if( fPe2Lx) {63 if(!fPeLoader) { 63 64 windll->AddRef(); 64 65 … … 121 122 //Don't proceed for pe2lx/win32k (os/2 dll unload dependency bug) 122 123 //Don't do it either after ExitProcess has been called 123 if( fPe2Lx|| WinExe == NULL)124 if(!fPeLoader || WinExe == NULL) 124 125 return TRUE; 125 126 … … 194 195 #endif 195 196 196 if( fPe2Lx)197 if(!fPeLoader) 197 198 return ret; 198 199 -
TabularUnified tags/trunk/src/kernel32/winexelx.cpp ¶
r13382 r13952 1 /* $Id: winexelx.cpp,v 1. 5 2000-02-16 14:22:11sandervl Exp $ */1 /* $Id: winexelx.cpp,v 1.6 2000-04-14 22:35:27 sandervl Exp $ */ 2 2 3 3 /* … … 66 66 67 67 if(winexe) { 68 winexe->setCommandLine(ppib->pib_pchcmd); 68 char *cmdline; 69 int cmdlen = strlen(ppib->pib_pchcmd); 70 71 cmdlen += strlen(ppib->pib_pchcmd+cmdlen+1); 72 cmdline = (char *)malloc(cmdlen+2); //term. 0 + space 73 strcpy(cmdline, ppib->pib_pchcmd); 74 strcat(cmdline, " "); 75 strcat(cmdline, ppib->pib_pchcmd+strlen(ppib->pib_pchcmd)+1); 76 winexe->setCommandLine(cmdline); 77 free(cmdline); 69 78 winexe->setEntryPoint((ULONG)EntryPoint); 70 79 winexe->start(); -
TabularUnified tags/trunk/src/kernel32/winexepe2lx.cpp ¶
r13638 r13952 1 /* $Id: winexepe2lx.cpp,v 1. 5 2000-03-09 19:03:22sandervl Exp $ */1 /* $Id: winexepe2lx.cpp,v 1.6 2000-04-14 22:35:27 sandervl Exp $ */ 2 2 3 3 /* … … 37 37 38 38 39 BOOL fPe2Lx = FALSE;40 41 39 /** 42 40 * Register a Pe2Lx Executable module. … … 58 56 { 59 57 Win32Pe2LxExe *pWinPe2LxExe; 60 61 fPe2Lx = TRUE;62 58 63 59 /* I/O init. */ -
TabularUnified tags/trunk/src/kernel32/winexepe2lx.h ¶
r13638 r13952 1 /* $Id: winexepe2lx.h,v 1. 1 2000-03-09 19:03:22sandervl Exp $ */1 /* $Id: winexepe2lx.h,v 1.2 2000-04-14 22:35:28 sandervl Exp $ */ 2 2 3 3 /* … … 32 32 }; 33 33 34 extern BOOL fPe2Lx;35 36 34 #endif //__WINEXEPE2LX_H__ -
TabularUnified tags/trunk/src/kernel32/winexepeldr.cpp ¶
r13382 r13952 1 /* $Id: winexepeldr.cpp,v 1. 7 2000-02-16 14:22:11sandervl Exp $ */1 /* $Id: winexepeldr.cpp,v 1.8 2000-04-14 22:35:28 sandervl Exp $ */ 2 2 3 3 /* … … 42 42 extern char szErrorModule[]; 43 43 44 BOOL fPeLoader = FALSE; 45 44 46 //****************************************************************************** 45 47 //Called by ring 3 pe loader to create win32 executable 46 48 //****************************************************************************** 47 BOOL WIN32API CreateWin32PeLdrExe(char *szFileName, ULONG reservedMem)49 BOOL WIN32API CreateWin32PeLdrExe(char *szFileName, char *szCmdLine, ULONG reservedMem) 48 50 { 49 51 APIRET rc; … … 52 54 WINEXCEPTION_FRAME exceptFrame; 53 55 Win32PeLdrExe *WinExe; 54 char *szCmdLine; 56 char *szFullCmdLine; 57 58 fPeLoader = TRUE; 55 59 56 60 WinExe = new Win32PeLdrExe(szFileName); … … 62 66 return FALSE; 63 67 } 64 //TODO: Create full path for executable?65 szCmdLine = ppib->pib_pchcmd + strlen(ppib->pib_pchcmd) + 1;66 while(*szCmdLine != 0 && *szCmdLine == ' ')67 szCmdLine++;68 68 69 WinExe->setCommandLine(szCmdLine); 70 dprintf(("Cmd line: %s", szCmdLine)); 69 szFullCmdLine = (char *)malloc(strlen(szFileName) + 1 + strlen(szCmdLine) + 1); 70 strcpy(szFullCmdLine, szFileName); 71 strcat(szFullCmdLine, " "); 72 strcat(szFullCmdLine, szCmdLine); 73 WinExe->setCommandLine(szFullCmdLine); 74 dprintf(("Cmd line: %s", szFullCmdLine)); 75 free(szFullCmdLine); 71 76 72 77 if(getenv("WIN32_IOPL2")) { -
TabularUnified tags/trunk/src/kernel32/winexepeldr.h ¶
r13653 r13952 1 /* $Id: winexepeldr.h,v 1. 1 2000-03-10 16:12:02sandervl Exp $ */1 /* $Id: winexepeldr.h,v 1.2 2000-04-14 22:35:28 sandervl Exp $ */ 2 2 3 3 /* … … 16 16 #include <winimagepeldr.h> 17 17 18 typedef BOOL (* WIN32API WIN32CTOR)(char *, ULONG);18 typedef BOOL (* WIN32API WIN32CTOR)(char *, char *, ULONG); 19 19 20 20 //Class for executables run by the ring 3 PE loader … … 39 39 extern char szInteralErrorMsg[]; 40 40 41 extern BOOL fPeLoader; 42 41 43 #endif //__WINEXEPELDR_H__ -
TabularUnified tags/trunk/src/kernel32/winimagebase.cpp ¶
r13638 r13952 1 /* $Id: winimagebase.cpp,v 1.1 0 2000-03-09 19:03:22sandervl Exp $ */1 /* $Id: winimagebase.cpp,v 1.11 2000-04-14 22:35:28 sandervl Exp $ */ 2 2 3 3 /* … … 133 133 //****************************************************************************** 134 134 //****************************************************************************** 135 void Win32ImageBase::findDll(char *szFileName, char *szFullName, int cchFullFileName) 136 { 137 char modname[CCHMAXPATH]; 138 HFILE dllfile; 139 char *imagepath; 140 141 strcpy(szFullName, szFileName); 142 strupr(szFullName); 143 if(!strchr(szFullName, (int)'.')) { 144 strcat(szFullName,".DLL"); 145 } 146 //search order: 147 //1) current dir 148 //2) exe dir 149 //3) windows system dir (kernel32 path) 150 //4) path 151 dllfile = OSLibDosOpen(szFullName, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 152 if(dllfile == NULL) {//search in libpath for dll 153 strcpy(modname, WinExe->getFullPath()); 154 //remove file name from full path 155 imagepath = modname + strlen(modname) - 1; 156 while(*imagepath != '\\') imagepath--; 157 imagepath[1] = 0; 158 strcat(modname, szFileName); 159 dllfile = OSLibDosOpen(modname, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 160 if(dllfile == NULL) { 161 strcpy(modname, kernel32Path); 162 strcat(modname, szFileName); 163 dllfile = OSLibDosOpen(modname, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 164 if(dllfile == NULL) { 165 OSLibDosSearchPath(OSLIB_SEARCHENV, "PATH", modname, szFullName, cchFullFileName); 166 } 167 else { 168 strcpy(szFullName, modname); 169 OSLibDosClose(dllfile); 170 } 171 } 172 else { 173 strcpy(szFullName, modname); 174 OSLibDosClose(dllfile); 175 } 176 } 177 else OSLibDosClose(dllfile); 178 } 179 //****************************************************************************** 180 //****************************************************************************** 135 181 BOOL Win32ImageBase::isPEImage(char *szFileName) 136 182 { 137 char modname[CCHMAXPATH];138 183 char filename[CCHMAXPATH]; 139 184 char *syspath; … … 148 193 int nSections, i; 149 194 150 strcpy(filename, szFileName); 151 strupr(filename); 152 if(!strchr(filename, (int)'.')) { 153 strcat(filename,".DLL"); 154 } 155 dllfile = OSLibDosOpen(filename, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 156 if(dllfile == NULL) {//search in libpath for dll 157 strcpy(modname, kernel32Path); 158 strcat(modname, filename); 159 dllfile = OSLibDosOpen(modname, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 160 if(dllfile == NULL) { 161 OSLibDosSearchPath(OSLIB_SEARCHENV, "PATH", filename, filename, sizeof(filename)); 162 } 163 else { 164 strcpy(filename, modname); 165 OSLibDosClose(dllfile); 166 } 167 } 168 else OSLibDosClose(dllfile); 169 195 findDll(szFileName, filename, sizeof(filename)); 170 196 rc = DosOpen(filename, /* File path name */ 171 &win32handle,/* File handle */197 &win32handle, /* File handle */ 172 198 &ulAction, /* Action taken */ 173 199 0L, /* File primary allocation */ -
TabularUnified tags/trunk/src/kernel32/winimagebase.h ¶
r13638 r13952 1 /* $Id: winimagebase.h,v 1. 1 2000-03-09 19:03:22sandervl Exp $ */1 /* $Id: winimagebase.h,v 1.2 2000-04-14 22:35:28 sandervl Exp $ */ 2 2 3 3 /* … … 82 82 83 83 static BOOL isPEImage(char *szFileName); 84 static void findDll(char *szFileName, char *szFullName, int cchFullFileName); 84 85 85 86 void setEntryPoint(ULONG startAddress) { entryPoint = startAddress; }; -
TabularUnified tags/trunk/src/kernel32/winimagepeldr.cpp ¶
r13836 r13952 1 /* $Id: winimagepeldr.cpp,v 1.3 8 2000-03-28 17:11:50sandervl Exp $ */1 /* $Id: winimagepeldr.cpp,v 1.39 2000-04-14 22:35:28 sandervl Exp $ */ 2 2 3 3 /* … … 129 129 } 130 130 else { 131 if(!strchr(szFileName, '.')) { 132 strcat(szFileName,".DLL"); 133 } 134 dllfile = OSLibDosOpen(szFileName, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 135 if(dllfile == NULL) {//search in libpath for dll 136 strcpy(szModule, kernel32Path); 137 strcat(szModule, szFileName); 138 strcpy(szFileName, szModule); 139 140 dllfile = OSLibDosOpen(szFileName, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 141 if(dllfile == NULL) { 142 if(!strstr(szFileName, ".DLL")) { 143 strcat(szFileName,".DLL"); 144 dllfile = OSLibDosOpen(szFileName, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 145 if(dllfile == NULL) { 146 strcpy(szModule, kernel32Path); 147 strcat(szModule, szFileName); 148 strcpy(szFileName, szModule); 149 } 150 else OSLibDosClose(dllfile); 151 } 152 dllfile = OSLibDosOpen(szFileName, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 153 if(dllfile == NULL) { 154 strcpy(szFileName, pszFileName); 155 strupr(szFileName); 156 OSLibDosSearchPath(OSLIB_SEARCHENV, "PATH", szFileName, szFileName, sizeof(szFileName)); 157 } 158 else OSLibDosClose(dllfile); 159 } 160 else OSLibDosClose(dllfile); 161 } 162 else OSLibDosClose(dllfile); 131 findDll(szFileName, szModule, sizeof(szModule)); 132 strcpy(szFileName, szModule); 163 133 } 164 134 strcpy(szModule, OSLibStripPath(szFileName)); -
TabularUnified tags/trunk/src/kernel32/wprocess.cpp ¶
r13739 r13952 1 /* $Id: wprocess.cpp,v 1.7 5 2000-03-18 19:49:44sandervl Exp $ */1 /* $Id: wprocess.cpp,v 1.76 2000-04-14 22:35:29 sandervl Exp $ */ 2 2 3 3 /* … … 23 23 #include "winexebase.h" 24 24 #include "windllpeldr.h" 25 #include "winexepe 2lx.h"25 #include "winexepeldr.h" 26 26 #include "winfakepeldr.h" 27 27 #include <vmutex.h> … … 423 423 module = Win32DllBase::findModule((LPSTR)lpszLibFile); 424 424 if(module) { 425 if(module->isLxDll() && !module->isLoaded() && !fPe2Lx) {425 if(module->isLxDll() && !module->isLoaded() && fPeLoader) { 426 426 //can happen with i.e. wininet 427 427 //wininet depends on wsock32; when the app loads wsock32 afterwards … … 449 449 { 450 450 module = Win32DllBase::findModule(hDll); 451 if(module && module->isLxDll() && !fPe2Lx) {451 if(module && module->isLxDll() && fPeLoader) { 452 452 module->setLoadLibrary(); 453 453 module->AddRef();
Note:
See TracChangeset
for help on using the changeset viewer.