home *** CD-ROM | disk | FTP | other *** search
/ Computer Tool Software / soft.iso / Scanner / HP / SCAN4C2.ZIP / SCANJET.MS_ / SCANJET.MS
Encoding:
Text File  |  1995-02-28  |  41.8 KB  |  1,502 lines

  1. '**************************************************************************
  2. '*                    HP ScanJet/DeskScan II v2.2 Setup
  3. '*
  4. '* (c) Copyright Hewlett-Packard Company, 1991-1995.
  5. '* All rights are reserved. Copying or other reproduction of
  6. '* this program except for archival purposes is prohibited
  7. '* without the prior written consent of Hewlett-Packard Company.
  8. '*
  9. '*                   RESTRICTED RIGHTS LEGEND
  10. '*
  11. '* Use, duplication, or disclosure by the Government is subject to 
  12. '* restrictions as set forth in paragraph (b) (3) (B) of the Rights 
  13. '* in Technical Data and Computer Software clause in DAR 7-104.9(a).
  14. '*
  15. '* HEWLETT-PACKARD COMPANY
  16. '* Greeley, Colorado
  17. '*
  18. '**************************************************************************
  19.  
  20.  
  21. ''$DEFINE DEBUG                      '' Define for script development/debugging
  22.  
  23. '$INCLUDE 'setupapi.inc'
  24. '$INCLUDE 'ds2util.inc'
  25. '$INCLUDE 'msdetect.inc'
  26.  
  27.  
  28. '' ********** CONSTANTS **********
  29.  
  30. '' ***** Bitmap ID from DIALOGS.RC *****
  31.  
  32. CONST LOGO                             = 1
  33.  
  34. '' ***** Dialog ID's *****
  35.  
  36. CONST WELCOME                        = 100
  37. CONST ASKQUIT                        = 200
  38. CONST DESTPATH                        = 300
  39. CONST EXITFAILURE                    = 400
  40. CONST EXITQUIT                        = 600
  41. CONST EXITSUCCESS                    = 700
  42. CONST OPTIONS                        = 800
  43. CONST APPHELP                        = 900
  44. CONST APPHELP1                        = 901
  45. CONST APPHELP2                        = 902
  46. CONST APPHELP3                        = 903
  47. CONST APPHELP4                        = 904
  48. CONST APPHELP5                        = 905
  49. CONST APPHELP6                        = 906
  50.  
  51. CONST MODIFYCONFIG                = 1010
  52. CONST MODIFYSYSTEMINI            = 1020
  53. CONST INSERTREF                    = 1050
  54. CONST REMOVEHIPERF                = 1060
  55. CONST HIPERFNAMES                    = 1070
  56. CONST MODIFYIICSYSTEMINI        = 1080
  57.  
  58. CONST GROUPLIST                    = 2000
  59. CONST CARDOPTIONS                    = 2010
  60. CONST ERRORSPACE                    = 2030
  61.  
  62. CONST CHECK                            = 2500
  63.  
  64. CONST CUSTINST                        = 6200
  65. CONST BADPATH                        = 6400
  66.  
  67. CONST CDCONFIRMINFO                = 7300
  68.  
  69. CONST ERR_WINDOWSVERSION        = 8000
  70. CONST ERR_WINDOWSMODE            = 8001
  71. CONST ERR_CORRUPTSOURCES        = 8002
  72. CONST ERR_DOSVERSION                = 8003
  73.  
  74. CONST STR_OPTIONALSCSICARD        = 8100
  75. CONST STR_DIR                        = 8101
  76. CONST STR_PROGMANGROUP            = 8102
  77. CONST STR_SCANNER                    = 8103
  78. CONST STR_INTERFACECARD            = 8104
  79. CONST STR_SCSIADDRESS            = 8105
  80. CONST STR_SCANNERTEST            = 8106
  81. CONST STR_READMETXT                 = 8107
  82. CONST STR_SJPLUSCARD                = 8108
  83. CONST STR_GROUPSTRING            = 8109
  84. CONST STR_DESKSCAN             = 8110
  85. CONST STR_HPSCREENCALIBRATION = 8111
  86. CONST STR_SETUP                = 8112
  87. CONST STR_TITLE                = 8113
  88. CONST STR_HPINTERFACECARD      = 8114
  89. CONST STR_ABOUT1               = 8115
  90. CONST STR_ABOUT2               = 8116
  91. CONST STR_EISA                 = 8117
  92. CONST STR_MCA                  = 8118
  93. CONST STR_ISA                  = 8119
  94. CONST STR_NOTEPADEXE           = 8120
  95. CONST STR_HPDSINI                    = 8121
  96.  
  97.  
  98.  
  99. '' ***** GLOBALS *****
  100.  
  101. GLOBAL ExtraCosts$                '' List of extra costs to add per drive.
  102. GLOBAL DestCost&                    '' Calc'd disk space required to install files
  103. GLOBAL WinCost&                    '' 
  104. GLOBAL DestFree&                    '' Amount of free space on the destination disk
  105. GLOBAL WinFree&                    '' 
  106.  
  107. GLOBAL DriversList$
  108.  
  109. GLOBAL ASPIFound%
  110. GLOBAL CAMFound%
  111.  
  112. GLOBAL MajVer%                            '' Major version number (Windows or DOS)
  113. GLOBAL MinVer%                            '' Minor version number (Windows or DOS)
  114. GLOBAL WinMode%
  115.  
  116. GLOBAL WinDir$                            '' Windows directory.
  117. GLOBAL TwainDir$                        '' Directory for the TWAIN Data Source.
  118.  
  119. GLOBAL DEST$                            '' Default destination directory.
  120. GLOBAL OptScanner(2) AS STRING    '' Scanner installation option.
  121. GLOBAL ScannerPick$                    '' Text for 'ScannerChoice'.
  122. GLOBAL ScannerChoice%                '' 1 for ScanJet II or 3 family,
  123.                                              '' 2 for ScanJet Plus,
  124. GLOBAL AskModSysIni%                    '' 1 if the SYSTEM.INI file should be mod'd
  125. GLOBAL ConfigFile$
  126.  
  127. GLOBAL OPTSETUP$                        '' Setup type option selection.
  128. GLOBAL OPTCard$                        '' Option to use existing card.
  129. GLOBAL OPTCardText(3) AS STRING    '' Text for selected card option.
  130. GLOBAL DEFAULTGROUP$                    '' Default group name.
  131. GLOBAL GROUP$                            '' Selected group name.
  132. GLOBAL SystemArchitecture$            '' Detected architecture.
  133. GLOBAL LISTMADE%                        '' True if group names list has been
  134.                                             '' made, False otherwise.
  135. GLOBAL DS2Cui$
  136.  
  137. ''GLOBAL MUSTREBOOT%                    '' 1 if CONFIG.SYS or SYSTEM.INI modified.
  138. ''                                            '' 0 if neither file modified.
  139. ''GLOBAL MANUALMOD%                        '' 1 if user must modify SYSTEM.INI or
  140. ''                                            '' CONFIG.SYS.  0 if not needed.
  141.  
  142.  
  143. '' ***** SUBROUTINES *****
  144.  
  145. DECLARE SUB Install
  146. DECLARE SUB MyRemoveFiles
  147. DECLARE SUB CalcCopyCost
  148. DECLARE SUB MakeCopyList
  149. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  150.  
  151.  
  152. ''***************************************************************************
  153. ''***********                 BEGINNING OF SCRIPT                  **********
  154. ''***************************************************************************
  155.  
  156. INIT:
  157.     dim dlg%
  158.     errStr$     = STRING$(256,0)
  159.     Setup$      = STRING$(128,0)
  160.     DS2Cui$     = "ds2cui.dll"        '' Custom UI stuff for DS2
  161. ''    MUSTREBOOT% = 0
  162. ''    MANUALMOD%  = 0
  163.  
  164.  
  165.     i% = AcquireString(STR_SETUP, Setup$, 128)
  166.  
  167.     About1$ = STRING$(256,0)
  168.     i% = AcquireString(STR_ABOUT1, About1$, 256)
  169.  
  170.     About2$ = STRING$(128,0)
  171.     i% = AcquireString(STR_ABOUT2, About2$, 128)
  172.  
  173.     SetAbout About1$, About2$
  174.  
  175.     About1$ = STRING$(0,0)                    '' release string's memory
  176.     About2$ = STRING$(0,0)
  177.     
  178.  
  179.     ''    Verify DOS version:  Must be DOS 5.0 or better...
  180.  
  181.     MajVer% = GetDOSMajorVersion()
  182.     MinVer% = GetDOSMinorVersion()
  183.  
  184.     IF (MajVer% < 5) THEN
  185.         i%   = FAcquireString(ERR_DOSVERSION, errStr$, 256)
  186.         i%   = DoMsgBox(errStr$, Setup$, MB_TASKMODAL+MB_ICONHAND+MB_OK)
  187.         dlg% = EXITFAILURE
  188.         GOTO QUITL1
  189.     END IF
  190.  
  191.  
  192.     ''    Verify Windows version and mode:  Must be Windows 3.1 or better...
  193.  
  194.     MajVer% = GetWindowsMajorVersion()
  195.     MinVer% = GetWindowsMinorVersion()
  196.  
  197.     IF (MajVer% < 3) OR ((MajVer% = 3) AND (MinVer% < 1)) THEN
  198.         i%   = FAcquireString(ERR_WINDOWSVERSION, errStr$, 256)
  199.         i%   = DoMsgBox(errStr$, Setup$, MB_TASKMODAL+MB_ICONHAND+MB_OK)
  200.         dlg% = EXITFAILURE
  201.         GOTO QUITL1
  202.     END IF
  203.  
  204.     WinMode% = GetWindowsMode()
  205.  
  206.     IF WinMode% = 0 THEN
  207.         i%   = AcquireString(ERR_WINDOWSMODE, errStr$, 256)
  208.         i%   = DoMsgBox(errStr$,  Setup$, MB_TASKMODAL+MB_ICONHAND+MB_OK)
  209.         dlg% = EXITFAILURE
  210.         GOTO QUITL1
  211.     END IF
  212.  
  213.  
  214.     ''    Display main window frame maximized.
  215.  
  216.     dim hWnd%
  217.     dim j%
  218.  
  219.     hWnd% = HwndFrame()
  220.     j%    = MoveWindow(hWnd%, 0, 0, GetScreenWidth(), GetScreenHeight(), 0) 
  221.  
  222.  
  223.     ''    Create place holders for setup information that will be displayed
  224.     ''    in a "ConfirmInfo" dialog.  One "AddListItem" is needed for each
  225.     ''    piece of data that will be displayed.  The NULLs will be replaced
  226.     ''    based on information entered by the user.
  227.  
  228.     AddListItem "ConfirmTextIn", ""
  229.     AddListItem "ConfirmTextIn", ""
  230.     AddListItem "ConfirmTextIn", ""
  231.     AddListItem "ConfirmTextIn", ""
  232.     AddListItem "ConfirmTextIn", ""
  233.     AddListItem "ConfirmTextIn", ""
  234.  
  235.  
  236.     '' Initialize a bunch of variables and strings and stuff...
  237.  
  238.     OptScanner(0)  = "ScanJet IIp, IIc, IIcx, 3p, 3c "
  239. ''    OptScanner(0)  = "ScanJet IIp, IIc, IIcx, 3p "
  240.     OptScanner(1)  = "ScanJet Plus "
  241.     ScannerChoice% = 1                '' ScanJet II or 3 family
  242.     ScannerPick$   = OptScanner(ScannerChoice% - 1)
  243.     
  244.     DriversList$        = "SJDrivers"
  245.     SystemArchitecture$ = "ISA"
  246.     SetSymbolValue "SystemArchitecture", SystemArchitecture$
  247.  
  248.     AddListItem DriversList$, "SJDRIVER.SYS"    
  249.     AddListItem DriversList$, "MINI400I.SYS"    
  250.     AddListItem DriversList$, "SJIIX.SYS"    
  251.     AddListItem DriversList$, "SJII.SYS"
  252.  
  253.     SetSymbolValue "SJIIDriverFound",    "0"    '' "1" if HP SCSI card found
  254.     SetSymbolValue "RemingtonCardFound", "0"    '' "1" if Remington is found
  255.     SetSymbolValue "WIN31VxD",           "WIN400I.386"
  256.     SetSymbolValue "ScannerVxD",         "HPSCANR.386"
  257.     SetSymbolValue "InstalledCard",      "0"
  258.     
  259.     WinDir$ = GetWindowsDir()
  260.  
  261.     SetSymbolValue "ConfigTemp",    "C:\CONFIG.TMP"    
  262.     SetSymbolValue "AutoexecTemp",  "C:\AUTOEXEC.TMP"
  263.     SetSymbolValue "SysIniTemp",    WinDir$+"SYSTEM.TMP"    
  264.     SetSymbolValue "SysIniThrowAwayFile", WinDir$+"SYSTEM.HP~"
  265.     
  266.     SetSymbolValue "ConfigBackup",  "C:\CONFIG.HP"    
  267.     SetSymbolValue "AutoexecBackup","C:\AUTOEXEC.HP"    
  268.     SetSymbolValue "SysIniBackup",  WinDir$+"SYSTEM.HP"    
  269.  
  270.     HELPPROC$  = "FHelpDlgProc"    '' Define Help procedures
  271.     HELP1PROC$ = "FHelp1DlgProc"
  272.     HELP2PROC$ = "FHelp2DlgProc"
  273.     HELP3PROC$ = "FHelp3DlgProc"
  274.     HELP4PROC$ = "FHelp4DlgProc"
  275.     HELP5PROC$ = "FHelp5DlgProc"
  276.     HELP6PROC$ = "FHelp6DlgProc"
  277.  
  278.  
  279.     '' Set up the background bitmap and the window title...
  280.  
  281.     SetBitmap DS2Cui$, LOGO
  282.     Title$ = STRING$(64,0)
  283.     i%     = AcquireString(STR_TITLE, Title$, 64)
  284.     SetTitle Title$
  285.     Title$ = STRING$(0,0)
  286.  
  287.  
  288.     ''    Handle the .INF file...
  289.  
  290.     szInf$ = STRING$(144,0)
  291.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  292.  
  293.     IF szInf$ = "" THEN                '' Get the PATH for the .INF file...
  294.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SCANJET.INF"
  295.     END IF
  296.  
  297.     ReadInfFile szInf$                '' Read the .INF file..
  298.     szInf$ = STRING$(0,0)
  299.  
  300.  
  301.  
  302.     '' Some more initialization stuff...
  303.  
  304.     groupStr$     = STRING$(64,0)
  305.     i%            = AcquireString(STR_GROUPSTRING, groupStr$, 64)
  306.     DEFAULTGROUP$ = groupStr$
  307.     GROUP$        = DEFAULTGROUP$
  308.     groupStr$     = STRING$(0,0)
  309.  
  310.     LISTMADE% = 0
  311.     OPTSETUP$ = "1"
  312.     OPTCard$  = "1"                    '' HP SCSI card (Remington or Fred)
  313.     SetSymbolValue "OPTCard", OPTCard$
  314.  
  315.     '' Initialize the Interface Card Name String array...
  316.  
  317.     cardStr$       = STRING$(256,0)
  318.     i% = AcquireString(STR_HPINTERFACECARD, cardStr$, 256)
  319.     OPTCardText(0) = cardStr$
  320.     i% = AcquireString(STR_OPTIONALSCSICARD, cardStr$, 256)
  321.     OPTCardText(1) = cardStr$
  322.     i% = AcquireString(STR_SJPLUSCARD, cardStr$, 256)
  323.     OPTCardText(2) = cardStr$
  324.     cardStr$       = STRING$(0,0)
  325.  
  326.     ASPIFound% = 0
  327.  
  328.     DEST$     = "C:\DESKSCAN"
  329.     TwainDir$ = WinDir$ + "TWAIN\"  
  330.     SetSymbolValue "InstallDir", DEST$
  331.     SetSymbolValue "TwainDir",   TwainDir$
  332.  
  333.     AddListItem "SettingsTextIn", DEST$
  334.     AddListItem "SettingsTextIn", GROUP$
  335.     AddListItem "SettingsTextIn", OPTCardText(0)
  336.     AddListItem "SettingsTextIn", OptScanner(0)
  337.  
  338.     AddListItem "DiskSpaceData", MID$(DEST$, 1, 2)
  339.     AddListItem "DiskSpaceData", ""
  340.     AddListItem "DiskSpaceData", ""
  341.     AddListItem "DiskSpaceData", MID$(WinDir$, 1, 2)
  342.     AddListItem "DiskSpaceData", ""
  343.     AddListItem "DiskSpaceData", ""
  344.  
  345.     DestCost& = 0
  346.     WinCost&  = 0
  347.     DestFree& = 0
  348.     WinFree&  = 0
  349.  
  350.  
  351.  
  352. WELCOME:
  353.     '' **********************
  354.     '' *** Welcome dialog ***
  355.     '' **********************
  356.     dim sz$                                '' dynamic-length string
  357.     sz$ = UIStartDlg(DS2Cui$, WELCOME, "FInfoDlgProc", APPHELP6, HELP6PROC$)
  358.  
  359.     IF sz$ = "CONTINUE" THEN        '' Pressed the "Continue" button
  360.         UIPop 1
  361.  
  362.     ELSEIF sz$ = "REACTIVATE" THEN
  363.         GOTO WELCOME
  364.  
  365.     ELSE                                    '' Pressed the "Exit" button
  366. ''        UIPop 1
  367.         GOSUB ASKQUIT
  368.         GOTO WELCOME
  369.     END IF
  370.  
  371.     IF IsItEISA = 1 THEN                ''    Get information about the system.
  372.         SystemArchitecture$ = "EISA"
  373.         EISAStr$ = STRING$(128,0)
  374.         i% = AcquireString(STR_EISA, EISAStr$, 128)
  375.         SetSymbolValue "SystemArchitecture", EISAStr$
  376.         EISAStr$ = STRING$(0,0)
  377.  
  378.     ELSEIF IsItMCA = 2 THEN
  379.         SystemArchitecture$ = "MCA"
  380.         MCAStr$ = STRING$(128,0)
  381.         i% = AcquireString(STR_MCA, MCAStr$, 128)
  382.         SetSymbolValue "SystemArchitecture", MCAStr$
  383.         MCAStr$ = STRING$(0,0)
  384.  
  385.     ELSE
  386.         SystemArchitecture$ = "ISA"
  387.         ISAStr$ = STRING$(128,0)
  388.         i% = AcquireString(STR_ISA, ISAStr$, 128)
  389.         SetSymbolValue "SystemArchitecture", ISAStr$
  390.         ISAStr$ = STRING$(0,0)
  391.     END IF
  392.  
  393.  
  394.     ASPIFound% = FindASPI
  395.     CAMFound%  = FindCAM
  396.  
  397.  
  398.  
  399.  
  400. CHOOSESCANNER:        '' Select which scanner(s) is/are being installed.
  401.     ScannerPick$ = ""
  402.     ScannerChoice% = 0
  403.  
  404. CHOOSESCANNERL1:    '' Is the scanner a ScanJet Plus or ScanJet II/3 family?
  405.     '' ********************************
  406.     '' *** Scanner Selection dialog ***
  407.     '' ********************************
  408.     sz$ = UIStartDlg(DS2Cui$, OPTIONS, "FRadioDlgProc", APPHELP1, HELP1PROC$)
  409.     szChoice$ = GetSymbolValue("ButtonChecked")
  410.  
  411.  
  412.     IF (szChoice$ = "1") THEN
  413.         ScannerChoice% = 1            '' ScanJet II or 3 family Scanner
  414.         IF (FCheckForRemington() <> 0) THEN
  415.             SetSymbolValue "RemingtonCardFound", "1"
  416.             SetSymbolValue "InstalledCard", "3"
  417.         ELSE
  418.             SetSymbolValue "InstalledCard", "4"
  419.         ENDIF
  420.         '' We decide in the ds2cui.c:ModifyConfig() routine whether the 
  421.         '' interface card is a Remington or Fred card and (i would think)
  422.         '' set OPTCard$ accordingly (though I haven't found the code that
  423.         '' does it yet--klb 940607).
  424.  
  425.     ELSE
  426.         OPTCard$       = "3"            '' ScanJet Plus Card
  427.         ScannerChoice% = 2            '' ScanJet Plus Scanner
  428.         SetSymbolValue "InstalledCard", "1"
  429.         SetSymbolValue "OPTCard", OPTCard$
  430.         ReplaceListItem "SettingsTextIn", 3, OPTCardText(2)
  431.         ReplaceListItem "SettingsTextIn", 4, OptScanner(ScannerChoice% - 1)
  432.     END IF
  433.  
  434.     ScannerPick$ = OptScanner(ScannerChoice% - 1)
  435.  
  436.     IF sz$ = "CONTINUE" THEN        '' Pressed the "Continue" button
  437.         UIPop 1
  438.         MakeCopyList                    '' Build the default file copy list
  439.         CalcCopyCost                    ''    Compute req'd disk space
  440.         GOTO OPTION
  441.     
  442.     ELSEIF sz$ = "REACTIVATE" THEN
  443.         GOTO CHOOSESCANNERL1
  444.  
  445.     ELSE                                    '' Pressed the "Exit" button
  446.          GOSUB ASKQUIT
  447.         GOTO CHOOSESCANNER
  448.     END IF
  449.  
  450.  
  451.  
  452. OPTION:            ''    Installation Settings confirmation dialog
  453.                     
  454. OPTL1:
  455.     '' ************************************
  456.     '' *** Installation Settings dialog *** 
  457.     '' ************************************
  458.     sz$ = UIStartDlg(DS2Cui$, CUSTINST, "FCustomOptDlgProc", APPHELP2, HELP2PROC$)
  459.  
  460.     OPTSETUP$ = GetSymbolValue("ButtonChecked")
  461.     UIPop 1    
  462.  
  463.     IF sz$ = "CONTINUE" THEN            '' Pressed the 'Continue' button
  464.         OPTSETUP$ = "1"
  465.  
  466.     ELSEIF sz$ = "REACTIVATE" THEN
  467.         GOTO OPTL1
  468.  
  469.     ELSEIF sz$ = "CUSTOM" THEN            '' Pressed the 'Modify' button
  470.         OPTSETUP$ = "2"
  471.  
  472.     ELSE                                        '' Pressed the 'Exit' button
  473.         UIPop 1
  474.          GOSUB ASKQUIT
  475.         GOTO OPTION
  476.     END IF
  477.  
  478.  
  479. CHECKDISKSPACE:    '' for the quick path, we still need to check disk space
  480.  
  481.     IF (OPTSETUP$ = "1") THEN
  482.         IF DestFree& < DestCost& THEN
  483.             '' **************************************
  484.             '' *** Insufficient Disk Space Dialog ***
  485.             '' **************************************
  486.             sz$ = UIStartDlg(DS2Cui$, ERRORSPACE, "FDiskErrorDlgProc", 0, "")
  487.  
  488.             IF sz$ = "EXIT" THEN            '' Pressed the "Exit" button
  489.                 GOSUB ASKQUIT
  490.                 GOTO CHECKDISKSPACE
  491.  
  492.             ELSEIF sz$ = "REACTIVATE" THEN
  493.                 GOTO CHECKDISKSPACE
  494.  
  495.             ELSE                                '' Pressed the "OK" button
  496.                  UIPop 2
  497.                 GOTO GETPATH
  498.             END IF
  499.  
  500.         ELSE
  501.             UIPop 1
  502.         END IF
  503.  
  504.         GOTO STARTINSTALL
  505.     END IF
  506.  
  507.  
  508.  
  509. GETPATH:
  510.     SetSymbolValue "EditTextIn", DEST$
  511.     SetSymbolValue "EditFocus", "END"
  512.  
  513. GETPATHL1:
  514.     '' ***********************************************
  515.     '' *** Installation Directory Selection dialog ***
  516.     '' ***********************************************
  517.     sz$   = UIStartDlg(DS2Cui$, DESTPATH, "FEditDlgProc", APPHELP3, HELP3PROC$)
  518.     DEST$ = LTRIM$(RTRIM$(GetSymbolValue("EditTextOut")))
  519.  
  520.     SetSymbolValue "InstallDir", DEST$
  521.  
  522.     IF sz$ = "CONTINUE" THEN
  523.         IF IsDirWritable(DEST$) = 0 THEN
  524.             GOSUB BADPATH
  525.             GOTO GETPATHL1
  526.         END IF
  527.         MakeCopyList                    '' disk or directory may have changed
  528.         CalcCopyCost                    '' target disk may have changed
  529.         GOTO TESTSPACE
  530.  
  531.     ELSEIF sz$ = "REACTIVATE" THEN
  532.         GOTO GETPATHL1
  533.  
  534.     ELSEIF sz$ = "BACK" THEN
  535.         UIPop 1
  536.         GOTO OPTION
  537.  
  538.     ELSE
  539.         UIPop 1
  540.         GOSUB ASKQUIT
  541.         GOTO GETPATH
  542.     END IF
  543.  
  544.     
  545.  
  546.  
  547. TESTSPACE:
  548.     IF (DestFree& < DestCost&) THEN
  549.         '' **************************************
  550.         '' *** Insufficient Disk Space Dialog ***
  551.         '' **************************************
  552.         sz$ = UIStartDlg(DS2Cui$, ERRORSPACE, "FDiskErrorDlgProc", 0, "")
  553.  
  554.         IF sz$ = "EXIT" THEN            '' Pressed the "Exit" button
  555.             GOSUB ASKQUIT
  556.             GOTO TESTSPACE
  557.  
  558.         ELSEIF sz$ = "REACTIVATE" THEN
  559.             GOTO TESTSPACE
  560.  
  561.         ELSE                                '' Pressed the "OK" button
  562.              UIPop 2
  563.             GOTO GETPATH
  564.         END IF
  565.  
  566.     ELSE
  567.         UIPop 1                            '' is this needed?  klb 940615
  568.     END IF
  569.  
  570.     '' If express setup and did the destination because of a disk space 
  571.     '' problem, then we need to go do the installation.
  572.  
  573.     IF OPTSETUP$ = "1" THEN
  574.         GOTO STARTINSTALL
  575.     END IF
  576.  
  577.  
  578.  
  579. GETGROUPNAME:
  580.     IF LISTMADE% = 0 THEN
  581.         AddListItem "ListGroupsIn", DEFAULTGROUP$
  582.         LISTMADE% = 1
  583.     END IF
  584.  
  585.     SetSymbolValue "ListGroupsOut", DEFAULTGROUP$
  586.  
  587. GETGROUPNAMEL1:
  588.     '' *******************************************
  589.     '' *** Select Program Manager Group dialog ***
  590.     '' *******************************************
  591.     sz$    = UIStartDlg(DS2Cui$, GROUPLIST, "FGroupsDlgProc", APPHELP4, HELP4PROC$)
  592.  
  593.     GROUP$ = GetSymbolValue("EditGroupOut")
  594.  
  595.     IF sz$ = "CONTINUE" THEN
  596.         UIPop 1
  597.         GOTO CARDOPTION
  598.  
  599.     ELSEIF sz$ = "REACTIVATE" THEN
  600.         GOTO GETGROUPNAMEL1
  601.  
  602.     ELSEIF sz$ = "BACK" THEN
  603.         UIPop 1
  604.         GOTO GETPATH
  605.  
  606.     ELSE
  607.         UIPop 1
  608.         GOSUB ASKQUIT
  609.         GOTO GETGROUPNAME
  610.     END IF
  611.  
  612.  
  613.  
  614. CARDOPTION:
  615.     IF (ScannerChoice% = 2) THEN            '' ScanJet Plus == 2
  616.         OPTCard$ = "3"                            '' ScanJet Plus interface card
  617.         SetSymbolValue "InstalledCard", "1"
  618.         SetSymbolValue "OPTCard", OPTCard$
  619.         SetSymbolValue "RemingtonCardFound", "0"
  620.         GOTO CONFIRMINFO                        '' already know the card so skip the dlg
  621.     END IF
  622.  
  623.     SetSymbolValue "RadioDefault", OPTCard$
  624.  
  625. CARDOPTIONL1:                 
  626.     '' *********************************************
  627.     '' *** Scanner Interface Card Options dialog ***
  628.     '' *********************************************
  629.     sz$ = UIStartDlg(DS2Cui$, CARDOPTIONS, "FCardOptDlgProc", APPHELP5, HELP5PROC$)
  630.  
  631.    OPTCard$ = GetSymbolValue("ButtonChecked")
  632.  
  633.     SetSymbolValue "OPTCard", OPTCard$
  634.  
  635.     IF sz$ = "CONTINUE" THEN
  636.         UIPop 1
  637.         IF OPTCard$ = "1" THEN
  638.             IF (FCheckForRemington() <> 0) THEN
  639.                 SetSymbolValue "InstalledCard", "3"
  640.                 SetSymbolValue "RemingtonCardFound", "1"
  641.             ELSE
  642.                 SetSymbolValue "InstalledCard", "4"
  643.             ENDIF
  644.  
  645.         ELSEIF OPTCard$ = "2" THEN
  646.             SetSymbolValue "InstalledCard", "0"
  647.             SetSymbolValue "RemingtonCardFound", "0"
  648.         END IF
  649.         GOTO CONFIRMINFO
  650.  
  651.     ELSEIF sz$ = "REACTIVATE" THEN
  652.         GOTO CARDOPTIONL1
  653.  
  654.     ELSEIF sz$ = "BACK" THEN
  655.         UIPop 1
  656.         GOTO GETGROUPNAME
  657.  
  658.     ELSE
  659.         UIPop 1
  660.          GOSUB ASKQUIT
  661.         GOTO CARDOPTION
  662.     END IF
  663.  
  664.  
  665.  
  666. CONFIRMINFO:
  667.     genericStr$ = STRING$(64,0)
  668.     i% = AcquireString(STR_DIR, genericStr$, 64)
  669.     ReplaceListItem "ConfirmTextIn", 1, genericStr$+":  "+DEST$
  670.  
  671.     i% = AcquireString(STR_PROGMANGROUP, genericStr$, 64)
  672.     ReplaceListItem "ConfirmTextIn", 2, genericStr$+":  "+GROUP$
  673.  
  674.     i% = AcquireString(STR_SCANNER, genericStr$, 64)
  675.     ReplaceListItem "ConfirmTextIn", 3, genericStr$+":   "+ScannerPick$
  676.  
  677.     i% = AcquireString(STR_INTERFACECARD, genericStr$, 64)
  678.     IF OPTCard = "1" THEN
  679.         ReplaceListItem "ConfirmTextIn", 4, genericStr$+":   "+OPTCardText(0)
  680.  
  681.     ELSEIF OPTCard = "2" THEN    
  682.         ReplaceListItem "ConfirmTextIn", 4, genericStr$+":   "+OPTCardText(1)
  683.  
  684.     ELSEIF OPTCard = "3" THEN
  685.         ReplaceListItem "ConfirmTextIn", 4, genericStr$+":   "+OPTCardText(2)
  686.  
  687.     ELSE
  688.         ReplaceListItem "ConfirmTextIn", 4, genericStr$+":   "+OPTCardText(0)
  689.     END IF
  690.  
  691.     genericStr$ = STRING$(0,0)
  692.  
  693.  
  694.     '' *******************************
  695.     '' *** Verify Settings dialogs ***
  696.     '' *******************************
  697.     sz$ = UIStartDlg(DS2Cui$, CDCONFIRMINFO, "FConfirmDlgProc", 0, "")
  698.  
  699.     IF sz$ = "CONTINUE" THEN
  700.         UIPop 1
  701.         GOTO STARTINSTALL
  702.  
  703.     ELSEIF sz$ = "REACTIVATE" THEN
  704.         GOTO CONFIRMINFO
  705.  
  706.     ELSEIF sz$ = "BACK" THEN
  707.         UIPop 1
  708.         GOTO GETPATH
  709.     END IF
  710.  
  711.  
  712.  
  713. STARTINSTALL:        ''    Begin installation
  714.     Install            '' Call the installation control subroutine
  715.  
  716.  
  717.  
  718. QUIT:
  719.     ON ERROR GOTO ERRQUIT
  720.     dlg% = 0
  721.     
  722.     IF ERR = 0 THEN
  723. ''        IF AskModSysIni% = 0 THEN
  724. ''            dlg% = EXITSUCCESS1        '' Don't tell them to reboot
  725. ''        ELSE
  726.             dlg% = EXITSUCCESS        '' Tell them to reboot
  727. ''        END IF            
  728.  
  729.     ELSEIF ERR = STFQUIT THEN
  730.         dlg% = EXITQUIT
  731.  
  732.     ELSE
  733.         dlg% = EXITFAILURE
  734.     END IF
  735.  
  736. QUITL1:
  737.     '' *********************************************************************
  738.     '' The dialog that's displayed depends on the value of dlg% set in QUIT:
  739.     '' *********************************************************************
  740.     sz$ = UIStartDlg(DS2Cui$, dlg%, "FInfo0DlgProc", 0, "")
  741.  
  742.     IF sz$ = "REACTIVATE" THEN
  743.         GOTO QUITL1
  744.     END IF
  745.  
  746.     UIPop 1
  747.  
  748.  
  749.  
  750. ALL_DONE:                                '' Check whether README.TXT got copied.
  751.                                             '' If not, don't bother trying to show it.
  752.     ReadmeTxtStr$ = STRING$(16,0)
  753.     i% = AcquireString(STR_READMETXT, ReadmeTxtStr$, 16)
  754.     i% = DoesFileExist(MakePath(DEST$, ReadmeTxtStr$), femExists)
  755.  
  756.     IF i% = 1 THEN 
  757.         NotePadExeStr$ = STRING$(16,0)
  758.         i% = AcquireString(STR_NOTEPADEXE, NotePadExeStr$, 16)
  759.         RUN NotePadExeStr$+" "+MakePath(DEST$, ReadmeTxtStr$), NOWAIT
  760.         NotePadExeStr$ = STRING$(0,0)
  761.     END IF
  762.  
  763.     ReadmeTxtStr$ = STRING$(0,0)
  764.     errStr$       = STRING$(0,0)
  765.  
  766.     MyRemoveFiles                        '' Delete installer files not used by Bamm-Bamm.
  767.  
  768.      END                                    '' This is an exit point for the script.
  769.  
  770.  
  771.  
  772. ERRQUIT:
  773.     i% = AcquireString(ERR_CORRUPTSOURCES, errStr$, 256)
  774.     i% = DoMsgBox(errStr$, Setup$, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  775.  
  776.     errStr$ = STRING$(0,0)
  777.  
  778.     MyRemoveFiles                        '' Delete installer files not used by Bamm-Bamm.
  779.  
  780.     END                                    '' This is an exit point for the script.
  781.  
  782.  
  783.  
  784. BADPATH:
  785.     '' **********************************************
  786.     '' *** Unknown Path or Directory Error dialog ***
  787.     '' **********************************************
  788.     sz$ = UIStartDlg(DS2Cui$, BADPATH, "FInfo0DlgProc", 0, "")
  789.  
  790.     IF sz$ = "REACTIVATE" THEN
  791.         GOTO BADPATH
  792.  
  793.     ELSE
  794.         UIPop 1                            '' Only one button--Pop the error alert
  795.     END IF
  796.  
  797.     RETURN
  798.  
  799.  
  800.  
  801. ASKQUIT:
  802.     '' *******************************
  803.     '' *** Incomplete Setup dialog ***
  804.     '' *******************************
  805.     sz$ = UIStartDlg(DS2Cui$, ASKQUIT, "FQuitDlgProc", 0, "")
  806.  
  807.     IF sz$ = "EXIT" THEN                '' Pressed the "Quit" button
  808.         UIPopAll
  809.         ERROR STFQUIT
  810.  
  811.     ELSEIF sz$ = "REACTIVATE" THEN
  812.         GOTO ASKQUIT
  813.  
  814.     ELSE
  815.         UIPop 1                            '' Pressed the "Back" button--Pop the error alert
  816.     END IF
  817.  
  818.     RETURN
  819.  
  820. '' ****************************************
  821. '' ********** END OF MAIN SCRIPT **********
  822. '' ****************************************
  823.  
  824.  
  825.  
  826. '*************************************************************************
  827. '** Subroutine: CalcCopyCost
  828. '** Purpose:    Computes the amount of disk space needed to copy the files
  829. '**             the files in the copy list.
  830. '** Arguments:     none.
  831. '** Returns:     none.
  832. '*************************************************************************
  833. SUB CalcCopyCost STATIC
  834.  
  835.     '' How much disk space will we need to copy all these files?
  836.  
  837.     CostPerDisk$ = "CostPerDisk"
  838.     StillNeed&   = GetCopyListCost(ExtraCosts$, CostPerDisk$,"")
  839. ''    DestCost&    = 1536000                '' 1.5 MB required to install Bamm-Bamm
  840.     DestCost&    = 0
  841.     WinCost&     = 0
  842.     cost&        = 0
  843.  
  844.     FOR i% = 1 to 26 STEP 1
  845.         cost& = VAL(GetListItem(CostPerDisk$, i%))
  846.  
  847. '$IFDEF DEBUG
  848. ''    k% = DoMsgBox("drive ("+CHR$(i% + ASC("A")-1)+") cost ("+str$(cost&)+").", "Copy Costs", MB_TASKMODAL+MB_OK+MB_ICONINFORMATION)
  849. '$ENDIF
  850.  
  851.     NEXT i%
  852.  
  853.     DestDrive$ = MID$(DEST$, 1, 1)
  854.     i%         = ASC(ucase$(DestDrive$)) - ASC("A") + 1
  855.     DestCost&  = VAL(GetListItem(CostPerDisk$, i%))
  856.  
  857.     ReplaceListItem "DiskSpaceData", 1, " " + DestDrive$ + ":"
  858.     ReplaceListItem "DiskSpaceData", 2, STR$(DestCost& / 1024) + " K"
  859.     drive$    = MID$(DEST$, 1, 1)
  860.     DestFree& = GetFreeSpaceForDrive(drive$)
  861.  
  862.     IF (DestFree& < 0) THEN
  863.         DestFree& = 0
  864.     END IF
  865.  
  866.     ReplaceListItem "DiskSpaceData", 3, STR$(DestFree& / 1024) + " K"
  867.  
  868.     WinDrive$ = MID$(WinDir$, 1, 1)
  869.     ndrive%   = ASC(ucase$(WinDrive$)) - ASC("A") + 1
  870.     WinCost&  = VAL(GetListItem(CostPerDisk$, ndrive%))
  871.  
  872. '$IFDEF DEBUG
  873. ''    i% = DoMsgBox("Windows drive ('"+str$(ndrive%)+"') index in list.", "Copy Costs", MB_TASKMODAL+MB_OK+MB_ICONINFORMATION)
  874. '$ENDIF
  875.  
  876.     ReplaceListItem "DiskSpaceData", 5, STR$(WinCost& / 1024) + " K"
  877.  
  878.     WinFree& = GetFreeSpaceForDrive(WinDrive$)
  879.  
  880.     IF (WinFree& < 0) THEN
  881.         WinFree& = 0
  882.     END IF
  883.  
  884.     ReplaceListItem "DiskSpaceData", 6, STR$(WinFree& / 1024) + " K"
  885.  
  886.     CostPerDisk$ = ""
  887.  
  888. END SUB
  889.  
  890.  
  891.  
  892. '*************************************************************************
  893. '** Subroutine: MakeCopyList
  894. '** Purpose:    Builds the copy list.
  895. '** Arguments:     none.
  896. '** Returns:     none.
  897. '*************************************************************************
  898. SUB MakeCopyList STATIC
  899.  
  900.     ClearCopyList                                    '' Start with a clean copy list
  901.  
  902.     SrcDir$ = GetSymbolValue("STF_SRCDIR")    '' Get our SOURCE directory
  903.  
  904.     '' Add all the files to the copy list that we copy in all cases...
  905.  
  906. ''$IFDEF 1
  907.     AddSectionFilesToCopyList "Setup Files",        SrcDir$, DEST$
  908.     AddSectionFilesToCopyList "Files",              SrcDir$, DEST$
  909.     AddSectionFilesToCopyList "Utility Files",      SrcDir$, DEST$
  910.     AddSectionFilesToCopyList "Windows",            SrcDir$, WinDir$
  911.     AddSectionFilesToCopyList "Windows:System",     SrcDir$, WinDir$+"SYSTEM\"
  912.     AddSectionFilesToCopyList "Windows:TWAIN",      SrcDir$, TwainDir$
  913. ''$ENDIF
  914.  
  915.     '' Here's how to check for NT -- IF (IsItNT()) THEN ...
  916.     '' Where should we put files on an NT system?
  917.     '' How can we keep from installing DOS and Windows drivers on an NT system?
  918.     '' Do any dialogs need to change for installation on an NT system?
  919.     ''    AddSectionFilesToCopyList "NT Files", SrcDir$, DEST$
  920.  
  921.     '' Add files that are specific to EISA or MCA backplane computers...
  922.  
  923.     IF SystemArchitecture$ = "EISA" THEN
  924.  
  925.         IF ScannerChoice% = 1 THEN    '' ScanJet II or 3 family scanner...
  926.             IF GetSymbolValue("RemingtonCardFound") = "1" THEN
  927.                 AddSectionFilesToCopyList "Remington Card EISA", SrcDir$, DEST$
  928.             ELSE
  929.                 AddSectionFilesToCopyList "Fred Card EISA", SrcDir$, DEST$
  930.             ENDIF
  931.  
  932.         ELSEIF ScannerChoice% = 2 THEN
  933.             AddSectionFilesToCopyList "ScanJet Plus EISA", SrcDir$, DEST$
  934.         END IF
  935.  
  936.     ELSEIF SystemArchitecture$ = "MCA" THEN
  937.  
  938.         IF ScannerChoice% = 1 THEN    '' ScanJet II or 3 family scanner...
  939.             IF GetSymbolValue("RemingtonCardFound") = "1" THEN
  940.                 AddSectionFilesToCopyList "Remington Card MCA", SrcDir$, DEST$
  941.             ELSE
  942.                 AddSectionFilesToCopyList "Fred Card MCA", SrcDir$, DEST$
  943.             ENDIF
  944.  
  945.         ELSEIF ScannerChoice% = 2 THEN
  946.             AddSectionFilesToCopyList "ScanJet Plus MCA", SrcDir$, DEST$
  947.         END IF
  948.     END IF
  949.  
  950.     
  951.     '' Add the driver files that match the type of interface card specified...
  952.  
  953.     IF ScannerChoice% = 1 THEN        '' ScanJet II or 3 family scanner...
  954.  
  955.         IF GetSymbolValue("RemingtonCardFound") = "1" THEN
  956.             AddSectionFilesToCopyList "Remington Card Utils", SrcDir$, DEST$
  957.             AddSectionFilesToCopyList "Remington Card Drivers", SrcDir$, DEST$
  958.         ELSE
  959.             AddSectionFilesToCopyList "Fred Card Drivers", SrcDir$, DEST$
  960.         ENDIF
  961.  
  962.     ELSEIF ScannerChoice% = 2 THEN
  963.  
  964.         AddSectionFilesToCopyList "ScanJet Plus Utils", SrcDir$, DEST$
  965.         AddSectionFilesToCopyList "ScanJet Plus Drivers", SrcDir$, DEST$
  966.     END IF
  967.  
  968. END SUB
  969.  
  970.  
  971.  
  972. '*************************************************************************
  973. '** Subroutine: Install
  974. '** Purpose:    Performs all installation operations.
  975. '** Arguments:     none.
  976. '** Returns:     none.
  977. '** History:
  978. '**   940516 klb Added AcquireString() call for STR_NOTEPADEXE (local var
  979. '**              is NotePadExeStr$).
  980. '**              Changed hard-coded reference to "readme.txt" to result
  981. '**              of AcquireString() on STR_READMETXT.
  982. '**              Added label CONFIG:
  983. '**              Commented out the CopyFile() immediately after CONFIG:.
  984. '**              Replaced the UIPop 1 command in CONFIG: with a big
  985. '**              IF/THEN/ELSE to treat the modification more intelligently.
  986. '**              Commented out all the AUTOEXEC modify stuff because we're
  987. '**              adding HPDS25.INI file support to the TWAIN stuff.
  988. '**              Commented out all the old SYSTEM.INI code and replaced it
  989. '**              wholesale with the SYSINI: block from the Kennel code.
  990. '**              Commented out all the CONFIG.SYS modification stuff and
  991. '**              replaced it wholesale with Kennel code (hope it works).
  992. '**              Added UIPop1 to ELSE in GETREFDISKL1:.
  993. '**   940518 klb Added code to write the HPDS25.INI file.
  994. '**   940621 klb Deleted the line that was writing initialization info to
  995. '**              the INI file -- this is wholly handled in WriteHPDSINI()
  996. '**              now and shouldn't happen here.
  997. '**              Added a CopyFile call so that the INI file created in the
  998. '**              Windows directory is copied to the install directory.  That
  999. '**              way, if the INI file gets trashed in the Windows directory,
  1000. '**              the user can just copy the original from the install dir
  1001. '**              and, assuming that DeskScan hasn't been moved, life will
  1002. '**              once again be wonderful.]
  1003. '**   940628 klb Third-party SCSI card (InstalledCard$ == 0) set ConfigFile$
  1004. '**              to the ScanJet Plus configuration file (!hwp1461.cfg)
  1005. '**              instead of the Fred file (!hwp2080.cfg).  So, I changed the
  1006. '**              string to the correct file name.
  1007. '**
  1008. '*************************************************************************
  1009. SUB Install STATIC
  1010.  
  1011.     CreateDir DEST$, cmoVital        ''    Create the destination directory...
  1012.  
  1013.     CopyFilesInCopyList                '' Copy files from distrib disk to dest disk
  1014.     
  1015.     ''    Create the Program Manager Group with the name specified by the user...
  1016.  
  1017.     CreateProgmanGroup GROUP$, "", cmoNone
  1018.     ShowProgmanGroup   GROUP$, 1,  cmoNone
  1019.  
  1020.     
  1021.     ''    Create the Program Manager Group Icons...
  1022.  
  1023.     NameStr$       = STRING$(128,0)
  1024.     NotePadExeStr$ = STRING$(16,0)
  1025.  
  1026.     i%       = AcquireString(STR_DESKSCAN,    NameStr$, 128)
  1027.     CreateProgManItem GROUP$, NameStr$, MakePath(DEST$, "DESKSCAN.EXE"), "", cmoOverwrite
  1028.  
  1029.     i%       = AcquireString(STR_SCSIADDRESS, NameStr$, 128)
  1030.     CreateProgManItem GROUP$, NameStr$, MakePath(DEST$, "SCSIADDR.EXE"), "", cmoOverwrite
  1031.  
  1032.     i%       = AcquireString(STR_SCANNERTEST, NameStr$, 128)
  1033.     CreateProgManItem GROUP$, NameStr$, MakePath(DEST$, "SCANTEST.EXE"), "", cmoOverwrite
  1034.  
  1035.     i%       = AcquireString(STR_READMETXT,   NameStr$, 128)
  1036.     i%       = AcquireString(STR_NOTEPADEXE,  NotePadExeStr$, 16)
  1037.     CreateProgManItem GROUP$, NameStr$, NotePadExeStr$+" "+MakePath(DEST$, NameStr$), "", cmoOverwrite
  1038.  
  1039.     NotePadExeStr$ = STRING$(0,0)
  1040.     NameStr$       = STRING$(0,0)
  1041.  
  1042.  
  1043.     ''    write our TWAIN data source .ini file...
  1044.  
  1045.     DSIniStr$ = STRING$(16,0)
  1046.     i% = AcquireString(STR_HPDSINI, DSIniStr$, 16)
  1047.     i% = WriteHPDSINI()
  1048.  
  1049.     '' Make a copy of the INI file in the install directory so recovery is easy
  1050.  
  1051.     CopyFile WinDir$+DSIniStr$, DEST$+"\"+DSIniStr$, cmoOverwrite, 0
  1052.     DSIniStr$ = STRING$(0,0)
  1053.  
  1054.     '' Make a copy of the TWAIN data source file into the install directory...
  1055.  
  1056.     CopyFile TWAINDir$+"HPDS22.DS", DEST$+"\HPDS22.DS", cmoOverwrite, 0
  1057.  
  1058.  
  1059.  
  1060. CONFIG:    
  1061.     AskModSysIni%   = 0
  1062.  
  1063.     ''    Make a temporary copy of the CONFIG.SYS.  If we aren't told to modify
  1064.     ''    the SYS file, we'll delete it and the user won't know it was there...
  1065.  
  1066.     CopyFile "C:\CONFIG.SYS", GetSymbolValue("ConfigBackup"), cmoOverwrite, 0
  1067.  
  1068.     '' ********************************
  1069.     '' *** Modify CONFIG.SYS dialog ***
  1070.     '' ********************************
  1071.  
  1072.     sz$ = UIStartDlg(DS2Cui$, MODIFYCONFIG, "FModifyConfigDlgProc", 0, "")
  1073.  
  1074.     IF (sz$ = "CONTINUE") THEN    '' User wants us to mod CONFIG for them...
  1075.         UIPop 1                        '' FModifyConfigDlgProc() updated 'ConfigTemp'...
  1076.         CopyFile   GetSymbolValue("ConfigTemp"), "C:\CONFIG.SYS", cmoOverwrite,0
  1077.         RemoveFile GetSymbolValue("ConfigTemp"), cmoNone
  1078. ''        MUSTREBOOT% = 1
  1079.  
  1080.     ELSEIF sz$ = "REACTIVATE" THEN
  1081.         GOTO CONFIG
  1082.  
  1083.     ELSE                                '' User wants us to leave CONFIG file alone...
  1084.         UIPop 1                        '' CONFIG file not mod'd so delete the temp file...
  1085.         RemoveFile GetSymbolValue("ConfigBackup"), cmoNone
  1086. ''        MANUALMOD% = 1
  1087.     END IF
  1088.  
  1089.     ''
  1090.     '' The 'InstalledCard' symbol's values are defined in ds2cui.h.
  1091.     '' Since we "know" which card is being used, decide now whether the user
  1092.     '' may want us to modify their SYSTEM.INI file for them.
  1093.     ''
  1094.     InstalledCard$ = GetSymbolValue("InstalledCard")
  1095.  
  1096.     IF InstalledCard$="0" THEN            '' No Card detected...
  1097.         AskModSysIni% = 1                    '' Assume it'll be a Fred card eventually
  1098.  
  1099.     ELSEIF InstalledCard$="1" THEN    '' ScanJet Plus card
  1100.         AskModSysIni% = 0
  1101.  
  1102.     ELSEIF InstalledCard$="2" THEN    '' SJ Plus card in certain Gateway CPUs
  1103.         AskModSysIni% = 0
  1104.  
  1105.     ELSEIF InstalledCard$="3" THEN    '' Remington SCSI card
  1106. ''        AskModSysIni% = 0
  1107.         AskModSysIni% = 1                    '' Add EMMExclude line
  1108.  
  1109.     ELSEIF InstalledCard$="4" THEN    '' Fred SCSI card
  1110.         AskModSysIni% = 1                    '' Add high-performance drivers
  1111.  
  1112.     ELSEIF InstalledCard$="5" THEN    '' 3rd-party SCSI card
  1113.         AskModSysIni% = 0
  1114.     END IF
  1115.  
  1116.  
  1117.  
  1118.  
  1119. CHECKSYSINIFORHIPERF:        '' Our high-performance drivers (VxDs) in SYSTEM.INI?
  1120.  
  1121.     CopyFile WinDir$+"SYSTEM.INI", GetSymbolValue("SysIniThrowAwayFile"), cmoOverwrite, 0
  1122.     i% = FCheckForHiPerfDrivers()
  1123.  
  1124.     '' Regardless of the outcome of the search, dispose of our temp file...
  1125.     RemoveFile GetSymbolValue("SysIniThrowAwayFile"), cmoNone
  1126.  
  1127.     IF i% = 0 THEN                        '' >0 means one or more of our VxDs were found
  1128.         GOTO SYSINI                        '' 0 means none of our VxDs were found
  1129.     END IF
  1130.  
  1131.     '' ****************************************************
  1132.     '' *** Remove Unused Drivers from SYSTEM.INI dialog ***
  1133.     '' ****************************************************
  1134.     sz$ = UIStartDlg(DS2Cui$, REMOVEHIPERF, "FRemoveHiPerfDlgProc", 0, "")
  1135.  
  1136.     IF sz$ = "CONTINUE" THEN        '' Pressed the "Yes" button
  1137.         UIPop 1
  1138.         CopyFile   WinDir$+"SYSTEM.INI", GetSymbolValue("SysIniBackup"), cmoOverwrite, 0
  1139.         i% = FRemoveHiPerfDrivers()
  1140.  
  1141.         IF i% = 0 THEN                    '' FRemoveHiPerfDrivers() failed...
  1142.             RemoveFile GetSymbolValue("SysIniBackup"), cmoNone
  1143.             '$IFDEF DEBUG
  1144.                 i% = DoMsgBox("FRemoveHiPerDrivers() failed to remove VxDs!", "DEBUG", MB_OK+MB_TASKMODAL)
  1145.             '$ENDIF
  1146.         
  1147.         ELSE                                '' VxDs removed OK so save our changes...
  1148.             RemoveFile WinDir$+"SYSTEM.INI", cmoNone
  1149.             RenameFile GetSymbolValue("SysIniTemp"), "SYSTEM.INI"
  1150. ''            MUSTREBOOT% = 1
  1151.         ENDIF
  1152.  
  1153.         GOTO SYSINI                        '' in any event, go on...
  1154.  
  1155.     ELSEIF sz$ = "REACTIVATE" THEN
  1156.         GOTO CHECKSYSINIFORHIPERF
  1157.  
  1158.     ELSEIF sz$ = "EXIT" THEN        '' Pressed the "Exit" button
  1159.         UIPop 1
  1160.         GOSUB ASKQUIT2
  1161.         GOTO CHECKSYSINIFORHIPERF
  1162.  
  1163.     ELSEIF sz$ = "CANCEL" THEN        '' Pressed the "No" button
  1164.         UIPop 1
  1165. ''        MANUALMOD% = 1
  1166.         GOTO MANUALSYSINI
  1167.  
  1168.     ELSE
  1169.         UIPop 1
  1170.     END IF
  1171.  
  1172.  
  1173.  
  1174. MANUALSYSINI:
  1175.     '' ****************************************************
  1176.     '' *** Manually update SYSTEM.INI dialog ***
  1177.     '' ****************************************************
  1178.     sz$ = UIStartDlg(DS2Cui$, HIPERFNAMES, "FManualSysIniDlgProc", 0, "")
  1179.  
  1180.     '' Process the result of "FManualSysIniDlgProc"
  1181.  
  1182.     IF sz$ = "CONTINUE" THEN
  1183.         UIPop 1
  1184.         GOTO SYSINI
  1185.         
  1186.     ELSEIF sz$ = "BACK" THEN
  1187.         UIPop 1
  1188.         GOTO CHECKSYSINIFORHIPERF
  1189.  
  1190.     ELSEIF sz$= "REACTIVATE" THEN
  1191.         GOTO MANUALSYSINI
  1192.  
  1193.     ELSE
  1194.         UIPop 1
  1195.         GOTO SYSINI
  1196.     END IF
  1197.  
  1198.  
  1199.  
  1200.  
  1201. SYSINI:
  1202.     IF AskModSysIni% = 0 THEN                    '' gate the SYSTEM.INI mod dialog
  1203.         GOTO EISA_MCA_FILES
  1204.     END IF
  1205.  
  1206.     ''
  1207.     '' The 'InstalledCard' symbol's values are defined in ds2cui.h.
  1208.     ''
  1209.     InstalledCard$ = GetSymbolValue("InstalledCard")
  1210.  
  1211.  
  1212.     '' ********************************
  1213.     '' *** Modify SYSTEM.INI dialog ***
  1214.     '' ********************************
  1215.     IF InstalledCard$ = "3" THEN                '' Remington SCSI Card
  1216.         sz$ = UIStartDlg(DS2Cui$, MODIFYIICSYSTEMINI, "FYesNoDlgProc", 0, "")
  1217.      ELSE                                                '' Fred SCSI Card
  1218.         sz$ = UIStartDlg(DS2Cui$, MODIFYSYSTEMINI, "FYesNoDlgProc", 0, "")
  1219.     END IF
  1220.  
  1221.     IF sz$ = "CONTINUE" THEN
  1222.         UIPop 1
  1223. ''        MUSTREBOOT% = 1
  1224.         CopyFile WinDir$+"SYSTEM.INI", GetSymbolValue("SysIniBackup"), cmoOverwrite,0
  1225.         i% = ModifySysIni()
  1226.  
  1227.         IF i% <> 0 THEN                            '' only if ModifySysIni() suceeds...
  1228.             RemoveFile WinDir$+"SYSTEM.INI", cmoNone
  1229.             RenameFile GetSymbolValue("SysIniTemp"), "SYSTEM.INI"
  1230.  
  1231.         ELSE
  1232.             RemoveFile GetSymbolValue("SysIniTemp"), cmoNone
  1233.         END IF
  1234.  
  1235.     ELSEIF sz$ = "REACTIVATE" THEN
  1236.         GOTO SYSINI
  1237.  
  1238.     ELSE
  1239.         UIPop 1
  1240. ''        MANUALMOD% = 1
  1241.     END IF
  1242.  
  1243.  
  1244. EISA_MCA_FILES:
  1245.     ''
  1246.     '' The 'InstalledCard' symbol's values are defined in ds2cui.h.
  1247.     ''
  1248.     InstalledCard$ = GetSymbolValue("InstalledCard")
  1249.  
  1250.     IF InstalledCard$ = "5" THEN                '' 3rd party SCSI
  1251.         GOTO DONE
  1252.     ENDIF
  1253.         
  1254.     IF (SystemArchitecture$ = "MCA") THEN
  1255.         IF InstalledCard$ = "0" THEN            '' No card found, assume Fred card
  1256.             ConfigFile$ = "@631f.adf"
  1257.  
  1258.         ELSEIF InstalledCard$ = "1" THEN        '' ScanJet Plus card
  1259.             ConfigFile$ = "@601f.adf"
  1260.  
  1261.         ELSEIF InstalledCard$ = "2" THEN        '' ScanJet Plus card in some Gateways
  1262.             ConfigFile$ = "@601f.adf"
  1263.  
  1264.         ELSEIF InstalledCard$ = "3" THEN        '' Remington SCSI card
  1265.             ConfigFile$ = "@621f.adf"
  1266.  
  1267.         ELSEIF InstalledCard$ = "4" THEN        '' Fred SCSI card
  1268.             ConfigFile$ = "@631f.adf"
  1269.         END IF
  1270.  
  1271. ''        GOTO DONE                                    '' Don't ask for EISA Reference Disk
  1272.  
  1273.     ELSEIF (SystemArchitecture$ = "EISA") THEN
  1274.         IF InstalledCard$ = "0" THEN            '' No card found, assume Fred card
  1275.             ConfigFile$ = "!hwp2080.cfg"
  1276.  
  1277.         ELSEIF InstalledCard$ = "1" THEN        '' ScanJet Plus card
  1278.             ConfigFile$ = "!hwp1461.cfg"
  1279.  
  1280.         ELSEIF InstalledCard$ = "2" THEN        '' ScanJet Plus card in some Gateways
  1281.             ConfigFile$ = "!hwp1461.cfg"
  1282.  
  1283.         ELSEIF InstalledCard$ = "3" THEN        '' Remington SCSI card
  1284.             ConfigFile$ = "!hwp2002.cfg"
  1285.  
  1286.         ELSEIF InstalledCard$ = "4" THEN        '' Fred SCSI card
  1287.             ConfigFile$ = "!hwp2080.cfg"
  1288.         END IF
  1289.  
  1290.         GOTO GETREFDISK
  1291.  
  1292.     ELSE                                                '' System Architecture is "ISA"
  1293.         GOTO DONE
  1294.     ENDIF
  1295.  
  1296.  
  1297.  
  1298. GETREFDISK:
  1299.     SetSymbolValue "EditTextIn", "A:\"
  1300.     SetSymbolValue "EditFocus", "END"
  1301.  
  1302. GETREFDISKL1:
  1303.     '' ************************************
  1304.     '' *** Backup Reference Disk dialog ***
  1305.     '' ************************************
  1306.     sz$      = UIStartDlg(DS2Cui$, INSERTREF, "FRefDiskDlgProc", 0, "")
  1307.     refDisk$ = GetSymbolValue("EditTextOut")
  1308.     tStr$    = refDisk$
  1309.  
  1310.     IF (MID$(refDisk$,LEN(refDisk$)) <> "\") THEN
  1311.         refDisk$ = tStr$ + "\"
  1312.     END IF
  1313.  
  1314.     IF (sz$ = "CONTINUE") THEN
  1315.         UIPop 1
  1316.  
  1317.         IF (IsDirWritable(refDisk$) = 0) THEN
  1318.             GOSUB BADPATH
  1319.             GOTO GETREFDISKL1
  1320.         END IF
  1321.  
  1322.         CopyFile MakePath(DEST$,ConfigFile$), MakePath(refDisk$,ConfigFile$), cmoNone, 0
  1323.  
  1324.     ELSEIF sz$ = "REACTIVATE" THEN
  1325.         GOTO GETREFDISKL1
  1326.  
  1327.     ELSEIF sz$ = "BACK" THEN
  1328.         UIPop 1
  1329.         GOTO DONE
  1330.  
  1331.     ELSE
  1332.         UIPop 1
  1333.          GOSUB ASKQUIT2
  1334.         GOTO GETREFDISK
  1335.     END IF
  1336.  
  1337. GOTO DONE
  1338.  
  1339.  
  1340.  
  1341. BADPATH:
  1342.     '' ****************************************
  1343.     '' *** Unknown Path or Directory dialog ***
  1344.     '' ****************************************
  1345.     sz$ = UIStartDlg(DS2Cui$, BADPATH, "FInfo0DlgProc", 0, "")
  1346.  
  1347.     IF sz$ = "REACTIVATE" THEN
  1348.         GOTO BADPATH
  1349.     END IF
  1350.  
  1351.     UIPop 1
  1352.     RETURN
  1353.  
  1354.  
  1355.  
  1356. ASKQUIT2:
  1357.     '' *******************************
  1358.     '' *** Incomplete Setup dialog ***
  1359.     '' *******************************
  1360.     sz$ = UIStartDlg(DS2Cui$, ASKQUIT, "FQuitDlgProc", 0, "")
  1361.  
  1362.     IF sz$ = "EXIT" THEN
  1363.         UIPopAll
  1364.         ERROR STFQUIT
  1365.     
  1366.     ELSEIF sz$ = "REACTIVATE" THEN
  1367.         GOTO ASKQUIT2
  1368.  
  1369.     ELSE
  1370.         UIPop 1
  1371.     END IF
  1372.  
  1373.     RETURN
  1374.  
  1375.  
  1376.  
  1377. DONE:
  1378. END SUB
  1379.  
  1380.  
  1381.  
  1382. '*************************************************************************
  1383. '** Subroutine: MakePath
  1384. '** Purpose:    Appends a file name to the end of a directory path,
  1385. '**             inserting a backslash character as needed.
  1386. '** Arguments:
  1387. '**    szDir$   full directory path (with optional ending "\")
  1388. '**    szFile$  filename to append to directory
  1389. '** Returns:     Resulting fully qualified path name.
  1390. '*************************************************************************
  1391. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  1392.  
  1393.     IF szDir$ = "" THEN
  1394.         MakePath = szFile$
  1395.  
  1396.     ELSEIF szFile$ = "" THEN
  1397.         MakePath = szDir$
  1398.  
  1399.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  1400.         MakePath = szDir$ + szFile$
  1401.  
  1402.     ELSE
  1403.         MakePath = szDir$ + "\" + szFile$
  1404.     END IF
  1405.  
  1406. END FUNCTION
  1407.  
  1408.  
  1409.  
  1410.  
  1411. '*************************************************************************
  1412. '** Subroutine: MyRemoveFiles
  1413. '** Purpose:    Deletes any files from the destination disk that are
  1414. '**             used by the Installer but not by the scanning software.
  1415. '** Arguments:     none.
  1416. '** Returns:     none.
  1417. '** History:    940427 klb Created.
  1418. '*************************************************************************
  1419. SUB MyRemoveFiles STATIC
  1420.  
  1421.     oldcursor% = ShowWaitCursor()
  1422.     
  1423.     IF (DoesFileExist(MakePath(DEST$, "scanjet.inf"), femExists) = 1) THEN
  1424.         RemoveFile MakePath(DEST$, "scanjet.inf"), cmoForce
  1425.     END IF
  1426.  
  1427.     IF (DoesFileExist(MakePath(DEST$, "scanjet.mst"), femExists) = 1) THEN
  1428.         RemoveFile MakePath(DEST$, "scanjet.mst"), cmoForce
  1429.     END IF
  1430.  
  1431.     IF (DoesFileExist(MakePath(DEST$, "ddeml.dll"), femExists) = 1) THEN
  1432.         RemoveFile MakePath(DEST$, "ddeml.dll"), cmoForce
  1433.     END IF
  1434.  
  1435.     IF (DoesFileExist(MakePath(DEST$, "_mstest.exe"), femExists) = 1) THEN
  1436.         RemoveFile MakePath(DEST$, "_mstest.exe"), cmoForce
  1437.     END IF
  1438.  
  1439.     IF (DoesFileExist(MakePath(DEST$, "ds2cui.dll"), femExists) = 1) THEN
  1440.         RemoveFile MakePath(DEST$, "ds2cui.dll"), cmoForce
  1441.     END IF
  1442.  
  1443.     IF (DoesFileExist(MakePath(DEST$, "ds2util.inc"), femExists) = 1) THEN
  1444.         RemoveFile MakePath(DEST$, "ds2util.inc"), cmoForce
  1445.     END IF
  1446.  
  1447.     IF (DoesFileExist(MakePath(DEST$, "ds2util.dll"), femExists) = 1) THEN
  1448.         RemoveFile MakePath(DEST$, "ds2util.dll"), cmoForce
  1449.     END IF
  1450.  
  1451.     IF (DoesFileExist(MakePath(DEST$, "setup.exe"), femExists) = 1) THEN
  1452.         RemoveFile MakePath(DEST$, "setup.exe"), cmoForce
  1453.     END IF
  1454.  
  1455.     IF (DoesFileExist(MakePath(DEST$, "setup.lst"), femExists) = 1) THEN
  1456.         RemoveFile MakePath(DEST$, "setup.lst"), cmoForce
  1457.     END IF
  1458.  
  1459.     IF (DoesFileExist(MakePath(DEST$, "setupapi.inc"), femExists) = 1) THEN
  1460.         RemoveFile MakePath(DEST$, "setupapi.inc"), cmoForce
  1461.     END IF
  1462.  
  1463.     IF (DoesFileExist(MakePath(DEST$, "mscomstf.dll"), femExists) = 1) THEN
  1464.         RemoveFile MakePath(DEST$, "mscomstf.dll"), cmoForce
  1465.     END IF
  1466.  
  1467.     IF (DoesFileExist(MakePath(DEST$, "msdetect.inc"), femExists) = 1) THEN
  1468.         RemoveFile MakePath(DEST$, "msdetect.inc"), cmoForce
  1469.     END IF
  1470.  
  1471.     IF (DoesFileExist(MakePath(DEST$, "msdetstf.dll"), femExists) = 1) THEN
  1472.         RemoveFile MakePath(DEST$, "msdetstf.dll"), cmoForce
  1473.     END IF
  1474.  
  1475.     IF (DoesFileExist(MakePath(DEST$, "msinsstf.dll"), femExists) = 1) THEN
  1476.         RemoveFile MakePath(DEST$, "msinsstf.dll"), cmoForce
  1477.     END IF
  1478.  
  1479.     IF (DoesFileExist(MakePath(DEST$, "msshlstf.dll"), femExists) = 1) THEN
  1480.         RemoveFile MakePath(DEST$, "msshlstf.dll"), cmoForce
  1481.     END IF
  1482.  
  1483.     IF (DoesFileExist(MakePath(DEST$, "msuilstf.dll"), femExists) = 1) THEN
  1484.         RemoveFile MakePath(DEST$, "msuilstf.dll"), cmoForce
  1485.     END IF
  1486.  
  1487.     IF (DoesFileExist(MakePath(DEST$, "expand.exe"), femExists) = 1) THEN
  1488.         RemoveFile MakePath(DEST$, "expand.exe"), cmoForce
  1489.     END IF
  1490.  
  1491.     IF (DoesFileExist(MakePath(TwainDir$, "hpdsii.ds"), femExists) = 1) THEN
  1492.         RenameFile MakePath(TwainDir$, "hpdsii.ds"), "hpdsii.old"
  1493.     END IF
  1494.     
  1495.     IF (DoesFileExist(MakePath(TwainDir$, "hpds21.ds"), femExists) = 1) THEN
  1496.         RenameFile MakePath(TwainDir$, "hpds21.ds"), "hpds21.old"
  1497.     END IF
  1498.  
  1499.     RestoreCursor oldcursor
  1500.  
  1501. END SUB
  1502.