Google
      
发新话题
打印

自由天空硬件智能判断驱动选择程序v1.0Final功能函数源代码

自由天空硬件智能判断驱动选择程序v1.0Final功能函数源代码

感谢自由天空技术论坛!

Func InstallDrivers($DeviceKeyword,$DriverPath)
        ProcessClose("PrDrvS.exe")
        ProcessClose("7za.exe")
        Dim $i,$j,$7zaPath,$7zDrvPath,$DeviceKeywordStr,$DeviceKeywordStr2,$Count
        Dim $p,$q,$ListLine,$ListLine2
        Dim $t1,$t2,$tm
        Dim $S
        Dim $f
        Dim $TimeBegin,$TimeDif,$Minutes,$Seconds
        Dim $KillDrvPath
        Dim $RD[10]
        $7zaPath=@ComSpec & " /c " &$InstallPath&"\7za.exe"
        $t1=1000
        $t2=0
        If Not(FileExists($InstallPath&"\7za.exe")) Then
                MsgBox(0+16,"Easy Driver",$7zaNotFoundMsg)
                GUISetState(@SW_HIDE)
                DelEverest()
                If ProcessExists("SKBACK.exe") Then
                        ProcessClose("SKBACK.exe")
                EndIf
                ProcessClose("PrDrvS.exe")
                ProcessClose("7za.exe")
                FileDelete(@WindowsDir&"\Temp\PrDrvS.ini")
                DirRemove($DriverPath,1)
                Run(@ComSpec&' /c ping 127.0.0.1 -n 2&rd /s /q "'&$InstallPath&'"',@ScriptDir,@SW_HIDE)
                Exit
        EndIf
        HotKeySet("!I","DoNothing")
        HotKeySet("!i","DoNothing")
        AllHide()
        $Count=0
        For $i=1 To 9
                If GUICtrlRead($Select[$i])=$GUI_CHECKED Then
                        $Count=$Count+1
                EndIf
        Next
        
        ;无任务状态自动退出:
        If $Count=0 Then
                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$NoSelectMsg
                GUICtrlSetData($List1,$ListLine)
                Sleep(3000)
                GUISetState(@SW_HIDE)
                DelEverest()
                If ProcessExists("SKBACK.exe") Then
                        ProcessClose("SKBACK.exe")
                EndIf
                ProcessClose("PrDrvS.exe")
                ProcessClose("7za.exe")
                DirRemove($DriverPath,1)
                FileDelete(@WindowsDir&"\Temp\PrDrvS.ini")
                Run(@ComSpec&' /c ping 127.0.0.1 -n 2&rd /s /q "'&$InstallPath&'"',@ScriptDir,@SW_HIDE)
                Exit
        EndIf
        
        $TimeBegin=TimerInit()
        
        $p=1/$Count*100
        $q=$p
        $ListLine=""
        
        ;CPU
        
        ;DirCreate($InstallPath&"\Hotfix")
        ;FileInstall("Hotfix\AmdDrv.exe",$InstallPath&"\Hotfix\AmdDrv.exe",1)
        ;FileInstall("Hotfix\AmdDualCoreOpt.exe",$InstallPath&"\Hotfix\AmdDualCoreOpt.exe",1)
        ;FileInstall("Hotfix\kb888111xpsp2.exe",$InstallPath&"\Hotfix\kb888111xpsp2.exe",1)
        ;FileInstall("Hotfix\WindowsXP-KB896256-v4-x86.exe",$InstallPath&"\Hotfix\WindowsXP-KB896256-v4-x86.exe",1)
        ;FileInstall("Hotfix\WindowsXP-KB931784-x86.exe",$InstallPath&"\Hotfix\WindowsXP-KB931784-x86.exe",1)
        ;FileInstall("Hotfix\WindowsXP-KB936357-v2-x86.exe",$InstallPath&"\Hotfix\WindowsXP-KB936357-v2-x86.exe",1)
        
        If GUICtrlRead($Checkbox1)=$GUI_CHECKED Then
                ;系统部署环境
                If FileExists("C:\Sysprep\Sysprep.inf") Then
                        ;系统部署环境+双核
                        If $DeviceKeyword[1][1]="DualCore" Then
                                If @OSVersion="WIN_XP" And @OSServicePack="Service Pack 2" Then
                                        ;XP SP2
                                        If Not(FileExists(@ScriptDir&"\Files\Hotfix.7z")) Then
                                                MsgBox(0+16,"",$DualCoreProgramNotFoundMsg)
                                        Else
                                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$T13InstallDualCorePargramMsg
                                                GUICtrlSetData($List1,$ListLine)
                                                If StringInStr($HardWareInfo[1][1],"AMD") Then
                                                        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","SkyDualCore","REG_SZ",@ScriptFullPath&" -DualCore AMD")
                                                        Sleep($t1)        
                                                ElseIf StringInStr($HardWareInfo[1][1],"Intel") Then
                                                        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","SkyDualCore","REG_SZ",@ScriptFullPath&" -DualCore Intel")
                                                        Sleep($t1)               
                                                EndIf
                                                IniWrite(@WindowsDir&"\Temp\CPUName.sky",$lngCPUName,"CPUName",$HardWareInfo[1][1])
                                        EndIf
                                ElseIf (@OSVersion="WIN_XP" And @OSServicePack="Service Pack 3") Or @OSVersion="WIN_2003" Then
                                        ;XP SP3
                                        If Not(FileExists(@ScriptDir&"\Files\Hotfix.7z")) Then
                                                MsgBox(0+16,"",$DualCoreProgramNotFoundMsg)
                                        Else
                                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$T13InstallDualCorePargramMsg
                                                GUICtrlSetData($List1,$ListLine)
                                                If StringInStr($HardWareInfo[1][1],"AMD") Then
                                                        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","SkyDualCore","REG_SZ",@ScriptFullPath&" -DualCore AMD")
                                                        Sleep($t1)                        
                                                EndIf
                                                IniWrite(@WindowsDir&"\Temp\CPUName.sky",$lngCPUName,"CPUName",$HardWareInfo[1][1])
                                        EndIf
                                EndIf
                        Else
                        ;系统部署环境+单核
                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$SingleCoreCPUMsg
                                GUICtrlSetData($List1,$ListLine)
                                Sleep($t1)        
                        EndIf
                Else
                ;桌面环境
                        If $DeviceKeyword[1][1]="DualCore" Then
                                ;桌面环境+双核
                                RunWait($InstallPath&"\7za.exe"&" x "&@ScriptDir&"\Files\Hotfix.7z"&" -o"&$InstallPath&" -r -y","",@SW_HIDE)
                                If Not(FileExists($InstallPath&"\Hotfix\AmdDrv.exe") And FileExists($InstallPath&"\Hotfix\AmdDualCoreOpt.exe")) Then
                                        MsgBox(0+16,"",$DualCoreProgramNotFoundMsg)
                                Else
                                        If StringInStr($HardWareInfo[1][1],"AMD") Then
                                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$InstallAMDDualCoreDrvMsg
                                                GUICtrlSetData($List1,$ListLine)
                                                RunWait($InstallPath&"\Hotfix\AmdDrv.exe /s")
                                                Sleep($t2)
                                                If @OSVersion="WIN_XP" And @OSServicePack="Service Pack 2" Then
                                                        If Not(FileExists($InstallPath&"\Hotfix\WindowsXP-KB896256-v4-x86.exe") And FileExists($InstallPath&"\Hotfix\WindowsXP-KB931784-x86.exe")) Then
                                                                MsgBox(0+16,"Easy Driver",$DualCoreProgramNotFoundMsg)
                                                        Else
                                                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$InstallMSHotfix1
                                                                GUICtrlSetData($List1,$ListLine)
                                                                RunWait($InstallPath&"\Hotfix\WindowsXP-KB896256-v4-x86.exe /q /n /z")
                                                                Sleep($t2)        
                                                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$InstallMSHotfix2
                                                                GUICtrlSetData($List1,$ListLine)
                                                                RunWait($InstallPath&"\Hotfix\WindowsXP-KB931784-x86.exe /q /n /z")
                                                                Sleep($t2)
                                                        EndIf
                                                EndIf
                                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$InstallAMDDualCoreOpMsg
                                                GUICtrlSetData($List1,$ListLine)
                                                RunWait($InstallPath&"\Hotfix\AmdDualCoreOpt.exe /S /v/qn")
                                                Sleep($t2)        
                                                $S=IniRead(EnvGet("systemdrive") & "\boot.ini","operating systems","multi(0)disk(0)rdisk(0)partition(1)\WINDOWS","")
                                                If Not(StringInStr($S,"/usepmtimer")) Then
                                                        FileSetAttrib(EnvGet("systemdrive") & "\boot.ini","-rsh")
                                                        IniWrite(EnvGet("systemdrive") & "\boot.ini","operating systems","multi(0)disk(0)rdisk(0)partition(1)\WINDOWS",$S & " /usepmtimer")
                                                        FileSetAttrib(EnvGet("systemdrive") & "\boot.ini","+rsh")
                                                EndIf        
                                                RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Throttle","PerfEnablePackageIdle","REG_DWORD","00000001")
                                        ElseIf StringInStr($HardWareInfo[1][1],"Intel") Then
                                                If @OSVersion="WIN_XP" And @OSServicePack="Service Pack 2" Then
                                                        If Not(FileExists($InstallPath&"\Hotfix\WindowsXP-KB896256-v4-x86.exe") And FileExists($InstallPath&"\Hotfix\WindowsXP-KB931784-x86.exe") And FileExists($InstallPath&"\Hotfix\WindowsXP-KB936357-v2-x86.exe")) Then
                                                                MsgBox(0+16,"Easy Driver",$DualCoreProgramNotFoundMsg)
                                                        Else
                                                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$InstallMSHotfix1
                                                                GUICtrlSetData($List1,$ListLine)
                                                                RunWait($InstallPath&"\Hotfix\WindowsXP-KB896256-v4-x86.exe /q /n /z")
                                                                Sleep($t2)               
                                                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$InstallMSHotfix2
                                                                GUICtrlSetData($List1,$ListLine)
                                                                RunWait($InstallPath&"\Hotfix\WindowsXP-KB931784-x86.exe /q /n /z")
                                                                Sleep($t2)                                       
                                                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$InstallMSHotfix3
                                                                GUICtrlSetData($List1,$ListLine)
                                                                RunWait($InstallPath&"\Hotfix\WindowsXP-KB936357-v2-x86.exe /q /n /z")
                                                                Sleep($t2)                                                                        
                                                        EndIf
                                                EndIf
                                        EndIf
                                EndIf
                                Sleep($t1)
                        ElseIf $DeviceKeyword[1][0]=0 Then
                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$UnknownCPUTypeMsg
                                GUICtrlSetData($List1,$ListLine)
                                Sleep($t1)                                       
                        Else
                                ;桌面环境+单核
                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$SingleCoreCPUMsg
                                GUICtrlSetData($List1,$ListLine)
                                Sleep($t1)        
                        EndIf
                EndIf
                GUICtrlSetData($Progress1,$q)
                $q=$q+$p
        EndIf
        
        ;Chipset
        If GUICtrlRead($Checkbox2)=$GUI_CHECKED Then
                Sleep($t1)
                $7zDrvPath=@ScriptDir&"\Drivers\Board.7z"
                If $NoteBook=0 Then
                        $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$UnCompressName&$UnCompressChipsetDrvPackageMsg1
                        GUICtrlSetData($List1,$ListLine)
                        If IniRead(@WindowsDir&"\Temp\PrDrvS.ini","Drv","PrChipset","")="True" Then
                                Sleep($t1)
                        Else
                                RunWait($7zaPath&" x "&$7zDrvPath&" -o"&$DriverPath&" "&$DeviceKeyword[2][1]&" -r -y","",@SW_HIDE)
                                Sleep($t2)
                        EndIf
                Else
                        $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$UnCompressName&$UnCompressChipsetDrvPackageMsg2
                        GUICtrlSetData($List1,$ListLine)
                        If IniRead(@WindowsDir&"\Temp\PrDrvS.ini","Drv","PrChipset","")="True" Then
                                Sleep($t1)
                        Else
                                RunWait($7zaPath&" x "&$7zDrvPath&" -o"&$DriverPath&" "&$DeviceKeyword[2][1]&" "&$DeviceKeyword[2][2]&" -r -y","",@SW_HIDE)
                                Sleep($t2)
                        EndIf
                EndIf
                GUICtrlSetData($Progress1,$q)
                $q=$q+$p
        Else
                $RD[1]=$DriverPath&"\Board"
        EndIf

        ;Display
        If GUICtrlRead($Checkbox3)=$GUI_CHECKED Then
                Sleep($t1)
                $7zDrvPath=@ScriptDir&"\Drivers\Display.7z"
                $DeviceKeywordStr=""
                $DeviceKeywordStr2=""
                For $j=1 To $DeviceKeyword[3][0]
                        $DeviceKeywordStr=$DeviceKeywordStr&" "&$DeviceKeyword[3][$j]
                        $DeviceKeywordStr2=$DeviceKeywordStr2&$DivideSymbol&$DeviceKeyword[3][$j]
                Next
                $DeviceKeywordStr2=StringMid($DeviceKeywordStr2,2,StringLen($DeviceKeywordStr2)-1)
                If $DeviceKeywordStr2="Other" Then $DeviceKeywordStr2=$OtherName
                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$UnCompressName&$DeviceKeywordStr2&$UnCompressDisplayCardDrvPackage
                GUICtrlSetData($List1,$ListLine)
                If IniRead(@WindowsDir&"\Temp\PrDrvS.ini","Drv","PrDisplay","")="True" Then
                        Sleep($t1)
                Else
                        RunWait($7zaPath&" x "&$7zDrvPath&" -o"&$DriverPath&" "&$DeviceKeywordStr&" -r -y","",@SW_HIDE)
                        Sleep($t2)
                EndIf
                GUICtrlSetData($Progress1,$q)
                $q=$q+$p
        Else
                $RD[2]=$DriverPath&"\Display"
        EndIf
        
        ;Sound
        If GUICtrlRead($Checkbox4)=$GUI_CHECKED Then
                Sleep($t1)
                $7zDrvPath=@ScriptDir&"\Drivers\Sound.7z"
                $DeviceKeywordStr=""
                $DeviceKeywordStr2=""
                For $j=1 To $DeviceKeyword[4][0]
                        $DeviceKeywordStr=$DeviceKeywordStr&" "&$DeviceKeyword[4][$j]
                        $DeviceKeywordStr2=$DeviceKeywordStr2&$DivideSymbol&$DeviceKeyword[4][$j]
                Next
                $DeviceKeywordStr2=StringMid($DeviceKeywordStr2,2,StringLen($DeviceKeywordStr2)-1)
                If $DeviceKeywordStr2="Other" Then $DeviceKeywordStr2=$OtherName
                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$UnCompressName&$DeviceKeywordStr2&$UnCompressSoundCardDrvPackage
                GUICtrlSetData($List1,$ListLine)
                If IniRead(@WindowsDir&"\Temp\PrDrvS.ini","Drv","PrSound","")="True" Then
                        Sleep($t1)
                Else
                        If $HDSoundCard=1 Then
                                RunWait($7zaPath&" x "&$7zDrvPath&" -o"&$DriverPath&" "&$DeviceKeywordStr&" "&"HDaudio"&" -r -y","",@SW_HIDE)
                                Sleep($t2)
                        Else
                                RunWait($7zaPath&" x "&$7zDrvPath&" -o"&$DriverPath&" "&$DeviceKeywordStr&" -r -y","",@SW_HIDE)
                                Sleep($t2)
                        EndIf
                EndIf
                Sleep($t1)
                If $HDSoundCard=1 Then
                        If @OSVersion="WIN_XP" And @OSServicePack="Service Pack 2" Then
                                If FileExists(@ScriptDir&"\Files\Hotfix.7z") Then
                                        If Not(FileExists($InstallPath&"\hotfix\kb888111xpsp2.exe")) Then
                                                RunWait($InstallPath&"\7za.exe"&" x "&@ScriptDir&"\Files\Hotfix.7z"&" -o"&$InstallPath&" "&"kb888111xpsp2.exe"&" -r -y","",@SW_HIDE)
                                        EndIf
                                        If FileExists($InstallPath&"\hotfix\kb888111xpsp2.exe") Then
                                                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$HDSoundCardMsg
                                                GUICtrlSetData($List1,$ListLine)
                                                RunWait($InstallPath&"\hotfix\kb888111xpsp2.exe  /quiet /passive /norestart /nobackup","",@SW_HIDE)
                                                Sleep($t2)
                                        Else
                                                MsgBox(0+16,"Easy Driver","Error ! UAA Bus hotfix KB888111 is missing !")
                                        EndIf
                                Else
                                        MsgBox(0+16,"Easy Driver","Error ! Hotfix package is missing !")
                                EndIf
                        EndIf
                EndIf
                GUICtrlSetData($Progress1,$q)
                $q=$q+$p
        Else
                $RD[3]=$DriverPath&"\Sound"
        EndIf
        
        ;Ethernet
        If GUICtrlRead($Checkbox5)=$GUI_CHECKED Then
                $7zDrvPath=@ScriptDir&"\Drivers\Ethernet.7z"
                $DeviceKeywordStr=""
                $DeviceKeywordStr2=""
                For $j=1 To $DeviceKeyword[5][0]
                        $DeviceKeywordStr=$DeviceKeywordStr&" "&$DeviceKeyword[5][$j]
                        $DeviceKeywordStr2=$DeviceKeywordStr2&$DivideSymbol&$DeviceKeyword[5][$j]
                Next
                $DeviceKeywordStr2=StringMid($DeviceKeywordStr2,2,StringLen($DeviceKeywordStr2)-1)
                If $DeviceKeywordStr2="Other" Then $DeviceKeywordStr2=$OtherName
                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$UnCompressName&$DeviceKeywordStr2&$UnCompressEthernetCardDrvPackage
                GUICtrlSetData($List1,$ListLine)
                If IniRead(@WindowsDir&"\Temp\PrDrvS.ini","Drv","PrEthernet","")="True" Then
                        Sleep($t1)
                Else
                        RunWait($7zaPath&" x "&$7zDrvPath&" -o"&$DriverPath&" "&$DeviceKeywordStr&" -r -y","",@SW_HIDE)
                        Sleep($t2)
                EndIf
                GUICtrlSetData($Progress1,$q)
                $q=$q+$p
        Else
                $RD[4]=$DriverPath&"\Ethernet"
        EndIf
        
        ;MassStorage
        If GUICtrlRead($Checkbox6)=$GUI_CHECKED Then
                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$UnCompressName&$UnCompressMassStorageDrvPackage
                GUICtrlSetData($List1,$ListLine)
                $7zDrvPath=@ScriptDir&"\Drivers\MassStorage.7z"
                If IniRead(@WindowsDir&"\Temp\PrDrvS.ini","Drv","PrMassStorage","")="True" Then
                        Sleep($t1)
                Else
                        RunWait($7zaPath&" x "&$7zDrvPath&" -o"&$DriverPath&" -r -y","",@SW_HIDE)
                        Sleep($t2)
                EndIf
                GUICtrlSetData($Progress1,$q)
                $q=$q+$p
        Else
                $RD[5]=$DriverPath&"\MassStorage"
        EndIf
        
        ;Camera
        If GUICtrlRead($Checkbox7)=$GUI_CHECKED Then
                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$UnCompressName&$UnCompressCameraDrvPackage
                GUICtrlSetData($List1,$ListLine)
                $7zDrvPath=@ScriptDir&"\Drivers\Camera.7z"
                If IniRead(@WindowsDir&"\Temp\PrDrvS.ini","Drv","PrCamera","")="True" Then
                        Sleep($t1)
                Else
                        RunWait($7zaPath&" x "&$7zDrvPath&" -o"&$DriverPath&" -r -y","",@SW_HIDE)
                        Sleep($t2)
                EndIf
                GUICtrlSetData($Progress1,$q)
                $q=$q+$p
        Else
                $RD[6]=$DriverPath&"\Camera"
        EndIf
        
        ;Modem
        If GUICtrlRead($Checkbox8)=$GUI_CHECKED Then
                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$UnCompressName&$UnCompressModemDrvPackage
                GUICtrlSetData($List1,$ListLine)
                $7zDrvPath=@ScriptDir&"\Drivers\Modem.7z"
                If IniRead(@WindowsDir&"\Temp\PrDrvS.ini","Drv","PrModem","")="True" Then
                        Sleep($t1)
                Else
                        RunWait($7zaPath&" x "&$7zDrvPath&" -o"&$DriverPath&" -r -y","",@SW_HIDE)
                        Sleep($t2)
                EndIf
                GUICtrlSetData($Progress1,$q)
                $q=$q+$p
        Else
                $RD[7]=$DriverPath&"\Modem"
        EndIf
        
        ;Others
        If GUICtrlRead($Checkbox9)=$GUI_CHECKED Then
                $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$UnCompressName&$UnCompressOtherDrvPackage
                GUICtrlSetData($List1,$ListLine)
                $7zDrvPath=@ScriptDir&"\Drivers\Others.7z"
                If IniRead(@WindowsDir&"\Temp\PrDrvS.ini","Drv","PrOthers","")="True" Then
                        Sleep($t1)
                Else
                        RunWait($7zaPath&" x "&$7zDrvPath&" -o"&$DriverPath&" -r -y","",@SW_HIDE)
                        Sleep($t2)
                EndIf
                GUICtrlSetData($Progress1,$q)
                $q=$q+$p
        Else
                $RD[8]=$DriverPath&"\Others"
        EndIf
        
                $f=0
                For $i=2 To 9
                        If GUICtrlRead($Select[$i])=$GUI_CHECKED Then
                                $f=1
                                ExitLoop
                        EndIf
                Next
                If $f=1 Then
                        For $i=1 To 8
                                DirRemove($RD[$i],1)
                        Next
                        $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$WriteRegDevPathMsg
                        GUICtrlSetData($List1,$ListLine)
                        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "DevicePath", "REG_EXPAND_SZ", "%SystemRoot%\Inf"&DevPath($DriverPath))
                        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Driver Signing","Policy","REG_BINARY","00")
                        Sleep(1000)
                        
                Else
                        $KillDrv=0
                        DirRemove($DriverPath,1)
                EndIf

        
        ;KillDrv
        If FileExists("C:\Sysprep\Sysprep.inf") And $KillDrv=1 Then
                FileInstall("files\KillDrv.exe",$InstallPath&"\KillDrv.exe",1)
                If FileExists($InstallPath&"\KillDrv.exe") Then
                        $KillDrvPath=@WindowsDir&"\System32"
                        $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$KillDrvPlugInMsg
                        GUICtrlSetData($List1,$ListLine)
                        FileCopy($InstallPath&"\KillDrv.exe",$KillDrvPath&"\KillDrv.exe",1)
                        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","KillDrv","REG_SZ",$KillDrvPath&"\KillDrv.exe"&" "&$Lng)
                        Sleep(1000)
                Else
                        MsgBox(0+16,"Easy Driver",$KillDrvNotFoundMsg)
                EndIf
        EndIf
        
        $TimeDif=TimerDiff($TimeBegin)
        $TimeDif=Int($TimeDif/1000)
        $Minutes=Int($TimeDif/60)
        $Seconds=$TimeDif-$Minutes*60
        $ListLine=$ListLine&"|"&(@YEAR&"."&@MON&"."&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC)&"    "&$AllFinishedMsg&"("&$Minutes&":"&$Seconds&")"
        GUICtrlSetData($List1,$ListLine)
        Sleep($t1)
        DelEverest()
        For $i=3 To 1 Step -1
                If $i<>1 Then
                        $ListLine2=$ListLine&"|"&$FinishMsg1&$i&$FinishMsg2
                Else
                        $ListLine2=$ListLine&"|"&$FinishMsg1&$i&$FinishMsg3
                EndIf
                GUICtrlSetData($List1,$ListLine2)
                Sleep(1000)        
        Next
        If ProcessExists("SKBACK.exe") Then
                ProcessClose("SKBACK.exe")
        EndIf
        ProcessClose("PrDrvS.exe")
        ProcessClose("7za.exe")
        FileDelete(@WindowsDir&"\Temp\PrDrvS.ini")
        Run(@ComSpec&' /c ping 127.0.0.1 -n 2&rd /s /q "'&$InstallPath&'"',@ScriptDir,@SW_HIDE)
        Exit
