Changeset 1372 for trunk/dll/valid.c


Ignore:
Timestamp:
Jan 3, 2009, 11:53:11 PM (17 years ago)
Author:
Gregg Young
Message:

Prevent IsExecutable from identifying dlls as executable. Work around DosQueryAppType identifying text files whos first to characters are NE as executable. Use fProtectOnly to prevent execution of Dos/Win programs. Tickets 330, 325, 332

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/valid.c

    r1369 r1372  
    601601      ret = DosQueryAppType(fname, &apptype);
    602602    }
     603    if (apptype & (FAPPTYP_DLL |
     604                   FAPPTYP_PHYSDRV |
     605                   FAPPTYP_VIRTDRV |
     606                   FAPPTYP_PROTDLL))
     607      return FALSE;
     608    if (apptype == 0x000b && (!p ||
     609        (stricmp(p, ".EXE") &&
     610         stricmp(p, ".COM") &&
     611         stricmp(p, ".CMD") &&
     612         stricmp(p, ".BAT") &&
     613         stricmp(p, ".BMT"))))
     614      return FALSE;
    603615    if (!fProtectOnly) {
    604616      if ((!ret && (!apptype ||
     
    612624                      FAPPTYP_WINDOWSPROT |
    613625                      FAPPTYP_32BIT |
    614                       0x1000)))) ||
     626                      FAPPTYP_WINDOWSPROT31)))) ||
    615627          (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BAT") || !stricmp(p, ".BMT"))))
    616628        return TRUE;
     
    618630    else if ((!ret && (!apptype ||
    619631                       (apptype &
    620                         (FAPPTYP_WINDOWSREAL |
    621                          FAPPTYP_WINDOWSPROT |
    622                          FAPPTYP_32BIT |
    623                          0x1000)))) ||
     632                        (FAPPTYP_NOTWINDOWCOMPAT |
     633                         FAPPTYP_WINDOWCOMPAT |
     634                         FAPPTYP_WINDOWAPI |
     635                         FAPPTYP_BOUND |
     636                         FAPPTYP_32BIT)))) ||
    624637             (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BMT"))))
    625638      return TRUE;
    626639    if (fProtectOnly && (apptype &
    627                        (FAPPTYP_NOTWINDOWCOMPAT |
    628                         FAPPTYP_WINDOWCOMPAT |
    629                         FAPPTYP_WINDOWAPI |
    630                         FAPPTYP_BOUND |
    631                         FAPPTYP_DOS)) &&
     640                         (FAPPTYP_DOS |
     641                          FAPPTYP_WINDOWSREAL |
     642                          FAPPTYP_WINDOWSPROT |
     643                          FAPPTYP_WINDOWSPROT31)) &&
    632644        (p && (!stricmp(p, ".EXE") || !stricmp(p, ".COM"))))
    633645      saymsg(MB_OK,
Note: See TracChangeset for help on using the changeset viewer.