王朝网络
分享
 
 
 

基于键盘远程钩子的LWIN屏蔽小程序

王朝system·作者佚名  2006-01-10
宽屏版  字体: |||超大  

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

.386

.model flat, stdcall

option casemap :none

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

; Include 文件定义

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

include windows.inc

include user32.inc

includelib user32.lib

include kernel32.inc

includelib kernel32.lib

include Hookdll.inc

includelib Hookdll.lib

include Shell32.inc

includelib Shell32.lib

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

; Equ 等值定义

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

ICO_MAIN equ 1000

DLG_MAIN equ 1000

IDC_TEXT equ 1001

WM_SHELLNOTIFY equ WM_USER+5

IDI_TRAY equ ICO_MAIN

IDM_RESTORE equ 1000

IDM_EXIT equ 1010

WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD

.data

ClassName db "TrayIconWinClass",0

RestoreString db "小白制作",0

ExitString db "关闭",0

szAboutText db '西南科技大学信控学院','电子03级,小白制作。Mailto:nike3721@163.com。', '这是个绿色软件,一时无聊做的,用来屏蔽左边的开始键。', '不必再担心打游戏的时候不小心按到而退出。这是个绿色软件', '整个软件只有不到9KB,用纯汇编语言编写,不需要安装。谢谢支持!祝玩得愉快。',0dh,

'如果你有什么意见或建议请发到上面的邮箱。版本V1.0.2005年3月12日',0

.data?

hInstance dd ?

note NOTIFYICONDATA <>

hPopupMenu dd ?

.code

start:

invoke GetModuleHandle, NULL

mov hInstance,eax

invoke WinMain, hInstance,NULL,NULL, SW_SHOWDEFAULT

invoke ExitProcess,eax

WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD

LOCAL wc:WNDCLASSEX

LOCAL msg:MSG

LOCAL hwnd:HWND

mov wc.cbSize,SIZEOF WNDCLASSEX

mov wc.style, CS_HREDRAW or CS_VREDRAW or CS_DBLCLKS

mov wc.lpfnWndProc, OFFSET WndProc

mov wc.cbClsExtra,NULL

mov wc.cbWndExtra,NULL

push hInst

pop wc.hInstance

mov wc.hbrBackground,COLOR_APPWORKSPACE

mov wc.lpszMenuName,NULL

mov wc.lpszClassName,OFFSET ClassName

invoke LoadIcon,hInstance,ICO_MAIN

mov wc.hIcon,eax

mov wc.hIconSm,eax

invoke LoadCursor,NULL,IDC_ARROW

mov wc.hCursor,eax

invoke RegisterClassEx, addr wc

invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR ClassName,ADDR szAboutText,\

WS_OVERLAPPED+WS_CAPTION+WS_SYSMENU,CW_USEDEFAULT,\

CW_USEDEFAULT,350,200,NULL,NULL,\

hInst,NULL

mov hwnd,eax

.while TRUE

invoke GetMessage, ADDR msg,NULL,0,0

.BREAK .IF (!eax)

invoke TranslateMessage, ADDR msg

invoke DispatchMessage, ADDR msg

.endw

mov eax,msg.wParam

ret

WinMain endp

WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

LOCAL pt:POINT

.if uMsg==WM_CREATE

invoke CreatePopupMenu

mov hPopupMenu,eax

invoke InstallHook,hWnd

.if ! eax

invoke DestroyWindow,hWnd

.endif

invoke AppendMenu,hPopupMenu,MF_STRING,IDM_EXIT,addr ExitString

mov note.cbSize,sizeof NOTIFYICONDATA

push hWnd

pop note.hwnd

mov note.uID,IDI_TRAY

mov note.uFlags,NIF_ICON+NIF_MESSAGE+NIF_TIP

mov note.uCallbackMessage,WM_SHELLNOTIFY

invoke LoadIcon,hInstance,ICO_MAIN

mov note.hIcon,eax

invoke lstrcpy,addr note.szTip,addr RestoreString

invoke ShowWindow,hWnd,SW_HIDE

