home *** CD-ROM | disk | FTP | other *** search
/ Maximum 3D 3 / m3d-p3.iso / PROGRAM / FLEXSIGN.563 / FSPLUS55.RAR / IMAGE / DISK0 / FLEXSIGN.MST < prev    next >
Text File  |  1996-04-10  |  53KB  |  1,686 lines

  1. '**************************************************************************
  2. '*                       MSSetup Toolkit Sample 2
  3. '**************************************************************************
  4.  
  5.  
  6. '$INCLUDE 'setupapi.inc'
  7. '$INCLUDE 'msdetect.inc'
  8. '$INCLUDE 'msregdb.inc'
  9. '$INCLUDE 'msshared.inc'
  10.  
  11. ''Dialog ID's
  12. CONST WELCOME       = 100
  13. CONST ASKQUIT      = 200
  14. CONST DESTPATH     = 300
  15. CONST EXITFAILURE  = 400
  16. CONST EXITQUIT     = 600
  17. CONST EXITSUCCESS  = 700
  18. CONST SCANNERSLT   = 2500    ''####112792 added for scanner selection
  19. CONST CONFIGPATH   = 2700    ''####113092 ask the user to indicate the location of config.sys
  20. CONST PROGRAMGROUP = 2800   ''032095 install program group or not
  21. CONST RESTART32     = 2900   ''032495 let user know it's restarting windows
  22. CONST RESTART      = 3000   ''WinG install , restart or not
  23. CONST LANGUAGEDISK = 3100   ''Ask for Language disk #1
  24. CONST CUSTINST     = 6200   ''120294 added a checkbox for cut manager
  25. CONST TOOBIG       = 6300
  26. CONST BADPATH      = 6400
  27.  
  28. CONST HELPWELCOME              = 1000
  29. CONST VERPATH                  = 1100
  30. CONST EXITFAILNOTWIN31         = 1200
  31. CONST EXITFAILNOTENH           = 1300
  32. CONST EXITFAILNOTPAGING        = 1325
  33. CONST EXITFAILNOTINTEL         = 1350
  34. CONST EXITFAILRUNAPP           = 1360
  35. CONST FREECELLINST             = 1400
  36. CONST FREECELLINSTNOWIN32S     = 1450
  37. CONST FREECELLPATH             = 1500
  38. CONST HELPFREECELL             = 1600
  39.  
  40. ''Bitmap ID
  41. CONST LOGO         = 1
  42.  
  43. ''File Types
  44. CONST APPFILES     = 1  
  45. CONST DRIVERFILES  = 2  
  46. CONST CUSTOMFILES  = 3
  47. CONST BORDERFILES  = 4
  48. CONST FSFONTFILES  = 5  ''9406
  49. CONST ESTIMAFILES  = 6    ''9407
  50. CONST TOOLSFILES   = 7    ''9408
  51.  
  52. ''CheckBox Types
  53. CONST FLEXSIGN       = 1
  54. CONST CMANAGER    = 2
  55. CONST WIN32S        = 3
  56. CONST SCAN            = 4
  57.  
  58. CONST UNIT            = 5
  59. CONST OS            = 6
  60.  
  61. ''Scanner Type    ''####112792 added (if using the FCheckDlgProc, max= 10)
  62. CONST HPSCANJETII = 1
  63. CONST UMAX        = 2
  64. CONST MICROTEK    = 3
  65. CONST PANA307      = 4  ''####930629yj
  66. CONST PANA505      = 5  ''####9310
  67. CONST PANA506      = 6 
  68. CONST VISTA          = 7    ''9404
  69.  
  70. GLOBAL szFullPath$    '' full path of config.sys
  71. GLOBAL scanner1$, scanner2$, scanner3$, scanner4$, scanner5$, scanner6$, scanner7$   ''####9310
  72. CONST drivername1$ = "SJII.SYS"
  73. CONST drivername2$ = "USCAN.SYS"
  74. CONST drivername_vista$ = "VISTA.SYS"    ''9404
  75. CONST drivername3$ = "MSCAN.SYS"
  76. CONST drivername4$ = "MEI2PANA.SYS"    ''####930629yj
  77. CONST drivername4_5$ = "MEISCAN5"    ''####9310
  78. CONST drivername4_6$ = "MEISCAN6"
  79. CONST drivername4_7$ = "MEISCAN7"
  80.  
  81. GLOBAL CHECKITEMSIN$    '' used by FCheckDlgProc
  82. GLOBAL CHECKITEMSOUT$
  83.  
  84.  
  85. GLOBAL DEST$        ''Default destination directory.
  86. GLOBAL DESTCOPY$    ''Copy of the default directory, in case DEST$ has been changed
  87. GLOBAL WINDRIVE$    ''Windows drive letter.
  88. GLOBAL WINDDIR$        ''120294 Windows directory.
  89. GLOBAL CUSTOMDIR$    ''120294 Custom directory.
  90. GLOBAL CMANAGDIR$    ''120294 CManager directory.  driver goes into windows.
  91. GLOBAL FLEXIDIR$    ''120294 Flexi direcotry.  empty for now
  92. GLOBAL SYSDIR$        ''950303 LTX driver, windows/system
  93. GLOBAL PRINTERDIR$    ''041995 Printer DLL dir, in windows/cmanager/printdrv
  94. GLOBAL COLORTABLEDIR$ ''041995 Color Table data Dir, dest + /clrtable
  95. GLOBAL FILTERSDIR$    ''053095 Quark filters dir.
  96. GLOBAL SOURCEDRIVE$  ''source drive letter
  97.  
  98. GLOBAL DESTWING32$
  99. GLOBAL DESTSYS$      ''Windows\System directory.
  100. GLOBAL DEST32S$      ''Windows\System\Win32s directory
  101. GLOBAL DESTFREE$     ''Freecell directory
  102. GLOBAL OLE_PROTECT%  ''Indicates whether ole2 dlls were protected from being
  103.                      '' copied.
  104. GLOBAL INF1$            '' FLEXSIGN.INF dir
  105. GLOBAL INF2$            '' LANGUAGE.INF dir
  106.  
  107. GLOBAL tempPath$    ''9404
  108.  
  109. ''CustInst list symbol names
  110. GLOBAL APPNEEDS$    ''Option list costs per drive
  111. GLOBAL OPT1NEEDS$   ''120294 cost of cmanager
  112. GLOBAL OPT2NEEDs$      ''031895 cost of Win32s
  113. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  114. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  115.  
  116. ''Dialog list symbol names
  117. GLOBAL CHECKSTATES$
  118. GLOBAL STATUSTEXT$
  119. GLOBAL DRIVETEXT$
  120.  
  121.  
  122. DECLARE SUB AddOptFilesToCopyList (ftype%)
  123. DECLARE SUB RecalcOptFiles (ftype%)
  124. DECLARE SUB RecalcPath
  125. DECLARE SUB SetDriveStatus
  126. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  127. DECLARE FUNCTION ReducePath (szDir$) AS STRING
  128.  
  129. DECLARE SUB Install(OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%)
  130. DECLARE SUB UpdateSystemIni
  131. DECLARE FUNCTION RebootSystem(OLEONLY%) AS INTEGER
  132. DECLARE FUNCTION MakeSystemIni LIB "INIUPD.DLL" (arg1$, arg2$) AS INTEGER
  133. ''DECLARE FUNCTION RestartWindows LIB "INIUPD.DLL" AS INTEGER
  134. DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
  135. DECLARE FUNCTION PagingEnabled LIB "INIUPD.DLL" AS INTEGER
  136. DECLARE FUNCTION ShareEnabled LIB "INIUPD.DLL" AS INTEGER
  137. DECLARE FUNCTION IsWin32sLoaded LIB "INIUPD.DLL" (arg1$) AS INTEGER
  138. DECLARE FUNCTION IsRunningApp LIB "INIUPD.DLL" AS INTEGER
  139. DECLARE FUNCTION SetCuiFlags LIB "MSCUISTF.DLL" (arg1%, arg2%) AS INTEGER
  140. DECLARE FUNCTION ExitWindowsExec LIB "USER.EXE" (arg1$, arg2$) AS INTEGER
  141. DECLARE FUNCTION GetModuleHandle LIB "KRNL386.EXE" (arg1$) AS INTEGER
  142. DECLARE FUNCTION LoadLibrary LIB "KRNL386.EXE" (arg1$) AS INTEGER
  143. DECLARE SUB FreeLibrary LIB "KRNL386.EXE" (arg1%)
  144. DECLARE FUNCTION SetErrorMode LIB "KRNL386.EXE" (arg1%) AS INTEGER
  145.  
  146. ''WinG
  147. GLOBAL TMPDEST$        '' tmpfile destination
  148.  
  149. GLOBAL bInstallDVA%
  150.  
  151. DECLARE FUNCTION GetRealWindowsSysDir AS STRING
  152. DECLARE SUB UpdateWinG32 (szOrig$) 
  153.  
  154. DECLARE FUNCTION OnWin3x LIB "setuphlp.DLL" AS INTEGER
  155. DECLARE FUNCTION VflatdPresent LIB "setuphlp.DLL" AS INTEGER
  156. DECLARE FUNCTION GetRealSystemDir LIB "setuphlp.DLL" (szDir$,cbBuf%) AS INTEGER
  157. DECLARE FUNCTION RestartWindows LIB "setuphlp.DLL" AS INTEGER
  158. DECLARE FUNCTION IsWin32FileNewer LIB "setuphlp.DLL" (szOrig$,szNew$) AS INTEGER
  159. DECLARE SUB RenameFilePlease LIB "setuphlp.DLL" (szOrig$,szNew$) 
  160.  
  161.  
  162. INIT:
  163.      bInstallDVA% = 0
  164.  
  165.     CUIDLL$ = "mscuistf.dll"            ''custom user interface dll
  166.  
  167.      HELPPROC$ = "FHelpDlgProc"          '' Help dialog procedure
  168.     szOldVer$ ="1.00.000     "          '' Reserve space in string for version
  169.     WIN32ENABLED% = 0
  170.      RUNNING32APP% = 0
  171.      OLEONLY% = 0
  172.     OLE2_16% = 0
  173.     OLE2AUTO_16% = 0
  174.     OLE16RUNAPP% = 0
  175.      OLE_PROTECT% = 0
  176.      WING_RUNTIME = 0
  177.      WING_DVA = 0
  178.      WING_32 = 0
  179.  
  180.     ON ERROR GOTO ERRNORMAL
  181.  
  182.      SrcDir$ = GetSymbolValue("STF_SRCDIR")
  183.  
  184.  
  185.     SetBitmap CUIDLL$, LOGO
  186.  
  187.     SetTitle "FlexiSIGN Plus Installation"
  188.  
  189.     INF1$ = GetSymbolValue("STF_SRCINFPATH")
  190.      IF INF1$ = "" THEN
  191.         INF1$ = GetSymbolValue("STF_CWDDIR") + "FLEXSIGN.INF"
  192.      END IF
  193.     ReadInfFile INF1$
  194.  
  195. tempPath$ = GetSymbolValue("STF_CWDDIR")
  196. SOURCEDRIVE$ = MID$(SrcDir$, 1, 1)
  197. IF (SOURCEDRIVE$ <> "A") AND (SOURCEDRIVE$ <> "a") AND (SOURCEDRIVE$ <> "B") AND (SOURCEDRIVE$ <> "b") THEN
  198.     SrcDir$ = MAKEPATH(ReducePath(SrcDir$), "lang1")
  199. ELSE
  200.  
  201. LANG1:
  202.     sz$ = UIStartDlg(CUIDLL$, LANGUAGEDISK, "FInfoDlgProc", HELPWELCOME, HELPPROC$)
  203.     UIpop 1
  204.     IF sz$ <> "CONTINUE" THEN
  205.         GOTO LANG1
  206.     END IF
  207. END IF
  208.  
  209. Copyfile MAKEPATH(SrcDir$,"language.inf"),  MAKEPATH(tempPath$, "language.inf"), cmoAppend, 1
  210. INF2$ = MAKEPATH (tempPath$, "language.INF")
  211. SrcDir$ = GetSymbolValue("STF_SRCDIR")
  212.  
  213.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  214.     WINDDIR$ = GetWindowsDir
  215.      CMANAGDIR$ = WINDDIR$ + "CMANAGER"
  216.      PRINTERDIR$ = CMANAGDIR$ + "\PRINTDRV"
  217.     CUSTOMDIR$ = CMANAGDIR$ + "\CUSTOM"
  218.     FLEXIDIR$ = WINDDIR$ + "FLEXI"
  219.     SYSDIR$ = GetWindowsSysDir()
  220.     DESTWING32$ = GetRealWindowsSysDir
  221.      DESTSYS$ = GetWindowsSysDir()
  222.      DEST32S$ = DESTSYS + "WIN32S\"
  223.  
  224. '$IFDEF DEBUG
  225.      i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  226.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  227.      IF IsDriveValid(WinDrive$) = 0 THEN
  228.         i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  229.           GOTO QUIT
  230.     END IF
  231. '$ENDIF ''DEBUG
  232.  
  233. CHECK:
  234.     '' Can not run on versions less than 3.10.
  235.      IF GetWindowsMajorVersion < 3 THEN
  236.         ExitCode% = EXITFAILNOTWIN31
  237.         GOTO QUIT
  238.      END IF
  239.     IF GetWindowsMajorVersion = 3 AND GetWindowsMinorVersion < 10 THEN
  240.         ExitCode% = EXITFAILNOTWIN31
  241.           GOTO QUIT
  242.     END IF
  243.     '' Check that we are not runnig on Chicago, including pre-released
  244.      '' Chicago versions.
  245.     IF GetWindowsMajorVersion * 100 + GetWindowsMinorVersion > 350 THEN
  246.         ExitCode% = EXITSUCCESS
  247.           WIN32ENABLED% = 1
  248.           GOTO FLEXI
  249.     END IF
  250.      IF GetWindowsMode < 2  THEN
  251.         IF OnWindowsNT() THEN
  252.             ExitCode% = EXITFAILNOTINTEL '' Running on Windows NT (on RISC)
  253.           ELSE
  254.             ExitCode% = EXITFAILNOTENH   '' Standard Mode Windows
  255.         END IF
  256.           GOTO QUIT
  257.     END IF
  258.     IF OnWindowsNT() THEN
  259.           ExitCode% = EXITSUCCESS
  260.         WIN32ENABLED% = 1
  261.           GOTO FLEXI
  262.      END IF
  263.     ExitCode% = EXITSUCCESS
  264.  
  265. DIALOG1:
  266.      if IsRunningApp() <> 0 THEN
  267.        ExitCode% = EXITFAILRUNAPP
  268.          RUNNING32APP%    = 1
  269.          sz$ = UIStartDlg(CUIDLL$, ExitCode%, "FInfo0DlgProc", 0, "")
  270.          IF sz$ = "REACTIVATE" THEN
  271.               GOTO DIALOG1
  272.          END IF
  273.          UIPop 1
  274.          GOTO FLEXI
  275.      END IF
  276.  
  277.      '' Get version of Win32s to be installed from version info in INF file
  278.     szNewVer$ = GetSectionKeyVersion("WindowsSystem", "WIN32S16.DLL")
  279.  
  280.     '' See if OLE is included.
  281.  
  282.     OLEINCLUDED% = DoesFileExist( GetSymbolValue("STF_SRCDIR") + "OLE2THK.DL_", femExists )
  283.  
  284.      IF OLEINCLUDED% = 1 THEN
  285.         '' See whether one of the OLE 16 bit components is loaded.
  286.         IF GetModulehandle("compobj") <> 0 THEN
  287.                 OLE16RUNAPP% = 1
  288.             GOTO GetOleVersion
  289.         END IF
  290.           IF GetModuleHandle("ole2") <> 0 THEN
  291.             OLE16RUNAPP% = 1
  292.             GOTO GetOleVersion
  293.           END IF
  294.         IF GetModuleHandle("ole2prox") <> 0 THEN
  295.             OLE16RUNAPP% = 1
  296.                 GOTO GetOleVersion
  297.         END IF
  298.           IF GetModuleHandle("ole2conv") <> 0 THEN
  299.                 OLE16RUNAPP% = 1
  300.             GOTO GetOleVersion
  301.         END IF
  302.           IF GetModuleHandle("storage") <> 0 THEN
  303.             OLE16RUNAPP% = 1
  304.             GOTO GetOleVersion
  305.           END IF
  306.         IF GetModuleHandle("ole2nls") <> 0 THEN
  307.             OLE16RUNAPP% = 1
  308.                 GOTO GetOleVersion
  309.         END IF
  310.           IF GetModuleHandle("ole2disp") <> 0 THEN
  311.             OLE16RUNAPP% = 1
  312.                 GOTO GetOleVersion
  313.           END IF
  314.           IF GetModuleHandle("typelib") <> 0 THEN
  315.                 OLE16RUNAPP% = 1
  316.                 GOTO GetOleVersion
  317.           END IF
  318.  
  319. GetOleVersion:
  320.           szOleNewVer$ = GetSectionKeyVersion("OleWindowsSystemWin32s", "OLE2THK.DLL")
  321.  
  322.           '' Get version of currently installed OLE32 from version info of
  323.         '' ole2thk file
  324.           szOleOldVer$ = GetVersionOfFile( DESTSYS$ + "WIN32S\OLE2THK.DLL" )
  325.  
  326.           szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "COMPOBJ.DLL" )
  327.           szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "COMPOBJ.DLL")
  328.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  329.                 OLE2_16% = 1
  330.         END IF
  331.  
  332.           szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2.DLL" )
  333.           szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "OLE2.DLL")
  334.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  335.                 OLE2_16% = 1
  336.         END IF
  337.  
  338.           szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2PROX.DLL" )
  339.           szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "OLE2PROX.DLL")
  340.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  341.                 OLE2_16% = 1
  342.         END IF
  343.  
  344.           szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "STORAGE.DLL" )
  345.           szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "STORAGE.DLL")
  346.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  347.                 OLE2_16% = 1
  348.         END IF
  349.  
  350.           szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2CONV.DLL" )
  351.           szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "OLE2CONV.DLL")
  352.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  353.                 OLE2_16% = 1
  354.         END IF
  355.  
  356.           szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2NLS.DLL" )
  357.           szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "OLE2NLS.DLL")
  358.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  359.                 OLE2AUTO_16% = 1
  360.         END IF
  361.  
  362.           szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2DISP.DLL" )
  363.           szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "OLE2DISP.DLL")
  364.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  365.                 OLE2AUTO_16% = 1
  366.         END IF
  367.  
  368.           szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "TYPELIB.DLL" )
  369.           szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "TYPELIB.DLL")
  370.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  371.                 OLE2AUTO_16% = 1
  372.         END IF
  373.  
  374.      END IF
  375.  
  376.     OLE2_32% = 1
  377.  
  378.     '' Check if Win32s is partially installed
  379.      sz$ = GetIniKeyString (DESTSYS$ + "WIN32S.INI", "Win32s", "Setup")
  380.      '' If WIN32S.INI specifies Win32s Setup=0, then force complete Win32s file overwrite
  381.     IF sz$ = "0" THEN
  382.         GOTO WELCOME
  383.      END IF
  384.     '' If WIN32S.INI is missing, try and reinstall Win32s files/recreate WIN32S.INI
  385.      IF sz$ <> "1" THEN
  386.         GOTO WELCOME
  387.      END IF
  388.  
  389.      '' If Win32s is already installed, get running version number
  390.      i% = DoesFileExist( DESTSYS$ + "W32SYS.DLL", femExists )
  391.      IF i% = 1 THEN
  392.           i% = IsWin32sLoaded( szOldVer$ )
  393.      ENDIF
  394.  
  395.      IF i% = 0 THEN
  396.         GOTO WELCOME
  397.      END IF
  398.  
  399.      IF szNewVer$ > szOldVer$ THEN
  400.           GOTO WELCOME
  401.     END IF
  402.  
  403.     OLE2_32% = 0
  404.  
  405.      IF szNewVer$ = szOldVer$ AND OLEINCLUDED% = 1 THEN
  406.         '' Compare OLE32 version and versions of each of OLE16 libraries.
  407.         sz$ = GetIniKeyString (DESTSYS$ + "WIN32S.INI", "OLE", "Setup")
  408.           '' If WIN32S.INI specifies OLE2 Setup=0, then force OLE2 file overwrite
  409.         IF ((sz$ <> "1") OR (szOleNewVer$ > szOleOldVer$)) THEN
  410.             OLEONLY% = 1
  411.                 OLE2_32% = 1
  412.             GOTO WELCOME
  413.         END IF
  414.  
  415.     IF OLE2_16% OR OLE2AUTO_16 THEN
  416.             OLEONLY% = 1
  417.                 GOTO WELCOME
  418.         END IF
  419.  
  420.      END IF
  421.      WIN32ENABLED% = 1
  422.      GOTO FLEXI
  423.  
  424. WELCOME:
  425.     i% = SetCuiFlags(OLEONLY%, OLE16RUNAPP%)
  426.      sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", HELPWELCOME, HELPPROC$)
  427.     IF sz$ = "CONTINUE" THEN
  428.         UIPop 1
  429.      ELSE
  430.         GOSUB ASKQUIT
  431.         GOTO WELCOME
  432.      END IF
  433.  
  434.  
  435. GETWIN32SPATH:
  436.     IF PagingEnabled() = 0 THEN
  437.         i% = DoMsgBox("Use the Control Panel 386 Enhanced icon and configure Windows using the Virtual Memory option.", "Win32s requires Virtual Memory", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  438.           ExitCode% = EXITFAILURE '' Enhanced mode but not paging
  439.         GOTO QUIT
  440.     END IF
  441.  
  442.     IF ShareEnabled() = 0 THEN
  443.         i% = DoMsgBox( "File-sharing must be enabled. Run SHARE.EXE before starting Windows or add SHARE.EXE to your AUTOEXEC.BAT file.", "Win32s Setup: SHARE.EXE is not loaded", MB_TASKMODAL+MB_ICONEXCLAMATION+MB_OK)
  444.      END IF
  445.  
  446.     SetSymbolValue "EditTextIn", DESTSYS$
  447.      SetSymbolValue "EditFocus", "END"
  448.  
  449. FLEXI:
  450.  
  451.     DEST$ = WINDRIVE$ + ":\FSPLUS55"
  452.     ''CustInst list symbols
  453.      CHECKSTATES$ = "CheckItemsState"
  454.      STATUSTEXT$  = "StatusItemsText"
  455.     DRIVETEXT$   = "DriveStatusText"
  456.      FOR i% = 1 TO 5 STEP 1
  457.           AddListItem CHECKSTATES$, "ON"
  458.     NEXT i%
  459.     FOR i% = 1 TO 6 STEP 1
  460.         AddListItem STATUSTEXT$, ""
  461.      NEXT i%
  462.     FOR i% = 1 TO 7 STEP 1
  463.           AddListItem DRIVETEXT$, ""
  464.     NEXT i%
  465.      ReplaceListItem DRIVETEXT$, 7, DEST$
  466.  
  467.     ''Disk cost list symbols
  468.     APPNEEDS$   = "AppNeeds"
  469.     OPT1NEEDS$    = "Opt1Needs"  ''1202 Cutmananger needs
  470.     OPT2NEEDS$    = "Opt2Needs"
  471.     EXTRACOSTS$ = "ExtraCosts"
  472.     BIGLIST$    = "BigList"
  473.     FOR i% = 1 TO 3 STEP 1
  474.           AddListItem BIGLIST$, ""
  475.     NEXT i%
  476.     FOR i% = 1 TO 26 STEP 1
  477.           AddListItem EXTRACOSTS$, "0"
  478.     NEXT i%
  479.  
  480.     RecalcPath
  481.     SetDriveStatus
  482.  
  483. '$IFDEF DEBUG
  484.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  485. '$ENDIF ''DEBUG
  486.  
  487. IF WIN32ENABLED% = 1 THEN
  488.     ReplaceListItem CHECKSTATES$, WIN32S, "OFF"
  489.     RecalcOptFiles WIN32S
  490.     SetDriveStatus
  491. END IF
  492.  
  493. IF RUNNING32APP% = 1 THEN
  494.     ReplaceListItem CHECKSTATES$, FLEXSIGN, "OFF"
  495.     ReplaceListItem CHECKSTATES$, WIN32S, "OFF"
  496.     RecalcOptFiles FLEXSIGN
  497.     RecalcOptFiles WIN32S
  498.     SetDriveStatus
  499. END IF
  500.  
  501.  
  502. ReplaceListItem CHECKSTATES$, SCAN, "OFF"
  503. sz$ = GetIniKeyString ("WIN.INI", "intl", "iMeasure")
  504. IF sz$ = "1" THEN
  505.     ReplaceListItem STATUSTEXT$, UNIT, "ENGLISH"
  506. ELSE
  507.     ReplaceListItem STATUSTEXT$, UNIT, "METRICS"
  508. END IF
  509. IF GetWindowsMajorVersion * 100 + GetWindowsMinorVersion > 350 THEN
  510.     ReplaceListItem STATUSTEXT$, OS, "Windows95"
  511. ELSE
  512.     ReplaceListItem STATUSTEXT$, OS, "Windows 3.x"
  513. END IF
  514.  
  515.  
  516. CUSTINST:
  517.  
  518.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", 0, "")
  519.  
  520.  
  521.     IF sz$ = "CONTINUE" THEN
  522.         ''Install only if it will fit.
  523.         FOR i% = 1 TO 3 STEP 1
  524.                 IF GetListItem(BIGLIST$, i%) <> "" THEN
  525.                 GOSUB TOOBIG
  526.                 GOTO CUSTINST
  527.                 END IF
  528.         NEXT i%
  529.         UIPop 1
  530.         GOTO INSTALLFLEXI
  531.      ELSEIF sz$ = "PATH" THEN
  532.         GOTO GETPATH
  533.      ELSEIF (sz$ = "CHK1") THEN
  534.           IF (RUNNING32APP% = 1) THEN
  535.                 ReplaceListItem CHECKSTATES$, FLEXSIGN, "OFF"
  536.           END IF
  537.           RecalcOptFiles FLEXSIGN
  538.           SetDriveStatus
  539.           GOTO CUSTINST
  540.     ELSEIF sz$ = "CHK2" THEN            ''120294  for cut manager
  541.           RecalcOptFiles CMANAGER
  542.           SetDriveStatus
  543.           GOTO CUSTINST
  544.     ELSEIF (sz$ = "CHK3") THEN
  545.           IF (RUNNING32APP% = 1) OR (WIN32ENABLED% = 1) THEN
  546.                 ReplaceListItem CHECKSTATES$, WIN32S, "OFF"
  547.           END IF
  548.           RecalcOptFiles WIN32S
  549.           SetDriveStatus
  550.           GOTO CUSTINST
  551.     ELSEIF sz$ = "CHK4" THEN
  552.         GOTO CUSTINST
  553.     ELSEIF sz$ = "BTN1" THEN
  554.         IF GetListItem(STATUSTEXT$, UNIT)="ENGLISH" THEN
  555.             ReplaceListItem STATUSTEXT$, UNIT, "METRICS"
  556.         ELSE
  557.             ReplaceListItem STATUSTEXT$, UNIT, "ENGLISH"
  558.         END IF
  559.         GOTO CUSTINST
  560.     ELSEIF sz$ = "BTN2" THEN
  561.         IF GetListItem(STATUSTEXT$, OS)="Windows95" THEN
  562.             ReplaceListItem STATUSTEXT$, OS, "Windows 3.x"
  563.         ELSE
  564.             ReplaceListItem STATUSTEXT$, OS, "Windows95"
  565.         END IF
  566.         RecalcOptFiles CMANAGER
  567.         SetDriveStatus
  568.         GOTO CUSTINST
  569.     ELSEIF sz$ = "REACTIVATE" THEN
  570.           RecalcPath
  571.           SetDriveStatus
  572.           GOTO CUSTINST
  573.      ELSE
  574.           GOSUB ASKQUIT
  575.           GOTO CUSTINST
  576.      END IF
  577.  
  578.  
  579. INSTALLFLEXI:
  580.  
  581. DestCopy$ = DEST$
  582. ClearCopyList
  583.  
  584. '' Install Language Files first
  585.  
  586. '' Install AppFiles
  587. ReadInfFile INF2$
  588.  
  589.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  590.     DEST$ = DestCopy$
  591.     IF GetListItem(CHECKSTATES$, FLEXSIGN)="ON" THEN
  592.         AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
  593.         CreateDir DEST$, cmoNone
  594.         CreateDir FLEXIDIR$, cmoNone
  595.     END IF
  596.  
  597.  
  598. '' Install EstimaFiles
  599.  
  600.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  601.     DEST$ = DestCopy$ + "\ESTIMATE"
  602.     IF GetListItem(CHECKSTATES$, FLEXSIGN)="ON" THEN
  603.         AddSectionFilesToCopyList "EstimaFiles", SrcDir$, DEST$
  604.         CreateDir DEST$, cmoNone
  605.     END IF
  606.  
  607.  
  608.  
  609. '' Install DriverFiles
  610.  
  611.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  612.     DEST$ = CMANAGDIR$
  613.     IF GetListItem(CHECKSTATES$, CMANAGER)="ON" THEN
  614.         AddSectionFilesToCopyList "DriverFiles", SrcDir$, DEST$
  615.         CreateDir DEST$, cmoNone
  616.     END IF
  617.  
  618. '' Install CmanagFiles
  619.  
  620.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  621.     DEST$ = WINDDIR$
  622.     IF GetListItem(CHECKSTATES$, CMANAGER)="ON" THEN
  623.         IF GetListItem(STATUSTEXT$, OS)="Windows95" THEN
  624.             AddSectionFilesToCopyList "CM95Files", SrcDir$, DEST$
  625.         ELSE
  626.             AddSectionFilesToCopyList "CmanagFiles", SrcDir$, DEST$
  627.         END IF
  628.         CreateDir DEST$, cmoNone
  629.     END IF
  630.  
  631.  
  632. CopyFilesInCopyList
  633.     DEST$ = WINDDIR$
  634.     FEXIST% = DoesFileExist(DEST$ + "CMCW31.EXE", femExists)
  635.     IF FEXIST% = 1 THEN
  636.         FEXIST% = DoesFileExist(DEST$ + "CMCUT.EXE", femExists)
  637.         IF FEXIST% = 1 THEN
  638.             RemoveFile DEST$ + "CMCUT.EXE", cmoForce
  639.         END IF
  640.         RenameFile DEST$ + "CMCW31.EXE", "CMCUT.EXE"
  641.     END IF
  642.  
  643.     FEXIST% = DoesFileExist(DEST$ + "CMCW95.EXE", femExists)
  644.     IF FEXIST% = 1 THEN
  645.         FEXIST% = DoesFileExist(DEST$ + "CMCUT.EXE", femExists)
  646.         IF FEXIST% = 1 THEN
  647.             RemoveFile DEST$ + "CMCUT.EXE", cmoForce
  648.         END IF
  649.         RenameFile DEST$ + "CMCW95.EXE", "CMCUT.EXE"
  650.     END IF
  651.  
  652.      FEXIST% = DoesFileExist(DEST$ + "CMW31.EXE", femExists)
  653.     IF FEXIST% = 1 THEN
  654.         FEXIST% = DoesFileExist(DEST$ + "CMANAGER.EXE", femExists)
  655.         IF FEXIST% = 1 THEN
  656.             RemoveFile DEST$ + "CMANAGER.EXE", cmoForce
  657.         END IF
  658.         RenameFile DEST$ + "CMW31.EXE", "CMANAGER.EXE"
  659.     END IF
  660.  
  661.      FEXIST% = DoesFileExist(DEST$ + "CMW95.EXE", femExists)
  662.     IF FEXIST% = 1 THEN
  663.         FEXIST% = DoesFileExist(DEST$ + "CMANAGER.EXE", femExists)
  664.         IF FEXIST% = 1 THEN
  665.             RemoveFile DEST$ + "CMANAGER.EXE", cmoForce
  666.         END IF
  667.         RenameFile DEST$ + "CMW95.EXE", "CMANAGER.EXE"
  668.     END IF
  669.  
  670.     FEXIST% = DoesFileExist(DEST$ + "PMW31.EXE", femExists)
  671.     IF FEXIST% = 1 THEN
  672.         FEXIST% = DoesFileExist(DEST$ + "PM.EXE", femExists)
  673.         IF FEXIST% = 1 THEN
  674.             RemoveFile DEST$ + "PM.EXE", cmoForce
  675.         END IF
  676.         RenameFile DEST$ + "PMW31.EXE", "PM.EXE"
  677.     END IF
  678.  
  679.     FEXIST% = DoesFileExist(DEST$ + "PMW95.EXE", femExists)
  680.     IF FEXIST% = 1 THEN
  681.         FEXIST% = DoesFileExist(DEST$ + "PM.EXE", femExists)
  682.         IF FEXIST% = 1 THEN
  683.             RemoveFile DEST$ + "PM.EXE", cmoForce
  684.         END IF
  685.         RenameFile DEST$ + "PMW95.EXE", "PM.EXE"
  686.     END IF
  687.  
  688.  
  689.  
  690. '' Install Program Files second
  691. '' Install AppFiles
  692. ReadInfFile INF1$
  693.  
  694.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  695.     DEST$ = DestCopy$
  696.     IF GetListItem(CHECKSTATES$, FLEXSIGN)="ON" THEN
  697.         AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
  698.         CreateDir DEST$, cmoNone
  699.         CreateDir FLEXIDIR$, cmoNone
  700.     END IF
  701.  
  702. '' Instal System Files
  703.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  704.     DEST$ = SYSDIR$
  705.     IF GetListItem(CHECKSTATES$, FLEXSIGN)="ON" OR GetListItem(CHECKSTATES$, CMANAGER)="ON" THEN
  706.         AddSectionFilesToCopyList "SystemFiles", SrcDir$, DEST$
  707.         CreateDir DEST$, cmoNone
  708.     END IF
  709.  
  710.     
  711. '' Install Filter files, Quark filters
  712.  
  713.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  714.     DEST$ = DestCopy$ + "\filters"
  715.     IF GetListItem(CHECKSTATES$, FLEXSIGN)="ON" THEN
  716.         AddSectionFilesToCopyList "FiltersFiles", SrcDir$, DEST$
  717.         CreateDir DEST$, cmoNone
  718.     END IF
  719.  
  720. '' Install flexi files, 
  721.  
  722.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  723.     DEST$ = FLEXIDIR$
  724.     IF GetListItem(CHECKSTATES$, FLEXSIGN)="ON" THEN
  725.         AddSectionFilesToCopyList "FlexiFiles", SrcDir$, DEST$
  726.         CreateDir DEST$, cmoNone
  727.     END IF
  728.  
  729. '' Install WinG
  730.  
  731.  IF GetListItem(CHECKSTATES$, FLEXSIGN)="ON" THEN
  732.     AddSectionFilesToCopyList "runtime", SrcDir$, DESTSYS$
  733.     '
  734.     ' only use DVA on Windows 3.x
  735.     '
  736.     IF OnWin3x() = 1 THEN
  737.          AddSectionFilesToCopyList "dva", SrcDir$, DESTSYS$
  738.         IF VflatdPresent() = 0 THEN
  739.         CreateSysIniKeyValue GetWindowsDir + "system.ini", "386Enh", "device", GetWindowsSysDir+"dva.386", cmoOverwrite
  740.         bInstallDVA% = 1
  741.         END IF
  742.     END IF
  743.  
  744.     AddSectionFilesToCopyList "wing32", SrcDir$, DESTWING32$
  745.             Dest1$ = MakePath(DESTWING32$,"wing32.dll")
  746.     Dest2$ = MakePath(DESTWING32$,"wing32.xxx")
  747.     RenameFilePlease Dest1$,Dest2$
  748.     UpdateWinG32 GetRealWindowsSysDir()
  749.  END IF
  750.  
  751.  
  752. '' Install BorderFiles
  753.  
  754.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  755.     DEST$ = DestCopy$ + "\BORDERS"
  756.     IF GetListItem(CHECKSTATES$, FLEXSIGN)="ON" THEN
  757.         AddSectionFilesToCopyList "BorderFiles", SrcDir$, DEST$
  758.         CreateDir DEST$, cmoNone
  759.      END IF
  760.  
  761. '' flexmst.15a
  762. '' Install Win32s
  763.  
  764. COPYFILES:
  765. IF GetListItem(CHECKSTATES$, WIN32S)="ON" THEN
  766.      IF OLEONLY% = 0 THEN
  767.           CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "0", cmoOverwrite
  768.      END IF
  769.      IF OLE2_32% = 1 THEN
  770.           CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "OLE", "Setup", "0", cmoOverwrite
  771.     END IF
  772.  
  773.      '' Indicate Win32s install failure until all files known to be copied.
  774.      ExitCode% = EXITFAILURE
  775.      ERR = 0
  776.      CreateDir DEST32S$, cmoNone
  777.      Install OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%
  778.      UpdateSystemIni
  779.      '' Terminate if unhandled fatal error
  780.      IF ERR <> 0 THEN
  781.      GOTO QUIT
  782.      END IF
  783.  
  784.      IF OLEONLY% = 0 THEN
  785.           CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "1", cmoOverwrite
  786.           CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Version", szNewVer$, cmoOverwrite
  787.           CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Nls", "AnsiCP", "1252", cmoOverwrite
  788.      END IF
  789.      IF OLE2_32% = 1 THEN
  790.           CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "OLE", "Setup", "1", cmoOverwrite
  791.           CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "OLE", "Version", szOleNewVer, cmoOverwrite
  792.      END IF
  793.  
  794.      i% = DoMsgBox("Win32s files successfully installed.", "Microsoft Win32s Setup", MB_OK+MB_TASKMODAL)
  795.      '' Indicate Win32s correctly copied and installed.
  796.      ExitCode% = EXITSUCCESS
  797.  
  798. ''flexmst.15b
  799. ''Install FreeCell
  800. FREECELL:
  801.     IF OLEONLY% = 1 THEN
  802.         GOTO QUIT
  803.     ENDIF
  804.     IF WIN32ENABLED% = 1 THEN
  805.         sz$ = UIStartDlg(CUIDLL$, FREECELLINSTNOWIN32S, "FInfoDlgProc",0, "")
  806.     ELSE
  807.         sz$ = UIStartDlg(CUIDLL$, FREECELLINST, "FInfoDlgProc",0, "")
  808.     END IF
  809.     UIPop 1
  810.     IF sz$ <> "CONTINUE" THEN
  811.         GOTO QUIT
  812.     END IF
  813.  
  814. GETFREEPATH:
  815.     DESTFREE$ = MID$(DESTSYS$,1,3) + "WIN32APP\FREECELL\"
  816.     SetSymbolValue "EditTextIn", DESTFREE$
  817.     SetSymbolValue "EditFocus", "END"
  818.  
  819. GETFREEPATHL1:
  820.     sz$ = UIStartDlg(CUIDLL$, FREECELLPATH, "FEditDlgProc", HELPFREECELL, HELPPROC$)
  821.  
  822.     IF sz$ = "CONTINUE" THEN
  823.         DESTFREE$ = GetSymbolValue("EditTextOut")
  824.  
  825.         IF MID$(DESTFREE$, LEN(DESTFREE$), 1) <> "\" THEN
  826.             DESTFREE$ = DESTFREE$ + "\"
  827.         END IF
  828.         ''Validate new path.
  829.         IF IsDirWritable(DESTFREE$) = 0 THEN
  830.             GOSUB BADPATH
  831.             GOTO GETFREEPATHL1
  832.         END IF
  833.         UIPop 1
  834.  
  835.         GOTO COPYFREECELL
  836.     ELSEIF sz$ = "REACTIVATE" THEN
  837.         GOTO GETFREEPATHL1
  838.     ELSEIF sz$ = "EXIT" THEN
  839.         UIPop 1
  840.           GOTO INSTALL1
  841.     END IF
  842.  
  843. COPYFREECELL:
  844.     ClearCopyList
  845.     CreateDir DESTFREE$, cmoNone
  846.  
  847.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  848.  
  849.     ERR = 0
  850.     AddSectionFilesToCopyList "Win32appFreecell", SrcDir$, DESTFREE$
  851.     CopyFilesInCopyList
  852.     '' If error copying FreeCell, not a fatal error. Win32s is already installed.
  853.     IF ERR <> 0 THEN
  854.     ERR = 0
  855.     GOTO QUIT
  856.     END IF
  857.     ERR = 0
  858.  
  859.     IF DoesFileExist( DESTSYS$ + "WIN32S.INI", femExists ) THEN
  860.     CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Freecell", "Setup", "1", cmoOverwrite
  861.     CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Freecell", "Version", szNewVer$, cmoOverwrite
  862.     END IF
  863.  
  864.     ERR = 0
  865.     CreateProgmanGroup "Win32 Applications", "", cmoNone
  866.     ShowProgmanGroup   "Win32 Applications", 1, cmoNone
  867.     CreateProgmanItem  "Win32 Applications", "Freecell", DESTFREE$ + "FREECELL.EXE", "", cmoOverwrite
  868.     '' Only put up success dialog if icon added to group
  869.     IF ERR = 0 THEN
  870.     i% = DoMsgBox("Freecell was successfully installed.", "Freecell Setup", MB_OK+MB_TASKMODAL)
  871.     END IF
  872.     ERR = 0
  873. ''flexmst.15c
  874.  
  875.  
  876. END IF
  877.  
  878. ''REALLY install now
  879. IF GetListItem(CHECKSTATES$, WIN32S)="OFF" THEN
  880.      CopyFilesInCopyList
  881. END IF
  882.  
  883. INSTALL1:
  884.  
  885. unitDef$ = MakePath(FLEXIDIR$, "unit.def")
  886. OPEN unitDef$ FOR OUTPUT AS #1
  887. outStr$ = GetListItem(STATUSTEXT$, UNIT)
  888. PRINT #1, outStr$
  889. CLOSE #1
  890.  
  891. IF (GetListItem(CHECKSTATES$, APPFILES)="ON") OR (GetListItem(CHECKSTATES$, CMANAGER) = "ON") THEN
  892.     sz$ = UIStartDlg(CUIDLL$, PROGRAMGROUP, "FInfoDlgProc", HELPWELCOME, HELPPROC$)
  893.     UIpop 1
  894.     IF sz$ <> "CONTINUE" THEN
  895.         GOTO SCANNER
  896.     END IF
  897. END IF
  898.  
  899.     IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  900.         CreateProgmanGroup "FlexiSIGN Plus", "", cmoNone
  901.         ShowProgmanGroup  "FlexiSIGN Plus", 1, cmoNone
  902.         CreateProgmanItem "FlexiSIGN Plus", "FlexiSIGN Plus 5.6v3", MakePath(DestCopy$,"FSPLUS55.EXE"), "", cmoOverwrite
  903.         tempPath$ = "write " + MakePath(DestCopy$,"Readme.doc")
  904.         CreateProgmanItem "FlexiSIGN Plus", "Read Me", tempPath$, "", cmoOverwrite
  905.         CreateProgmanItem "FlexiSIGN Plus", "Estimation Editor", MakePath(DestCopy$,"estimate\estimate.exe"), "", cmoOverwrite
  906.     END IF
  907.     IF GetListItem(CHECKSTATES$, CMANAGER) = "ON" THEN
  908.         CreateProgmanGroup "FlexiSIGN Plus", "", cmoNone
  909.         ShowProgmanGroup  "FlexiSIGN Plus", 1, cmoNone
  910.         CreateIniKeyValue MakePath(WINDDIR$,"SYSTEM.INI"),"DDESHARES","CUTMANAGER$","CMANAGER,CUTMANAGER,,31,,0,,0,0,0", cmoOverwrite
  911.         CreateProgmanItem "FlexiSIGN Plus", "Cut Manager", MakePath(WINDDIR$,"cmanager.exe"), "", cmoOverwrite
  912.         CreateProgmanItem "FlexiSIGN Plus", "Custom Command Editor", MakePath(CMANAGDIR$,"csmedit.exe"), "", cmoOverwrite
  913.     END IF
  914.  
  915.     ''941206 added for skipping scanner setup if not installing cut-manager
  916. SCANNER:
  917.     IF GetListItem(CHECKSTATES$, SCAN) = "OFF" THEN
  918.         GOTO QUIT
  919.     END IF
  920.     '' ####112792 added for checking the scanner, reset check items, initially none
  921.     CHECkITEMSIN$ = "CheclItemsIn"
  922.     CHECKITEMSOUT$ = "CheckItemsOut"
  923.     FOR i% = 1 TO 6 STEP 1             ''###9310 Added pana505 506
  924.         AddListItem CHECKITEMSIN$, "OFF"
  925.     NEXT i%
  926.  
  927. SETUPSCANNER:
  928.     sz$ = UIStartDlg(CUIDLL$, SCANNERSLT, "FCheckDlgProc", 0, "")
  929.     IF sz$ = "EXIT" THEN
  930.         UIPop 1
  931.         GOTO QUIT
  932.     ELSEIF sz$ = "CONTINUE" THEN
  933.         scanner1$ = GetListItem(CHECKITEMSOUT$, HPSCANJETII)
  934.         scanner2$ = GetListItem(CHECKITEMSOUT$, UMAX)
  935.         scanner3$ = GetListItem(CHECKITEMSOUT$, MICROTEK)
  936.         scanner4$ = GetListItem(CHECKITEMSOUT$, PANA307) ''###9310
  937.         scanner5$ = GetListItem(CHECKITEMSOUT$, PANA505)
  938.         scanner6$ = GetListItem(CHECKITEMSOUT$, PANA506)
  939.         scanner7$ = GetListItem(CHECKITEMSOUT$, VISTA)
  940.         IF (scanner1$ = "ON") OR (scanner2$ = "ON") OR (scanner3$ = "ON") OR (scanner4$ = "ON") OR (scanner5$ = "ON") OR (scanner6$ = "ON") OR (scanner7$ = "ON")  THEN
  941.             UIPop 1     '' at least one of them is selected
  942.         ELSE
  943.             i% = DoMsgBox("No scanner was selected! Please try again.", "Wait!", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  944.             GOTO SETUPSCANNER
  945.         END IF
  946.     ELSE
  947.       GOTO SETUPSCANNER
  948.     ENDIF    
  949.     GOSUB SCANNERCONFIG
  950.     msg$ = "Please restart your computer after this installation"
  951.     i% = DoMsgBox( msg$, "SUCCESS", MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  952.  
  953.  
  954.  
  955. QUIT:
  956.      '' Install error handler for final message box routines
  957.      ON ERROR GOTO ERRQUIT
  958.      IF ERR = 0 THEN
  959.           dlg% = ExitCode%
  960.      ELSEIF ERR = STFQUIT THEN
  961.           IF (OLE_PROTECT% = 1) THEN
  962.                 '' Free all previously loaded libraries
  963.                 FreeLibrary GetModuleHandle("compobj")
  964.                 FreeLibrary GetModuleHandle("ole2")
  965.                 FreeLibrary GetModuleHandle("ole2prox")
  966.                 FreeLibrary GetModuleHandle("ole2conv")
  967.                 FreeLibrary GetModuleHandle("storage")
  968.                 FreeLibrary GetModuleHandle("ole2nls")
  969.                 FreeLibrary GetModuleHandle("ole2disp")
  970.                 FreeLibrary GetModuleHandle("typelib")
  971.           END IF
  972.           dlg% = EXITQUIT
  973.           ExitCode% = EXITQUIT
  974.      ELSE
  975.           dlg% = EXITFAILURE
  976.           ExitCode% = EXITQUIT
  977.      END IF
  978.  
  979. QUITL1:
  980.       if dlg% = EXITSUCCESS AND bInstallDVA% = 1 then
  981.         sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfoDlgProc", HELPWELCOME, HELPPROC$)
  982.         UIPop 1
  983.         IF sz$ = "CONTINUE" THEN
  984.              rc% = RestartWindows
  985.         ENDIF
  986.       endif
  987.  
  988.      IF WIN32ENABLED% = 1 THEN
  989.           UIPop 1
  990.           END
  991.      END IF
  992.  
  993.      sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  994.      IF sz$ = "REACTIVATE" THEN
  995.           GOTO QUITL1
  996.      END IF
  997.      UIPop 1
  998.  
  999. RS32:
  1000.     IF (GetListItem(CHECKSTATES$, WIN32S) = "ON") AND (ExitCode% = EXITSUCCESS) THEN
  1001.         sz$ = UIStartDlg(CUIDLL$, RESTART32, "FInfoDlgProc", HELPWELCOME, HELPPROC$)
  1002.         UIpop 1
  1003.         IF sz$ <> "CONTINUE" THEN
  1004.             GOTO RS32
  1005.         END IF
  1006.     END IF
  1007.  
  1008.      IF ExitCode% = EXITSUCCESS THEN
  1009.           IF RebootSystem(OLEONLY%) = 0 THEN
  1010.             CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "0", cmoOverwrite
  1011.                 IF OLE2_32% = 1 THEN
  1012.                      CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "OLE", "Setup", "0", cmoOverwrite
  1013.                 END IF
  1014.                 i% = DoMsgBox("Win32s is not properly configured and Win32s Setup must be run again.", "Unable to Restart Windows", MB_ICONEXCLAMATION+MB_OK+MB_TASKMODAL)
  1015.           END IF
  1016.      ENDIF
  1017.  
  1018.  
  1019.      END
  1020.  
  1021.      END
  1022.  
  1023. ERRQUIT:
  1024.     i% = DoMsgBox("Setup sources were corrupted, call 1-610-521-6300", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  1025.     END
  1026.  
  1027. '' Bypass run-time errors. Let final dialog box display fatal error message.
  1028. ERRNORMAL:
  1029.      '' Check if user cancelled setup
  1030.      IF ERR = STFQUIT THEN
  1031.      GOTO QUIT
  1032.      END IF
  1033.      RESUME NEXT
  1034.  
  1035.  
  1036. SCANNERCONFIG:    ''####112792 add
  1037.     GOTO GETCONFIGPATH
  1038. CONFIGPATH:
  1039.     drv$ = MID$(DEST$, 1, 1)+ ":\"
  1040.     szFullPath$ = FindFileInTree("config.sys", drv$)
  1041.      IF szFullPath$ = "" THEN  ''cannot find config.sys
  1042.        msg$ = "Can't find your config.sys file in drive " + UCASE$(drv$) + ", please try again."
  1043.        i% = DoMsgBox( msg$, "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  1044.        GOTO GETCONFIGPATH
  1045.      ENDIF
  1046.  
  1047.      SplitPath szFullPath$, drv$, dir$, filename$, ext$
  1048.     IF drv$ = "" THEN    '' Big trouble, which drive is the boot one
  1049.         msg$ = "Can't find your config.sys file in drive " + UCASE$(drv$) + ", please try again."
  1050.        i% = DoMsgBox( msg$, "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  1051.        GOTO GETCONFIGPATH
  1052.     END IF
  1053.  
  1054.     OPEN szFullPath$ FOR INPUT AS #1
  1055.     SplitPath szFullPath$, drv$, dir$, filename$, ext$
  1056.     tempSys$ = drv$+dir$+"config.qqq"
  1057.     OPEN tempSys$ FOR OUTPUT AS #2
  1058.  
  1059.     IF (scanner4$ = "ON") OR (scanner5$ = "ON") OR (scanner6$ = "ON") THEN     ''####9310
  1060.         outStr$ = "DEVICE=" + DESTCOPY$ + "\" + drivername4$ + " /Va1 /P100" 
  1061.         PRINT #2, outStr$
  1062.     END IF  ''9311 307 requires this to be put before others
  1063.  
  1064.     WHILE NOT EOF(1)
  1065.         LINE INPUT #1, lineStr$
  1066.         uLineStr$ = UCASE$(lineStr$)
  1067.           outStr$ = ""
  1068.         IF (scanner1$ = "ON") AND INSTR(uLineStr$, drivername1$) THEN
  1069.             outStr$ = "DEVICE=" + DESTCOPY$ + "\" + drivername1$
  1070.             PRINT #2, outStr$
  1071.             scanner1$ = "OFF"      ''reset so we will not write it twice
  1072.         ELSEIF (scanner2$ = "ON") AND INSTR(uLineStr$, drivername2$) THEN
  1073.             outStr$ = "DEVICE=" + DESTCOPY$ + "\" + drivername2$
  1074.             PRINT #2, outStr$
  1075.             scanner2$ = "OFF"      ''reset so we will not write it twice
  1076.         ELSEIF (scanner3$ = "ON") AND INSTR(uLineStr$, drivername3$) THEN
  1077.             outStr$ = "DEVICE=" + DESTCOPY$ + "\" + drivername3$
  1078.             PRINT #2, outStr$
  1079.             scanner3$ = "OFF"      ''reset so we will not write it twice
  1080.         ELSEIF (scanner7$ = "ON") AND INSTR(uLineStr$, drivername_vista$) THEN  ''???
  1081.             outStr$ = "DEVICE=" + DESTCOPY$ + "\" + drivername_vista$
  1082.             PRINT #2, outStr$
  1083.             scanner7$ = "OFF"      ''reset so we will not write it twice
  1084.         ELSEIF INSTR(uLineStr$, drivername4$) THEN     ''for Panasonic 9310
  1085.             outStr$ = "REM " + lineStr$    ''comment out
  1086.             PRINT #2, outStr$
  1087.         ELSEIF INSTR(uLineStr$, "FILES=") THEN
  1088.             cfilenum% = GetConfigNumFiles()
  1089.             IF cfilenum% < 40 THEN
  1090.                 outStr$ = "FILES=40"
  1091.             END IF
  1092.         ELSE
  1093.             PRINT #2, lineStr$     '' output as it is
  1094.         ENDIF
  1095.     WEND
  1096.     CLOSE #1
  1097.     IF scanner1$ = "ON" THEN
  1098.         outStr$ = "DEVICE=" + DESTCOPY$ + "\" + drivername1$
  1099.           PRINT #2, outStr$
  1100.     END IF
  1101.     IF scanner2$ = "ON" THEN
  1102.         outStr$ = "DEVICE=" + DESTCOPY$ + "\" + drivername2$
  1103.             PRINT #2, outStr$
  1104.     END IF
  1105.     IF scanner3$ = "ON" THEN
  1106.         outStr$ = "DEVICE=" + DESTCOPY$ + "\" + drivername3$
  1107.            PRINT #2, outStr$
  1108.     END IF
  1109.     IF scanner7$ = "ON" THEN
  1110.         outStr$ = "DEVICE=" + DESTCOPY$ + "\" + drivername_vista$
  1111.            PRINT #2, outStr$
  1112.     END IF
  1113.     CLOSE #2
  1114.  
  1115.     RemoveFile drv$+dir$+"config.bak", cmoForce
  1116.     RenameFile szFullPath$, "config.bak"
  1117.     RenameFile tempSys$, "config.sys"
  1118.  
  1119.     ''9310 added autoexec.bat processing when installing panasonic driver
  1120.     IF (scanner4$ = "ON") OR (scanner5$ = "ON") OR (scanner6$ = "ON") THEN
  1121.         szFullPath$ = drv$+"\autoexec.bat"  ''autox.bat should be at the root
  1122.         OPEN szFullPath$ FOR INPUT AS #1
  1123.         tempSys$ = drv$+"\autoexec.qqq"
  1124.         OPEN tempSys$ FOR OUTPUT AS #2
  1125.  
  1126.         scanner1$ = "NO"   ''use scanner1 as a temp var here. NO means not-written-yet.
  1127.         WHILE NOT EOF(1)
  1128.             LINE INPUT #1, lineStr$
  1129.             uLineStr$ = UCASE$(lineStr$)
  1130.             outStr$ = ""
  1131.             IF scanner1$ = "NO" THEN
  1132.                 IF INSTR(uLineStr$, drivername4_7$) THEN
  1133.                     IF scanner4$ = "ON" THEN
  1134.                         outStr$ = DESTCOPY$ + "\" + drivername4_7$ + " /Va1 /P100"  ''for 307
  1135.                         scanner1$ = "YES"     ''reset so we will not write it twice
  1136.                     ELSE
  1137.                         outStr$ = "REM " + lineStr$
  1138.                     END IF
  1139.                     PRINT #2, outStr$
  1140.                 ELSEIF INSTR(uLineStr$, drivername4_5$) THEN
  1141.                     IF scanner5$ = "ON" THEN
  1142.                         outStr$ = DESTCOPY$ + "\" + drivername4_5$ + " /Va1 /P100 /Dn"
  1143.                         scanner1$ = "YES"     ''reset so we will not write it twice
  1144.                     ELSE
  1145.                         outStr$ = "REM " + lineStr$
  1146.                           END IF
  1147.                     PRINT #2, outStr$
  1148.                 ELSEIF INSTR(uLineStr$, drivername4_6$) THEN
  1149.                     IF scanner6$ = "ON" THEN
  1150.                         outStr$ = DESTCOPY$ + "\" + drivername4_6$ + " /Va1 /P100 /Dn"
  1151.                         scanner1$ = "YES"     ''reset so we will not write it twice
  1152.                     ELSE
  1153.                         outStr$ = "REM " + lineStr$
  1154.                     END IF
  1155.                     PRINT #2, outStr$
  1156.                 ELSE
  1157.                     PRINT #2, lineStr$     '' output as it is
  1158.                 END IF
  1159.             ELSE
  1160.                 IF (INSTR(uLineStr$, drivername4_7$) OR INSTR(uLineStr$, drivername4_5$) OR INSTR(uLineStr$, drivername4_6$)) THEN  ''make sure only write once
  1161.                     lineStr$ = "REM " + lineStr$   ''comment out
  1162.                 END IF
  1163.                 PRINT #2, lineStr$     '' output as it is OR comment out
  1164.             ENDIF
  1165.         WEND
  1166.         CLOSE #1
  1167.         IF scanner1$ = "NO" THEN  ''if not-written-yet
  1168.             IF (scanner4$ = "ON") THEN
  1169.                 outStr$ = DESTCOPY$ + "\" + drivername4_7$ + " /Va1 /P100"  ''for 307
  1170.             ELSEIF (scanner5$ = "ON") THEN
  1171.                 outStr$ = DESTCOPY$ + "\" + drivername4_5$ + " /Va1 /P100 /Dn"
  1172.             ELSEIF (scanner6$ = "ON") THEN
  1173.                 outStr$ = DESTCOPY$ + "\" + drivername4_6$ + " /Va1 /P100 /Dn"
  1174.             ELSE      ''default
  1175.                 outStr$ = DESTCOPY$ + "\" + drivername4_7$ + " /Va1 /P100"  ''for 307
  1176.             END IF
  1177.             PRINT #2, outStr$
  1178.         END IF
  1179.         CLOSE #2
  1180.         RemoveFile drv$+"\autoexec.bak", cmoForce
  1181.         RenameFile szFullPath$, "autoexec.bak"
  1182.         RenameFile tempSys$, "autoexec.bat"
  1183.     END IF
  1184.  
  1185.     RETURN
  1186.  
  1187. GETCONFIGPATH:
  1188.     DEST$ = WINDRIVE$ + ":\"
  1189.     SetSymbolValue "EditTextIn", DEST$
  1190.     SetSymbolValue "EditFocus", "END"
  1191. GETPATHL2:
  1192.     sz$ = UIStartDlg(CUIDLL$, CONFIGPATH, "FEditDlgProc", 0, "")
  1193.  
  1194.      IF sz$ = "CONTINUE" THEN
  1195.         olddest$ = DEST$
  1196.         DEST$ = GetSymbolValue("EditTextOut")
  1197.  
  1198.         ''Validate new path.
  1199.         ''IF IsDirWritable(DEST$) = 0 THEN
  1200.         IF IsDriveValid(UCASE$(MID$(DEST$, 1, 1))) = 0 THEN
  1201.             msg$ = "Driver " + UCASE$(MID$(DEST$, 1, 1)) + " is not a valid driver!"
  1202.             i% = DoMsgBox(msg$, "WAIT", MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  1203.             GOTO GETPATHL2
  1204.         END IF
  1205.         UIPop 1
  1206.  
  1207.         olddest$ = ""
  1208.           GOTO CONFIGPATH
  1209.      ELSEIF sz$ = "REACTIVATE" THEN
  1210.         GOTO GETPATHL2
  1211.     ELSE    '' the user try to do it manually
  1212.         msg$ = "Driver(s) not installed, please change your config.sys manually before using them."
  1213.         i% = DoMsgBox(msg$, "WARNING", MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  1214.         GOTO QUIT
  1215.     END IF
  1216.  
  1217.  
  1218. GETPATH:
  1219.      SetSymbolValue "EditTextIn", DEST$
  1220.     SetSymbolValue "EditFocus", "END"
  1221. GETPATHL1:
  1222.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", 0, "")
  1223.  
  1224.     IF sz$ = "CONTINUE" THEN
  1225.           olddest$ = DEST$
  1226.         DEST$ = GetSymbolValue("EditTextOut")
  1227.  
  1228.           ''Validate new path.
  1229.         IF IsDirWritable(DEST$) = 0 THEN
  1230.             GOSUB BADPATH
  1231.                 GOTO GETPATHL1
  1232.         END IF
  1233.         UIPop 1
  1234.  
  1235.         ''Truncate display if too long.
  1236.         IF LEN(DEST$) > 23 THEN
  1237.                 ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  1238.         ELSE
  1239.             ReplaceListItem DRIVETEXT$, 7, DEST$
  1240.           END IF
  1241.  
  1242.         ''Recalc if path changed.
  1243.           IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  1244.             RecalcPath
  1245.             SetDriveStatus
  1246.           END IF
  1247.  
  1248.         olddest$ = ""
  1249.           GOTO CUSTINST
  1250.     ELSEIF sz$ = "REACTIVATE" THEN
  1251.         RecalcPath
  1252.           SetDriveStatus
  1253.         GOTO GETPATHL1
  1254.     ELSEIF sz$ = "EXIT" THEN
  1255.           GOSUB ASKQUIT
  1256.         GOTO GETPATHL1
  1257.      ELSE
  1258.         UIPop 1
  1259.           GOTO CUSTINST
  1260.     END IF
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266. TOOBIG:
  1267.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  1268.     IF sz$ = "REACTIVATE" THEN
  1269.         RecalcPath
  1270.           SetDriveStatus
  1271.         GOTO TOOBIG
  1272.     END IF
  1273.      UIPop 1
  1274.     RETURN
  1275.  
  1276.  
  1277.  
  1278. BADPATH:
  1279.      sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  1280.     IF sz$ = "REACTIVATE" THEN
  1281.         RecalcPath
  1282.           SetDriveStatus
  1283.         GOTO BADPATH
  1284.     END IF
  1285.      UIPop 1
  1286.     RETURN
  1287.  
  1288.  
  1289.  
  1290. ASKQUIT:
  1291.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  1292.  
  1293.     IF sz$ = "EXIT" THEN
  1294.           UIPopAll
  1295.         ERROR STFQUIT
  1296.     ELSEIF sz$ = "REACTIVATE" THEN
  1297.           GOTO ASKQUIT
  1298.     ELSE
  1299.         UIPop 1
  1300.      END IF
  1301.     RETURN
  1302.  
  1303.  
  1304.  
  1305. '**
  1306. '** Purpose:
  1307. '**     Adds the specified option files to the copy list.
  1308. '** Arguments:
  1309. '**     ftype%  - type of files to add, one of the following:
  1310. '**             APPFILES, OPTFILES1, OPTFILES2
  1311. '** Returns:
  1312. '**     none.
  1313. '*************************************************************************
  1314. ''120294  Revised to calculate correct cost
  1315.  
  1316. SUB AddOptFilesToCopyList (ftype%) STATIC
  1317.  
  1318.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  1319.  
  1320.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  1321.  
  1322.         FSFontDir$ =  WINDRIVE$ + ":\FSFONTS" ''9406
  1323.  
  1324.         IF ftype% = FLEXSIGN THEN
  1325.             ReadInfFile INF2$
  1326.             AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
  1327.             ReadInfFile INF1$
  1328.             AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
  1329.             AddSectionFilesToCopyList "SystemFiles", SrcDir$, SYSDIR$
  1330.             AddSectionFilesToCopyList "FiltersFiles", SrcDir$, DEST$ + "\filters"
  1331. ''WinG
  1332.             AddSectionFilesToCopyList "runtime", SrcDir$, DESTSYS$
  1333.     '
  1334.     ' only use DVA on Windows 3.x
  1335.     '
  1336.             IF OnWin3x() = 1 THEN
  1337.               AddSectionFilesToCopyList "dva", SrcDir$, DESTSYS$
  1338.             END IF
  1339.             AddSectionFilesToCopyList "wing32", SrcDir$, DESTWING32$
  1340.  
  1341.  
  1342.  
  1343.             AddSectionFilesToCopyList "BorderFiles", SrcDir$, DEST$+"\BORDERS"
  1344.  
  1345.             ReadInfFile INF2$
  1346.             AddSectionFilesToCopyList "EstimaFiles", SrcDir$, DEST$+"\ESTIMATE"
  1347.             ReadInfFile INF1$
  1348.  
  1349.  
  1350. ''Win32s
  1351.     ELSEIF ftype% = WIN32S THEN
  1352.             IF OLEONLY% = 0 THEN
  1353.               AddSectionFilesToCopyList "WindowsSystem", SrcDir$, DESTSYS$
  1354.               AddSectionFilesToCopyList "WindowsSystemWin32s", SrcDir$, DEST32S$
  1355.             END IF
  1356.             OLEINCLUDED% = DoesFileExist( GetSymbolValue("STF_SRCDIR") + "OLE2THK.DL_", femExists )
  1357.             if OLEINCLUDED% = 1 THEN
  1358.               IF (OLE2_16% = 1) OR (OLE2AUTO_16% = 1) THEN
  1359.                     AddSectionFilesToCopyList "OleWindowsSystem", SrcDir$, DESTSYS$
  1360.               END IF
  1361.               IF OLE2_32% = 1 THEN
  1362.                     AddSectionFilesToCopyList "OleWindowsSystemWin32s", SrcDir$, DESTSYS$ + "WIN32S\"
  1363.              END IF
  1364.               IF (OLE2_16% = 1) OR (OLE2_32% = 1) OR (OLE2AUTO_16% = 1) THEN
  1365.                     AddSectionFilesToCopyList "Ole2RegWindowsSystem", SrcDir$, DESTSYS$
  1366.               END IF
  1367.               IF (OLE2AUTO_16% = 1) THEN
  1368.                     AddSectionFilesToCopyList "StdoleWindowsSystem", SrcDir$, DESTSYS$
  1369.               END IF
  1370.         END IF
  1371.  
  1372.  
  1373.         ELSEIF ftype% = CMANAGER THEN
  1374.             AddSectionFilesToCopyList "SystemFiles", SrcDir$, SYSDIR$
  1375.             ReadInfFile INF2$
  1376.             AddSectionFilesToCopyList "DriverFiles", SrcDir$, CMANAGDIR$
  1377.             IF GetListItem(STATUSTEXT$, OS)="Windows95" THEN
  1378.                 AddSectionFilesToCopyList "CM95Files", SrcDir$, WINDDIR$
  1379.             ELSE
  1380.                 AddSectionFilesToCopyList "CmanagFiles", SrcDir$, WINDDIR$
  1381.             END IF
  1382.  
  1383.             ReadInfFile INF1$
  1384.         END IF
  1385.         SrcDir$ = ""
  1386.     END IF
  1387. END SUB
  1388.  
  1389.  
  1390. '**
  1391. '** Purpose:
  1392. '**     Recalculates disk space for the given option files and sets
  1393. '**     the status info symbol "StatusItemsText".
  1394. '** Arguments:
  1395. '**     ftype% - type of files to add, one of the following:
  1396. '**             APPFILES, OPTFILES1, OPTFILES2
  1397. '** Returns:
  1398. '**     none.
  1399. '*************************************************************************
  1400. SUB RecalcOptFiles (ftype%) STATIC
  1401.      CursorSave% = ShowWaitCursor()
  1402.      ClearCopyList
  1403.      AddOptFilesToCopyList ftype%
  1404.  
  1405.     fExtra% = 0
  1406.     IF ftype% = FLEXSIGN THEN
  1407.         ListSym$ = APPNEEDS$
  1408.         IF GetListItem(CHECKSTATES$, FLEXSIGN) = "ON" THEN
  1409.             ''Add extra cost to Windows drive for ini/progman, etc.
  1410.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  1411.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  1412.             fExtra% = 1
  1413.         END IF
  1414.  
  1415.     ELSEIF ftype% = CMANAGER THEN
  1416.             ListSym$ = OPT1NEEDS$
  1417.     ELSEIF ftype% = WIN32S THEN
  1418.             ListSym$ = OPT2NEEDS$
  1419.     END IF
  1420.  
  1421.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  1422.  
  1423.     cost& = 0
  1424.     FOR i% = 1 TO 26 STEP 1
  1425.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  1426.     NEXT i%
  1427.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  1428.  
  1429.     IF StillNeed& > 0 THEN
  1430.         ReplaceListItem BIGLIST$, ftype%, "YES"
  1431.     ELSE
  1432.         ReplaceListItem BIGLIST$, ftype%, ""
  1433.     END IF
  1434.  
  1435.     IF fExtra% THEN
  1436.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  1437.     END IF
  1438.     RestoreCursor CursorSave%
  1439.     ListSym$ = ""
  1440. END SUB
  1441.  
  1442.  
  1443. '**
  1444. '** Purpose:
  1445. '**     Recalculates disk space and sets option status info according
  1446. '**     to the current destination path.
  1447. '** Arguments:
  1448. '**     none.
  1449. '** Returns:
  1450. '**     none.
  1451. '*************************************************************************
  1452. SUB RecalcPath STATIC
  1453.  
  1454.     CursorSave% = ShowWaitCursor()
  1455.  
  1456.     RecalcOptFiles FLEXSIGN
  1457.     RecalcOptFiles CMANAGER
  1458.     RecalcOptFiles WIN32S
  1459.     RestoreCursor CursorSave%
  1460. END SUB
  1461.  
  1462.  
  1463. '**
  1464. '** Purpose:
  1465. '**     Sets drive status info according to latest disk space calcs.
  1466. '** Arguments:
  1467. '**     none.
  1468. '** Returns:
  1469. '**     none.
  1470. '*************************************************************************
  1471. SUB SetDriveStatus STATIC
  1472.  
  1473.     drive$ = MID$(DEST$, 1, 1)
  1474.      ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  1475.     cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%))+ VAL(GetListItem(OPT2NEEDS$, ndrive%))
  1476.      free& = GetFreeSpaceForDrive(drive$)
  1477.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  1478.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  1479.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  1480.  
  1481.     IF drive$ = WINDRIVE$ THEN
  1482.         ReplaceListItem DRIVETEXT$, 4, ""
  1483.           ReplaceListItem DRIVETEXT$, 5, ""
  1484.         ReplaceListItem DRIVETEXT$, 6, ""
  1485.     ELSE
  1486.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  1487.         cost& = VAL(GetListItem(APPNEEDS$, ndrive%))+ VAL(GetListItem(OPT1NEEDS$, ndrive%))+ VAL(GetListItem(OPT2NEEDS$, ndrive%))
  1488.           IF cost& = 0 THEN
  1489.             ReplaceListItem DRIVETEXT$, 4, ""
  1490.             ReplaceListItem DRIVETEXT$, 5, ""
  1491.             ReplaceListItem DRIVETEXT$, 6, ""
  1492.         ELSE
  1493.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  1494.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  1495.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  1496.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  1497.         END IF
  1498.     END IF
  1499. END SUB
  1500.  
  1501.  
  1502. '**
  1503. '** Purpose:
  1504. '**     Builds the copy list and performs all installation operations.
  1505. '** Arguments:
  1506. '**     none.
  1507. '** Returns:
  1508. '**     none.
  1509. '*************************************************************************
  1510. SUB Install(OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%) STATIC
  1511.  
  1512.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  1513.  
  1514.     '' Use file layout sections that specify OLDER file version/time check
  1515.     IF OLEONLY% = 0 THEN
  1516.         AddSectionFilesToCopyList "WindowsSystem", SrcDir$, DESTSYS$
  1517.         AddSectionFilesToCopyList "WindowsSystemWin32s", SrcDir$, DESTSYS$ + "WIN32S\"
  1518.         '' Add obsolete files to be removed
  1519.       ''  AddSectionFilesToCopyList "Win32sSystemObsoleteFiles", SrcDir$, DESTSYS$ + "WIN32S\"
  1520.     END IF
  1521.  
  1522.     OLE_PROTECT% = 0
  1523.     OLEINCLUDED% = DoesFileExist( GetSymbolValue("STF_SRCDIR") + "OLE2THK.DL_", femExists )
  1524.     if OLEINCLUDED% = 1 THEN
  1525.         IF (OLE2_16% = 1) OR (OLE2AUTO_16% = 1) THEN
  1526.             IF OLE16RUNAPP% = 1 THEN
  1527.                 '' Force all OLE2 DLLS to be copied during reboot.
  1528.                 i% = SetErrorMode(-32768)
  1529.                 i% = LoadLibrary(DESTSYS$ + "compobj.dll")
  1530.                 i% = LoadLibrary(DESTSYS$ + "ole2.dll")
  1531.                 i% = LoadLibrary(DESTSYS$ + "ole2prox.dll")
  1532.                 i% = LoadLibrary(DESTSYS$ + "ole2conv.dll")
  1533.                 i% = LoadLibrary(DESTSYS$ + "storage.dll")
  1534.                 i% = LoadLibrary(DESTSYS$ + "ole2nls.dll")
  1535.                 i% = LoadLibrary(DESTSYS$ + "ole2disp.dll")
  1536.                 i% = LoadLibrary(DESTSYS$ + "typelib.dll")
  1537.                 OLE_PROTECT% = 1
  1538.             END IF
  1539.             AddSectionFilesToCopyList "OleWindowsSystem", SrcDir$, DESTSYS$
  1540.         END IF
  1541.         IF OLE2_32% = 1 THEN
  1542.             AddSectionFilesToCopyList "OleWindowsSystemWin32s", SrcDir$, DESTSYS$ + "WIN32S\"
  1543.         END IF
  1544.         IF (OLE2_16% = 1) OR (OLE2_32% = 1) OR (OLE2AUTO_16% = 1) THEN
  1545.             AddSectionFilesToCopyList "Ole2RegWindowsSystem", SrcDir$, DESTSYS$
  1546.         END IF
  1547.         IF (OLE2AUTO_16% = 1) THEN
  1548.             AddSectionFilesToCopyList "StdoleWindowsSystem", SrcDir$, DESTSYS$
  1549.         END IF
  1550.     END IF
  1551.  
  1552.     SetRestartDir GetWindowsDir()
  1553.  
  1554.     CopyFilesInCopyList
  1555.  
  1556.     IF (OLE_PROTECT% = 1) THEN
  1557.         '' Free all previously loaded libraries
  1558.         FreeLibrary GetModuleHandle("compobj")
  1559.         FreeLibrary GetModuleHandle("ole2")
  1560.         FreeLibrary GetModuleHandle("ole2prox")
  1561.         FreeLibrary GetModuleHandle("ole2conv")
  1562.         FreeLibrary GetModuleHandle("storage")
  1563.         FreeLibrary GetModuleHandle("ole2nls")
  1564.         FreeLibrary GetModuleHandle("ole2disp")
  1565.         FreeLibrary GetModuleHandle("typelib")
  1566.         OLE_PROTECT% = 0
  1567.     END IF
  1568.     IF OLEINCLUDED% AND (OLE2_16% OR OLE2_32% OR OLE2AUTO_16%) THEN
  1569.         RUN "regedit /s " + DESTSYS$ + "ole2.reg"
  1570.     END IF
  1571.  
  1572. END SUB
  1573.  
  1574. SUB UpdateSystemIni STATIC
  1575.  
  1576.     VxDPath$ = DEST32S$ + "W32S.386"
  1577.     SystemIniPath$ = GetWindowsDir()
  1578.  
  1579.     t% = MakeSystemIni(SystemIniPath$, VxdPath$)
  1580.  
  1581. END SUB
  1582.  
  1583. FUNCTION RebootSystem(OLEONLY%) STATIC AS INTEGER
  1584.  
  1585. '   Check if any files were locked during install.  If the RestartList
  1586. '   is not empty, ExitExecRestart() will restart Windows, cleanup setup
  1587. '   files, and copy over locked files before Windows restarts.
  1588.     i% = RestartListEmpty()
  1589.     IF i% = 0 THEN
  1590. '      ExitExecRestart() only returns if applications refuse to be shutdown.
  1591. '      Win32s is installed but will not operate until Windows is restarted
  1592. '      and the Win32s VxD is loaded.
  1593.        i% = ExitExecRestart()
  1594.        RebootSystem = 0
  1595.     ELSE
  1596. '      If the RestartList list is empty, it is necessary to restart windows
  1597. '      directly.  The MSSETUP program creates _MSRSTRT.EXE and _MSSETUP.BAT
  1598. '      in the restart directory.  This program should be exec'd to handle
  1599. '      proper MSSETUP cleanup (temp files) and restart Windows.
  1600.        IF (OLEONLY% = 1) THEN
  1601.            RebootSystem = 1
  1602.        ELSE
  1603.            i% = ExitWindowsExec( GetWindowsDir() + "_MSRSTRT.EXE", "_MSSETUP.BAT" )
  1604.            RebootSystem = 0
  1605.        END IF
  1606.     ENDIF
  1607.  
  1608. END FUNCTION
  1609.  
  1610.  
  1611.  
  1612. '**
  1613. '** Purpose:
  1614. '**     Appends a file name to the end of a directory path,
  1615. '**     inserting a backslash character as needed.
  1616. '** Arguments:
  1617. '**     szDir$  - full directory path (with optional ending "\")
  1618. '**     szFile$ - filename to append to directory
  1619. '** Returns:
  1620. '**     Resulting fully qualified path name.
  1621. '*************************************************************************
  1622. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  1623.     IF szDir$ = "" THEN
  1624.         MakePath = szFile$
  1625.     ELSEIF szFile$ = "" THEN
  1626.         MakePath = szDir$
  1627.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  1628.         MakePath = szDir$ + szFile$
  1629.     ELSE
  1630.         MakePath = szDir$ + "\" + szFile$
  1631.     END IF
  1632. END FUNCTION
  1633.  
  1634. FUNCTION ReducePath (szDir$) STATIC AS STRING
  1635.     c% = 0
  1636.     j% = 0
  1637.     FOR i% = LEN(szDir$) TO 1 STEP -1
  1638.         IF (MID$(szDir$, i%, 1) = "\") and (c% < 2) THEN
  1639.             c% = c% + 1
  1640.             j% = i%
  1641.         END IF
  1642.     NEXT i%
  1643.     ReducePath = MID$(szDir$, 1, j%)
  1644. END FUNCTION
  1645.  
  1646. FUNCTION GetRealWindowsSysDir STATIC AS STRING
  1647.     szBuf$ = string$(260, 32)
  1648.     cbBuf% = GetRealSystemDir(szBuf$, 260)
  1649.     IF cbBuf% = 0 THEN
  1650.         ERROR STFERR
  1651.     ELSE
  1652.         IF cbBuf% > 259 THEN
  1653.             res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
  1654.             ERROR STFERR
  1655.         END IF
  1656.         szBuf$ = RTRIM$(szBuf$)
  1657.         IF MID$(szBuf$, 1, 1) = "\" THEN
  1658.             szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
  1659.         ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
  1660.             szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
  1661.         END IF
  1662.         IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
  1663.             szBuf$ = szBuf$ + "\"
  1664.         END IF
  1665.         GetRealWindowsSysDir = szBuf$
  1666.     END IF
  1667.  
  1668.     szBuf$ = ""
  1669. END FUNCTION
  1670.  
  1671. SUB UpdateWinG32 (szOrig$) STATIC
  1672.     '
  1673.     ' Here we check the version ourselves of wing32.dll, since 
  1674.     ' we can't get version checking for Win32 apps from Win16
  1675.     '
  1676.     FileNew$ = MakePath(szOrig$, "wing32.dll")
  1677.     FileOrig$ = MakePath(szOrig$, "wing32.xxx")
  1678.     IF IsWin32FileNewer( FileOrig$, FileNew$ ) THEN
  1679.     RemoveFile FileOrig$, cmoForce
  1680.     ELSE
  1681.         RemoveFile FileNew$, cmoForce        ' get rid of new file
  1682.     RenameFilePlease FileOrig$,FileNew$    ' put back old file
  1683.     END IF
  1684. END SUB
  1685.  
  1686.