#RequireAdmin
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=C:\WINDOWS\system32\SHELL32.dll
#AutoIt3Wrapper_Outfile=E:\360data\重要数据\桌面\USB开启工具XN(32).exe
#AutoIt3Wrapper_Outfile_x64=E:\360data\重要数据\桌面\USB开启工具XN(64).exe
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_Res_LegalCopyright=公司-IT信息运维
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#Region
#EndRegion
#Region
#EndRegion ;********
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <GuiIPAddress.au3>
Local $usbfile = "",$usbch1 = "",$usbch2 = "",$passwd = ""
;显示关闭等级是全关还是部分开启-开始
If FileExists(@WindowsDir & "\inf\usbstor.inf.ba_") Then
$usbfile = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR", "Start")
If $usbfile = "00000003" Then
$usbfile = "部分开启"
Else
$usbfile = "全部关闭"
EndIf
EndIf
If FileExists(@WindowsDir & "\inf\usbstor.inf") Then
FileMove(@WindowsDir & "\inf\usbstor.inf", @WindowsDir & "\inf\usbstor.inf.ba_")
FileMove(@WindowsDir & "\inf\usbstor.PNF", @WindowsDir & "\inf\usbstor.PNF.ba_")
RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR", "Start", "REG_DWORD", "00000004")
MsgBox(64,"USB","你的主机已经关闭USB设备功能,你将无法使用U盘,如需开启请与IT运维联系",2)
Else
$passwd = InputBox("USB", "输入您的密码,有问题请与IT运维联系。()", "", "*")
If $passwd = "" Then
MsgBox(16,"错误","密码不能为空,请重新输入")
Else
If $passwd <> "pass!@#$" Then
MsgBox(16,"错误","输入的密码错误,请重新输入")
Else
#Region ### START Koda GUI section ### Form=e:\360data\重要数据\桌面\form1_1.kxf
$Form1_1 = GUICreate("USB-开关-by Mgchl", 265, 232, -1, -1)
GUISetIcon("D:\应用系统\休眠工具.exe", -1)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
Dim $StatusBar1_PartsWidth[2] = [50, -1]
_GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar1, @TAB & "Mgchl", 0)
_GUICtrlStatusBar_SetText($StatusBar1, @TAB & "公司", 1)
$Group1 = GUICtrlCreateGroup("功能设置", 16, 80, 113, 121)
GUICtrlSetBkColor(-1, 0xC0DCC0)
$Radio1 = GUICtrlCreateRadio("部分开启", 40, 104, 81, 17)
$Radio2 = GUICtrlCreateRadio("全部开启", 40, 133, 81, 17)
$Radio3 = GUICtrlCreateRadio("全部关闭", 40, 164, 81, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("当前状态", 16, 8, 113, 57)
GUICtrlSetColor(-1, 0x008000)
$Label1 = GUICtrlCreateLabel(""&$usbfile, 24, 32, 98, 30, $SS_CENTER)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("确定", 160, 136, 75, 25)
$Button2 = GUICtrlCreateButton("关于", 160, 168, 75, 25)
$Group3 = GUICtrlCreateGroup("友情提示", 144, 8, 105, 105)
GUICtrlSetColor(-1, 0x008000)
$Label2 = GUICtrlCreateLabel("Usb设备默认关闭", 152, 40, 95, 17)
GUICtrlSetColor(-1, 0x000000)
$Label3 = GUICtrlCreateLabel("开通请打IT运维", 152, 64, 86, 17)
GUICtrlSetColor(-1, 0x000000)
$Label4 = GUICtrlCreateLabel("32", 152, 88, 70, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form=关于.kxf
$Form_guanyu = GUICreate("关于", 268, 159, -1, -1)
$Label_guanyu_1 = GUICtrlCreateLabel("关于:", 23, 8, 86, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label_guanyu_2 = GUICtrlCreateLabel("USB开启关闭工具", 22, 32, 125, 17)
$Label_guanyu_3 = GUICtrlCreateLabel("作者:Mgchl", 23, 54, 120, 17)
$Label_guanyu_4 = GUICtrlCreateLabel(" Q Q :", 21, 78, 215, 17)
$Label_guanyu_5 = GUICtrlCreateLabel("MAIL:", 23, 101, 213, 17)
$Label_guanyu_6 = GUICtrlCreateLabel("HTTP://", 23, 123, 237, 17)
GUICtrlSetCursor (-1, 4)
$Button3 = GUICtrlCreateButton("功能设置", 184, 8, 75, 25)
GUISetState(@SW_HIDE, $Form_guanyu)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form=e:\inf_copy.kxf
$inf_copy = GUICreate("inf_恢复", 410, 236, -1, -1)
$Group1_copy = GUICtrlCreateGroup("文件路径", 32, 24, 257, 121)
$Label1_copy = GUICtrlCreateLabel("INF存放地址:", 51, 56, 81, 17)
$Label2_copy = GUICtrlCreateLabel("用户名:", 80, 80, 52, 17)
$Label3_copy = GUICtrlCreateLabel("密 码:", 80, 104, 52, 17)
$IPAddress1_copy = _GUICtrlIpAddress_Create($inf_copy, 136, 56, 130, 21)
_GUICtrlIpAddress_Set($IPAddress1_copy, "0.0.0.0")
$Input1_copy = GUICtrlCreateInput("administrator", 136, 80, 121, 21)
$Input2_copy = GUICtrlCreateInput("", 136, 104, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2_copy = GUICtrlCreateGroup("文件恢复状态", 32, 152, 257, 57)
$Label4_copy = GUICtrlCreateLabel("不文件恢复", 136, 168, 109, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1_copy = GUICtrlCreateButton("恢复", 304, 32, 75, 25)
$Button2_copy = GUICtrlCreateButton("取消", 304, 64, 75, 25)
GUISetState(@SW_HIDE,$inf_copy)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Radio1
$usbch1 = "bfkq"
Case $Radio2
$usbch1 = "kq"
Case $Radio3
$usbch1 = "qbgb"
Case $Button1
If $usbch1 = "qbgb" Then
;全部关闭
FileMove(@WindowsDir & "\inf\usbstor.inf", @WindowsDir & "\inf\usbstor.inf.ba_")
FileMove(@WindowsDir & "\inf\usbstor.PNF", @WindowsDir & "\inf\usbstor.PNF.ba_")
RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR", "Start", "REG_DWORD", "00000004")
Else
If $usbch1 = "bfkq" Then
;部分开启
FileMove(@WindowsDir & "\inf\usbstor.inf", @WindowsDir & "\inf\usbstor.inf.ba_")
FileMove(@WindowsDir & "\inf\usbstor.PNF", @WindowsDir & "\inf\usbstor.PNF.ba_")
RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR", "Start", "REG_DWORD", "00000003")
Else
If $usbch1 = "kq" Then
;全部开启
FileMove(@WindowsDir & "\inf\usbstor.inf.ba_", @WindowsDir & "\inf\usbstor.inf")
FileMove(@WindowsDir & "\inf\usbstor.PNF.ba_", @WindowsDir & "\inf\usbstor.PNF")
RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR", "Start", "REG_DWORD", "00000003")
Else
Exit
EndIf
EndIf
EndIf
Exit
Case $Button2
GUISetState(@SW_HIDE, $Form1_1)
GUISetState(@SW_SHOW, $Form_guanyu)
Case $Button3
GUISetState(@SW_HIDE, $Form_guanyu)
GUISetState(@SW_SHOW, $inf_copy)
Case $Button1_copy
;Run(@ComSpec &' /k net use \\'&$IPAddress1_copy&'\inf$ "'&$Input2_copy&'" /user:'&$Input1_copy)
MsgBox(0,"错误",'功能暂未开通')
Case $Button2_copy
Exit
EndSwitch
WEnd
EndIf
EndIf
EndIf |