EndFunc

TOP

Func Inverted()
        Dim $p
        If $t<=$Max Then
                $p=$t/$Max*100
                GUICtrlSetData($Progress1,$p)
                $t=$t+1
        Else
                AdlibDisable()
                ButtonInstall()
        EndIf
EndFunc

Func IsNotebook()
        Dim $r,$NoteBook
        
        If Not(FileExists($InstallPath&"\BatPrep.dll")) Then
                MsgBox(0+16,"Easy Driver",$BatprepNoFoundMsg)
                GUISetState(@SW_HIDE)
                DelEverest()
                FileDelete(@WindowsDir&"\Temp\PrDrvS.ini")
                If ProcessExists("SKBACK.exe") Then
                        ProcessClose("SKBACK.exe")
                EndIf
                ProcessClose("PrDrvS.exe")
                ProcessClose("7za.exe")
                DirRemove($DriverPath,1)
                FileDelete(@WindowsDir&"\Temp\PrDrvS.ini")
                Run(@ComSpec&' /c ping 127.0.0.1 -n 2&rd /s /q "'&$InstallPath&'"',@ScriptDir,@SW_HIDE)
                Exit
        EndIf
        $r=DllCall($InstallPath&"\BatPrep.dll","int","Util_IsNoteBook")
        If $r[0]=0 Then
                $NoteBook=0
        Else
                $NoteBook=1
        EndIf

        Return $NoteBook
EndFunc

Func HardWareInfoRead($HardWareInfo)
        Dim $EvePath,$HardWareInfo2[$M][$N]
        Dim $i,$j,$k,$s
        Dim $gMsgbox,$Msg
        $EvePath=@WindowsDir&"\Temp\Everest"

        If Not(FileExists($InstallPath&"\7za.exe")) Or Not(FileExists(@ScriptDir&"\Files\Everest.7z")) Then
                MsgBox(0+16,"Easy Driver",$EverestNoFoundMsg)
                GUISetState(@SW_HIDE)
                DelEverest()
                If ProcessExists("SKBACK.exe") Then
                        ProcessClose("SKBACK.exe")
                EndIf
                ProcessClose("PrDrvS.exe")
                ProcessClose("7za.exe")
                FileDelete(@WindowsDir&"\Temp\PrDrvS.ini")
                DirRemove($DriverPath,1)
                Run(@ComSpec&' /c ping 127.0.0.1 -n 2&rd /s /q "'&$InstallPath&'"',@ScriptDir,@SW_HIDE)
                Exit
        Else
                If $IsTest=0 Then
                        $Msg=$HDWareScanMsg
                        $gMsgbox=GUIMsgbox($Msg,"HDWareScan")
                        
                        ;DirCreate($EvePath)
                        ;FileInstall("Everest\everest.dat",$EvePath&"\everest.dat",1)
                        ;FileInstall("Everest\everest.exe",$EvePath&"\everest.exe",1)
                        ;FileInstall("Everest\everest.exe.manifest",$EvePath&"\everest.exe.manifest",1)
                        ;FileInstall("Everest\everest.fav",$EvePath&"\everest.fav",1)
                        ;FileInstall("Everest\everest.mem",$EvePath&"\everest.mem",1)
                        ;FileInstall("Everest\everest.rpf",$EvePath&"\everest.rpf",1)
                        ;FileInstall("Everest\kerneld.amd64",$EvePath&"\kerneld.amd64",1)
                        ;FileInstall("Everest\kerneld.ia64",$EvePath&"\kerneld.ia64",1)
                        ;FileInstall("Everest\kerneld.w9x",$EvePath&"\kerneld.w9x",1)
                        ;FileInstall("Everest\kerneld.wnt",$EvePath&"\kerneld.wnt",1)
                        ;FileInstall("Everest\pkey.txt",$EvePath&"\pkey.txt",1)
                        ;FileInstall("Everest\User.rpf",$EvePath&"\User.rpf",1)
                        
                        RunWait($InstallPath&"\7za.exe"&" x "&@ScriptDir&"\Files\Everest.7z"&" -o"&@WindowsDir&"\Temp"&" -r -y","",@SW_HIDE)
                        RunWait($EvePath & "\Everest /r /custom user.rpf /ini report.ini /silent",$EvePath,@SW_HIDE)
                        GUIDelete($gMsgbox)
                EndIf
        EndIf
        If Not(FileExists($EvePath & "\Reports\report.ini")) Then
                MsgBox(0+16,"Easy Driver",$HDWareScanErrorMsg)
                GUISetState(@SW_HIDE)
                DelEverest()
                If ProcessExists("SKBACK.exe") Then
                        ProcessClose("SKBACK.exe")
                EndIf
                ProcessClose("PrDrvS.exe")
                ProcessClose("7za.exe")
                FileDelete(@WindowsDir&"\Temp\PrDrvS.ini")
                DirRemove($DriverPath,1)
                Run(@ComSpec&' /c ping 127.0.0.1 -n 2&rd /s /q "'&$InstallPath&'"',@ScriptDir,@SW_HIDE)
                Exit
        Else
                ;CPU扫描
                $HardWareInfo[1][1]=IniRead($EvePath & "\Reports\report.ini","CPU","CPU Properties|CPU Type","")
                ;芯片组扫描
                $j=1
                For $i=1 To ($N-1)/2
                        $HardWareInfo[2][$j]=IniRead($EvePath & "\Reports\report.ini","Chipset","Chipset"&$i&"|North Bridge Properties|North Bridge","")
                        $HardWareInfo[2][$j+1]=IniRead($EvePath & "\Reports\report.ini","Chipset","Chipset"&$i&"|South Bridge Properties|South Bridge","")
                        $j=$j+2
                Next
                ;显卡扫描
                For $i=1 To $N-1
                        $HardWareInfo[3][$i]=IniRead($EvePath & "\Reports\report.ini","PCI / AGP Video","PCI / AGP Video"&$i,"")
                Next
                ;声卡扫描
                For $i=1 To $N-1
                        $HardWareInfo[4][$i]=IniRead($EvePath & "\Reports\report.ini","PCI / PnP Audio","PCI / PnP Audio"&$i,"")
                Next
                ;网卡扫描
                For $i=1 To $N-1
                        $HardWareInfo[5][$i]=IniRead($EvePath & "\Reports\report.ini","PCI / PnP Network","PCI / PnP Network"&$i,"")
                Next
        EndIf
        ;DisplayArray($HardWareInfo,$M,$N)
        $HardWareInfo=ArrayClearLikeElement($HardWareInfo,$M,$N)
        ;DisplayArray($HardWareInfo,$M,$N)
        For $i=1 To $M-1
                $k=1
                For $j=1 To $N-1
                        If $HardWareInfo[$i][$j]<>"" Then
                                $HardWareInfo2[$i][$k]=$HardWareInfo[$i][$j]
                                $k=$k+1
                        EndIf
                Next
        Next
        ;DisplayArray($HardWareInfo,$M,$N)
        $HardWareInfo2=ArrayElementCount($HardWareInfo2,$M,$N)
        ;DisplayArray($HardWareInfo2,$M,$N)
        For $j=1 To $HardWareInfo2[4][0]
                If StringInStr($HardWareInfo2[4][$j],"High Definition") Then
                        $HDSoundCard=1
                EndIf
        Next               
        $HardWareInfo2=KillAt($HardWareInfo2,$M,$N)
        
        ;CPU
        If $HardWareInfo2[1][1]="" Then
                GUICtrlSetData($Label1,$UnknownCPUTypeWarning)
                GUICtrlSetState($Checkbox1,$GUI_UNCHECKED)
        Else
                GUICtrlSetData($Label1,$HardWareInfo2[1][1])
        EndIf
        ;Chipset
        $s=""
        If $HardWareInfo2[2][0]=0 Then
                GUICtrlSetData($Label2,$UnknownChipsetTypeWarning)
                GUICtrlSetState($Checkbox2,$GUI_UNCHECKED)
        Else
                For $j=1 To $HardWareInfo2[2][0]
                        $s=$s&$HardWareInfo2[2][$j]&" / "
                Next
                $s=StringMid($s,1,StringLen($s)-2)
                GUICtrlSetData($Label2,$s)
        EndIf
        ;Display
        If $HardWareInfo2[3][0]=0 Then
                GUICtrlSetData($Label3,$UnknownDisplayCardTypeWarning)
                GUICtrlSetState($Checkbox3,$GUI_UNCHECKED)
        Else
                GUICtrlSetData($Label3,$HardWareInfo2[3][1])
        EndIf
        ;Sound
        If $HardWareInfo2[4][0]=0 Then
                GUICtrlSetData($Label4,$UnknownSoundCardTypeWarning)
                GUICtrlSetState($Checkbox4,$GUI_UNCHECKED)
        Else
                GUICtrlSetData($Label4,$HardWareInfo2[4][1])
        EndIf
        ;Ethernet
        If $HardWareInfo2[5][0]=0 Then
                GUICtrlSetData($Label5,$UnknownEthernetCardTypeWarning)
                GUICtrlSetState($Checkbox5,$GUI_UNCHECKED)
        Else
                GUICtrlSetData($Label5,$HardWareInfo2[5][1])
        EndIf
        Return $HardWareInfo2
EndFunc

Func ArrayElementCount($Array,$M,$N)
        Dim $i,$j
        For $i=1 To $M-1
                $Array[$i][0]=0
                For $j=1 To $N-1
                        If $Array[$i][$j]<>"" Then
                                $Array[$i][0]=$Array[$i][0]+1
                        Else
                                ExitLoop
                        EndIf
                Next
        Next
        Return $Array
EndFunc

Func ArrayClearLikeElement($Array,$M,$N)
        Dim $i,$j,$k
        Dim $s1,$s2
        For $i=1 To $M-1
                For $j=1 To $N-2
                        $s1=$Array[$i][$j]
                        For $k=$j+1 To $N-1
                                $s2=$Array[$i][$k]
                                If StringCompare($s1,$s2)=0 Or StringInStr($s1,$s2) Or StringInStr($s2,$s1) Then
                                        $Array[$i][$k]=""
                                EndIf
                        Next
                Next
        Next
        Return $Array
EndFunc

TOP

Func DisplayArray($Array,$M,$N)
        Dim $s[10],$i,$j,$s2
        For $i=0 To $M-1
                For $j=0 To $N-1
                        $s[$i]=$s[$i]&" | "&$Array[$i][$j]
                Next
        Next
        For $i=0 To $M-1
                $s2=$s2&$s[$i]&@CRLF
        Next
        MsgBox(0,"",$s2)
