' Install.vbs
'
' Install Ravisent's DVD Player 1.5.00.1120 on Windows 2000
' Version 1.02
'
' Created: March 11, 2000
' Updated: July 6, 2000
'
' Copyright (c) 2000 Niclas Pennskog (niclas@rtg.se)
'
' To run this script you need to put the following files in
' the same directory as the script:
' * data1.cab from ftp://12.15.236.250/CinemasterC3.0/30Installer.zip
' * i5comp.exe and ZD51145.DLL from
'   http://software.freepage.de/enigma_/i5comp.zip or
'   http://cert.unisa.it/pub/PC/SAC/pack/i5comp21.rar or
'   http://www.suddendischarge.com/Disassemblers.html
'
' You should also have administrator rights.
'
' This script is only needed until Ravisent releases an official
' working installer for their DVD Player.
'
' See http://www.rtg.se/~niclas/dvd/cinemaster/ for more info!
'

Option Explicit

Dim intRet
Dim WshShell, fso, oShellLink
Dim strTitle, strAppDir1, strAppDir2, strTemp

strTitle="DVD Player Installation"

' Create WshShell and FileSystem object
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

' Create new application directory string
strAppDir1=WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir") & "\Ravisent"
strAppDir2=WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir") & "\Ravisent\DVD Player"

intRet=MsgBox("This script will install Ravisent DVD Player 1.5.00.1120 for use in Windows 2000." & vbCrLf & vbCrLf & _
  "You should run this script in a temporary directory where data1.cab from" & vbCrLf & _
  "30Installer.zip has been extracted and i5comp.exe and ZD51145.DLL have" & vbCrLf & _
  "been copied. See the comments in the source for links." & vbCrLf & _
  "You should also have administrator rights." & vbCrLf & vbCrLf & _
  "The application will be installed in the directory: " & vbCrLf & strAppDir2, vbOkCancel, strTitle)

If intRet=vbOk Then

  ' Check for i5comp5.exe, ZD51145.DLL and data1.cab
  If Not fso.FileExists("data1.cab") Then MsgBox "Can't find 'data1.cab'!"
  If Not fso.FileExists("i5comp.exe") Then MsgBox "Can't find 'i5comp.exe'!"
  If Not fso.FileExists("ZD51145.DLL") Then MsgBox "Can't find 'ZD51145.DLL'!"

  ' Extract all files in data1.cab
  WshShell.Run "i5comp x data1.cab DVDPlayer.exe",1,True
  WshShell.Run "i5comp x data1.cab dvba00us.dll",1,True
  WshShell.Run "i5comp x data1.cab RPC2.dll",1,True
  WshShell.Run "i5comp x data1.cab cinmst32.dll",1,True
  WshShell.Run "i5comp x data1.cab dvdpld32.dll",1,True

  ' Create directory
  If Not fso.FolderExists(strAppDir1) Then fso.CreateFolder(strAppDir1)
  If Not fso.FolderExists(strAppDir2) Then fso.CreateFolder(strAppDir2)

  ' Copy files
  fso.CopyFile "DVDPlayer.exe", strAppDir2 & "\"
  fso.CopyFile "dvba00us.dll", strAppDir2 & "\"
  fso.CopyFile "RPC2.dll", strAppDir2 & "\"
  fso.CopyFile "cinmst32.dll", strAppDir2 & "\"
  fso.CopyFile "dvdpld32.dll", strAppDir2 & "\"

  ' Delete files
  fso.DeleteFile "DVDPlayer.exe"
  fso.DeleteFile "dvba00us.dll"
  fso.DeleteFile "RPC2.dll"
  fso.DeleteFile "cinmst32.dll"
  fso.DeleteFile "dvdpld32.dll"

  ' Create SPDIF button key (0=standard, 2=volume slider, 4=SPDIF button)
  WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Quadrant International, Inc.\DVDPlayer\1.5\SliderMode", 4 ,"REG_DWORD"

  intRet=MsgBox("If you have a CineMaster card with TV output you should" & vbCrLf & _
    "enable this feature by choosing Yes below.", vbOkCancel, strTitle)

  If intRet=vbOk Then
    ' Create hardware video out key (0=disabled, 1=enabled)
    WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Quadrant International, Inc.\DVDPlayer\1.5\HWVidOut", 1 ,"REG_DWORD"
  End If

  ' Create shortcuts
  intRet=MsgBox("Do you want to create a shortcut in the Start menu (for all users)?", vbYesNo, strTitle)
  If intRet=vbYes Then
    Set oShellLink = WshShell.CreateShortcut(WshShell.SpecialFolders("AllUsersPrograms") & "\Ravisent DVD Player.lnk")
    oShellLink.TargetPath =strAppDir2 & "\DVDPlayer.exe"
    oShellLink.WorkingDirectory = strAppDir2
    oShellLink.Save
  End If
  intRet=MsgBox("Do you want to create a shortcut on the desktop (for all users)?", vbYesNo, strTitle)
  If intRet=vbYes Then
    strTemp=WshShell.SpecialFolders("AllUsersDesktop")
    Set oShellLink = WshShell.CreateShortcut(strTemp & "\Ravisent DVD Player.lnk")
    oShellLink.TargetPath = strAppDir2 & "\DVDPlayer.exe"
    oShellLink.WorkingDirectory = strAppDir2
    oShellLink.Save
  End If

  ' Start the Ravisent DVD Player (will not set working directory properly)
'  intRet=MsgBox("Do you want to start the DVD Player?", vbYesNo, strTitle)
'  If intRet=vbYes Then WshShell.Run (Chr(34) & strAppDir2 & "\DVDPlayer.exe" & Chr(34))

  MsgBox "The installation has been completed.", vbOkOnly, strTitle

End If
