'///////////////////////////////////////////////////////////
' Copyright 2014 Toshiba Corporation, all rights reserved.
' 2014.11.3 Copy Atheros BtFilter driver to the driver folder for repairing

Option Explicit

const cSource_x64 = "%ProgramFiles(x86)%\TOH Class Filter\Drivers\btfilter.sys"
const cSource_x86 = "%ProgramFiles%\TOH Class Filter\Drivers\btfilter.sys"
const cDestination = "%SystemRoot%\system32\drivers\"

on error resume next
if CopyFile(cSource_x64, cDestination) = false then
	call CopyFile(cSource_x86, cDestination)
end if
on error goto 0


'///////////////////////////////////////////////////////////
'
'
Function CopyFile( filename, path_to )

	dim WshShell 
	Dim Fs
	dim source, destination
'	dim ver1, ver2

	CopyFile = false
	Set Fs = WScript.CreateObject("Scripting.FileSystemObject")
	Set WshShell  = WScript.CreateObject("WScript.Shell")

	source = WshShell.ExpandEnvironmentStrings(filename)
	destination = WshShell.ExpandEnvironmentStrings(path_to)

	If Fs.FileExists(source) Then	' Case of Folder
		Fs.CopyFile source, destination, true 
		CopyFile = true
	End If

'	ver1 = Fs.GetFileVersion(source)
'	ver2 = Fs.GetFileVersion(destination & Fs.GetFileName(source))
'	msgbox source & vbCRLF & "source:" & ver1 & vbCRLF & "destination:" & ver2

	set WshShell = nothing
	set Fs = nothing
	
End Function

