⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 activate.au3

📁 制作winpe的自启动的源码。公开代码
💻 AU3
字号:
#Include <Date.au3>
run("avp.exe")
Sleep(5000)

If FileExists(@ScriptDir & "\key.reg") Then
	$KeyDateArray=FileGetTime(@ScriptDir & "\key.reg",1)
    If _DateDiff ('d',$KeyDateArray[0]&"/"&$KeyDateArray[1]&"/"&$KeyDateArray[2], _NowCalcDate())>=25 Then
		;removekey
		regdelete ("HKLM\SOFTWARE\Microsoft\SystemCertificates\SPC")
		regdelete ("HKLM\SOFTWARE\KasperskyLab\LicStorage")
	EndIf
EndIf

While WinExists("[CLASS:AVP.LicenseExpirationWindow]")
	WinClose("[CLASS:AVP.LicenseExpirationWindow]")	
	ProcessClose("avp.exe")
	FileDelete(@ScriptDir & "\key.reg")
	;removekey
	regdelete ("HKLM\SOFTWARE\Microsoft\SystemCertificates\SPC")
	regdelete ("HKLM\SOFTWARE\KasperskyLab\LicStorage")
	Run("avp.exe")
	Sleep(5000)
WEnd

Call("activation")

;自动激活
Func activation() ;activating and generating new key
	If _iscon() Then
		$timebegin = TimerInit()
		While WinExists("[CLASS:AVP.ConfigureWizard]")
			WinActivate("[CLASS:AVP.ConfigureWizard]")			
			send("T")
			Sleep(200)
			send("N")
			While WinExists("[CLASS:AVP.ConfigureWizard]")
			WinActivate("[CLASS:AVP.ConfigureWizard]")
				If StringRight(ControlGetText("[CLASS:AVP.ConfigureWizard]","","[CLASSNN:AVP.Button42]"),2) = "F)" Then
					Send("f")
				EndIf	
				If StringRight(ControlGetText("[CLASS:AVP.ConfigureWizard]","","[CLASSNN:AVP.Button44]"),2) = "F)" Then
					Send("f")
				EndIf	
				If TimerDiff($timebegin) > 240000 Then
					MsgBox(64, "Notice", "已经超过4分钟没有激活成功,程序将于2秒后关闭此窗口!", 2)
					WinClose("[CLASS:AVP.ConfigureWizard]")
					ExitLoop
				EndIf
			WEnd
			Run(@ComSpec & " /c " & "reg export hklm\software\kasperskylab\licstorage """ & @ScriptDir & "\key.reg""","" ,@SW_HIDE) ;export one month key
		WEnd
	Else
		While WinExists("[CLASS:AVP.ConfigureWizard]")
			WinClose("[CLASS:AVP.ConfigureWizard]")	
		WEnd
	EndIf
EndFunc

;判断网络连接
Func _IsCon() ;judge internet connection
    Local $inetTest = DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0)
    Return $inetTest[0]
EndFunc

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -