📄 antiautorun.asm
字号:
.elseif eax == WM_INITDIALOG
invoke LoadIcon,hInstance,ICO_MAIN
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
;********************************************************************
;添加菜单
;********************************************************************
invoke GetSystemMenu,hWnd,FALSE
mov @hSysMenu,eax
invoke AppendMenu,@hSysMenu,MF_SEPARATOR,0,NULL
invoke AppendMenu,@hSysMenu,0,IDC_ABOUT,offset szAbout
;********************************************************************
;初始化组合框
;********************************************************************
.while szVol<='Z'
invoke lstrcat,addr szDisk,addr szVol
invoke lstrcat,addr szDisk,addr szM
invoke GetDriveType,addr szDisk
.if eax==DRIVE_FIXED
invoke SendDlgItemMessage,hWnd,IDC_COMBO1,CB_ADDSTRING,0,addr szDisk
.elseif eax==DRIVE_REMOVABLE
invoke SendDlgItemMessage,hWnd,IDC_COMBO1,CB_ADDSTRING,0,addr szDisk
.endif
invoke RtlZeroMemory,addr szDisk,sizeof szDisk
inc szVol
.endw
;********************************************************************
; 初始化单选钮和复选框
;********************************************************************
invoke CheckDlgButton,hWnd,IDC_SELDISK,BST_CHECKED
invoke CheckDlgButton,hWnd,IDC_REPAIR,BST_CHECKED
invoke CheckDlgButton,hWnd,IDC_FORBID,BST_CHECKED
;********************************************************************
.elseif eax == WM_COMMAND
mov eax,wParam
;********************************************************************
;确定按钮的处理过程
;********************************************************************
.if ax == IDOK
;********************************************************************
;确定之免疫全部
;********************************************************************
invoke IsDlgButtonChecked,hWnd,IDC_ALLDISK
.if eax == BST_CHECKED
invoke lstrcpy,addr szVol,addr szVol2
.while szVol<='Z'
invoke lstrcat,addr szDisk,addr szVol
invoke lstrcat,addr szDisk,addr szM
invoke GetDriveType,addr szDisk
.if eax==DRIVE_FIXED
invoke _Antiautorun,addr szDisk
.elseif eax==DRIVE_REMOVABLE
invoke _Antiautorun,addr szDisk
.endif
invoke RtlZeroMemory,addr szDisk,sizeof szDisk
inc szVol
.endw
.endif
invoke GetFileAttributes,addr sz2
.if eax!=INVALID_FILE_ATTRIBUTES
invoke GetDlgItem,hWnd,IDC_TXT
invoke SetWindowText,eax,addr szSucessAll
.endif
;********************************************************************
;确定之选择磁盘
;********************************************************************
invoke IsDlgButtonChecked,hWnd,IDC_SELDISK
.if eax == BST_CHECKED
invoke SendDlgItemMessage,hWnd,IDC_COMBO1,CB_GETCURSEL,0,0
mov ebx,eax
invoke SendDlgItemMessage,hWnd,IDC_COMBO1,CB_GETLBTEXT,ebx,addr szDisk
.if eax==CB_ERR
invoke GetDlgItem,hWnd,IDC_TXT
invoke SetWindowText,eax,addr szNoDisk
.else
invoke _Antiautorun,addr szDisk
invoke GetFileAttributes,addr sz2
.if eax!=INVALID_FILE_ATTRIBUTES
invoke GetDlgItem,hWnd,IDC_TXT
invoke SetWindowText,eax,addr szSucessOne
.endif
invoke RtlZeroMemory,addr szDisk,sizeof szDisk
.endif
.endif
;********************************************************************
;确定之修复磁盘打开关联
;********************************************************************
invoke IsDlgButtonChecked,hWnd,IDC_REPAIR
.if eax == BST_CHECKED
invoke lstrcpy,addr szVol,addr szVol2
.while szVol<='Z'
invoke lstrcat,addr szDisk,addr szVol
invoke lstrcat,addr szDisk,addr szM
invoke GetDriveType,addr szDisk
.if eax==DRIVE_FIXED
invoke _Repair,addr szDisk
.elseif eax==DRIVE_REMOVABLE
invoke _Repair,addr szDisk
.endif
invoke RtlZeroMemory,addr szDisk,sizeof szDisk
inc szVol
.endw
.endif
;********************************************************************
;禁止自动运行功能
;********************************************************************
invoke IsDlgButtonChecked,hWnd,IDC_FORBID
.if eax == BST_CHECKED
invoke _ForbidAuto,eax
.endif
;********************************************************************
;取消按钮的处理过程
;********************************************************************
.elseif ax ==IDC_CANCEL
;********************************************************************
;取消全部
;********************************************************************
invoke IsDlgButtonChecked,hWnd,IDC_ALLDISK
.if eax == BST_CHECKED
invoke lstrcpy,addr szVol,addr szVol2
.while szVol<='Z'
invoke lstrcat,addr szDisk,addr szVol
invoke lstrcat,addr szDisk,addr szM
invoke GetDriveType,addr szDisk
.if eax==DRIVE_FIXED
invoke _Autorun,addr szDisk
.elseif eax==DRIVE_REMOVABLE
invoke _Autorun,addr szDisk
.endif
invoke RtlZeroMemory,addr szDisk,sizeof szDisk
inc szVol
.endw
invoke GetDlgItem,hWnd,IDC_TXT
invoke SetWindowText,eax,addr szRemoveAll
.endif
;********************************************************************
;取消之选择磁盘
;********************************************************************
invoke IsDlgButtonChecked,hWnd,IDC_SELDISK
.if eax == BST_CHECKED
invoke SendDlgItemMessage,hWnd,IDC_COMBO1,CB_GETCURSEL,0,0
mov ebx,eax
invoke SendDlgItemMessage,hWnd,IDC_COMBO1,CB_GETLBTEXT,ebx,addr szDisk
.if eax==CB_ERR
invoke IsDlgButtonChecked,hWnd,IDC_FORBID
.if eax == BST_CHECKED
invoke GetDlgItem,hWnd,IDC_TXT
invoke SetWindowText,eax,addr szNoDisk2
.elseif eax == BST_UNCHECKED
invoke GetDlgItem,hWnd,IDC_TXT
invoke SetWindowText,eax,addr szNoDisk3
.endif
.else
invoke _Autorun,addr szDisk
invoke GetDlgItem,hWnd,IDC_TXT
invoke SetWindowText,eax,addr szRemoveOne
invoke RtlZeroMemory,addr szDisk,sizeof szDisk
.endif
.endif
;********************************************************************
;取消之恢复自动运行功能
;********************************************************************
invoke IsDlgButtonChecked,hWnd,IDC_FORBID
.if eax == BST_UNCHECKED
invoke _ForbidAuto,eax
.endif
;********************************************************************
.elseif ax ==IDC_ALLDISK
invoke GetDlgItem,hWnd,IDC_COMBO1
invoke EnableWindow,eax,FALSE
.elseif ax ==IDC_SELDISK
invoke GetDlgItem,hWnd,IDC_COMBO1
invoke EnableWindow,eax,TRUE
.elseif ax ==IDC_END
invoke EndDialog,hWnd,NULL
.endif
.elseif eax == WM_SYSCOMMAND
mov eax,wParam
movzx eax,ax
.if eax == IDC_ABOUT
invoke DialogBoxParam,hInstance,DLG_ABOUT,hWnd,offset _ProcDlgAbout,NULL
.else
invoke DefWindowProc,hWnd,wMsg,wParam,lParam
ret
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_ProcDlgMain endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,DLG_MAIN,NULL,offset _ProcDlgMain,NULL
invoke ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -