为NTFS格式的U盘加入权限写保护可以防止简单的U盘病毒入侵!
注意:放到U盘以外使用! www.upan.cc
附AU3源码:
#NoTrayIcon #Region ;**** 参数创建于 ACNWrapper_GUI **** #AutoIt3Wrapper_icon=项目2.ico #AutoIt3Wrapper_outfile=U盘权限设置.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Description=U盘权限设置 #AutoIt3Wrapper_Res_Fileversion=13.1.26.4 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_Res_LegalCopyright=QQ:411933069 #EndRegion ;**** 参数创建于 ACNWrapper_GUI **** ; 脚本开始 - 在这后面添加您的代码. #AutoIt3Wrapper_UseAnsi=y #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUiCreate("U盘权限设置工具", 480, 206, -1, -1) $Group1 = GUICtrlCreateGroup("U盘权限设置工具说明", 16, 16, 445, 150) GUICtrlSetColor(-1, 0x42A5FF) GUICtrlCreateLabel("NTFS格式是WINDOWS系统推荐使用的格式,设置用户权限后可以防止病毒 的写入!", 30, 45, 430, 20) GUICtrlCreateLabel("对系统安全和U盘资料安全有着至关重要的作用!设置简单方便,只需轻轻一点!", 30, 70, 430, 20) GUICtrlCreateLabel("注意:U盘设置NTFS格式后在DOS下将无法识别!,请仔细阅读说明后再设置!", 30, 95, 430, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateLabel("请选择U盘:", 20, 184, 145, 245) $button = GUICtrlCreateButton("转换格式", 335, 180, 65, 23) $button1 = GUICtrlCreateButton("应 用 权 限 保 护 (&Y)", 30, 128, 160, 30) $button2 = GUICtrlCreateButton("解 除 权 限 保 护 (&N)", 280, 128, 160, 30) $button3 = GUICtrlCreateButton("刷新磁盘", 270, 180, 60, 23) $button4 = GUICtrlCreateButton("退出", 405, 180, 65, 23) $combo1 = GUICtrlCreateCombo("", 80, 182, 185, 35, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $CBS_DROPDOWNLIST)) GUICtrlCreateGroup("", -99, -99, 1, 1) _Disk() Write() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $button4 Exit Case $button $Zdrive = GUICtrlRead($combo1) $drive = StringLeft($Zdrive, 2) If DriveGetFileSystem($drive) = "NTFS" Then MsgBox(0, "温馨提醒", "此U盘已是NTFS格式无需转换") ContinueLoop Else ToolTip(@CR & "正在转换磁盘为NTFS格式,请稍等......" & @CR, @DesktopWidth - 260, @DesktopHeight - 120) GUICtrlSetState($combo1, $GUI_DISABLE) GUICtrlSetState($button, $GUI_DISABLE) GUICtrlSetState($button1, $GUI_DISABLE) GUICtrlSetState($button2, $GUI_DISABLE) GUICtrlSetState($button3, $GUI_DISABLE) GUICtrlSetState($button4, $GUI_DISABLE) RunWait(@ComSpec & ' /c convert ' & $drive & ' /fs:ntfs', @ScriptDir, @SW_HIDE) GUICtrlSetState($combo1, $GUI_ENABLE) GUICtrlSetState($button, $GUI_ENABLE) GUICtrlSetState($button1, $GUI_ENABLE) GUICtrlSetState($button2, $GUI_ENABLE) GUICtrlSetState($button3, $GUI_ENABLE) GUICtrlSetState($button4, $GUI_ENABLE) ProcessWaitClose("cmd.exe") DirRemove("c:\recycler", 1) FileDelete("c:\Recycled") ToolTip(@CR & "正设置完成!感谢使用!" & @CR, @DesktopWidth - 260, @DesktopHeight - 120) Sleep(1000) Write() ToolTip("") EndIf Case $button1 $Zdrive = GUICtrlRead($combo1) $drive = StringLeft($Zdrive, 2) If DriveGetFileSystem($drive) <> "NTFS" Then $Zx = MsgBox(36, "温馨提醒", "您的磁盘不是NTFS格式的是否转换后在执行?", 6) If $Zx = 6 Then ToolTip(@CR & "正在转换磁盘为NTFS格式,请稍等......" & @CR, @DesktopWidth - 260, @DesktopHeight - 120) GUICtrlSetState($combo1, $GUI_DISABLE) GUICtrlSetState($button, $GUI_DISABLE) GUICtrlSetState($button1, $GUI_DISABLE) GUICtrlSetState($button2, $GUI_DISABLE) GUICtrlSetState($button3, $GUI_DISABLE) GUICtrlSetState($button4, $GUI_DISABLE) RunWait(@ComSpec & ' /c convert ' & $drive & ' /fs:ntfs', @ScriptDir, @SW_HIDE) ToolTip(@CR & "正在设置磁盘为只读状态,请稍等......" & @CR, @DesktopWidth - 260, @DesktopHeight - 120) RunWait(@ComSpec & ' /c ' & 'echo y|cacls ' & $drive & ' /t /g everyone:r', @ScriptDir, @SW_HIDE) GUICtrlSetState($combo1, $GUI_ENABLE) GUICtrlSetState($button, $GUI_ENABLE) GUICtrlSetState($button1, $GUI_ENABLE) GUICtrlSetState($button2, $GUI_ENABLE) GUICtrlSetState($button3, $GUI_ENABLE) GUICtrlSetState($button4, $GUI_ENABLE) ToolTip(@CR & "正设置完成!感谢使用!" & @CR, @DesktopWidth - 260, @DesktopHeight - 120) Sleep(1000) Write() ToolTip("") EndIf Else ToolTip(@CR & "正在设置磁盘为只读状态,请稍等......" & @CR, @DesktopWidth - 260, @DesktopHeight - 120) GUICtrlSetState($combo1, $GUI_DISABLE) GUICtrlSetState($button, $GUI_DISABLE) GUICtrlSetState($button1, $GUI_DISABLE) GUICtrlSetState($button2, $GUI_DISABLE) GUICtrlSetState($button3, $GUI_DISABLE) GUICtrlSetState($button4, $GUI_DISABLE) RunWait(@ComSpec & ' /c ' & 'echo y|cacls ' & $drive & ' /t /g everyone:r', @ScriptDir, @SW_HIDE) GUICtrlSetState($combo1, $GUI_ENABLE) GUICtrlSetState($button, $GUI_ENABLE) GUICtrlSetState($button1, $GUI_ENABLE) GUICtrlSetState($button2, $GUI_ENABLE) GUICtrlSetState($button3, $GUI_ENABLE) GUICtrlSetState($button4, $GUI_ENABLE) ToolTip(@CR & "设置只读状态完成!感谢使用!" & @CR, @DesktopWidth - 260, @DesktopHeight - 120) Sleep(1000) Write() ToolTip("") EndIf Case $button2 $Zdrive = GUICtrlRead($combo1) $drive = StringLeft($Zdrive, 2) ToolTip(@CR & "正在解除磁盘只读状态,请稍等......" & @CR, @DesktopWidth - 260, @DesktopHeight - 120) GUICtrlSetState($combo1, $GUI_DISABLE) GUICtrlSetState($button, $GUI_DISABLE) GUICtrlSetState($button1, $GUI_DISABLE) GUICtrlSetState($button2, $GUI_DISABLE) GUICtrlSetState($button3, $GUI_DISABLE) GUICtrlSetState($button4, $GUI_DISABLE) RunWait(@ComSpec & ' /c ' & 'echo y|cacls ' & $drive & ' /t /g everyone:f', @ScriptDir, @SW_HIDE) GUICtrlSetState($combo1, $GUI_ENABLE) GUICtrlSetState($button, $GUI_ENABLE) GUICtrlSetState($button1, $GUI_ENABLE) GUICtrlSetState($button2, $GUI_ENABLE) GUICtrlSetState($button3, $GUI_ENABLE) GUICtrlSetState($button4, $GUI_ENABLE) ToolTip(@CR & "您已获得磁盘所有权限!感谢使用!" & @CR, @DesktopWidth - 260, @DesktopHeight - 120) Sleep(1000) Write() ToolTip("") Case $button3 _Disk() Write() Case $combo1 Write() EndSwitch WEnd Func _Disk() GUICtrlSetData($combo1, "") $disk = DriveGetDrive("REMOVABLE") If Not @error Then For $i = 1 To $disk[0] $disk[$i] = StringUpper($disk[$i]) If DriveGetLabel($disk[$i]) = "" Then $DriveLabel = "\可移动磁盘" Else $DriveLabel = "\" & DriveGetLabel($disk[$i]) EndIf $DriveTotal = DriveSpaceTotal($disk[$i]) $DriveTotalGB = "【容量:" & ByteConversion($DriveTotal) & "】" GUICtrlSetData($combo1, $disk[$i] & $DriveLabel & $DriveTotalGB, $disk[1] & $DriveLabel & $DriveTotalGB) Next EndIf EndFunc ;==>_Disk Func Write() $Zdrive = GUICtrlRead($combo1) $drive = StringLeft($Zdrive, 2) $File = $drive & "\Temp\" $Temp = DirCreate($File) If FileExists($File) Then DirRemove($File, 1) GUICtrlSetState($button2, $GUI_DISABLE) GUICtrlSetState($button1, $GUI_ENABLE) Else DirRemove($File, 1) GUICtrlSetState($button1, $GUI_DISABLE) GUICtrlSetState($button2, $GUI_ENABLE) EndIf EndFunc ;==>Write Func ByteConversion($lBytes) If $lBytes < 1024 Then Return Round($lBytes, 2) & "MB" ElseIf $lBytes < 1048576 Then Return Round($lBytes / 1024, 2) & "GB" EndIf EndFunc ;==>ByteConversion 优盘之家
U盘NTFS格式用户权限写保护工具(附源码):http://www.upan.cc/tools/security/3150.html