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