WIN32汇编 怎么实现键盘Ctrl+Alt+Del的屏蔽

dachidahu 2007-06-06 10:23:25
能否给出具体代码~谢谢了
...全文
226 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
dongyi940333 2007-06-07
  • 打赏
  • 举报
回复
这是INTER汇编语言程序设计第四版书上的一个例子,用于阻止按CTRL-ALT-DELETE重启.
该程序只能在计算机引导到MS_DOS方式下才能正常工作,WINDOWS禁止TSR程序截取键盘按键.

主要用到INT 21H的功能35H和25H,你自已看一下,初学,不对之处请指出,谢谢

TITLE Reset-Disabling program (No_Reset.asm)

; This program disables the usual DOS reset command
; (Ctrl-Alt-Del), by intercepting the INT 9 keyboard
; hardware interrupt. It checks the shift status bits
; in the MS-DOS keyboard flag and changes any Ctrl-Alt-Del
; to Alt-Del. The computer can only be rebooted by
; typing Ctrl+Alt+Right shift+Del. Assemble, link,
; and convert to a COM program by including the /T
; command on the Microsoft LINK command line.
; Last update: 10/12/01

.model tiny
.code
rt_shift EQU 01h ; Right shift key: bit 0
ctrl_key EQU 04h ; CTRL key: bit 2
alt_key EQU 08h ; ALT key: bit 3
del_key EQU 53h ; scan code for DEL key
kybd_port EQU 60h ; keyboard input port

ORG 100h ; this is a COM program
start:
jmp setup ; jump to TSR installation

; Memory-resident code begins here
int9_handler PROC FAR
sti ; enable hardware interrupts
pushf ; save regs & flags
push es
push ax
push di

; Point ES:DI to the DOS keyboard flag byte:
L1: mov ax,40h ; DOS data segment is at 40h
mov es,ax
mov di,17h ; location of keyboard flag
mov ah,es:[di] ; copy keyboard flag into AH

; Test for the CTRL and ALT keys:
L2: test ah,ctrl_key ; CTRL key held down?
jz L5 ; no: exit
test ah,alt_key ; ALT key held down?
jz L5 ; no: exit

; Test for the DEL and Right-shift keys:
L3: in al,kybd_port ; read keyboard port
cmp al,del_key ; DEL key pressed?
jne L5 ; no: exit
test ah,rt_shift ; right shift key pressed?
jnz L5 ; yes: allow system reset

L4: and ah,NOT ctrl_key ; no: turn off bit for CTRL
mov es:[di],ah ; store keyboard_flag

L5: pop di ; restore regs & flags
pop ax
pop es
popf
jmp cs:[old_interrupt9] ; jump to INT 9 routine

old_interrupt9 DWORD ?

int9_handler ENDP
end_ISR label BYTE

; --------------- (end of TSR program) ------------------
; Save a copy of the original INT 9 vector, and set up
; the address of our program as the new vector. Terminate
; this program and leave the int9_handler procedure in memory.

setup:
mov ax,3509h ; get INT 9 vector
int 21h
mov word ptr old_interrupt9,bx ; save INT 9 vector
mov word ptr old_interrupt9+2,es

mov ax,2509h ; set interrupt vector, INT 9
mov dx,offset int9_handler
int 21h

mov ax,3100h ; terminate and stay resident
mov dx,OFFSET end_ISR ; point to end of resident code
shr dx,4 ; multiply by 16
inc dx ; round upward to next paragraph
int 21h ; execute MS-DOS function
END start
网管教程 从入门到精通软件篇 ★一。★详细的xp修复控制台命令和用法!!! 放入xp(2000)的光盘,安装时候选R,修复! Windows XP(包括 Windows 2000)的控制台命令是在系统出现一些意外情况下的一种非常有效的诊断和测试以及恢复系统功能的工具。小编的确一直都想把这方面的命令做个总结,这次辛苦老范给我们整理了这份实用的秘笈。   Bootcfg   bootcfg 命令启动配置和故障恢复(对于大多数计算机,即 boot.ini 文件)。   含有下列参数的 bootcfg 命令仅在使用故障恢复控制台时才可用。可在命令提示符下使用带有不同参数的 bootcfg 命令。   用法:   bootcfg /default  设置默认引导项。   bootcfg /add    向引导列表中添加 Windows 安装。   bootcfg /rebuild  重复全部 Windows 安装过程并允许用户选择要添加的内容。   注意:使用 bootcfg /rebuild 之前,应先通过 bootcfg /copy 命令备份 boot.ini 文件。   bootcfg /scan    扫描用于 Windows 安装的所有磁盘并显示结果。   注意:这些结果被静态存储,并用于本次会话。如果在本次会话期间磁盘配置发生变化,为获得更新的扫描,必须先重新启动计算机,然后再次扫描磁盘。   bootcfg /list   列出引导列表中已有的条目。   bootcfg /disableredirect 在启动引导程序中禁用重定向。   bootcfg /redirect [ PortBaudRrate] |[ useBiosSettings]   在启动引导程序中通过指定配置启用重定向。   范例: bootcfg /redirect com1 115200 bootcfg /redirect useBiosSettings   hkdsk   创建并显示磁盘的状态报告。Chkdsk 命令还可列出并纠正磁盘上的错误。   含有下列参数的 chkdsk 命令仅在使用故障恢复控制台时才可用。可在命令提示符下使用带有不同参数的 chkdsk 命令。   vol [drive:] [ chkdsk [drive:] [/p] [/r]   参数  无   如果不带任何参数,chkdsk 将显示当前驱动器中的磁盘状态。 drive: 指定要 chkdsk 检查的驱动器。 /p   即使驱动器不在 chkdsk 的检查范围内,也执行彻底检查。该参数不对驱动器做任何更改。 /r   找到坏扇区并恢复可读取的信息。隐含着 /p 参数。   注意 Chkdsk 命令需要 Autochk.exe 文件。如果不能在启动目录(默认为 %systemroot%System32)中找到该文件,将试着在 Windows 安装 CD 中找到它。如果有多引导系统的计算机,必须保证是在包含 Windows 的驱动器上使用该命令。 Diskpart   创建和删除硬盘驱动器上的分区。diskpart 命令仅在使用故障恢复控制台时才可用。   diskpart [ /add |/delete] [device_name |drive_name |partition_name] [size]   参数 无   如果不带任何参数,diskpart 命令将启动 diskpart 的 Windows 字符模式版本。   /add   创建新的分区。   /delete   删除现有分区。   device_name   要创建或删除分区的设备。设备名称可从 map 命令的输出获得。例如,设备名称:   DeviceHardDisk0   drive_name   以驱动器号表示的待删除分区。仅与 /delete 同时使用。以下是驱动器名称的范例:   D:   partition_name   以分区名称表示的待删除分区。可代替 drive_name 使用。仅与 /delete 同时使用。以下是分区名称的范例:   DeviceHardDisk0Partition1    大小   要创建的分区大小,以兆字节 (MB)表示。仅与 /add 同时使用。   范例   下例将删除分区: diskpart /delete Device HardDisk0 Partition3 diskpart /delete F:   下例将在硬盘上添加一个 20 MB 的分区:   diskpart /add Device HardDisk0 20   Fixboot

21,459

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