Changeset 1394 for trunk/dll/valid.c


Ignore:
Timestamp:
Feb 5, 2009, 5:17:25 AM (17 years ago)
Author:
Steven Levine
Message:

Ticket 340: Convert GetPString to use STRINGTABLE.

Drop fm3dll.str and mkstr.exe from makefiles and wpi builders

Convert many functions to expect PCSZ arguments.
Correct walk, compare and dirsizes dialog setups to ignore saved dialog size
Drop copyright.c logic from makefile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/valid.c

    r1387 r1394  
    2929  25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis
    3030  03 Jan 09 GKY Check for system that is protectonly to gray out Dos/Win command lines and prevent
    31                 Dos/Win programs from being inserted into the execute dialog with message why.
     31                Dos/Win programs from being inserted into the execute dialog with message why.
    3232  03 Jan 09 GKY Modify IsExecutable to prevent some text files from being treated as executable
    33                 and prevent dlls from being loaded into execute dialog.
     33                and prevent dlls from being loaded into execute dialog.
    3434  05 Jan 09 GKY Fix IsBinary to recognize values above \xc4 (maybe lower) as positive.
    35                 When these high codes were it text files they showed as hex in new view.
     35                When these high codes were it text files they showed as hex in new view.
    3636
    3737***********************************************************************/
     
    121121
    122122int TestFDates(char *file1, char *file2, FDATE *datevar1, FTIME *timevar1,
    123                FDATE *datevar2, FTIME *timevar2)
     123               FDATE *datevar2, FTIME *timevar2)
    124124{
    125125  int comp = 0;
     
    140140  if (&datevar1 && &datevar2 && &timevar1 && &timevar2) {
    141141    comp = (datevar2->year >
    142             datevar1->year) ? 1 :
     142            datevar1->year) ? 1 :
    143143      (datevar2->year <
    144144       datevar1->year) ? -1 :
     
    173173
    174174int TestCDates(CDATE *datevar1, CTIME *timevar1,
    175                CDATE *datevar2, CTIME *timevar2)
     175               CDATE *datevar2, CTIME *timevar2)
    176176{
    177177  int comp = 0;
     
    179179  if (&datevar1 && &datevar2 && &timevar1 && &timevar2) {
    180180    comp = (datevar2->year >
    181             datevar1->year) ? 1 :
     181            datevar1->year) ? 1 :
    182182      (datevar2->year <
    183183       datevar1->year) ? -1 :
     
    212212}
    213213
    214 #if 0   // JBS  11 Sep 08
     214#if 0   // JBS  11 Sep 08
    215215BOOL IsDesktop(HAB hab, HWND hwnd)
    216216{
     
    329329    *pulType |= DRIVE_NOTWRITEABLE;
    330330  if (pulType && !strcmp(pfsn, NDFS32)){
    331         *pulType |= DRIVE_VIRTUAL;
     331        *pulType |= DRIVE_VIRTUAL;
    332332    }
    333333  if (pulType && !strcmp(pfsn, RAMFS)){
    334         *pulType |= DRIVE_RAMDISK;
     334        *pulType |= DRIVE_RAMDISK;
    335335    }
    336336  if (((PFSQBUFFER2) pvBuffer)->iType == FSAT_REMOTEDRV &&
     
    359359         !strcmp(pfsn, JFS) ||
    360360         !strcmp(pfsn, FAT32) ||
    361         !strcmp(pfsn, RAMFS) ||
    362         !strcmp(pfsn, NDFS32) ||
    363         !strcmp(pfsn, NTFS) ||
    364         !strcmp(pfsn, HPFS386))) {
     361        !strcmp(pfsn, RAMFS) ||
     362        !strcmp(pfsn, NDFS32) ||
     363        !strcmp(pfsn, NTFS) ||
     364        !strcmp(pfsn, HPFS386))) {
    365365      *pulType &= ~DRIVE_NOLONGNAMES;
    366366    }
     
    401401  NonRemovable = 1;                     // Preset as non removable
    402402  DosError(FERR_DISABLEHARDERR);
    403   rc = DosDevIOCtl(hDev, IOCTL_DISK, DSK_BLOCKREMOVABLE, &parmPkt.Cmd,  /*  Address of the command-specific argument list. */
    404                    sizeof(parmPkt.Cmd), /*  Length, in bytes, of pParams. */
    405                    &clParmBytes,        /*  Pointer to the length of parameters. */
    406                    &NonRemovable,       /*  Address of the data area. */
    407                    sizeof(NonRemovable),        /*  Length, in bytes, of pData. */
    408                    &clDataBytes);       /*  Pointer to the length of data. */
     403  rc = DosDevIOCtl(hDev, IOCTL_DISK, DSK_BLOCKREMOVABLE, &parmPkt.Cmd,  /* Address of the command-specific argument list. */
     404                   sizeof(parmPkt.Cmd), /* Length, in bytes, of pParams. */
     405                   &clParmBytes,        /* Pointer to the length of parameters. */
     406                   &NonRemovable,       /* Address of the data area. */
     407                   sizeof(NonRemovable),        /* Length, in bytes, of pData. */
     408                   &clDataBytes);       /* Pointer to the length of data. */
    409409
    410410  if (!rc && NonRemovable) {
     
    414414    memset(&dataPkt, 0xff, sizeof(dataPkt));
    415415    DosError(FERR_DISABLEHARDERR);
    416     rc = DosDevIOCtl(hDev, IOCTL_DISK, DSK_GETDEVICEPARAMS, &parmPkt.Cmd,       /*  Address of the command-specific argument list. */
    417                      sizeof(parmPkt.Cmd),       /*  Length, in bytes, of pParams. */
    418                      &clParmBytes,      /*  Pointer to the length of parameters. */
    419                      &dataPkt,          /*  Address of the data area. */
    420                      sizeof(dataPkt),   /*  Length, in bytes, of pData. */
    421                      &clDataBytes);     /*  Pointer to the length of data. */
     416    rc = DosDevIOCtl(hDev, IOCTL_DISK, DSK_GETDEVICEPARAMS, &parmPkt.Cmd,       /* Address of the command-specific argument list. */
     417                     sizeof(parmPkt.Cmd),       /* Length, in bytes, of pParams. */
     418                     &clParmBytes,      /* Pointer to the length of parameters. */
     419                     &dataPkt,          /* Address of the data area. */
     420                     sizeof(dataPkt),   /* Length, in bytes, of pData. */
     421                     &clDataBytes);     /* Pointer to the length of data. */
    422422
    423423    if (!rc && (dataPkt.bpb.fsDeviceAttr & BPB_REMOVABLE_MEDIA))
     
    438438BOOL IsFileSame(CHAR * filename1, CHAR * filename2)
    439439{
    440   /* returns:  -1 (error), 0 (is a directory), or 1 (is a file) */
     440  /* returns: -1 (error), 0 (is a directory), or 1 (is a file) */
    441441
    442442  FILESTATUS3L fsa1, fsa2;
     
    463463#endif
    464464
    465 INT IsFile(CHAR * filename)
    466 {
    467   /* returns:  -1 (error), 0 (is a directory), or 1 (is a file) */
     465INT IsFile(PCSZ filename)
     466{
     467  /* returns: -1 (error), 0 (is a directory), or 1 (is a file) */
    468468
    469469  FILESTATUS3 fsa;
     
    487487}
    488488
    489 BOOL IsRoot(CHAR * filename)
     489BOOL IsRoot(PCSZ filename)
    490490{
    491491  return (filename && isalpha(*filename) && filename[1] == ':' &&
     
    608608    }
    609609    if (apptype & (FAPPTYP_DLL |
    610                    FAPPTYP_PHYSDRV |
    611                    FAPPTYP_VIRTDRV |
    612                    FAPPTYP_PROTDLL))
     610                   FAPPTYP_PHYSDRV |
     611                   FAPPTYP_VIRTDRV |
     612                   FAPPTYP_PROTDLL))
    613613      return FALSE;
    614614    if (apptype == 0x000b && (!p ||
    615         (stricmp(p, ".EXE") &&
    616         stricmp(p, ".COM") &&
    617         stricmp(p, ".CMD") &&
    618         stricmp(p, ".BAT") &&
    619         stricmp(p, ".BTM"))))
     615        (stricmp(p, ".EXE") &&
     616        stricmp(p, ".COM") &&
     617        stricmp(p, ".CMD") &&
     618        stricmp(p, ".BAT") &&
     619        stricmp(p, ".BTM"))))
    620620      return FALSE;
    621621    if (!fProtectOnly) {
    622622      if ((!ret && (!apptype ||
    623                     (apptype &
    624                      (FAPPTYP_NOTWINDOWCOMPAT |
    625                       FAPPTYP_WINDOWCOMPAT |
    626                       FAPPTYP_WINDOWAPI |
    627                       FAPPTYP_BOUND |
    628                       FAPPTYP_DOS |
    629                       FAPPTYP_WINDOWSREAL |
    630                       FAPPTYP_WINDOWSPROT |
    631                       FAPPTYP_32BIT |
    632                       FAPPTYP_WINDOWSPROT31)))) ||
    633           (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BAT") || !stricmp(p, ".BTM"))))
    634         return TRUE;
     623                    (apptype &
     624                     (FAPPTYP_NOTWINDOWCOMPAT |
     625                      FAPPTYP_WINDOWCOMPAT |
     626                      FAPPTYP_WINDOWAPI |
     627                      FAPPTYP_BOUND |
     628                      FAPPTYP_DOS |
     629                      FAPPTYP_WINDOWSREAL |
     630                      FAPPTYP_WINDOWSPROT |
     631                      FAPPTYP_32BIT |
     632                      FAPPTYP_WINDOWSPROT31)))) ||
     633          (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BAT") || !stricmp(p, ".BTM"))))
     634        return TRUE;
    635635    }
    636636    else if ((!ret && (!apptype ||
    637                        (apptype &
    638                         (FAPPTYP_NOTWINDOWCOMPAT |
    639                         FAPPTYP_WINDOWCOMPAT |
    640                         FAPPTYP_WINDOWAPI |
    641                         FAPPTYP_BOUND |
    642                         FAPPTYP_32BIT)))) ||
    643              (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BTM"))))
     637                       (apptype &
     638                        (FAPPTYP_NOTWINDOWCOMPAT |
     639                        FAPPTYP_WINDOWCOMPAT |
     640                        FAPPTYP_WINDOWAPI |
     641                        FAPPTYP_BOUND |
     642                        FAPPTYP_32BIT)))) ||
     643             (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BTM"))))
    644644      return TRUE;
    645645    if (fProtectOnly && (apptype &
    646                         (FAPPTYP_DOS |
    647                           FAPPTYP_WINDOWSREAL |
    648                           FAPPTYP_WINDOWSPROT |
    649                           FAPPTYP_WINDOWSPROT31)) &&
    650         (p && (!stricmp(p, ".EXE") || !stricmp(p, ".COM"))))
     646                        (FAPPTYP_DOS |
     647                          FAPPTYP_WINDOWSREAL |
     648                          FAPPTYP_WINDOWSPROT |
     649                          FAPPTYP_WINDOWSPROT31)) &&
     650        (p && (!stricmp(p, ".EXE") || !stricmp(p, ".COM"))))
    651651      saymsg(MB_OK,
    652              HWND_DESKTOP,
    653              NullStr,
    654              GetPString(IDS_NOTPROTECTONLYEXE),
    655              filename);
     652             HWND_DESKTOP,
     653             NullStr,
     654             GetPString(IDS_NOTPROTECTONLYEXE),
     655             filename);
    656656  }
    657657  return FALSE;
     
    733733  driveflags[x] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS |
    734734                    DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS |
    735                     DRIVE_INCLUDEFILES | DRIVE_SLOW | DRIVE_NOSTATS |
    736                     DRIVE_WRITEVERIFYOFF);
     735                    DRIVE_INCLUDEFILES | DRIVE_SLOW | DRIVE_NOSTATS |
     736                    DRIVE_WRITEVERIFYOFF);
    737737  if (removable != -1) {
    738738    struct
     
    800800    driveflags[x] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS |
    801801                      DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS |
    802                       DRIVE_INCLUDEFILES | DRIVE_SLOW | DRIVE_NOSTATS |
    803                       DRIVE_WRITEVERIFYOFF);
     802                      DRIVE_INCLUDEFILES | DRIVE_SLOW | DRIVE_NOSTATS |
     803                      DRIVE_WRITEVERIFYOFF);
    804804  memset(driveserial, -1, sizeof(driveserial));
    805805  DosError(FERR_DISABLEHARDERR);
     
    808808    if (ulDriveMap & (1 << x) && !(driveflags[x] & DRIVE_IGNORE)) {
    809809      {
    810         ULONG flags = 0, size = sizeof(ULONG);
    811         CHAR FlagKey[80];
    812 
    813           sprintf(FlagKey, "%c.DriveFlags", (CHAR) (x + 'A'));
    814           if (PrfQueryProfileData(fmprof, appname, FlagKey, &flags, &size) &&
    815               size == sizeof(ULONG))
    816             driveflags[x] |= flags;
     810        ULONG flags = 0, size = sizeof(ULONG);
     811        CHAR FlagKey[80];
     812
     813          sprintf(FlagKey, "%c.DriveFlags", (CHAR) (x + 'A'));
     814          if (PrfQueryProfileData(fmprof, appname, FlagKey, &flags, &size) &&
     815              size == sizeof(ULONG))
     816            driveflags[x] |= flags;
    817817      }
    818818
     
    849849      PrfQueryProfileData(fmprof, appname, Key, &fVerifyOffChecked[x], &size);
    850850      if (!fVerifyOffChecked[x]) {
    851         if (driveflags[x] & DRIVE_REMOVABLE)
    852           driveflags[x] |= DRIVE_WRITEVERIFYOFF;
    853         if (!(driveflags[x] & DRIVE_INVALID)) {
    854           fVerifyOffChecked[x] = TRUE;
    855           PrfWriteProfileData(fmprof, appname, Key, &fVerifyOffChecked[x], sizeof(BOOL));
    856         }
     851        if (driveflags[x] & DRIVE_REMOVABLE)
     852          driveflags[x] |= DRIVE_WRITEVERIFYOFF;
     853        if (!(driveflags[x] & DRIVE_INVALID)) {
     854          fVerifyOffChecked[x] = TRUE;
     855          PrfWriteProfileData(fmprof, appname, Key, &fVerifyOffChecked[x], sizeof(BOOL));
     856        }
    857857      }
    858858    }
     
    972972}
    973973
    974 BOOL needs_quoting(register CHAR * f)
     974BOOL needs_quoting(PCSZ f)
    975975{
    976976  register CHAR *p = " &|<>";
     
    992992      if ((UINT) str[x] < ' ' && str[x] != '\r' && str[x] != '\n' && str[x] != '\t'
    993993          && str[x] != '\x1b' && str[x] != '\x1a' && str[x] != '\x07'
    994           && str[x] != '\x0c') {
    995         return TRUE;
     994          && str[x] != '\x0c') {
     995        return TRUE;
    996996      }
    997997      x++;
Note: See TracChangeset for help on using the changeset viewer.