home *** CD-ROM | disk | FTP | other *** search
/ Tietosanakirja Tiede / DKMMSCIE.ISO / dksetup / dksetup.bak < prev    next >
Text File  |  1995-10-19  |  15KB  |  469 lines

  1. ''$DEFINE DEBUG
  2. '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3. '   SCIENCE (FI)
  4. '
  5. '   VforW + Wing
  6. '
  7. '   VERSION:
  8. '   --------
  9. '   07/09/95    Add Wing drivers for penge 1.1
  10. '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  11. '07/06/95 Original gives option to not add icon, so need new .rc and rebuild .mak
  12. '07/07/95 Correct dkgen.inc so unregisters use of ctl3d
  13. '04/07/95 Make sure files in bin section of inf file 'always' overwrite
  14. '28/07/95 Ini file not created for minimum install, uses file provided in dkcode
  15. '27/06/95 Test for directory names max 8 chars
  16. '26/06/95 For minimum install, ini file is now not installed
  17. '19/06/95 Moved test for cirrus drivers to mst file as only applies to sampler
  18. '05/06/95 Fonts installed on users machine
  19. '01/06/95 No choice about adding icon to prog man, altered dkgen.inc & rc file
  20. '            (custom, customhelp & speed dlg boxes need changing)
  21. '22/05/95 Code for bundling with sampler
  22. '22/05/95 Large readme need Write (will need to change dlg box in rc file)
  23. '15/05/95 No warning that directory does not exist
  24. '03/05/95 Ini file put in executable directory rather than Windows dir to stop
  25. '            clash with foreign products with same name files
  26.  
  27.  
  28. '$INCLUDE 'dkgen.inc'
  29.  
  30.  
  31. 'IF WITH SAMPLER ( add to .inf & dkcode ) + see add to prog man below
  32. 'CONST SAMPLER_PATH = "SAMPLER"
  33. 'CONST APPLICATION_MENU_FILE = "custmenu.exe"
  34. 'CONST APPLICATION_EXE2_FILE = "dksd2pc.exe"
  35. 'DECLARE FUNCTION TestForCirrus LIB "dkutils.dll" () As INTEGER
  36.  
  37.  
  38. 'IF USING SPECIFIC FONTS
  39. 'DECLARE FUNCTION InstallFont LIB "dkutils.dll" (szFont$) AS INTEGER
  40. 'DECLARE SUB UpdateFonts()
  41.  
  42. ' Paths and INI stuff
  43. CONST APPLICATION_INI_FILE = "science.ini"
  44. CONST APPLICATION_EXE_FILE = "science.exe"
  45. CONST APPLICATION_PENGE_FILE = "science.png"
  46.  
  47. CONST INI_FILE_SOURCE = "AppPath" ' OR   "WinPath"
  48. CONST EDITOR_EXE = "notepad.exe " 'OR "write.exe "
  49.  
  50. ' Language dependant strings
  51. CONST APPLICATION_README_FILE = "lueminut.txt"
  52. CONST STR_README = "CD-ROM Tietosanakirja TIEDE Lue Minut"
  53. CONST STR_MSGCAPTION = "CD-ROM Tietosanakirja TIEDE Asennus"
  54. CONST STR_PRODUCTNAME = "CD-ROM Tietosanakirja TIEDE"
  55. CONST DEFAULT_INSTALL_PATH = "\HM\TIEDE"
  56.  
  57. DECLARE SUB Install()
  58. DECLARE SUB AddFilesToCopyList(szInstallType$)
  59. DECLARE FUNCTION IsCDROMDrive LIB "dkutils.dll" (wDrive%) As INTEGER
  60.  
  61.  
  62. Init:
  63.    Initialise STR_PRODUCTNAME, DEFAULT_INSTALL_PATH, STR_MSGCAPTION
  64.  
  65.  
  66. WelcomeDlg:
  67.     if Welcome() = NAV_BACK then
  68.         ' Don nothing - cant go back
  69.     end if
  70.  
  71.     if TestSystem() = NAV_BACK then
  72.         goto WelcomeDlg
  73.     end if
  74.  
  75. 'IF WITH SAMPLER
  76. 'TestCirrus:
  77. '    if TestForCirrus() = 1 then
  78. '        dButton = DoMsgBox(STR_CIRRUS, szMsgCaption$, MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  79. '    end if
  80.  
  81. 'IF EARLIER PRODS WITH NO SAMPLER
  82. '    UpdateADPCMDrivers
  83.  
  84.  
  85. ExpressCustomDlg:
  86.     ' defaults to Express
  87.     'if szExpressCustomChoice = "EXPRESS" then
  88.     '    SetSymbolValue "RadioDefault", "1"
  89.     'else
  90.     '    SetSymbolValue "RadioDefault", "1"
  91.     'end if
  92.  
  93. ECDlgLoop:
  94.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_SPEED, "FRadioDlgProc", IDD_WHIZZHELP, PROC_HELP)
  95.  
  96.     select case szButton
  97.     case "REACTIVATE"
  98.         goto ECDlgLoop
  99.     case "BACK"
  100.         UIPop 1
  101.         goto WelcomeDlg
  102.     case "CONTINUE" ' Install
  103.         UIPop 1
  104.         if GetSymbolValue("ButtonChecked") = "1" then
  105.             szExpressCustomChoice = "EXPRESS"
  106.             goto ExpressInstallLoop
  107.         else
  108.             szExpressCustomChoice = "CUSTOM"
  109.             goto CustomInstallLoop
  110.         end if
  111.     case "EXIT"
  112.         AskQuit
  113.         goto ECDlgLoop
  114.     end select
  115.  
  116.  
  117. CustomInstallLoop:
  118. GetPathDlg:
  119.     SetSymbolValue "EditTextIn", szDestPath
  120.     szOldDestPath = szDestPath
  121.     SetSymbolValue "EditFocus", "ALL"
  122.  
  123. GetPathDlgLoop:
  124.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_DESTPATH, "FEditDlgProc", IDD_PATHHELP, PROC_HELP)
  125.  
  126.     select case szButton
  127.     case "REACTIVATE"
  128.         goto GetPathDlgLoop
  129.  
  130.     case "BACK"
  131.         UIPop 1
  132.         szDestPath = szOldDestPath
  133.         goto ECDlgLoop
  134.  
  135.     case "CONTINUE"
  136.         UIPop 1
  137.         szDestPath = GetSymbolValue("EditTextOut")
  138.  
  139.         if mid$(szDestPath, 2, 1) = ":" and mid$(szDestPath, 3, 1) <> "\" then
  140.             szTemp$ = mid$(szDestPath, 1, 2) + "\" + mid$(szDestPath, 3, len(szDestPath)-2)
  141.             szDestPath = szTemp
  142.         end if
  143.  
  144.         if mid$(szDestPath, 2, 1) <> ":" then
  145.             if mid$(szDestPath, 1,1) <> "\" then
  146.                 szDestPath = mid$(szWinPath, 1,1) + ":\" + szDestPath
  147.             else
  148.                 szDestPath = mid$(szWinPath, 1,1) + ":" + szDestPath
  149.             end if
  150.         elseif IsDriveValid(mid$(szDestPath, 1,1)) = 0 then
  151.             szDestPath = szOldDestPath
  152.             UIPop 1
  153.             BadPath
  154.             goto GetPathDlg
  155.         end if
  156.  
  157.         ' check for "foreign" chars in path
  158.         slength% = len(szDestPath)
  159.         found% = 0
  160.         for i% = 1 to slength%
  161.             if asc(mid$(szDestPath, i%, 1)) > 126 then
  162.                 found% = 1
  163.             end if
  164.         next i%
  165.         if found% = 1 then
  166.             szDestPath = szOldDestPath
  167.             UIPop 1
  168.             BadPath
  169.             goto GetPathDlg
  170.         end if
  171.  
  172.         wDrive% = asc(mid$(szDestPath, 1,1)) - asc("A")
  173.         if IsCDROMDrive(wDrive%) > 0 then
  174.             szDestPath = szOldDestPath
  175.             UIPop 1
  176.             BadPath
  177.             goto GetPathDlg
  178.         end if
  179.  
  180.         if IsDriveNetwork(mid$(szDestPath,1,1)) = 1 then
  181.             szDestPath = szOldDestPath
  182.             UIPop 1
  183.             NetworkDrive
  184.             goto GetPathDlg
  185.         end if
  186.  
  187.         if IsDirWritable(szDestPath) = 0 then
  188.             szDestPath = szOldDestPath
  189.             UIPop 1
  190.             BadPath
  191.             goto GetPathDlg
  192.         end if
  193.  
  194.         'check dir names not > 8 chars
  195.         dirlength% = 0
  196.         i% = 3
  197.         while i% <> slength%
  198.             i% =i%+1
  199.             dirlength% = dirlength% +1
  200.             if mid$(szDestPath, i%, 1)="\" then
  201.                 if dirlength% > 9 then
  202.                     szDestPath = szOldDestPath
  203.                     dButton = DoMsgBox( STR_DIRTOOLONG, STR_MSGCAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  204.                     goto GetPathDlg
  205.                  else
  206.                     dirlength% = 0
  207.                 endif
  208.             end if
  209.  
  210.         wend
  211.         if dirlength% > 8 then
  212.             szDestPath = szOldDestPath
  213.             dButton = DoMsgBox( STR_DIRTOOLONG, STR_MSGCAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  214.             goto GetPathDlg
  215.         endif
  216.  
  217.  
  218.  
  219.   '      if DoesDirExist(szDestPath) = 0 then
  220.   '          dButton = DoMsgBox( STR_DIRNOTEXIST, STR_MSGCAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  221.   '          if dButton = 7 then
  222.   '              goto GetPathDlg
  223.   '          end if
  224.   '      end if
  225.  
  226.         UIPop 1
  227.  
  228.  
  229.     case "EXIT"
  230.         AskQuit
  231.         goto GetPathDlg
  232.     end select
  233.  
  234. GetCustomChoicesDlg:
  235.     SetSymbolValue "CheckItemsState", ""
  236.     AddListItem "CheckItemsState", szMinimalInstall
  237. '    AddListItem "CheckItemsState", szAddPMItem
  238. GetCustomChoicesLoop:
  239.  
  240.     ClearCopyList
  241.     if szMinimalInstall = "OFF" then
  242.         AddFilesToCopyList "FULL"
  243.     else
  244.         AddFilesToCopyList "MINIMAL"
  245.     end if
  246.  
  247.     dDestDrive = asc(mid$(szDestPath, 1,1)) - asc("A")+1
  248.     dWinDrive = asc(mid$(szWinPath, 1,1)) - asc("A")+1
  249.  
  250.     SetSymbolValue "DriveStatusText", ""
  251.     AddListItem "DriveStatusText", mid$(szDestPath, 1,1) + ":"
  252.     AddListItem "DriveStatusText", str$(GetDiskSpaceNeeded(dDestDrive) / 1024) + " K"
  253.     AddListItem "DriveStatusText", str$(GetFreeSpaceForDrive(mid$(szDestPath, 1,1))/1024) + " K"
  254.  
  255.     if dDestDrive = dWinDrive then
  256.         AddListItem "DriveStatusText", ""
  257.         AddListItem "DriveStatusText", ""
  258.         AddListItem "DriveStatusText", ""
  259.     else
  260.         AddListItem "DriveStatusText", mid$(szWinPath, 1,1) + ":"
  261.         AddListItem "DriveStatusText", str$(GetDiskSpaceNeeded(dWinDrive)/ 1024 ) + " K"
  262.         AddListItem "DriveStatusText", str$(GetFreeSpaceForDrive(mid$(szWinPath, 1,1))/1024) + " K"
  263.     end if
  264.  
  265.     AddListItem "DriveStatusText", szDestPath
  266.  
  267. ChooseInstall:
  268.  
  269.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_CUSTOM, "FCustInstDlgProc", IDD_CUSTOMHELP, PROC_HELP)
  270.  
  271.     szMinimalInstall = GetListItem("CheckItemsState", 1)
  272. '    szAddPMItem = GetListItem("CheckItemsState", 2)
  273.  
  274.     select case szButton
  275.     case "REACTIVATE"
  276.         goto GetCustomChoicesLoop
  277.     case "BACK"
  278.         UIPop 1
  279.         goto GetPathDlg
  280.     case "CONTINUE"
  281.         UIPop 1
  282.     case "EXIT"
  283.         AskQuit
  284.         goto GetCustomChoicesLoop
  285.     end select
  286.  
  287.     ClearCopyList
  288.     if szMinimalInstall = "OFF" then
  289.         AddFilesToCopyList "FULL"
  290.     else
  291.         AddFilesToCopyList "MINIMAL"
  292.     end if
  293.     goto CommonInstallLoop
  294.  
  295. ExpressInstallLoop:
  296.     AddFilesToCopyList "FULL"
  297.     goto CommonInstallLoop
  298.  
  299. CommonInstallLoop:
  300.     InitCommonInstall
  301.  
  302.     if szMinimalInstall = "ON" and GetFreeSpaceForDrive(mid$(szDestPath,1,1)) < MINIMUM_DISK_SPACE then
  303.         error ERR_NODISKSPACE
  304.     elseif GetFreeSpaceForDrive(mid$(szDestPath,1,1)) < GetDiskSpaceNeeded( asc(mid$(szDestPath, 1,1))-asc("A")+1 ) then
  305.         error ERR_NODISKSPACE
  306.     end if
  307.  
  308. 'IF LATER PROD BUT NOT SCIENCE
  309. '    UpdateWinGDrivers
  310.  
  311. 'IF LATER PROD OR WITH SAMPLER
  312.     UpdateIndeoAVIDrivers
  313.  
  314. 'IF USING SPECIFIC FONTS
  315. '    UpdateFonts
  316.  
  317.     Install
  318.  
  319.     CreateProgmanGroup STR_COMPANYNAME, "", cmoNone
  320.     ShowProgmanGroup   STR_COMPANYNAME, 1, cmoNone
  321. '    szReadmeTitle$ = STR_PRODUCTNAME + " " + STR_README
  322.  
  323. 'IF WITH SAMPLER
  324. '    szSamplerPath$ = MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), SAMPLER_PATH)
  325. '    szSamplerPath$ = MakePath(szSamplerPath$, APPLICATION_EXE2_FILE)
  326. '    if szMinimalInstall = "ON" then
  327. '        szInf$ = MakePath(szSrcBinPath, APPLICATION_MENU_FILE) + " " + MakePath(szSrcBinPath, APPLICATION_EXE_FILE) + " " + MakePath(szSrcBinPath, APPLICATION_PENGE_FILE) + " " + szSamplerPath$
  328. '        CreateProgmanItem STR_COMPANYNAME, STR_PRODUCTNAME, szInf, szInf, cmoOverwrite
  329. '         CreateProgmanItem STR_COMPANYNAME, STR_README, EDITOR_EXE + MakePath(szSrcBinPath, APPLICATION_README_FILE), "", cmoOverwrite
  330. '    else
  331. '        szInf$ = MakePath(szDestPath, APPLICATION_MENU_FILE) + " " + MakePath(szDestPath, APPLICATION_EXE_FILE) + " " + MakePath(szDestPath, APPLICATION_PENGE_FILE) + " " + szSamplerPath$
  332. '        CreateProgmanItem STR_COMPANYNAME, STR_PRODUCTNAME, szInf, szInf, cmoOverwrite
  333. '        CreateProgmanItem STR_COMPANYNAME, STR_README, EDITOR_EXE + MakePath(szDestPath, APPLICATION_README_FILE), "", cmoOverwrite
  334. '    end if
  335.  
  336. 'IF NO SAMPLER
  337.     if szMinimalInstall = "ON" then
  338.         szInf$ = MakePath(szSrcBinPath, APPLICATION_EXE_FILE) + " " + MakePath(szSrcBinPath, APPLICATION_PENGE_FILE)
  339.         CreateProgmanItem STR_COMPANYNAME, STR_PRODUCTNAME, szInf, szInf, cmoOverwrite
  340.         CreateProgmanItem STR_COMPANYNAME, STR_README, EDITOR_EXE + MakePath(szSrcBinPath, APPLICATION_README_FILE), "", cmoOverwrite
  341.     else
  342.         szInf$ = MakePath(szDestPath, APPLICATION_EXE_FILE) + " " + MakePath(szDestPath, APPLICATION_PENGE_FILE)
  343.         CreateProgmanItem STR_COMPANYNAME, STR_PRODUCTNAME, szInf, szInf, cmoOverwrite
  344.         CreateProgmanItem STR_COMPANYNAME, STR_README, EDITOR_EXE + MakePath(szDestPath, APPLICATION_README_FILE), "", cmoOverwrite
  345.     end if
  346.  
  347. '$IFDEF DEBUG
  348.     DumpCopyList MakePath(szDestPath, "copylist.txt")
  349. '$ENDIF ''DEBUG
  350.  
  351.     EndCommonInstall APPLICATION_README_FILE, 0, EDITOR_EXE
  352.  
  353. quit:
  354.     on error goto quit
  355.  
  356.     select case ERR
  357.  
  358.     case 0
  359.         hDlg = IDD_EXITSUCCESS
  360.     case STFQUIT
  361.         hDlg = IDD_EXITQUIT
  362.     case ERR_NODISKSPACE
  363.         hDlg = IDD_NODISKSPACE
  364.     case else
  365.         hDlg = IDD_EXITFAILURE
  366.     end select
  367.  
  368.     UIPop 10
  369. quit2:
  370.     szButton = UIStartDlg(CUIDLL_FILENAME, hDlg, "FInfo0DlgProc", 0, "")
  371.     select case szButton
  372.     case "REACTIVATE"
  373.         goto quit2
  374.     end select
  375.  
  376.     UIPop 1
  377.     DeInitialise
  378.     stop
  379.     end
  380.  
  381. quitError:
  382.     dButton = DoMsgBox (STR_QUITERROR, STR_MSGCAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  383.     DeInitialise
  384.     stop
  385.     end
  386.  
  387.  
  388.  
  389.  
  390. Sub Install() STATIC
  391.  
  392.     cursor% = ShowWaitCursor()
  393.     CreateDir szDestPath, cmoNone
  394.     SetRestartDir szDestPath
  395.     RestoreCursor(cursor%)
  396.  
  397.     CopyFilesInCopyList  'creates dir even if min install
  398.  
  399. 'IF LATER PROD OR WITH SAMPLER
  400.     Run ("regedit.exe /s " + MakePath(szWinPath, "mplayer.reg"))
  401.     Run ("regedit.exe /s " + MakePath(szWinSysPath, "OLE2.reg"))
  402.     Run ("regedit.exe /s " + MakePath(szWinSysPath, "cleanup.reg"))
  403.     Run ("profdisp.exe")
  404.  
  405.     if INI_FILE_SOURCE = "AppPath" then
  406.         szAppINIPath = MakePath(szDestPath, APPLICATION_INI_FILE)
  407.     else
  408.         szAppINIPath = MakePath(szWinPath, APPLICATION_INI_FILE)  'being phased out
  409.     end if
  410.  
  411.     szPengePath = mid$(szSrcSetupPath, 1,len(szSrcSetupPath)-len(SOURCE_SETUP_SUBDIR)-2) ' -2 removes backslash
  412.  
  413.     if szMinimalInstall = "OFF"  then
  414.         CreateIniKeyValue szAppINIPath, PRODUCT_INI_DIR_SECTION_NAME, PRODUCT_INI_DIR_ENTRY_NAME, szPengePath, cmoOverwrite
  415.     endif
  416.  
  417. End Sub
  418.  
  419.  
  420. Sub AddFilesToCopyList(szInstallType$) STATIC
  421.     cursor% = ShowWaitCursor()
  422.  
  423.     select case szInstallType
  424.     case "FULL"
  425.         AddSectionFilesToCopyList SETUP_INI_BINARIES_SECTION_NAME, szSrcBinPath, szDestPath
  426.  
  427.     case "MINIMAL"
  428.         ' nothing
  429.     end select
  430.  
  431. 'IF EARLIER PRODS AND NO SAMPLER
  432. '    if fSystemUpdated = 1 then
  433. '        AddSectionFilesToCopyList "ACM Drivers", szSrcBinPath, szWinSysPath
  434. '    end if
  435.  
  436.  
  437.  
  438. 'IF LATER PROD BUT NOT SCIENCE if before v1.1
  439.         AddSectionFilesToCopyList SETUP_INI_WING_BINARIES_NAME, szSrcBinPath, szWinSysPath
  440.         AddSectionFilesToCopyList SETUP_INI_WING32_BINARIES_NAME, szSrcBinPath, szWinSysPath
  441. 'IF LATER PROD OR WITH SAMPLER
  442.         AddSectionFilesToCopyList "VfW Runtime", szSrcBinPath, szWinSysPath
  443.         AddSectionFilesToCopyList "OLE2", szSrcBinPath, szWinSysPath
  444.         AddSectionFilesToCopyList "ACM Drivers", szSrcBinPath, szWinSysPath
  445.         AddSectionFilesToCopyList "MPlayer", szSrcBinPath, szWinPath
  446.         AddSectionFilesToCopyList "AVICodecs", szSrcBinPath, szWinSysPath
  447.  
  448.     RestoreCursor(cursor%)
  449. End Sub
  450.  
  451.  
  452. 'IF USING SPECIFIC FONTS
  453. 'Sub UpdateFonts() STATIC
  454. '    ' Check TT enabled
  455. '    MakeListFromSectionFilename "Fonts_list", "Fonts"
  456. '
  457. '    listLength% = GetListLength("Fonts_list")
  458. '    if listLength% > 0 then
  459. '        for item% = 1 to listLength%
  460. '            szFontFile$ = GetListItem("Fonts_list", item%)
  461. '            ' Check if exists
  462. '            'Install font
  463. '            ret% = InstallFont(MakePath(szSrcBinPath, szFontFile))
  464. '            ' Write WIN.INI
  465. '        next
  466. '    end if
  467. 'End Sub
  468.  
  469.