home *** CD-ROM | disk | FTP | other *** search
/ P.B. Bear's Birthday Party / DKMMPBBP.iso / dksetup / dksetup.mst < prev    next >
Text File  |  1995-05-19  |  11KB  |  356 lines

  1. ''$DEFINE DEBUG
  2. '$INCLUDE 'dkgen.inc'
  3.  
  4. ' Paths and INI stuff
  5. CONST APPLICATION_INI_FILE = "PBBEAR.ini"
  6. CONST APPLICATION_EXE_FILE = "PBBEAR.exe"
  7. CONST APPLICATION_EXE2_FILE = "dksd2pc.exe"
  8. CONST APPLICATION_MENU_FILE = "custmenu.exe"
  9. CONST APPLICATION_PENGE_FILE = "PBBEAR.png"
  10.  
  11. CONST INI_FILE_SOURCE = "WinPath" ' OR "AppPath"
  12.  
  13. ' Language dependant strings
  14. CONST APPLICATION_README_FILE = "readme.wri"
  15. 'CONST APPLICATION_README_FILE2 = "readme2.txt"
  16. CONST STR_README = "PB Bear's Birthday Party Read Me"
  17. CONST STR_MSGCAPTION = "PB Bear's Birthday Party Setup"
  18.  
  19. CONST STR_PRODUCTNAME = "PB Bear's Birthday Party"
  20. CONST DEFAULT_INSTALL_PATH = "\DKMM\PBBEAR"
  21.  
  22. CONST SAMPLER_PATH = "SAMPLER"
  23.  
  24.  
  25. DECLARE SUB Install()
  26. DECLARE SUB AddFilesToCopyList(szInstallType$)
  27.  
  28. DECLARE FUNCTION IsCDROMDrive LIB "dkutils.dll" (wDrive%) As INTEGER
  29.  
  30.  
  31. Init:
  32.    Initialise STR_PRODUCTNAME, DEFAULT_INSTALL_PATH, STR_MSGCAPTION
  33.  
  34.  
  35. WelcomeDlg:
  36.     if Welcome() = NAV_BACK then
  37.         ' Don nothing - cant go back
  38.     end if
  39.  
  40.     if TestSystem() = NAV_BACK then
  41.         goto WelcomeDlg
  42.     end if
  43.  
  44.  
  45. ExpressCustomDlg:
  46.     ' defaults to Express
  47.     'if szExpressCustomChoice = "EXPRESS" then
  48.     '    SetSymbolValue "RadioDefault", "1"
  49.     'else
  50.     '    SetSymbolValue "RadioDefault", "1"
  51.     'end if
  52.  
  53. ECDlgLoop:
  54.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_SPEED, "FRadioDlgProc", IDD_WHIZZHELP, PROC_HELP)
  55.  
  56.     select case szButton
  57.     case "REACTIVATE"
  58.         goto ECDlgLoop
  59.     case "BACK"
  60.         UIPop 1
  61.         goto WelcomeDlg
  62.     case "CONTINUE" ' Install
  63.         UIPop 1
  64.         if GetSymbolValue("ButtonChecked") = "1" then
  65.             szExpressCustomChoice = "EXPRESS"
  66.             goto ExpressInstallLoop
  67.         else
  68.             szExpressCustomChoice = "CUSTOM"
  69.             goto CustomInstallLoop
  70.         end if
  71.     case "EXIT"
  72.         AskQuit
  73.         goto ECDlgLoop
  74.     end select
  75.  
  76.  
  77. CustomInstallLoop:
  78. GetPathDlg:
  79.     SetSymbolValue "EditTextIn", szDestPath
  80.     szOldDestPath = szDestPath
  81.     SetSymbolValue "EditFocus", "ALL"
  82.  
  83. GetPathDlgLoop:
  84.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_DESTPATH, "FEditDlgProc", IDD_PATHHELP, PROC_HELP)
  85.  
  86.     select case szButton
  87.     case "REACTIVATE"
  88.         goto GetPathDlgLoop
  89.  
  90.     case "BACK"
  91.         UIPop 1
  92.         szDestPath = szOldDestPath
  93.         goto ECDlgLoop
  94.  
  95.     case "CONTINUE"
  96.         UIPop 1
  97.         szDestPath = GetSymbolValue("EditTextOut")
  98.  
  99.         if mid$(szDestPath, 2, 1) = ":" and mid$(szDestPath, 3, 1) <> "\" then
  100.             szTemp$ = mid$(szDestPath, 1, 2) + "\" + mid$(szDestPath, 3, len(szDestPath)-2)
  101.             szDestPath = szTemp
  102.         end if
  103.  
  104.         if mid$(szDestPath, 2, 1) <> ":" then
  105.             if mid$(szDestPath, 1,1) <> "\" then
  106.                 szDestPath = mid$(szWinPath, 1,1) + ":\" + szDestPath
  107.             else
  108.                 szDestPath = mid$(szWinPath, 1,1) + ":" + szDestPath
  109.             end if
  110.         elseif IsDriveValid(mid$(szDestPath, 1,1)) = 0 then
  111.             szDestPath = szOldDestPath
  112.             UIPop 1
  113.             BadPath
  114.             goto GetPathDlg
  115.         end if
  116.  
  117.         ' check for "foreign" chars in path
  118.         slength% = len(szDestPath)
  119.         found% = 0
  120.         for i% = 1 to slength%
  121.             if asc(mid$(szDestPath, i%, 1)) > 126 then
  122.                 found% = 1
  123.             end if
  124.         next i%
  125.         if found% = 1 then
  126.             szDestPath = szOldDestPath
  127.             UIPop 1
  128.             BadPath
  129.             goto GetPathDlg
  130.         end if
  131.  
  132.         wDrive% = asc(mid$(szDestPath, 1,1)) - asc("A")
  133.         if IsCDROMDrive(wDrive%) > 0 then
  134.             szDestPath = szOldDestPath
  135.             UIPop 1
  136.             BadPath
  137.             goto GetPathDlg
  138.         end if
  139.  
  140.         if IsDriveNetwork(mid$(szDestPath,1,1)) = 1 then
  141.             szDestPath = szOldDestPath
  142.             UIPop 1
  143.             NetworkDrive
  144.             goto GetPathDlg
  145.         end if
  146.  
  147.         if IsDirWritable(szDestPath) = 0 then
  148.             szDestPath = szOldDestPath
  149.             UIPop 1
  150.             BadPath
  151.             goto GetPathDlg
  152.         end if
  153.  
  154.   '      if DoesDirExist(szDestPath) = 0 then
  155.   '          dButton = DoMsgBox( STR_DIRNOTEXIST, STR_MSGCAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  156.   '          if dButton = 7 then
  157.   '              goto GetPathDlg
  158.   '          end if
  159.   '      end if
  160.         UIPop 1
  161.  
  162.  
  163.     case "EXIT"
  164.         AskQuit
  165.         goto GetPathDlg
  166.     end select
  167.  
  168. GetCustomChoicesDlg:
  169.     SetSymbolValue "CheckItemsState", ""
  170.     AddListItem "CheckItemsState", szMinimalInstall
  171.     AddListItem "CheckItemsState", szAddPMItem
  172. GetCustomChoicesLoop:
  173.  
  174.     ClearCopyList
  175.     if szMinimalInstall = "OFF" then
  176.         AddFilesToCopyList "FULL"
  177.     else
  178.         AddFilesToCopyList "MINIMAL"
  179.     end if
  180.  
  181.     dDestDrive = asc(mid$(szDestPath, 1,1)) - asc("A")+1
  182.     dWinDrive = asc(mid$(szWinPath, 1,1)) - asc("A")+1
  183.  
  184.     SetSymbolValue "DriveStatusText", ""
  185.     AddListItem "DriveStatusText", mid$(szDestPath, 1,1) + ":"
  186.     AddListItem "DriveStatusText", str$(GetDiskSpaceNeeded(dDestDrive) / 1024) + " K"
  187.     AddListItem "DriveStatusText", str$(GetFreeSpaceForDrive(mid$(szDestPath, 1,1))/1024) + " K"
  188.  
  189.     if dDestDrive = dWinDrive then
  190.         AddListItem "DriveStatusText", ""
  191.         AddListItem "DriveStatusText", ""
  192.         AddListItem "DriveStatusText", ""
  193.     else
  194.         AddListItem "DriveStatusText", mid$(szWinPath, 1,1) + ":"
  195.         AddListItem "DriveStatusText", str$(GetDiskSpaceNeeded(dWinDrive)/ 1024 ) + " K"
  196.         AddListItem "DriveStatusText", str$(GetFreeSpaceForDrive(mid$(szWinPath, 1,1))/1024) + " K"
  197.     end if
  198.  
  199.     AddListItem "DriveStatusText", szDestPath
  200.  
  201. ChooseInstall:
  202.  
  203.     szButton = UIStartDlg(CUIDLL_FILENAME, IDD_CUSTOM, "FCustInstDlgProc", IDD_CUSTOMHELP, PROC_HELP)
  204.  
  205.     szMinimalInstall = GetListItem("CheckItemsState", 1)
  206.     szAddPMItem = GetListItem("CheckItemsState", 2)
  207.  
  208.     select case szButton
  209.     case "REACTIVATE"
  210.         goto GetCustomChoicesLoop
  211.     case "BACK"
  212.         UIPop 1
  213.         goto GetPathDlg
  214.     case "CONTINUE"
  215.         UIPop 1
  216.     case "EXIT"
  217.         AskQuit
  218.         goto GetCustomChoicesLoop
  219.     end select
  220.  
  221.     ClearCopyList
  222.     if szMinimalInstall = "OFF" then
  223.         AddFilesToCopyList "FULL"
  224.     else
  225.         AddFilesToCopyList "MINIMAL"
  226.     end if
  227.     goto CommonInstallLoop
  228.  
  229. ExpressInstallLoop:
  230.     AddFilesToCopyList "FULL"
  231.     goto CommonInstallLoop
  232.  
  233. CommonInstallLoop:
  234.     InitCommonInstall
  235.  
  236.     if szMinimalInstall = "ON" and GetFreeSpaceForDrive(mid$(szDestPath,1,1)) < MINIMUM_DISK_SPACE then
  237.         error ERR_NODISKSPACE
  238.     elseif GetFreeSpaceForDrive(mid$(szDestPath,1,1)) < GetDiskSpaceNeeded( asc(mid$(szDestPath, 1,1))-asc("A")+1 ) then
  239.         error ERR_NODISKSPACE
  240.     end if
  241.  
  242.     UpdateWinGDrivers
  243.     UpdateIndeoAVIDrivers
  244.  
  245.     Install
  246.  
  247.     CreateProgmanGroup STR_COMPANYNAME, "", cmoNone
  248.     ShowProgmanGroup   STR_COMPANYNAME, 1, cmoNone
  249.     szReadmeTitle$ = STR_PRODUCTNAME + " " + STR_README
  250.  
  251.     szSamplerPath$ = MakePath( mid$(szSrcSetupPath, 1, (len(szSrcSetupPath) - len(SOURCE_SETUP_SUBDIR))-1), SAMPLER_PATH)
  252.     szSamplerPath$ = MakePath(szSamplerPath$, APPLICATION_EXE2_FILE)
  253.  
  254.     if szMinimalInstall = "ON" then
  255.         szInf$ = MakePath(szSrcBinPath, APPLICATION_MENU_FILE) + " " + MakePath(szSrcBinPath, APPLICATION_EXE_FILE) + " " + MakePath(szSrcBinPath, APPLICATION_PENGE_FILE) + " " + szSamplerPath$
  256.         CreateProgmanItem STR_COMPANYNAME, STR_PRODUCTNAME, szInf, szInf, cmoOverwrite
  257.         CreateProgmanItem STR_COMPANYNAME, STR_README, "write.exe " + MakePath(szSrcBinPath, APPLICATION_README_FILE), "", cmoOverwrite
  258.     else
  259.         szInf$ = MakePath(szDestPath, APPLICATION_MENU_FILE) + " " + MakePath(szDestPath, APPLICATION_EXE_FILE) + " " + MakePath(szDestPath, APPLICATION_PENGE_FILE) + " " + szSamplerPath$
  260.         CreateProgmanItem STR_COMPANYNAME, STR_PRODUCTNAME, szInf, szInf, cmoOverwrite
  261.         CreateProgmanItem STR_COMPANYNAME, STR_README, "write.exe " + MakePath(szDestPath, APPLICATION_README_FILE), "", cmoOverwrite
  262.     end if
  263.  
  264. '$IFDEF DEBUG
  265.     DumpCopyList MakePath(szDestPath, "copylist.txt")
  266. '$ENDIF ''DEBUG
  267.  
  268.     EndCommonInstall APPLICATION_README_FILE, 0
  269.  
  270. quit:
  271.     on error goto quit
  272.  
  273.     select case ERR
  274.  
  275.     case 0
  276.         hDlg = IDD_EXITSUCCESS
  277.     case STFQUIT
  278.         hDlg = IDD_EXITQUIT
  279.     case ERR_NODISKSPACE
  280.         hDlg = IDD_NODISKSPACE
  281.     case else
  282.         hDlg = IDD_EXITFAILURE
  283.     end select
  284.  
  285.     UIPop 10
  286. quit2:
  287.     szButton = UIStartDlg(CUIDLL_FILENAME, hDlg, "FInfo0DlgProc", 0, "")
  288.     select case szButton
  289.     case "REACTIVATE"
  290.         goto quit2
  291.     end select
  292.  
  293.     UIPop 1
  294.     DeInitialise
  295.     stop
  296.     end
  297.  
  298. quitError:
  299.     dButton = DoMsgBox (STR_QUITERROR, STR_MSGCAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  300.     DeInitialise
  301.     stop
  302.     end
  303.  
  304.  
  305.  
  306.  
  307. Sub Install() STATIC
  308.  
  309.     cursor% = ShowWaitCursor()
  310.     CreateDir szDestPath, cmoNone
  311.     SetRestartDir szDestPath
  312.     RestoreCursor(cursor%)
  313.  
  314.     CopyFilesInCopyList
  315.  
  316.     Run ("regedit.exe /s " + MakePath(szWinPath, "mplayer.reg"))
  317.     Run ("regedit.exe /s " + MakePath(szWinSysPath, "OLE2.reg"))
  318.     Run ("regedit.exe /s " + MakePath(szWinSysPath, "cleanup.reg"))
  319.     Run ("profdisp.exe")
  320.  
  321.     if INI_FILE_SOURCE = "AppPath" then
  322.         szAppINIPath = MakePath(szDestPath, APPLICATION_INI_FILE)
  323.     else
  324.         szAppINIPath = MakePath(szWinPath, APPLICATION_INI_FILE)
  325.     end if
  326.  
  327.     szPengePath = mid$(szSrcSetupPath, 1,len(szSrcSetupPath)-len(SOURCE_SETUP_SUBDIR)-2) ' -2 removes backslash
  328.     CreateIniKeyValue szAppINIPath, PRODUCT_INI_DIR_SECTION_NAME, PRODUCT_INI_DIR_ENTRY_NAME, szPengePath, cmoOverwrite
  329. End Sub
  330.  
  331.  
  332. Sub AddFilesToCopyList(szInstallType$) STATIC
  333.     cursor% = ShowWaitCursor()
  334.  
  335.     select case szInstallType
  336.     case "FULL"
  337.         AddSectionFilesToCopyList SETUP_INI_BINARIES_SECTION_NAME, szSrcBinPath, szDestPath
  338.  
  339.     case "MINIMAL"
  340.         ' nothing
  341.     end select
  342.  
  343. '    if fSystemUpdated = 1 then
  344.         AddSectionFilesToCopyList SETUP_INI_WING_BINARIES_NAME, szSrcBinPath, szWinSysPath
  345.         AddSectionFilesToCopyList SETUP_INI_WING32_BINARIES_NAME, szSrcBinPath, szWinSysPath
  346.         AddSectionFilesToCopyList "VfW Runtime", szSrcBinPath, szWinSysPath
  347.         AddSectionFilesToCopyList "OLE2", szSrcBinPath, szWinSysPath
  348.         AddSectionFilesToCopyList "ACM Drivers", szSrcBinPath, szWinSysPath
  349.         AddSectionFilesToCopyList "MPlayer", szSrcBinPath, szWinPath
  350.         AddSectionFilesToCopyList "AVICodecs", szSrcBinPath, szWinSysPath
  351. '    end if
  352.     RestoreCursor(cursor%)
  353. End Sub
  354.  
  355.  
  356.