Ignore:
Timestamp:
Apr 3, 2001, 12:51:58 AM (24 years ago)
Author:
sandervl
Message:

check executable type in CreateProcess and use PEC for VIO and PE for GUI apps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/winimagebase.cpp

    r4523 r5448  
    1 /* $Id: winimagebase.cpp,v 1.30 2000-10-23 13:42:44 sandervl Exp $ */
     1/* $Id: winimagebase.cpp,v 1.31 2001-04-02 22:51:58 sandervl Exp $ */
    22
    33/*
     
    204204//the Characteristics member of the file header structure)
    205205//******************************************************************************
    206 ULONG Win32ImageBase::isPEImage(char *szFileName, DWORD *Characteristics)
     206ULONG Win32ImageBase::isPEImage(char *szFileName, DWORD *Characteristics, DWORD *subsystem)
    207207{
    208208 char   filename[CCHMAXPATH];
     
    210210 HFILE  dllfile;
    211211 IMAGE_FILE_HEADER     fh;
     212 IMAGE_OPTIONAL_HEADER oh;
    212213 HFILE  win32handle;
    213214 ULONG  ulAction       = 0;      /* Action taken by DosOpen */
     
    262263        return ERROR_INVALID_EXE_SIGNATURE_W;
    263264  }
    264   ULONG hdrsize = pdoshdr->e_lfanew + SIZE_OF_NT_SIGNATURE + sizeof(IMAGE_FILE_HEADER);
     265  ULONG hdrsize = pdoshdr->e_lfanew + SIZE_OF_NT_SIGNATURE + sizeof(IMAGE_FILE_HEADER) + sizeof(IMAGE_OPTIONAL_HEADER);
    265266  free(pdoshdr);
    266267
     
    281282        goto failure;
    282283  }
     284  if(GetPEOptionalHeader (win32file, &oh) == FALSE) {
     285        goto failure;
     286  }
    283287
    284288  if(!(fh.Characteristics & IMAGE_FILE_EXECUTABLE_IMAGE)) {//not valid
     
    294298  if(Characteristics) {
    295299        *Characteristics = fh.Characteristics;
     300  }
     301  if(subsystem) {
     302        *subsystem = oh.Subsystem;
    296303  }
    297304  DosClose(win32handle);
Note: See TracChangeset for help on using the changeset viewer.