Changeset 7449 for trunk/src/kernel32/winimagepeldr.cpp
- Timestamp:
- Nov 24, 2001, 3:58:04 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagepeldr.cpp
r7350 r7449 1 /* $Id: winimagepeldr.cpp,v 1.9 1 2001-11-15 14:59:06 phallerExp $ */1 /* $Id: winimagepeldr.cpp,v 1.92 2001-11-24 14:58:04 sandervl Exp $ */ 2 2 3 3 /* … … 41 41 #include <misc.h> 42 42 #include <win32api.h> 43 #include <heapcode.h> 43 44 #include "winimagebase.h" 44 45 #include "winimagepeldr.h" … … 75 76 #endif 76 77 77 ULONG MissingApi(); 78 ULONG WIN32API MissingApiOrd(char *dllname, int ordinal); 79 ULONG WIN32API MissingApiName(char *dllname, char *functionname); 80 ULONG WIN32API MissingApi(char *message); 78 81 79 82 //****************************************************************************** … … 1296 1299 } 1297 1300 //****************************************************************************** 1301 #define MISSINGOFFSET_PUSHORDINAL 1 1302 #define MISSINGOFFSET_PUSHNAME 1 1303 #define MISSINGOFFSET_PUSHDLLNAME 6 1304 #define MISSINGOFFSET_FUNCTION 11 1305 1306 char missingapicode[18] = { 1307 //push dllname 1308 0x68, 0x00, 0x00, 0x00, 0x00, 1309 //push ordinal/name 1310 0x68, 0x00, 0x00, 0x00, 0x00, 1311 //mov ecx, MissingApiOrd/Name 1312 0xB9, 0x99, 0x99, 0x99, 0x99, 1313 //call ecx 1314 0xFF, 0xD1, 1315 //ret 1316 0xC3}; 1317 1298 1318 //****************************************************************************** 1299 1319 void Win32PeLdrImage::StoreImportByOrd(Win32ImageBase *WinImage, ULONG ordinal, ULONG impaddr) … … 1311 1331 1312 1332 dprintf((LOG, "--->>> NOT FOUND!" )); 1313 *import = (ULONG)MissingApi; 1333 char *code = (char *)_cmalloc(sizeof(missingapicode)); 1334 1335 memcpy(code, missingapicode, sizeof(missingapicode)); 1336 *(DWORD *)&code[MISSINGOFFSET_PUSHDLLNAME] = (DWORD)WinImage->getModuleName(); 1337 *(DWORD *)&code[MISSINGOFFSET_PUSHORDINAL] = ordinal; 1338 *(DWORD *)&code[MISSINGOFFSET_FUNCTION] = (DWORD)MissingApiOrd; 1339 *import = (ULONG)code; 1314 1340 } 1315 1341 else *import = apiaddr; … … 1331 1357 1332 1358 dprintf((LOG, "--->>> NOT FOUND!" )); 1333 *import = (ULONG)MissingApi; 1359 1360 char *code = (char *)_cmalloc(sizeof(missingapicode)); 1361 1362 memcpy(code, missingapicode, sizeof(missingapicode)); 1363 *(DWORD *)&code[MISSINGOFFSET_PUSHDLLNAME] = (DWORD)WinImage->getModuleName(); 1364 *(DWORD *)&code[MISSINGOFFSET_PUSHNAME] = (DWORD)impname; 1365 *(DWORD *)&code[MISSINGOFFSET_FUNCTION] = (DWORD)MissingApiName; 1366 *import = (ULONG)code; 1334 1367 } 1335 1368 else *import = apiaddr; … … 2015 2048 //****************************************************************************** 2016 2049 //****************************************************************************** 2017 ULONG MissingApi() 2050 ULONG WIN32API MissingApiOrd(char *dllname, int ordinal) 2051 { 2052 char message[128]; 2053 2054 sprintf(message, "The application has called the non-existing api %s->%d", dllname, ordinal); 2055 return MissingApi(message); 2056 } 2057 //****************************************************************************** 2058 //****************************************************************************** 2059 ULONG WIN32API MissingApiName(char *dllname, char *functionname) 2060 { 2061 char message[128]; 2062 2063 sprintf(message, "The application has called the non-existing api %s->%s", dllname, functionname); 2064 return MissingApi(message); 2065 } 2066 //****************************************************************************** 2067 //****************************************************************************** 2068 ULONG WIN32API MissingApi(char *message) 2018 2069 { 2019 2070 static BOOL fIgnore = FALSE; … … 2025 2076 2026 2077 do { 2027 r = WinMessageBox(HWND_DESKTOP, NULLHANDLE, "The application has called a non-existing api\n",2078 r = WinMessageBox(HWND_DESKTOP, NULLHANDLE, message, 2028 2079 "Internal Odin Error", 0, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION | MB_MOVEABLE); 2029 2080 }
Note:
See TracChangeset
for help on using the changeset viewer.