Changeset 4523 for trunk/src/kernel32/winimagebase.cpp
- Timestamp:
- Oct 23, 2000, 3:42:47 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagebase.cpp
r4474 r4523 1 /* $Id: winimagebase.cpp,v 1. 29 2000-10-10 17:14:07sandervl Exp $ */1 /* $Id: winimagebase.cpp,v 1.30 2000-10-23 13:42:44 sandervl Exp $ */ 2 2 3 3 /* … … 64 64 name = strrchr(szFileName, '\\')+1; 65 65 strcpy(szModule, name); 66 67 char *dot = strrchr(szModule, '.');68 if(dot)69 *dot = 0;70 66 } 71 67 else { … … 154 150 char *imagepath; 155 151 156 strcpy(szFullName, szFileName); 157 strupr(szFullName); 158 if(!strchr(szFullName, (int)'.')) { 159 strcat(szFullName,".DLL"); 160 } 161 162 //search order: 163 //1) exe dir 164 //2) current dir 165 //3) windows system dir (kernel32 path) 166 //4) windows dir 167 //5) path 168 if(WinExe) { 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 } 177 if(dllfile == NULL) { 178 strcpy(modname, szFullName); 179 dllfile = OSLibDosOpen(szFullName, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 180 if(dllfile == NULL) { 152 strcpy(szFullName, szFileName); 153 strupr(szFullName); 154 if(!strchr(szFullName, (int)'.')) { 155 strcat(szFullName, DLL_EXTENSION); 156 } 157 158 //search order: 159 //1) exe dir 160 //2) current dir 161 //3) windows system dir (kernel32 path) 162 //4) windows dir 163 //5) path 164 if(WinExe) { 165 strcpy(modname, WinExe->getFullPath()); 166 //remove file name from full path 167 imagepath = modname + strlen(modname) - 1; 168 while(*imagepath != '\\') 169 imagepath--; 170 imagepath[1] = 0; 171 strcat(modname, szFullName); 172 dllfile = OSLibDosOpen(modname, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 173 } 174 if(dllfile == NULL) 175 { 176 strcpy(modname, szFullName); 177 dllfile = OSLibDosOpen(szFullName, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 178 if(dllfile == NULL) 179 { 181 180 strcpy(modname, InternalGetSystemDirectoryA()); 182 strcat(modname, "\\");181 strcat(modname, "\\"); 183 182 strcat(modname, szFullName); 184 dllfile = OSLibDosOpen(modname, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 185 if(dllfile == NULL) { 186 strcpy(modname, InternalGetWindowsDirectoryA()); 187 strcat(modname, "\\"); 183 dllfile = OSLibDosOpen(modname, OSLIB_ACCESS_READONLY|OSLIB_ACCESS_SHAREDENYNONE); 184 if(dllfile == NULL) 185 { 186 strcpy(modname, InternalGetWindowsDirectoryA()); 187 strcat(modname, "\\"); 188 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;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 193 } 194 194 } 195 195 } 196 196 } 197 } 198 strcpy(szFullName, modname); 199 if(dllfile) OSLibDosClose(dllfile); 200 return TRUE; 197 strcpy(szFullName, modname); 198 if(dllfile) OSLibDosClose(dllfile); 199 return TRUE; 201 200 } 202 201 … … 254 253 rc = DosRead(win32handle, pdoshdr, sizeof(IMAGE_DOS_HEADER), &ulRead); 255 254 if(rc != NO_ERROR || ulRead != sizeof(IMAGE_DOS_HEADER)) { 256 free(pdoshdr);255 free(pdoshdr); 257 256 DosClose(win32handle); /* Close the file */ 258 257 return ERROR_INVALID_EXE_SIGNATURE_W; 259 258 } 260 259 if(pdoshdr->e_magic != IMAGE_DOS_SIGNATURE) { 261 free(pdoshdr);260 free(pdoshdr); 262 261 DosClose(win32handle); /* Close the file */ 263 262 return ERROR_INVALID_EXE_SIGNATURE_W; … … 294 293 } 295 294 if(Characteristics) { 296 295 *Characteristics = fh.Characteristics; 297 296 } 298 297 DosClose(win32handle); … … 346 345 * @remark Just a clarification: 347 346 * A module name is the filename of a executable image without 348 * path and withoutextention.347 * path, but *with* extention. 349 348 */ 350 349 BOOL Win32ImageBase::matchModName(const char *pszFilename) const … … 365 364 ) 366 365 { 367 if (ch == '.' && pszModNameEnd == NULL)368 pszModNameEnd = pszModName;369 366 pszModName--; 370 367 } 371 368 pszModName++; 372 369 373 370 /** @sketch 374 371 * Compare the names caseinsensitivly. 375 372 */ 376 if (pszModNameEnd)377 return strnicmp(pszModName, szModule, pszModNameEnd - pszModName) == 0;378 373 return stricmp(pszModName, szModule) == 0; 379 374 }
Note:
See TracChangeset
for help on using the changeset viewer.