Changeset 1369


Ignore:
Timestamp:
Jan 3, 2009, 7:43:34 PM (17 years ago)
Author:
Gregg Young
Message:

Add check for p-rotectonly system to gray out dos/win commandline choices etc. Ticket 325 It also fixes problem with some drives not being scanned on startup.

Location:
trunk/dll
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/datamin.c

    r1335 r1369  
    384384      WinCheckMenuItem(hwndMenu, MINI_BORING, fDullMin);
    385385      WinCheckMenuItem(hwndMenu, MINI_INCLREMOTE, fDataInclRemote);
     386      if (fProtectOnly) {
     387        WinEnableMenuItem(hwndMenu, IDM_DOSCOMMANDLINE, FALSE);
     388        WinEnableMenuItem(hwndMenu, IDM_WINFULLSCREEN, FALSE);
     389      }
    386390      NoFloat = TRUE;
    387391      if (!PopupMenu(hwnd, hwnd, hwndMenu))
  • trunk/dll/fm3dll.str

    r1248 r1369  
    4949Edit
    505010.System Proportional
    51 
     51The file %s is a Dos or Windows executible, however Dos and WinOS2 are not currently activated on this system.
    5252
    53538.Helvetica
  • trunk/dll/fm3str.h

    r1122 r1369  
    8585#define IDS_EDITTEXT                                          48
    8686#define IDS_10SYSPROTEXT                                      49
     87#define IDS_NOTPROTECTONLYEXE                                 50
    8788#define IDS_8HELVTEXT                                         52
    8889#define IDS_6HELVTEXT                                         53
  • trunk/dll/init.c

    r1365 r1369  
    140140#include "fortify.h"
    141141#include "excputil.h"                   // xbeginthread
     142#include "systemf.h"                    // runemf2
    142143
    143144#ifdef __IBMC__
     
    176177BOOL fIniExisted;
    177178BOOL fLogFile;
     179BOOL fProtectOnly;
    178180BOOL fReminimize;
    179181BOOL fWantFirstTimeInit;
     
    698700  CLASSINFO clinfo;
    699701  APIRET rc;
    700   APIRET rcl = 1;
    701   APIRET rcq = 1;
    702   PFN pfnResVersion = (PFN)NULL;
    703   ULONG RVMajor = 0;
    704   ULONG RVMinor = 0;
    705   ULONG ret = 0;
    706   FILESTATUS3 fs3;                      // 25 Aug 07 SHL
     702  APIRET rcl;
     703  APIRET rcq;
     704  PFN pfnResVersion;
     705  ULONG RVMajor;
     706  ULONG RVMinor;
     707  ULONG ret;
     708  FILESTATUS3 fs3;
    707709  PSZ env;
    708710  CHAR dllfile[CCHMAXPATH];
     
    732734    }
    733735  }
     736
    734737  rcl = DosLoadModule(NULL, 0, dllfile, &FM3ModHandle);
    735738  if (rcl) {
     
    739742    return FALSE;
    740743  }
    741   else {
     744
    742745    rc = DosExitList(EXLST_ADD, DeInitFM3DLL);
    743746    if (rc) {
     
    745748               "DosExitList");
    746749    }
     750
    747751    rcq = DosQueryProcAddr(FM3ModHandle, 1, "ResVersion", &pfnResVersion);
    748752    if (!rcq)
    749753      ret = pfnResVersion(&RVMajor, &RVMinor);
    750   }
     754  else {
     755    ret = 0;
     756    RVMajor = 0;
     757    RVMinor = 0;
     758  }
     759
    751760  if (RVMajor < VERMAJOR || (RVMajor == VERMAJOR && RVMinor < VERMINOR)) {
    752761    saymsg(MB_ENTER,
     
    834843    }
    835844      if (fs3.attrFile & FILE_DIRECTORY) {
    836         APIRET ret = 0;
    837845        strcpy(szTempName, env);
    838846        MakeTempName(szTempName, NULL, 1);
    839         ret = DosCreateDir(szTempName, 0);
    840         if (!ret) {   //check writable
    841           pTmpDir = xstrdup(szTempName, pszSrcFile, __LINE__);
     847        rc = DosCreateDir(szTempName, 0);
     848        if (!rc)
     849          pTmpDir = xstrdup(szTempName, pszSrcFile, __LINE__);  // if writable
    842850        }
    843851      }
    844852    }
    845   }
    846853
    847854  //Save the FM2 save directory name. This is the location of the ini, dat files etc.
     
    12391246    ULONG ulAppType;
    12401247
    1241       FullPath = searchapath("PATH", "LVMGUI.CMD");
    1242       if (*FullPath)
    1243         fLVMGui = TRUE;
     1248    FullPath = searchapath("PATH", "LVMGUI.CMD");
     1249    if (*FullPath)
     1250      fLVMGui = TRUE;
    12441251    if (!DosQueryAppType("DFSOS2.EXE", &ulAppType))
    12451252      fDFSee = TRUE;
    1246       if (!DosQueryAppType("MINILVM.EXE", &ulAppType))
    1247         fMiniLVM = TRUE;
    1248       if (!DosQueryAppType("FDISK.EXE", &ulAppType))
    1249         fFDisk = TRUE;
    1250       if (!DosQueryAppType("LVM.EXE", &ulAppType))
    1251         fLVM = TRUE;
     1253    if (!DosQueryAppType("MINILVM.EXE", &ulAppType))
     1254      fMiniLVM = TRUE;
     1255    if (!DosQueryAppType("FDISK.EXE", &ulAppType))
     1256      fFDisk = TRUE;
     1257    if (!DosQueryAppType("LVM.EXE", &ulAppType))
     1258      fLVM = TRUE;
     1259
     1260    // Check to see if we are running protect only
     1261    if (!DosQueryAppType(GetCmdSpec(TRUE), &ulAppType)) {
     1262      ret = runemf2(SEPARATE | WINDOWED | BACKGROUND | MINIMIZED,
     1263                    (HWND) 0, pszSrcFile, __LINE__, NULL, NULL,
     1264                    "%s /C exit", GetCmdSpec(TRUE));
     1265      if (ret == ERROR_SMG_INVALID_PROGRAM_TYPE)
     1266        fProtectOnly = TRUE;
     1267    }
     1268    else
     1269      fProtectOnly = TRUE;
    12521270  }
    12531271
     
    14671485        sprintf(szKey, "%s.DirCnrDir.%lu", GetPString(IDS_SHUTDOWNSTATE), x);
    14681486        size = sizeof(szDir);
    1469         if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {
    1470           drvNum = toupper(*szDir) - 'A';
     1487        if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size) &&
     1488            (fSwitchTreeOnFocus || fSwitchTree)) {
     1489          drvNum = toupper(*szDir) - 'A';
    14711490          fDrivetoSkip[drvNum] = TRUE;
    14721491        }
  • trunk/dll/init.h

    r1328 r1369  
    7171extern BOOL fIniExisted;
    7272extern BOOL fLogFile;
     73extern BOOL fProtectOnly;
    7374extern BOOL fReminimize;
    7475extern BOOL fWantFirstTimeInit;
  • trunk/dll/mainwnd.c

    r1364 r1369  
    57905790    CfgMenuInit(hwndMenu, FALSE);        // 14 Feb 08 SHL
    57915791    SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
     5792    if (fProtectOnly) {
     5793      WinEnableMenuItem(hwndMenu, IDM_DOSCOMMANDLINE, FALSE);
     5794      WinEnableMenuItem(hwndMenu, IDM_WINFULLSCREEN, FALSE);
     5795    }
    57925796    SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
    57935797    SetConditionalCascade(hwndMenu, IDM_AUTOVIEWSUBMENU, IDM_AUTOVIEW);
  • trunk/dll/mainwnd2.c

    r1335 r1369  
    814814        CfgMenuInit(hwndMenu, FALSE);   // 14 Feb 08 SHL
    815815        SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
     816        if (fProtectOnly) {
     817          WinEnableMenuItem(hwndMenu, IDM_DOSCOMMANDLINE, FALSE);
     818          WinEnableMenuItem(hwndMenu, IDM_WINFULLSCREEN, FALSE);
     819        }
    816820        SetConditionalCascade(hwndMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
    817821        SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
  • trunk/dll/systemf.c

    r1348 r1369  
    674674  BOOL useTermQ = FALSE;
    675675  char szTempdir[CCHMAXPATH];
     676  BOOL fNoErrorMsg = FALSE;
    676677
    677678  typedef struct {
     
    728729      ; // loop
    729730  }
     731
     732  if (!stricmp(pszCallingFile, "init.c"))
     733    fNoErrorMsg = TRUE;
    730734
    731735  if (!*pszPgm) {
     
    872876        if (pszDirectory && *pszDirectory)
    873877          switch_to(szSavedir);
    874         if (ret) {
     878        if (ret && !fNoErrorMsg) {
    875879          Dos_Error(MB_ENTER,ret,hwnd,pszSrcFile,__LINE__,
    876880                    GetPString(IDS_DOSEXECPGMFAILEDTEXT), pszPgm,
     
    11301134
    11311135      if (ret && ret != ERROR_SMG_START_IN_BACKGROUND) {
     1136        if (!fNoErrorMsg)
    11321137        Dos_Error(MB_CANCEL,ret,hwnd,pszSrcFile,__LINE__,
    11331138                  GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),pszPgm,pszArgs,
  • trunk/dll/valid.c

    r1358 r1369  
    600600      strcat(fname, ".");
    601601      ret = DosQueryAppType(fname, &apptype);
    602     } //fixme protectonly BMT GKY 23 Dec 08
    603     if ((!ret && (!apptype ||
    604                   (apptype &
    605                    (FAPPTYP_NOTWINDOWCOMPAT |
    606                     FAPPTYP_WINDOWCOMPAT |
    607                     FAPPTYP_WINDOWAPI |
    608                     FAPPTYP_BOUND |
    609                     FAPPTYP_DOS |
    610                     FAPPTYP_WINDOWSREAL |
    611                     FAPPTYP_WINDOWSPROT |
    612                     FAPPTYP_32BIT |
    613                     0x1000)))) ||
    614         (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BAT"))))
     602    }
     603    if (!fProtectOnly) {
     604      if ((!ret && (!apptype ||
     605                    (apptype &
     606                     (FAPPTYP_NOTWINDOWCOMPAT |
     607                      FAPPTYP_WINDOWCOMPAT |
     608                      FAPPTYP_WINDOWAPI |
     609                      FAPPTYP_BOUND |
     610                      FAPPTYP_DOS |
     611                      FAPPTYP_WINDOWSREAL |
     612                      FAPPTYP_WINDOWSPROT |
     613                      FAPPTYP_32BIT |
     614                      0x1000)))) ||
     615          (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BAT") || !stricmp(p, ".BMT"))))
     616        return TRUE;
     617    }
     618    else if ((!ret && (!apptype ||
     619                       (apptype &
     620                        (FAPPTYP_WINDOWSREAL |
     621                         FAPPTYP_WINDOWSPROT |
     622                         FAPPTYP_32BIT |
     623                         0x1000)))) ||
     624             (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BMT"))))
    615625      return TRUE;
     626    if (fProtectOnly && (apptype &
     627                       (FAPPTYP_NOTWINDOWCOMPAT |
     628                        FAPPTYP_WINDOWCOMPAT |
     629                        FAPPTYP_WINDOWAPI |
     630                        FAPPTYP_BOUND |
     631                        FAPPTYP_DOS)) &&
     632        (p && (!stricmp(p, ".EXE") || !stricmp(p, ".COM"))))
     633      saymsg(MB_OK,
     634             HWND_DESKTOP,
     635             NullStr,
     636             GetPString(IDS_NOTPROTECTONLYEXE),
     637             filename);
    616638  }
    617639  return FALSE;
Note: See TracChangeset for help on using the changeset viewer.