correy
驱动牛犊
驱动牛犊
  • 注册日期2007-11-12
  • 最后登录2017-04-07
  • 粉丝0
  • 关注0
  • 积分76分
  • 威望531点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
  • 社区居民
阅读:1596回复:0

使计算机发次声波的驱动程序

楼主#
更多 发布于:2009-12-30 21:46
;使计算机的主板上的蜂鸣器发出次声波的驱动程序。
;使计算机的主板上的蜂鸣器发出次声波的驱动程序。当然也可以提升运行级别,改变i/o许可位图等方法来实现。
;次声波虽然听不到但用计算机的任务管理器可以看到,有待你用共振器检测。不足之处,敬请论坛高手指导。

;先是服务控制程序。
;QQ:112426112
;Email:leguanyuan@126.com
;websites:http://hi.baidu.com/correy
;rc me.rc
;ml /coff test.asm /link /subsystem:windows me.res
.386
.model flat, stdcall
option casemap:none
include windows.inc
include kernel32.inc
include advapi32.inc
includelib kernel32.lib
includelib advapi32.lib
.data
correy db "correy",0
filename db "sys.sys",0
.data?
hSCManager dd ?
hService dd ?
acDriverPath db 260 dup(?)
.code
start:
invoke OpenSCManager,0,0,SC_MANAGER_CREATE_SERVICE
  mov hSCManager, eax
  push eax
  invoke GetFullPathName,addr filename, sizeof acDriverPath, addr acDriverPath, esp
  pop eax
  invoke CreateService, hSCManager,addr correy,addr correy, \
    SERVICE_START + DELETE, SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START, \
    SERVICE_ERROR_IGNORE, addr acDriverPath, 0, 0, 0, 0, 0
   mov hService, eax
   invoke StartService, hService, 0, 0
   invoke DeleteService, hService
   invoke CloseServiceHandle, hService
  invoke CloseServiceHandle, hSCManager
ret
end start
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;rc me.rc >error.txt
;ml /nologo /c /coff sys.asm  >>error.txt
;link /nologo /driver /base:0x10000 /align:32 /out:sys.sys /subsystem:native sys.obj>>error.txt
.386
.model flat, stdcall
option casemap:none
include ntstatus.inc
include ntddk.inc
include hal.inc
includelib hal.lib
DO_DELAY MACRO;延时
mov eax, 99999999h
.while eax
  dec eax
.endw
ENDM
.code
MakeBeep1 proc dwPitch:DWORD;方法1
cli
mov al, 10110110y
out 43h, al
mov eax, dwPitch
out 42h, al
mov al, ah
out 42h, al
in al, 61h
or  al, 11y
out 61h, al
sti
DO_DELAY
cli
in al, 61h
and al, 11111100y
out 61h, al
sti
ret
MakeBeep1 endp
MakeBeep2 proc dwPitch:DWORD;方法2
cli
invoke WRITE_PORT_UCHAR, 43h, 10110110y
mov eax, dwPitch
invoke WRITE_PORT_UCHAR, 42h, al
mov eax, dwPitch
invoke WRITE_PORT_UCHAR, 42h, ah
invoke READ_PORT_UCHAR, 61h
or  al, 11y
invoke WRITE_PORT_UCHAR, 61h, al
sti
DO_DELAY
cli
invoke READ_PORT_UCHAR, 61h
and al, 11111100y
invoke WRITE_PORT_UCHAR, 61h, al
sti
ret
MakeBeep2 endp
DriverEntry proc pDriverObject:PDRIVER_OBJECT, pusRegistryPath:PUNICODE_STRING
invoke MakeBeep1, 119318;10hz
invoke HalMakeBeep,9;方法3。
DO_DELAY
invoke MakeBeep2, 1193180;1hz
invoke HalMakeBeep, 0
mov eax, STATUS_DEVICE_CONFIGURATION_ERROR
ret
DriverEntry endp
end DriverEntry
游客

返回顶部