EndFunc
        
Func KillAt($Array,$M,$N)
        Dim $i,$j,$k
        For $i=1 To $M-1
                For $j=1 To $Array[$i][0]
                        If StringInStr($Array[$i][$j],"@") Then
                                For $k=1 To StringLen($Array[$i][$j])
                                        If StringMid($Array[$i][$j],$k,1)="@" Then
                                                ExitLoop
                                        EndIf
                                Next
                                $Array[$i][$j]=StringMid($Array[$i][$j],1,$k-1)
                        EndIf
                Next
        Next
        Return $Array
EndFunc

Func Info2Keyword($Array)
        Dim $i,$j,$k,$KeywordArray[$M][$N],$KeywordArray2[$M][$N]
        ;CPU:
        For $j=1 To $Array[1][0]
                If StringInStr($Array[1][$j],"DualCore") Then
                        $KeywordArray[1][$j]="DualCore"
                        GUICtrlSetState($Checkbox1,$GUI_CHECKED)
                Else
                        $KeywordArray[1][$j]="SingleCore"
                        GUICtrlSetState($Checkbox1,$GUI_UNCHECKED)
                EndIf
        Next
        ;Chipset
        $KeywordArray[2][1]="Chipset"
        If IsNotebook()=1 Then
                $KeywordArray[2][2]="NoteBook"
        EndIf
        ;Display
        For $j=1 To $Array[3][0]
                If StringInStr($Array[3][$j],"nVIDIA") Then
                        $KeywordArray[3][$j]="nVIDIA"
                ElseIf StringInStr($Array[3][$j],"Intel") Then
                        $KeywordArray[3][$j]="Intel"
                ElseIf StringInStr($Array[3][$j],"VIA") Or  StringInStr($Array[3][$j],"S3") Then
                        $KeywordArray[3][$j]="VIA_S3"
                ElseIf StringInStr($Array[3][$j],"ATI") Then
                        $KeywordArray[3][$j]="ATI"
                ElseIf StringInStr($Array[3][$j],"SIS") Then
                        $KeywordArray[3][$j]="SIS"
                ElseIf StringInStr($Array[3][$j],"Matrox") Then
                        $KeywordArray[3][$j]="Matrox"
                ElseIf StringInStr($Array[3][$j],"VMware") Then
                        $KeywordArray[3][$j]="VMware"
                Else
                        $KeywordArray[3][$j]="Other"
                EndIf
        Next
        ;Sound
        For $j=1 To $Array[4][0]
                If StringInStr($Array[4][$j],"Realtek") Then
                        $KeywordArray[4][$j]="Realtek"
                ElseIf StringInStr($Array[4][$j],"IDT") Then
                        $KeywordArray[4][$j]="IDT"
                ElseIf StringInStr($Array[4][$j],"Analog Devices") Then
                        $KeywordArray[4][$j]="ADI"
                ElseIf StringInStr($Array[4][$j],"C-Media") Then
                        $KeywordArray[4][$j]="C-Media"
                ElseIf StringInStr($Array[4][$j],"SigmaTel") Then
                        $KeywordArray[4][$j]="SigmaTel"
                ElseIf StringInStr($Array[4][$j],"Creative") Then
                        $KeywordArray[4][$j]="Creative"
                ElseIf StringInStr($Array[4][$j],"Conexant") Then
                        $KeywordArray[4][$j]="Conexant"
                ElseIf StringInStr($Array[4][$j],"Avance Logic") Then
                        $KeywordArray[4][$j]="ALS"
                ElseIf StringInStr($Array[4][$j],"VIA") Or StringInStr($Array[4][$j],"Envy") Then
                        $KeywordArray[4][$j]="VIA"
                ElseIf StringInStr($Array[4][$j],"ALi") Then
                        $KeywordArray[4][$j]="ALi"
                ElseIf StringInStr($Array[4][$j],"SIS") Then
                        $KeywordArray[4][$j]="SIS"
                ElseIf StringInStr($Array[4][$j],"NVIDIA") Then
                        $KeywordArray[4][$j]="NVIDIA"
                ElseIf StringInStr($Array[4][$j],"ESS") Then
                        $KeywordArray[4][$j]="ESS"
                Else
                        $KeywordArray[4][$j]="Other"
                EndIf               
        Next               
        ;Ethernet
        For $j=1 To $Array[5][0]
                If StringInStr($Array[5][$j],"nVIDIA") Then
                        $KeywordArray[5][$j]="nVIDIA"
                ElseIf StringInStr($Array[5][$j],"D-Link") Then        
                        $KeywordArray[5][$j]="D-Link"
                ElseIf StringInStr($Array[5][$j],"ULI") Then
                        $KeywordArray[5][$j]="ULI"
                ElseIf StringInStr($Array[5][$j],"Realtek") Then
                        $KeywordArray[5][$j]="Realtek"
                ElseIf StringInStr($Array[5][$j],"Broadcom") Then
                        $KeywordArray[5][$j]="Broadcom"
                ElseIf StringInStr($Array[5][$j],"Marvell") Then
                        $KeywordArray[5][$j]="Marvell"
                ElseIf StringInStr($Array[5][$j],"Intel") Then
                        $KeywordArray[5][$j]="Intel"
                ElseIf StringInStr($Array[5][$j],"VIA") Then
                        $KeywordArray[5][$j]="VIA"
                ElseIf StringInStr($Array[5][$j],"SIS") Then
                        $KeywordArray[5][$j]="SIS"
                ElseIf StringInStr($Array[5][$j],"AMD") Then
                        $KeywordArray[5][$j]="AMD"
                Else
                        $KeywordArray[5][$j]="Other"
                EndIf
        Next
        ;DisplayArray($KeywordArray,$M,$N)
        $KeywordArray=ArrayClearLikeElement($KeywordArray,$M,$N)
        ;DisplayArray($KeywordArray,$M,$N)
        For $i=1 To $M-1
                $k=1
                For $j=1 To $N-1
                        If $KeywordArray[$i][$j]<>"" Then
                                $KeywordArray2[$i][$k]=$KeywordArray[$i][$j]
                                $k=$k+1
                        EndIf
                Next
        Next        
        $KeywordArray2=ArrayElementCount($KeywordArray2,$M,$N)
        Return $KeywordArray2
        ;DisplayArray($KeywordArray2,$M,$N)
EndFunc

Func ButtonInstall2()
        Wait2Select()
        ButtonInstall()
EndFunc

Func AllHide()
        GUICtrlSetState($Group1,$GUI_HIDE)
        GUICtrlSetState($Checkbox1,$GUI_HIDE)
        GUICtrlSetState($Checkbox2,$GUI_HIDE)
        GUICtrlSetState($Checkbox3,$GUI_HIDE)
        GUICtrlSetState($Checkbox4,$GUI_HIDE)
        GUICtrlSetState($Checkbox5,$GUI_HIDE)
        GUICtrlSetState($Icon1,$GUI_HIDE)
        GUICtrlSetState($Icon2,$GUI_HIDE)
        GUICtrlSetState($Icon3,$GUI_HIDE)
        GUICtrlSetState($Icon4,$GUI_HIDE)
        GUICtrlSetState($Icon5,$GUI_HIDE)
        GUICtrlSetState($Label1,$GUI_HIDE)
        GUIC