Changeset 6646 for trunk/src/kernel32/module.cpp
- Timestamp:
- Sep 5, 2001, 2:58:00 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/module.cpp
r5587 r6646 1 /* 1 /* $Id: module.cpp,v 1.3 2001-09-05 12:57:59 bird Exp $ 2 * 2 3 * GetBinaryTypeA/W (Wine Port) 3 4 * … … 13 14 #include <misc.h> 14 15 15 #define DBG_LOCALLOG 16 #define DBG_LOCALLOG DBG_module 16 17 #include "dbglocal.h" 17 18 … … 38 39 || (!(ReadFile(hfile, modtab, ne->ne_cmod*sizeof(WORD), &len, NULL))) 39 40 || (len != ne->ne_cmod*sizeof(WORD)) ) 40 41 goto broken; 41 42 42 43 /* read imported names table */ … … 45 46 || (!(ReadFile(hfile, nametab, ne->ne_enttab - ne->ne_imptab, &len, NULL))) 46 47 || (len != ne->ne_enttab - ne->ne_imptab) ) 47 48 goto broken; 48 49 49 50 for (i=0; i < ne->ne_cmod; i++) 50 51 { 51 52 53 54 55 56 57 58 52 LPSTR module = &nametab[modtab[i]]; 53 TRACE("modref: %.*s\n", module[0], &module[1]); 54 if (!(strncmp(&module[1], "KERNEL", module[0]))) 55 { /* very old Windows file */ 56 MESSAGE("This seems to be a very old (pre-3.0) Windows executable. Expect crashes, especially if this is a real-mode binary !\n"); 57 type = SCS_WOW_BINARY; 58 goto good; 59 } 59 60 } 60 61 … … 107 108 /* Seek to the start of the file and read the DOS header information. 108 109 */ 109 if ( SetFilePointer( hfile, 0, NULL, SEEK_SET ) != -1 110 if ( SetFilePointer( hfile, 0, NULL, SEEK_SET ) != -1 110 111 && ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL ) 111 112 && len == sizeof(mz_header) ) … … 132 133 ( mz_header.e_lfarlc >= sizeof(IMAGE_DOS_HEADER) ) ) 133 134 if ( mz_header.e_lfanew >= sizeof(IMAGE_DOS_HEADER) 134 && SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ) != -1 135 && SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ) != -1 135 136 && ReadFile( hfile, magic, sizeof(magic), &len, NULL ) 136 137 && len == sizeof(magic) ) … … 162 163 * "extended header is a Windows executable (NE) 163 164 * header." This can mean either a 16-bit OS/2 164 * or a 16-bit Windows or even a DOS program 165 * or a 16-bit Windows or even a DOS program 165 166 * (running under a DOS extender). To decide 166 167 * which, we'll have to read the NE header. … … 168 169 169 170 IMAGE_OS2_HEADER ne; 170 if ( SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ) != -1 171 if ( SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ) != -1 171 172 && ReadFile( hfile, &ne, sizeof(ne), &len, NULL ) 172 173 && len == sizeof(ne) ) … … 177 178 case 5: *lpBinaryType = SCS_DOS_BINARY; return TRUE; 178 179 default: *lpBinaryType = 179 180 180 MODULE_Decide_OS2_OldWin(hfile, &mz_header, &ne); 181 return TRUE; 181 182 } 182 183 } … … 187 188 { 188 189 /* Unknown extended header, but this file is nonetheless 189 190 DOS-executable. 190 191 */ 191 192 *lpBinaryType = SCS_DOS_BINARY; 192 193 return TRUE; 193 194 } 194 195 }
Note:
See TracChangeset
for help on using the changeset viewer.