Ignore:
Timestamp:
Sep 5, 2001, 2:58:00 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

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 *
    23 * GetBinaryTypeA/W (Wine Port)
    34 *
     
    1314#include <misc.h>
    1415
    15 #define DBG_LOCALLOG    DBG_module
     16#define DBG_LOCALLOG    DBG_module
    1617#include "dbglocal.h"
    1718
     
    3839      || (!(ReadFile(hfile, modtab, ne->ne_cmod*sizeof(WORD), &len, NULL)))
    3940      || (len != ne->ne_cmod*sizeof(WORD)) )
    40         goto broken;
     41    goto broken;
    4142
    4243    /* read imported names table */
     
    4546      || (!(ReadFile(hfile, nametab, ne->ne_enttab - ne->ne_imptab, &len, NULL)))
    4647      || (len != ne->ne_enttab - ne->ne_imptab) )
    47         goto broken;
     48    goto broken;
    4849
    4950    for (i=0; i < ne->ne_cmod; i++)
    5051    {
    51         LPSTR module = &nametab[modtab[i]];
    52         TRACE("modref: %.*s\n", module[0], &module[1]);
    53         if (!(strncmp(&module[1], "KERNEL", module[0])))
    54         { /* very old Windows file */
    55             MESSAGE("This seems to be a very old (pre-3.0) Windows executable. Expect crashes, especially if this is a real-mode binary !\n");
    56             type = SCS_WOW_BINARY;
    57             goto good;
    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    }
    5960    }
    6061
     
    107108    /* Seek to the start of the file and read the DOS header information.
    108109     */
    109     if (    SetFilePointer( hfile, 0, NULL, SEEK_SET ) != -1 
     110    if (    SetFilePointer( hfile, 0, NULL, SEEK_SET ) != -1
    110111         && ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL )
    111112         && len == sizeof(mz_header) )
     
    132133                     ( mz_header.e_lfarlc >= sizeof(IMAGE_DOS_HEADER) ) )
    133134                    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
    135136                         && ReadFile( hfile, magic, sizeof(magic), &len, NULL )
    136137                         && len == sizeof(magic) )
     
    162163                     * "extended header is a Windows executable (NE)
    163164                     * 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
    165166                     * (running under a DOS extender).  To decide
    166167                     * which, we'll have to read the NE header.
     
    168169
    169170                     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
    171172                          && ReadFile( hfile, &ne, sizeof(ne), &len, NULL )
    172173                          && len == sizeof(ne) )
     
    177178                         case 5:  *lpBinaryType = SCS_DOS_BINARY;   return TRUE;
    178179                         default: *lpBinaryType =
    179                                   MODULE_Decide_OS2_OldWin(hfile, &mz_header, &ne);
    180                                   return TRUE;
     180                  MODULE_Decide_OS2_OldWin(hfile, &mz_header, &ne);
     181                  return TRUE;
    181182                         }
    182183                     }
     
    187188                {
    188189                    /* Unknown extended header, but this file is nonetheless
    189                        DOS-executable.
     190               DOS-executable.
    190191                     */
    191192                    *lpBinaryType = SCS_DOS_BINARY;
    192                     return TRUE;
     193                return TRUE;
    193194                }
    194195            }
Note: See TracChangeset for help on using the changeset viewer.