Changeset 4249 for trunk/src/kernel32/winimagebase.cpp
- Timestamp:
- Sep 13, 2000, 12:45:19 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagebase.cpp
r4003 r4249 1 /* $Id: winimagebase.cpp,v 1.2 5 2000-08-12 16:58:40 sandervlExp $ */1 /* $Id: winimagebase.cpp,v 1.26 2000-09-12 22:45:19 bird Exp $ */ 2 2 3 3 /* … … 5 5 * 6 6 * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl) 7 * Copyright 1998 Knut St. Osmundsen7 * Copyright 1998-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no) 8 8 * 9 9 * Project Odin Software License can be found in LICENSE.TXT … … 39 39 #include <winconst.h> 40 40 41 #define DBG_LOCALLOG 41 #define DBG_LOCALLOG DBG_winimagebase 42 42 #include "dbglocal.h" 43 43 … … 107 107 item = loadedDlls.Head(); 108 108 while(item) { 109 110 111 112 } 113 109 if(loadedDlls.getItem(item) == (ULONG)image) { 110 ret = TRUE; 111 break; 112 } 113 item = loadedDlls.getNext(item); 114 114 } 115 115 dlllistmutex.leave(); … … 147 147 //****************************************************************************** 148 148 //****************************************************************************** 149 BOOL Win32ImageBase::findDll(const char *szFileName, char *szFullName, 149 BOOL Win32ImageBase::findDll(const char *szFileName, char *szFullName, 150 150 int cchFullFileName, const char *pszAltPath) 151 151 { … … 157 157 strupr(szFullName); 158 158 if(!strchr(szFullName, (int)'.')) { 159 159 strcat(szFullName,".DLL"); 160 160 } 161 161 … … 167 167 //5) path 168 168 if(WinExe) { 169 170 171 172 173 174 175 169 strcpy(modname, WinExe->getFullPath()); 170 //remove file name from full path 171 imagepath = modname + strlen(modname) - 1; 172 while(*imagepath != '\\') imagepath--; 173 imagepath[1] = 0; 174 strcat(modname, szFullName); 175 dllfile = OSLibDosOpen(modname, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 176 176 } 177 177 if(dllfile == NULL) { 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 178 strcpy(modname, szFullName); 179 dllfile = OSLibDosOpen(szFullName, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 180 if(dllfile == NULL) { 181 strcpy(modname, InternalGetSystemDirectoryA()); 182 strcat(modname, "\\"); 183 strcat(modname, szFullName); 184 dllfile = OSLibDosOpen(modname, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 185 if(dllfile == NULL) { 186 strcpy(modname, InternalGetWindowsDirectoryA()); 187 strcat(modname, "\\"); 188 strcat(modname, szFullName); 189 dllfile = OSLibDosOpen(modname, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 190 if(dllfile == NULL) { 191 if(OSLibDosSearchPath(OSLIB_SEARCHENV, "PATH", szFullName, modname, sizeof(modname)) == 0) { 192 return FALSE; 193 } 194 } 195 } 196 } 197 197 } 198 198 strcpy(szFullName, modname); … … 200 200 return TRUE; 201 201 } 202 202 203 //****************************************************************************** 203 204 //returns ERROR_SUCCESS or error code … … 252 253 rc = DosRead(win32handle, pdoshdr, sizeof(IMAGE_DOS_HEADER), &ulRead); 253 254 if(rc != NO_ERROR || ulRead != sizeof(IMAGE_DOS_HEADER)) { 254 255 free(pdoshdr); 255 256 DosClose(win32handle); /* Close the file */ 256 257 return ERROR_INVALID_EXE_SIGNATURE_W; 257 258 } 258 259 if(pdoshdr->e_magic != IMAGE_DOS_SIGNATURE) { 259 260 free(pdoshdr); 260 261 DosClose(win32handle); /* Close the file */ 261 262 return ERROR_INVALID_EXE_SIGNATURE_W; … … 331 332 332 333 334 /** 335 * Matches a given filename or module name with the module name of 336 * this object. 337 * @returns TRUE: The modulenames matches. 338 * FALSE: Don't match. 339 * @param pszFilename Pointer to filename or module name. 340 * @status completely implemented. 341 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 342 * @remark Just a clarification: 343 * A module name is the filename of a executable image without 344 * path and without extention. 345 */ 346 BOOL Win32ImageBase::matchModName(const char *pszFilename) const 347 { 348 const char *pszModName; /* Pointer to the modulename. */ 349 const char *pszModNameEnd = NULL; /* Pointer to the dot starting the extention. (if any) */ 350 register char ch; 351 352 /** @sketch 353 * Search the filename string finding the modulename start and end. 354 * The loop ends when we have passed one char left of the module name. 355 */ 356 pszModName = pszFilename + strlen(pszFilename) - 1; 357 while (pszModName >= pszFilename 358 && (ch = *pszModName) != '\\' 359 && ch != '/' 360 && ch != ':' 361 ) 362 { 363 if (ch == '.' && pszModNameEnd != NULL) 364 pszModName = pszModName; 365 pszModName--; 366 } 367 pszModName++; 368 369 /** @sketch 370 * Compare the names caseinsensitivly. 371 */ 372 if (pszModNameEnd) 373 return strnicmp(pszModName, szModule, pszModNameEnd - pszModName) == 0; 374 return stricmp(pszModName, szModule) == 0; 375 }
Note:
See TracChangeset
for help on using the changeset viewer.