Changeset 1369 for trunk/dll/init.c


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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        }
Note: See TracChangeset for help on using the changeset viewer.