invoke Shell_NotifyIcon,NIM_ADD,addr note

.elseif uMsg==WM_DESTROY

invoke UninstallHook

invoke DestroyMenu,hPopupMenu

invoke PostQuitMessage,NULL

.elseif uMsg==WM_COMMAND

.if lParam==0

invoke Shell_NotifyIcon,NIM_DELETE,addr note

mov eax,wParam

.if ax== IDM_EXIT

invoke DestroyWindow,hWnd

.endif

.endif

.elseif uMsg==WM_SHELLNOTIFY

.if wParam==IDI_TRAY

.if lParam==WM_RBUTTONDOWN

invoke GetCursorPos,addr pt

invoke SetForegroundWindow,hWnd

invoke TrackPopupMenu,hPopupMenu,TPM_RIGHTALIGN,pt.x,pt.y,NULL,hWnd,NULL

invoke PostMessage,hWnd,WM_NULL,0,0

.elseif lParam==WM_LBUTTONDBLCLK

invoke MessageBox,NULL,addr szAboutText,addr RestoreString,MB_OK

.endif

.endif

.else

invoke DefWindowProc,hWnd,uMsg,wParam,lParam

ret

.endif

xor eax,eax

ret

WndProc endp

end start

;hookdll.asm

.386

.model flat, stdcall

option casemap :none

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

; Include 文件定义

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

include windows.inc

include user32.inc

includelib user32.lib

include kernel32.inc

includelib kernel32.lib

KBDLLHOOKSTRUCT struct

vkCode DWORD ?

scanCode DWORD ?

flags DWORD ?

time DWORD ?

dwExtraInfo DWORD ?

KBDLLHOOKSTRUCT ends

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

.data

hInstance dd ?

.data?

hWnd dd ?

hHook dd ?

dwMessage dd ?

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

.code

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

; dll 的入口函数

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

DllEntry proc _hInstance,_dwReason,_dwReserved

push _hInstance

pop hInstance

mov eax,TRUE

ret

DllEntry Endp

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

; 键盘钩子回调函数

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

HookProc proc _dwCode,_wParam,_lParam

local @stKbDllHookStruct:KBDLLHOOKSTRUCT

.if _dwCode == HC_ACTION

mov esi,_lParam

assume esi:ptr KBDLLHOOKSTRUCT

.if [esi].vkCode == VK_LWIN

;mov [esi].vkCode,VK_LCONTROL

mov eax,TRUE

assume esi:nothing

ret

.endif

assume esi:nothing

.endif

invoke CallNextHookEx,hHook,_dwCode,_wParam,_lParam

xor eax,eax

ret

HookProc endp

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

; 安装钩子

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

InstallHook proc _hWnd

push _hWnd

pop hWnd

invoke SetWindowsHookEx,WH_KEYBOARD_LL,addr HookProc,hInstance,NULL

mov hHook,eax

ret

InstallHook endp

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

; 卸载钩子

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

UninstallHook proc

invoke UnhookWindowsHookEx,hHook

ret

UninstallHook endp

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

End DllEntry

;hookdll.inc

HookProc proto :dword,:dword,:dword

InstallHook proto :dword

UninstallHook proto

hookdll.def

EXPORTS HookProc

InstallHook

UninstallHook

;makefile

NAME = Main

DLL = Hookdll

ML_FLAG = /c /coff

LINK_FLAG = /subsystem:windows

DLL_LINK_FLAG = /subsystem:windows /section:.bss,S

$(DLL).dll $(NAME).exe:

$(DLL).dll: $(DLL).obj $(DLL).def

Link $(DLL_LINK_FLAG) /Def:$(DLL).def /Dll $(DLL).obj

$(NAME).exe: $(NAME).obj $(NAME).res

Link $(LINK_FLAG) $(NAME).obj $(NAME).res

.asm.obj:

ml $(ML_FLAG) $<

.rc.res:

rc $<

clean:

del *.obj

del *.res

del *.exp

del *.lib

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
>>返回首页<<
推荐阅读
 
 
频道精选
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
© 2005- 王朝网络 版权所有