home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1995 December / SOFM_Dec1995.bin / pc / os2 / winshell / wpsinst.ms_ / wpsinst.ms
Text File  |  1995-10-31  |  33KB  |  860 lines

  1. '**************************************************************************
  2. '* MSSetup for Workplace Shell for Windows Install - Version 1.51
  3. '**************************************************************************
  4.  
  5. '$INCLUDE 'setupapi.inc'
  6. '$INCLUDE 'msdetect.inc'
  7.  
  8. ''Dialog ID's
  9. CONST WELCOME         = 100
  10. CONST ASKQUITDLG      = 200
  11. CONST DESTPATH        = 300
  12. CONST EXITFAILURE     = 400
  13. CONST EXITQUIT        = 600
  14. CONST EXITSUCCESS     = 700
  15. CONST OPTIONS         = 800
  16. CONST APPHELP         = 900  ''WELCOME  Help
  17. CONST APPHELP1        = 903  ''DESTPATH  Help
  18. CONST APPHELP2        = 925  ''CUSTOM  Help
  19. CONST APPHELP3        = 908  ''RADIO  Help
  20. CONST CHECK           = 2500
  21. CONST BADPATH         = 6400
  22. CONST MAINDLG         = 6600
  23. CONST LANGDLG         = 6500
  24. CONST SYSDESTPATH     = 6700
  25.  
  26. CONST MB_YESNO        = 4
  27. CONST MB_ICONQUESTION = 32
  28. CONST IDYES           = 6
  29.  
  30. ''Bitmap ID
  31. CONST LOGO = 1
  32.  
  33. GLOBAL DEST$        ''Default destination directory.
  34. GLOBAL SystemPath$  ''Default system directory.
  35. GLOBAL OPTsel$      ''Option selection from option dialog.
  36. GLOBAL CHECKSTATES$ ''USED WITH custom OPTIONS
  37. GLOBAL WinDrive$
  38. GLOBAL CUIDLL$
  39. GLOBAL iUpgrade%
  40. GLOBAL szType$
  41.  
  42. ' External function declarations.
  43. DECLARE FUNCTION WinExec LIB "KERNEL.EXE" (cmd$, show%) as Integer ''USED to kickoff pmtowp
  44. DECLARE FUNCTION ExitWindowsExec LIB "USER.EXE" (arg1$, arg2$) AS INTEGER
  45. ' DECLARE FUNCTION ExitWindows LIB "USER.EXE" (arg1&, arg2%) AS LONG
  46. DECLARE FUNCTION LoadLibrary LIB "KERNEL.EXE" (arg1$) AS INTEGER
  47. DECLARE SUB      FreeLibrary LIB "KERNEL.EXE" (arg1%)
  48. ' CTL3D.DLL functions.
  49. 'DECLARE FUNCTION Ctl3dAutoSubclass LIB "CTL3D.DLL" (arg1%) AS INTEGER
  50. 'DECLARE FUNCTION Ctl3dRegister     LIB "CTL3D.DLL" (arg1%) AS INTEGER
  51. 'DECLARE FUNCTION Ctl3dUnregister   LIB "CTL3D.DLL" (arg1%) AS INTEGER
  52.  
  53. ' Private functions and subroutines declarations.
  54. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  55. DECLARE FUNCTION StrStr(szStr1$,szStr2$) AS INTEGER
  56. DECLARE SUB      AddPathString(szNewPath$)
  57. DECLARE SUB      AskQuit
  58. DECLARE FUNCTION AskTypeOfInstall AS STRING
  59. DECLARE FUNCTION QueryLanguagesToInstall AS STRING
  60. DECLARE SUB      CheckForATM
  61. DECLARE SUB      Install
  62. DECLARE SUB      RebootSystem
  63.  
  64. szGetProcessorType$="You need at least an i386 architecture microprocessor to complete setup."
  65. szDoMsgBox$= "Workplace Shell for Windows Setup"
  66. INIT:
  67.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll - HAS EXTRA dBOX for A REAL CUSTOM
  68.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  69.  
  70. ' Initialization of 3D controls library.
  71. '    Result% = Ctl3dRegister(HinstFrame())
  72. '    Result% = Ctl3dAutoSubclass(HinstFrame())
  73.  
  74.     SetBitmap CUIDLL$, LOGO
  75.     SetTitle "Workplace Shell for Windows Setup"
  76.  
  77. ''check what version of windows is installed.and kick out a box if it is 3.0
  78.     Major% = GetWindowsMajorVersion()
  79.     Minor% = GetWindowsMinorVersion()
  80.  
  81.     IF Major% < 3 OR (Major% = 3 AND Minor% < 10) THEN
  82.         i% = DoMsgBox("Microsoft Windows version 3.1 is required to install this product!",szDoMsgBox$, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  83.         ' Unregister 3D controls.
  84. '        Result% = Ctl3dUnregister(HinstFrame())
  85.         END
  86.     ENDIF
  87. 'check processor type - less than 386, message box it and abort
  88.     IF GetProcessorType < 3 THEN
  89.         i% = DoMsgBox(szGetProcessorType$,szDoMsgBox$, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  90.         ' Unregister 3D controls.
  91. '        Result% = Ctl3dUnregister(HinstFrame())
  92.         END
  93.     ENDIF
  94.  
  95.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  96.     IF szInf$ = "" THEN
  97.         szInf$ = GetSymbolValue("STF_CWDDIR") + "WPINST.INF"
  98.     ENDIF
  99.     ReadInfFile szInf$
  100.  
  101.     OldBeepMode% = SetBeepingMode (1)
  102.     SetCopyGaugePosition -1,75
  103.  
  104.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  105.     DEST$ = WinDrive + ":\WPSHELL"
  106.     SystemPath$ = GetWindowsSysDir()
  107.  
  108.     CheckStates$ = "CheckItemsOut"  ''SETUPSTRING FOR CHECK BOX
  109.  
  110.     ClearCopyList
  111.  
  112. WELCOME:
  113.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  114.     IF sz$ = "CONTINUE" THEN
  115.         UIPop 1
  116.     ELSE
  117.         AskQuit
  118.         GOTO WELCOME
  119.     ENDIF
  120.  
  121.    ' Ask user if this is an upgrade or new install...
  122.    szType$ = AskTypeOfInstall
  123.  
  124.  
  125. GETPATH:
  126.         SetSymbolValue "EditTextIn", DEST$
  127.         SetSymbolValue "EditFocus", "END"
  128. GETPATHL1:
  129.         sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP1, HELPPROC$)
  130.         DEST$ = GetSymbolValue("EditTextOut")
  131.  
  132.         IF sz$ = "CONTINUE" THEN
  133.             IF IsDirWritable(DEST$) = 0 THEN
  134.                GOSUB BADPATH
  135.                GOTO GETPATHL1
  136.             ENDIF
  137.             UIPop 1
  138.         ELSEIF sz$ = "REACTIVATE" THEN
  139.             GOTO GETPATHL1
  140.         ELSEIF sz$ = "BACK" THEN
  141.             UIPop 1
  142.             GOTO WELCOME
  143.         ELSE
  144.             AskQuit
  145.             GOTO GETPATH
  146.         ENDIF
  147.  
  148.    ' Check if windows is "shared" (have different \WINDOWS and \SYSTEM paths).
  149.    NetInstall% = IsWindowsShared()
  150.    ' If Windows is not "shared" (i.e. is not in a network setup)...
  151.    IF NetInstall% = 0 THEN
  152.       ' Windows is not shared, therefore skip checking system path code.
  153.       GOTO QUERYLANGUAGE
  154.    ENDIF
  155.  
  156. GETSYSTEMPATH:
  157.         SetSymbolValue "EditTextIn", SystemPath$
  158.         SetSymbolValue "EditFocus", "END"
  159. GETSYSTEMPATHL1:
  160.         sz$ = UIStartDlg(CUIDLL$, SYSDESTPATH, "FEditDlgProc", APPHELP1, HELPPROC$)
  161.         SystemPath$ = GetSymbolValue("EditTextOut")
  162.  
  163.         IF sz$ = "CONTINUE" THEN
  164.             IF IsDirWritable(SystemPath$) = 0 THEN
  165.                GOSUB BADPATH
  166.                GOTO GETSYSTEMPATHL1
  167.             ENDIF
  168.             UIPop 1
  169.         ELSEIF sz$ = "REACTIVATE" THEN
  170.             GOTO GETSYSTEMPATHL1
  171.         ELSEIF sz$ = "BACK" THEN
  172.             UIPop 1
  173.             GOTO GETPATH
  174.         ELSE
  175.             AskQuit
  176.             GOTO GETSYSTEMPATH
  177.         ENDIF
  178.  
  179.  
  180. QUERYLANGUAGE:
  181.    szLangResult$ = QueryLanguagesToInstall
  182.  
  183.    RemoveSymbol("CheckItemsIn")
  184.    RemoveSymbol("CheckItemsOut")
  185.  
  186.     FOR i% = 1 TO 4 STEP 1
  187.         AddListItem "CheckItemsIn", "ON"        ''SETTING ALL CHECK BOXES TO ON
  188.     NEXT i%
  189.  
  190.    ' If user only wants to install language resources...
  191.    IF szType$ = "BTN3" THEN
  192.       ' Jump to getting the destination path.
  193.       GOTO INSTALL1
  194.    ENDIF
  195.  
  196.    ' If user is upgrading from an older version of WPSFWIN...
  197.    IF iUpgrade% = IDYES THEN
  198.       ' Add "Checked" items to list.
  199.       AddListItem "CheckItemsOut", "OFF"    ' Migrate PROGMAN Desktop is "OFF"
  200.       AddListItem "CheckItemsOut", "ON"     ' Replace "Task Manager" with "Window List" is "ON"
  201.       AddListItem "CheckItemsOut", "OFF"    ' Set OS/2 Color Scheme as default color scheme is "OFF"
  202.       AddListItem "CheckItemsOut", "ON"     ' Make WPSFWIN the default Windows shell is "ON"
  203.       ' Skip the next two dialogs and ask for install path.
  204.       GOTO INSTALL1
  205.    ENDIF
  206.  
  207. DIAGOPTS:
  208.     ''default for autoinstall
  209.     OPTsel$ = "1"
  210.     SetSymbolValue "RadioDefault", OPTsel$
  211. OPTL1:
  212.     sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", APPHELP3, HELPPROC$)
  213.     OPTsel$ = GetSymbolValue("ButtonChecked")
  214.  
  215.     IF sz$ = "CONTINUE" THEN
  216.         UIPop 1
  217.     ELSEIF sz$ = "REACTIVATE" THEN
  218.         GOTO OPTL1
  219.     ELSEIF sz$ = "BACK" THEN
  220.         UIPop 1
  221.         GOTO WELCOME
  222.     ELSE
  223.         AskQuit
  224.         GOTO DIAGOPTS
  225.     ENDIF
  226.  
  227. IF OPTsel$ = "1" THEN
  228.     ' If user does express will use default all "ON"
  229.     RemoveSymbol("CheckItemsOut")
  230.     FOR i% = 1 TO 4 STEP 1
  231.         AddListItem "CheckItemsOut", "ON"
  232.     NEXT i%
  233.     ' Getpath used twice/written twice when time tighten UP!!!
  234.     GOTO INSTALL1
  235. ENDIF
  236.  
  237. CHECKIT:
  238.     sz$ = UIStartDlg(CUIDLL$, Check, "FCheckDlgProc", APPHELP2, HELPPROC$)
  239.  
  240. CHECKT1:
  241.     IF sz$ = "CONTINUE" THEN
  242.        UIPop 1
  243.        GOTO INSTALL1
  244.     ELSEIF sz$ = "REACTIVATE" THEN
  245.        GOTO CHECKT1
  246.     ELSEIF sz$ = "CHK1" THEN
  247.        GOTO CHECKT1
  248.     ELSEIF sz$ = "CHK2" THEN
  249.        GOTO CHECKT1
  250.     ELSEIF sz$ = "CHK3" THEN
  251.        GOTO CHECKT1
  252.     ELSEIF sz$ = "BACK" THEN
  253.        UIPop 1
  254.        GOTO DIAGOPTS
  255.     ELSE
  256.        AskQuit
  257.        GOTO CHECKIT
  258.     ENDIF
  259.  
  260.  
  261. INSTALL1:
  262.     ' Check if user has Adobe Type Manager (ATM) drivers installed.
  263.     CheckForATM
  264.     ' Install product to destination directory.
  265.     Install
  266.  
  267. QUIT:
  268.     ON ERROR GOTO ERRQUIT
  269.  
  270.     IF ERR = 0 THEN
  271. QUITSUC:
  272.     sz$ = UIStartDlg(CUIDLL$, EXITSUCCESS, "FInfoDlgProc", APPHELP, HELPPROC$)
  273.         IF sz$ = "CONTINUE" THEN
  274.  
  275.            'RebootSystem
  276.            'i% = DoMsgBox("There was an error configuring the system.  You must re-run setup.", "Workplace Shell for Windows Setup", MB_ICONEXCLAMATION+MB_OK+MB_TASKMODAL)
  277.  
  278.            UIPopAll
  279.  
  280.            ' If install is run from OS/2 Developer Connection CD...
  281.            'z% = ExitWindows(0,0)
  282.  
  283.            ' Unregister 3D controls.
  284. '           Result% = Ctl3dUnregister(HinstFrame())
  285.  
  286.            END
  287.         ELSEIF sz$ = "REACTIVATE" THEN
  288.            GOTO QUITSUC
  289.         ELSE
  290.            AskQuit
  291.            GOTO  QUITSUC
  292.         ENDIF
  293.     ELSEIF ERR = STFQUIT THEN
  294.         dlg% = EXITQUIT
  295.     ELSE
  296.         dlg% = EXITFAILURE
  297.     ENDIF
  298. QUITL1:
  299.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  300.     IF sz$ = "REACTIVATE" THEN
  301.         GOTO QUITL1
  302.     ENDIF
  303.     UIPop 1
  304.  
  305.     ' Unregister 3D controls.
  306. '    Result% = Ctl3dUnregister(HinstFrame())
  307.  
  308.     END
  309.  
  310. ERRQUIT:
  311.     i% = DoMsgBox("Setup sources were corrupted, read your Documentation for a number to contact.","Workplace Shell for Windows Installation", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  312.  
  313.     ' Unregister 3D controls.
  314. '    Result% = Ctl3dUnregister(HinstFrame())
  315.  
  316.     END
  317.  
  318. BADPATH:
  319.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  320.     IF sz$ = "REACTIVATE" THEN
  321.         GOTO BADPATH
  322.     ENDIF
  323.     UIPop 1
  324.     RETURN
  325.  
  326.  
  327. SUB AskQuit STATIC
  328. ASKQUIT_LABEL:
  329.     sz$ = UIStartDlg(CUIDLL$, ASKQUITDLG, "FQuitDlgProc", 0, "")
  330.     IF sz$ = "EXIT" THEN
  331.        UIPopAll
  332.        ERROR STFQUIT
  333.     ELSEIF sz$ = "REACTIVATE" THEN
  334.        GOTO ASKQUIT_LABEL
  335.     ELSE
  336.        UIPop 1
  337.     ENDIF
  338. END SUB
  339.  
  340.  
  341. '**
  342. '** AskTypeOfInstall():
  343. '**
  344. '*************************************************************************
  345. FUNCTION AskTypeOfInstall STATIC AS STRING
  346. INSTALLTYPE:
  347.    szTemp$ = UIStartDlg(CUIDLL$, MAINDLG, "FCustInstDlgProc", 0, "")
  348.  
  349.    IF (szTemp$ = "BTN1") OR (szTemp$ = "BTN2") OR (szTemp$ = "BTN3") THEN
  350.        UIPop 1
  351.    ELSE
  352.        AskQuit
  353.        GOTO INSTALLTYPE
  354.    ENDIF
  355.  
  356.    IF szTemp$ = "BTN2" THEN
  357.       iUpgrade% = IDYES
  358.    ELSE
  359.       iUpgrade% = IDNO
  360.    ENDIF
  361.  
  362.    AskTypeOfInstall = szTemp$
  363.  
  364. END FUNCTION
  365.  
  366.  
  367. '**
  368. '** QueryLanguagesToInstall():
  369. '**
  370. '*************************************************************************
  371. FUNCTION QueryLanguagesToInstall STATIC AS STRING
  372.  
  373.    SrcDir$ = GetSymbolValue("STF_SRCDIR")
  374.    windir$ = GetWindowsDir()
  375.  
  376.    ' Query current language used in Windows.
  377.    Language$ = GetIniKeyString(windir$ + "win.ini","Intl","sLanguage")
  378.  
  379.    RemoveSymbol("CheckItemsIn")
  380.  
  381.    ' If portuguese...
  382.    IF (Language$ = "ptg") OR (Language$ = "ptb") THEN
  383.       ' Set defaults for dialog.
  384.       AddListItem "CheckItemsIn", "OFF"    ' US English
  385.       AddListItem "CheckItemsIn", "OFF"    ' Dutch
  386.       AddListItem "CheckItemsIn", "OFF"    ' Finnish
  387.       AddListItem "CheckItemsIn", "OFF"    ' French (Canadian)
  388.       AddListItem "CheckItemsIn", "OFF"    ' German
  389.       AddListItem "CheckItemsIn", "ON"     ' Portuguese
  390.       AddListItem "CheckItemsIn", "OFF"    ' Spanish
  391.       AddListItem "CheckItemsIn", "OFF"    ' Swedish
  392.    ' If dutch...
  393.    ELSEIF Language$ = "nld" THEN
  394.       ' Set defaults for dialog.
  395.       AddListItem "CheckItemsIn", "OFF"    ' US English
  396.       AddListItem "CheckItemsIn", "ON"     ' Dutch
  397.       AddListItem "CheckItemsIn", "OFF"    ' Finnish
  398.       AddListItem "CheckItemsIn", "OFF"    ' French (Canadian)
  399.       AddListItem "CheckItemsIn", "OFF"    ' German
  400.       AddListItem "CheckItemsIn", "OFF"    ' Portuguese
  401.       AddListItem "CheckItemsIn", "OFF"    ' Spanish
  402.       AddListItem "CheckItemsIn", "OFF"    ' Swedish
  403.    ' If german...
  404.    ELSEIF Language$ = "deu" THEN
  405.       ' Set defaults for dialog.
  406.       AddListItem "CheckItemsIn", "OFF"    ' US English
  407.       AddListItem "CheckItemsIn", "OFF"    ' Dutch
  408.       AddListItem "CheckItemsIn", "OFF"    ' Finnish
  409.       AddListItem "CheckItemsIn", "OFF"    ' French (Canadian)
  410.       AddListItem "CheckItemsIn", "ON"     ' German
  411.       AddListItem "CheckItemsIn", "OFF"    ' Portuguese
  412.       AddListItem "CheckItemsIn", "OFF"    ' Spanish
  413.       AddListItem "CheckItemsIn", "OFF"    ' Swedish
  414.    ' If swedish...
  415.    ELSEIF Language$ = "sve" THEN
  416.       ' Set defaults for dialog.
  417.       AddListItem "CheckItemsIn", "OFF"    ' US English
  418.       AddListItem "CheckItemsIn", "OFF"    ' Dutch
  419.       AddListItem "CheckItemsIn", "OFF"    ' Finnish
  420.       AddListItem "CheckItemsIn", "OFF"    ' French (Canadian)
  421.       AddListItem "CheckItemsIn", "OFF"    ' German
  422.       AddListItem "CheckItemsIn", "OFF"    ' Portuguese
  423.       AddListItem "CheckItemsIn", "OFF"    ' Spanish
  424.       AddListItem "CheckItemsIn", "ON"     ' Swedish
  425.    ' If french...
  426.    ELSEIF (Language$ = "fra") OR (Language$ = "frc")  THEN
  427.       ' Set defaults for dialog.
  428.       AddListItem "CheckItemsIn", "OFF"    ' US English
  429.       AddListItem "CheckItemsIn", "OFF"    ' Dutch
  430.       AddListItem "CheckItemsIn", "OFF"    ' Finnish
  431.       AddListItem "CheckItemsIn", "ON"     ' French (Canadian)
  432.       AddListItem "CheckItemsIn", "OFF"    ' German
  433.       AddListItem "CheckItemsIn", "OFF"    ' Portuguese
  434.       AddListItem "CheckItemsIn", "OFF"    ' Spanish
  435.       AddListItem "CheckItemsIn", "OFF"    ' Swedish
  436.    ' If finnish...
  437.    ELSEIF Language$ = "fin" THEN
  438.       ' Set defaults for dialog.
  439.       AddListItem "CheckItemsIn", "OFF"    ' US English
  440.       AddListItem "CheckItemsIn", "OFF"    ' Dutch
  441.       AddListItem "CheckItemsIn", "ON"     ' Finnish
  442.       AddListItem "CheckItemsIn", "OFF"    ' French (Canadian)
  443.       AddListItem "CheckItemsIn", "OFF"    ' German
  444.       AddListItem "CheckItemsIn", "OFF"    ' Portuguese
  445.       AddListItem "CheckItemsIn", "OFF"    ' Spanish
  446.       AddListItem "CheckItemsIn", "OFF"    ' Swedish
  447.    ELSEIF (Language$ = "esn") OR (Language$ = "esp")  THEN
  448.       ' Set defaults for dialog.
  449.       AddListItem "CheckItemsIn", "OFF"    ' US English
  450.       AddListItem "CheckItemsIn", "OFF"    ' Dutch
  451.       AddListItem "CheckItemsIn", "OFF"    ' Finnish
  452.       AddListItem "CheckItemsIn", "OFF"    ' French (Canadian)
  453.       AddListItem "CheckItemsIn", "OFF"    ' German
  454.       AddListItem "CheckItemsIn", "OFF"    ' Portuguese
  455.       AddListItem "CheckItemsIn", "ON"     ' Spanish
  456.       AddListItem "CheckItemsIn", "OFF"    ' Swedish
  457.  
  458. ' ******* COMMENTED OUT *******
  459. '   ' If danish...
  460. '   ELSEIF Language$ = "dan" THEN
  461. '      Add language dependent files to copy list.
  462. '      AddSectionFilesToCopyList "nls_dani", SrcDir$, DEST$
  463. ' ****** COMMENTED OUT *******
  464.  
  465.    ' Else US-english....
  466.    ELSE
  467.       ' Set defaults for dialog.
  468.       AddListItem "CheckItemsIn", "ON"     ' US English
  469.       AddListItem "CheckItemsIn", "OFF"    ' Dutch
  470.       AddListItem "CheckItemsIn", "OFF"    ' Finnish
  471.       AddListItem "CheckItemsIn", "OFF"    ' French (Canadian)
  472.       AddListItem "CheckItemsIn", "OFF"    ' German
  473.       AddListItem "CheckItemsIn", "OFF"    ' Portuguese
  474.       AddListItem "CheckItemsIn", "OFF"    ' Spanish
  475.       AddListItem "CheckItemsIn", "OFF"    ' Swedish
  476.    ENDIF
  477.  
  478. LANGTOINSTALL:
  479.    szTemp$ = UIStartDlg(CUIDLL$, LANGDLG, "FCheckDlgProc", 0, "")
  480.  
  481.    IF (szTemp$ = "CONTINUE") THEN
  482.        UIPop 1
  483.    ELSE
  484.        AskQuit
  485.        GOTO LANGTOINSTALL
  486.    ENDIF
  487.  
  488.    IF szTemp$ = "CONTINUE" THEN
  489.       IF GetListItem("CheckItemsOut",1) = "ON" THEN
  490.          ' US English
  491.          AddSectionFilesToCopyList "nls_enus", SrcDir$, DEST$
  492.       ENDIF
  493.       IF GetListItem("CheckItemsOut",2) = "ON" THEN
  494.          ' Dutch
  495.          AddSectionFilesToCopyList "nls_dutc", SrcDir$, DEST$
  496.       ENDIF
  497.       IF GetListItem("CheckItemsOut",3) = "ON" THEN
  498.          ' Finnish
  499.          AddSectionFilesToCopyList "nls_finn", SrcDir$, DEST$
  500.       ENDIF
  501.       IF GetListItem("CheckItemsOut",4) = "ON" THEN
  502.          ' French (Canadian)
  503.          AddSectionFilesToCopyList "nls_fren", SrcDir$, DEST$
  504.       ENDIF
  505.       IF GetListItem("CheckItemsOut",5) = "ON" THEN
  506.          ' German
  507.          AddSectionFilesToCopyList "nls_grmn", SrcDir$, DEST$
  508.       ENDIF
  509.       IF GetListItem("CheckItemsOut",6) = "ON" THEN
  510.          ' Portuguese (Brazilian)
  511.          AddSectionFilesToCopyList "nls_port", SrcDir$, DEST$
  512.       ENDIF
  513.       IF GetListItem("CheckItemsOut",7) = "ON" THEN
  514.          ' Spanish
  515.          AddSectionFilesToCopyList "nls_span", SrcDir$, DEST$
  516.       ENDIF
  517.       IF GetListItem("CheckItemsOut",8) = "ON" THEN
  518.          ' Swedish
  519.          AddSectionFilesToCopyList "nls_swed", SrcDir$, DEST$
  520.       ENDIF
  521.    ENDIF
  522.  
  523.    QueryLanguagesToInstall = szTemp$
  524.  
  525. END FUNCTION
  526.  
  527.  
  528. '**
  529. '** CheckForATM():
  530. '**
  531. '*************************************************************************
  532. SUB CheckForATM STATIC
  533.     Windir$ = GetWindowsDir()
  534.     SysLoc$ = Windir$ + "SYSTEM.INI"     'location and filename system.ini
  535.  
  536.     ' Read in "system.drv=" line from SYSTEM.INI file.
  537.     SysDriver$ = GetIniKeyString(SysLoc$,"boot","system.drv")
  538.     ATMSysDriver$ = GetIniKeyString(SysLoc$,"boot","atm.system.drv")
  539.     ' Check if ATM drivers are loaded.
  540.     IF (SysDriver$ = "atmsys.drv") OR (ATMSysDriver$ = "system.drv") THEN
  541.        ' Notify and ask user if changes should be made.
  542.        iResult% = DoMsgBox("You have the Adobe Type Manager (ATM) driver installed."+CHR$(10)+"We need to comment out the driver in order to work correctly."+CHR$(10)+"Do you want this done for you?",szDoMsgBox$,MB_YESNO+MB_TASKMODAL+MB_ICONQUESTION)
  543.        IF iResult% = IDYES THEN
  544.           '  Add ';' to comment out both lines.
  545.           RemoveIniKey  SysLoc$, "boot","system.drv",cmoVital
  546.           RemoveIniKey  SysLoc$, "boot","atm.system.drv",cmoVital
  547.           CreateIniKeyValue SysLoc$,"boot",";system.drv",SysDriver$,cmoAppend + cmoVital
  548.           CreateIniKeyValue SysLoc$,"boot",";atm.system.drv",ATMSysDriver$,cmoAppend + cmoVital
  549.        ENDIF
  550.     ENDIF
  551. END SUB
  552.  
  553.  
  554. '**
  555. '** Purpose:
  556. '**     Builds the copy list and performs all installation operations.
  557. '** Arguments:
  558. '**     none.
  559. '** Returns:
  560. '**     none.
  561. '*************************************************************************
  562. SUB Install STATIC
  563.    windir$ = GetWindowsDir()
  564.    SrcDir$ = GetSymbolValue("STF_SRCDIR")
  565.    sysdir$ = SystemPath$
  566.    CreateDir DEST$, cmoVITAL
  567.    SetRestartDir windir$
  568.    SysLoc$ = windir$ + "system.ini"     'location and filename system.ini
  569.  
  570.    ' Check if obsolete key exists.
  571.    KeyExists% = DoesIniKeyExist(SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_ButtonApperance")
  572.    ' If obsolete key exists, then...
  573.    IF KeyExists% = 1 THEN
  574.       ' Get current value ans store it.
  575.       szButtonAppearance$ = GetIniKeyString(SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_ButtonApperance")
  576.       ' Remove obsolete key from initialization file.
  577.       RemoveIniKey SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_ButtonApperance",cmoNone
  578.    ELSE
  579.       ' Default to "Hide".
  580.       szButtonAppearance$ = "Hide"
  581.    ENDIF
  582.  
  583.    CopyFile SysLoc$, DEST$ + "\system.bak",cmoVital,0
  584.  
  585.    ' Query current language used in Windows.
  586.    Language$ = GetIniKeyString(windir$ + "win.ini","Intl","sLanguage")
  587.  
  588.    ' By default, assign english title to "System Setup" string.
  589.    SystemSetup$ = "System Setup"
  590.  
  591.    ' If portuguese...
  592.    IF (Language$ = "ptg") OR (Language$ = "ptb") THEN
  593.       SystemSetup$ = "Configuraτπo do sistema"
  594.    ' If dutch...
  595.    ELSEIF Language$ = "nld" THEN
  596.       SystemSetup$ = "Systeem instellingen"
  597.    ' If german...
  598.    ELSEIF Language$ = "deu" THEN
  599.       SystemSetup$ = "Systemkonfiguration"
  600.    ' If swedish...
  601.    ELSEIF Language$ = "sve" THEN
  602.       SystemSetup$ = "Systemkonfiguration"
  603.    ' If french...
  604.    ELSEIF (Language$ = "fra") OR (Language$ = "frc")  THEN
  605.       SystemSetup$ = "Configuration du systΦme"
  606.    ' If finnish...
  607.    ELSEIF Language$ = "fin" THEN
  608.       SystemSetup$ = "JΣrjestelmΣasetukset"
  609.    ' If spanish...
  610.    ELSEIF (Language$ = "esn") OR (Language$ = "esp")  THEN
  611.       SystemSetup$ = "Configuraci≤n del Sistema"
  612.  
  613. ' ******* COMMENTED OUT *******
  614. '   ' If danish...
  615. '   ELSEIF Language$ = "dan" THEN
  616. ' ****** COMMENTED OUT *******
  617.  
  618.    ' Else US-english....
  619.    ELSE
  620.       SystemSetup$ = "System Setup"
  621.    ENDIF
  622.  
  623.    ' If user only wanted to install the language resources...
  624.    IF szType$ = "BTN3" THEN
  625.       ' Create INI key and copy resource libraries.
  626.       CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_SystemSetupFolderName",SystemSetup$,cmoVital + cmoOverwrite
  627.       CopyFilesInCopyList
  628.       GOTO INSTALL_DONE
  629.    ENDIF
  630.  
  631.    ' Add required files to copy list.
  632.    AddSectionFilesToCopyList "store", SrcDir$, DEST$
  633.    AddSectionFilesToCopyList "systm", SrcDir$, sysdir$
  634.    AddSectionFilesToCopyList "windows", SrcDir$, windir$
  635.  
  636.    ' If user wants us to replace the current Task Manager with Window List...
  637.    IF GetListItem(CheckStates$, 2) = "ON" THEN
  638.       ' Set the "taskman=" key value to the "Window List" program ("wndlist.exe").
  639.       CreateIniKeyValue  SysLoc$, "boot","taskman.exe",DEST$+ "\wndlist.exe",cmoOverwrite + cmoVital
  640.    ENDIF
  641.  
  642.    ' If user wants us to setup the OS/2 color scheme as the default color scheme...
  643.    IF GetListItem(CheckStates$, 3) = "ON" THEN
  644.         'we would copy bmp to windir, change sys.ini and change color scheme,  else copy to dest$
  645.         ' color scheme has not been created yet-add later
  646.         AddSectionFilesToCopyList "bmp", SrcDir$, DEST$
  647.         ' Backup *.INI files.
  648.         CopyFile windir$ + "win.ini", DEST$ + "\win.bak",cmoVital,0
  649.         CopyFile windir$ + "control.ini", DEST$ + "\control.bak",cmoVital,0
  650.  
  651.         ' Make the OS/2 Warp color scheme the current color scheme.
  652.         CreateIniKeyValue windir$ + "control.ini","current","color schemes","OS/2 Warp",cmoOverwrite + cmoVital
  653.  
  654.         ' Add the OS/2 2.x and OS/2 Warp color schemes to color scheme list.
  655.         CreateIniKeyValue windir$ + "control.ini", "Color Schemes","OS/2 Warp","808000,E8FFFF,FFFFFF,0,C0C0C0,0,800040,C0C0C0,FFFFFF,C0C0C0,C0C0C0,0,C0C0C0,C0C0C0,808080,0,808080,808080,FFFFFF,808080,FFFFFF",cmoAppend + cmoVital
  656.         CreateIniKeyValue windir$ + "control.ini", "Color Schemes","OS/2","C0C0C0,E8FFFF,FFFFFF,0,C0C0C0,0,808040,C0C0C0,FFFFFF,80FFFF,C0C0C0,0,C0C0C0,C0C0C0,808080,0,808080,808080,FFFFFF,808080,FFFFFF",cmoAppend + cmoVital
  657.  
  658.         ' Make the OS/2 Warp colors the default color.
  659.         CreateIniKeyValue windir$ + "win.ini","Colors","Background","0 128 128",cmoOverwrite + cmoVital
  660.         CreateIniKeyValue windir$ + "win.ini","Colors","AppWorkspace", "255 255 232",cmoOverwrite + cmoVital
  661.         CreateIniKeyValue windir$ + "win.ini","Colors", "Window","255 255 255",cmoOverwrite + cmoVital
  662.         CreateIniKeyValue windir$ + "win.ini","Colors","WindowText","0 0 0",cmoOverwrite + cmoVital
  663.         CreateIniKeyValue windir$ + "win.ini","Colors","Menu","192 192 192",cmoOverwrite + cmoVital
  664.         CreateIniKeyValue windir$ + "win.ini","Colors","MenuText","0 0 0",cmoOverwrite + cmoVital
  665.         CreateIniKeyValue windir$ + "win.ini","Colors","ActiveTitle","64 0 128",cmoOverwrite + cmoVital
  666.         CreateIniKeyValue windir$ + "win.ini","Colors","InactiveTitle","192 192 192",cmoOverwrite + cmoVital
  667.         CreateIniKeyValue windir$ + "win.ini","Colors","TitleText","255 255 255",cmoOverwrite + cmoVital
  668.         CreateIniKeyValue windir$ + "win.ini","Colors","ActiveBorder","192 192 192",cmoOverwrite + cmoVital
  669.         CreateIniKeyValue windir$ + "win.ini","Colors","InactiveBorder","192 192 192",cmoOverwrite + cmoVital
  670.         CreateIniKeyValue windir$ + "win.ini","Colors","WindowFrame","0 0 0",cmoOverwrite + cmoVital
  671.         CreateIniKeyValue windir$ + "win.ini","Colors","ScrollBar","192 192 192",cmoOverwrite + cmoVital
  672.         CreateIniKeyValue windir$ + "win.ini","Colors","ButtonFace","192 192 192",cmoOverwrite + cmoVital
  673.         CreateIniKeyValue windir$ + "win.ini","Colors","ButtonShadow","128 128 128",cmoOverwrite + cmoVital
  674.         CreateIniKeyValue windir$ + "win.ini","Colors","ButtonText","0 0 0",cmoOverwrite + cmoVital
  675.         CreateIniKeyValue windir$ + "win.ini","Colors","GrayText","128 128 128",cmoOverwrite + cmoVital
  676.         CreateIniKeyValue windir$ + "win.ini","Colors","Hilight","128 128 128",cmoOverwrite + cmoVital
  677.         CreateIniKeyValue windir$ + "win.ini","Colors","HilightText","255 255 255",cmoOverwrite + cmoVital
  678.         CreateIniKeyValue windir$ + "win.ini","Colors","InactiveTitleText","128 128 128",cmoOverwrite + cmoVital
  679.         CreateIniKeyValue windir$ + "win.ini","Colors","ButtonHilight","255 255 255",cmoOverwrite + cmoVital
  680.    ELSE
  681.         ' Backup *.INI files.
  682.         CopyFile windir$ + "win.ini", DEST$ + "\win.bak",cmoVital,0
  683.         CopyFile windir$ + "control.ini", DEST$ + "\control.bak",cmoVital,0
  684.         ' Add the OS/2 2.x and OS/2 Warp color schemes to color scheme list.
  685.         CreateIniKeyValue windir$ + "control.ini", "Color Schemes","OS/2 Warp","808000,E8FFFF,FFFFFF,0,C0C0C0,0,800040,C0C0C0,FFFFFF,C0C0C0,C0C0C0,0,C0C0C0,C0C0C0,808080,0,808080,808080,FFFFFF,808080,FFFFFF",cmoAppend + cmoVital
  686.         CreateIniKeyValue windir$ + "control.ini", "Color Schemes","OS/2","C0C0C0,E8FFFF,FFFFFF,0,C0C0C0,0,808040,C0C0C0,FFFFFF,80FFFF,C0C0C0,0,C0C0C0,C0C0C0,808080,0,808080,808080,FFFFFF,808080,FFFFFF",cmoAppend + cmoVital
  687.  
  688.         AddSectionFilesToCopyList "bmp", SrcDir$, DEST$
  689.    ENDIF
  690.  
  691.    CopyFilesInCopyList
  692.  
  693.    ' If user wants us to make WPSFWIN the current default Windows shell...
  694.    IF GetListItem(CheckStates$, 4) = "ON" THEN
  695.         'change sys.ini to reflect current changes
  696.         ' String$=GetIniKeyString(szFile$,szSect$,szKey$)  -gotta put a ; infront of current shell= ??, this is a start
  697.         OldShell$=GetIniKeyString(SysLoc$,"boot","shell")
  698.         CreateIniKeyValue  SysLoc$, "boot","shell",DEST$+ "\wpshell.exe",cmoOverwrite + cmoVital
  699.         CreateIniKeyValue SysLoc$,"boot",";shell",OldShell$,cmoAppend + cmoVital
  700.    ENDIF
  701.  
  702.    ' If user wants us to automatically migrate their PROGMAN desktop...
  703.    IF GetListItem(CheckStates$, 1) = "ON" THEN
  704.         ' Setup call to conversion utility and parameters...
  705.         IF GetListItem(CheckStates$, 3) = "ON" THEN
  706.            ' OS/2 Warp colors are being installed as default.
  707.            Exe1$ = dest$ + "\PMTOWP.EXE /s /w"
  708.         ELSE
  709.            ' No OS/2 color schemes are being installed as default.
  710.            Exe1$ = dest$ + "\PMTOWP.EXE /s"
  711.         ENDIF
  712.         ' Run PMTOWP.EXE (Program Manager to Workplace Shell) conversion utility.
  713.         i%= WinExec(EXE1$, SW_SHOW)
  714.    ENDIF
  715.  
  716.    ' Create WPSFWIN system entries in SYSTEM.INI.
  717.    CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","DESKTOP_HorzIconIndent","23",cmoVital
  718.    CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","DESKTOP_VertIconIndent","5",cmoVital
  719.    CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_ConfirmOnFolderDelete","Yes",cmoVital
  720.    CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_ConfirmOnDelete","Yes",cmoVital
  721.    CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_ConfirmOnFileSystemDelete","Yes",cmoVital
  722.    CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_Animation","Enabled",cmoVital
  723.    CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_ButtonAppearance",szButtonAppearance$,cmoVital
  724.    CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_MinBehavior","Hide",cmoVital
  725.    CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_OpenBehavior","CreateNew",cmoVital
  726.    CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_SystemSetupFolderName",SystemSetup$,cmoVital + cmoOverwrite
  727.    CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","SYSTEM_NoSave","Disabled",cmoVital
  728.    CreateIniKeyValue SysLoc$,"Workplace_Shell_for_Windows","COLOR_ShadowText","FF0000",cmoVital
  729.  
  730.    ' WIN.INI System Events Sounds entries.
  731.    CreateIniKeyValue windir$ + "win.ini", "sounds","WPFolderClose",",Workplace Shell Close Folder",cmoVital
  732.    CreateIniKeyValue windir$ + "win.ini", "sounds","WPFolderOpen",",Workplace Shell Open Folder",cmoVital
  733.    CreateIniKeyValue windir$ + "win.ini", "sounds","WPBeginDrag",",Workplace Shell Begin Drag",cmoVital
  734.    CreateIniKeyValue windir$ + "win.ini", "sounds","WPEndDrag",",Workplace Shell End Drag",cmoVital
  735.    CreateIniKeyValue windir$ + "win.ini", "sounds","WPShred",",Workplace Shell Shred",cmoVital
  736.  
  737.    ' Convert WPSHELL.INI file to new format if upgrading.
  738.    IF iUpgrade% = IDYES THEN
  739.       ' Convert older WPSHELL.INI profile into newer format.
  740.       'i% = WinExec(dest$+"\CONVINI.EXE /s", SW_SHOW)
  741.    ENDIF
  742.  
  743. INSTALL_DONE:
  744.  
  745. END SUB
  746.  
  747.  
  748. '**********************************************************************************************************************************************
  749. SUB RebootSystem STATIC
  750.  
  751. '   Check if any files were locked during install.  If the RestartList
  752. '   is not empty, ExitExecRestart() will restart Windows, cleanup setup
  753. '   files, and copy over locked files before Windows restarts.
  754.     i% = RestartListEmpty()
  755.     IF i% = 0 THEN
  756. '      ExitExecRestart() only returns if applications refuse to be shutdown.
  757. '      Win32s is installed but will not operate until Windows is restarted
  758. '      and the Win32s VxD is loaded.
  759.          z% = ExitExecRestart()
  760.         WHILE z% = 0
  761. QUITSUC1:
  762.            sz$ = UIStartDlg(CUIDLL$, EXITSUCCESS, "FInfoDlgProc", APPHELP, HELPPROC$)
  763.            IF sz$ = "CONTINUE" THEN
  764.                z% = ExitExecRestart()
  765.                UIPop 1
  766.            ELSEIF sz$ = "REACTIVATE" THEN
  767.                GOTO QUITSUC1
  768.            ELSEIF sz$ = "CANCEL" THEN
  769.                GOTO QUITSUC1
  770.            ENDIF
  771.         WEND
  772.     ELSE
  773. '      If the RestartList list is empty, it is necessary to restart windows
  774. '      directly.  The MSSETUP program creates _MSRSTRT.EXE and _MSSETUP.BAT
  775. '      in the restart directory.  This program should be exec'd to handle
  776. '      proper MSSETUP cleanup (temp files) and restart Windows.
  777.           z% =ExitWindowsExec( GetWindowsDir() + "_MSRSTRT.EXE", "_MSSETUP.BAT" )
  778.           WHILE z% = 0
  779. QUITSUC2:
  780.              sz$ = UIStartDlg(CUIDLL$, EXITSUCCESS, "FInfoDlgProc", APPHELP, HELPPROC$)
  781.              IF sz$ = "CONTINUE" THEN
  782.                  z% = ExitWindowsExec( GetWindowsDir() + "_MSRSTRT.EXE", "_MSSETUP.BAT" )
  783.                  UIPop 1
  784.              ELSEIF sz$ = "REACTIVATE" THEN
  785.                  GOTO QUITSUC2
  786.            ELSEIF sz$ = "CANCEL" THEN
  787.                GOTO QUITSUC2
  788.              ENDIF
  789.           WEND
  790.     ENDIF
  791.  
  792. END SUB
  793.  
  794. '*************************************************************************
  795.  
  796.  
  797.  
  798. '**
  799. '** Purpose:
  800. '**     Appends a file name to the end of a directory path,
  801. '**     inserting a backslash character as needed.
  802. '** Arguments:
  803. '**     szDir$  - full directory path (with optional ending "\")
  804. '**     szFile$ - filename to append to directory
  805. '** Returns:
  806. '**     Resulting fully qualified path name.
  807. '*************************************************************************
  808. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  809.     IF szDir$ = "" THEN
  810.         MakePath = szFile$
  811.     ELSEIF szFile$ = "" THEN
  812.         MakePath = szDir$
  813.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  814.         MakePath = szDir$ + szFile$
  815.     ELSE
  816.         MakePath = szDir$ + "\" + szFile$
  817.     ENDIF
  818. END FUNCTION
  819.  
  820.  
  821. '**
  822. '** Purpose:
  823. '** Arguments:
  824. '** Returns:
  825. '*************************************************************************
  826. FUNCTION StrStr(szStr1$,szStr2$) STATIC AS INTEGER
  827.    ' If either string is empty, exit immediatedly.
  828.    IF (szStr1$ <> "") AND (szStr2$ <> "") THEN
  829.       FOR i% = 1 TO LEN(szStr1$) STEP 1
  830.             IF MID$(szStr1$,i%,LEN(szStr2$)) = szStr2$ THEN
  831.                StrStr = 1
  832.                GOTO STRSTR_END
  833.             ENDIF
  834.       NEXT i%
  835.    ENDIF
  836.  
  837.    StrStr = 0
  838.  
  839. STRSTR_END:
  840.  
  841. END FUNCTION
  842.  
  843.  
  844. '**
  845. '** Purpose:
  846. '** Arguments:
  847. '** Returns:
  848. '*************************************************************************
  849. SUB AddPathString(szNewPath$) STATIC
  850.  
  851.    szCurrentPath$ = GetEnvVariableValue("PATH")
  852.  
  853.    IF StrStr(szCurrentPath$,szNewPath$) = 0 THEN
  854.       'PrependToPath "AUTOEXEC.BAT","AUTOEXEC.BAT",szNewPath$,cmoVital + cmoOverwrite
  855.    ENDIF
  856.  
  857. END SUB
  858.  
  859.  
  860.