Changeset 3375 for trunk/src/kernel32/winimagebase.cpp
- Timestamp:
- Apr 15, 2000, 12:35:29 AM (25 years ago)
- File:
-
- 1 edited
-
trunk/src/kernel32/winimagebase.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagebase.cpp
r3059 r3375 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 */
Note:
See TracChangeset
for help on using the changeset viewer.
