能力值:
( LV12,RANK:420 )
2 楼
HideTool就是这么做的,不过人家是在驱动实现的,在ntdll领空内找一个ret
另外,你这个硬编码40是从哪来的,好像不对,各平台上是不一样的。
能力值:
( LV2,RANK:10 )
3 楼
这个代码在xp sp2下通过经过测试的 硬编码确实会有问题
第一次发帖就引起mj注意 太太太幸运了 哈哈哈。。。~
能力值:
( LV4,RANK:50 )
4 楼
#define KBD_HOOK_API_NUM 40 //WH_KEYBAORD ??? 几个共用
#define DEBUG_HOOK_API_NUM 43 //WH_DEBUG
#define MOUSE_HOOK_API_NUM 44 //WH_MOUSE
#define KBD_LL_HOOK_API_NUM 45 //WH_KEYBOARD_LL
#define MSLL_HOOK_API_NUM 46 //WH_MOUSE_LL
#define EVENT_MSG_HOOK_API_NUM 49 //WH_JOURNALRECORD
能力值:
( LV12,RANK:420 )
5 楼
跟这个不一样吧,防全局钩子拦ClientLoadLibrary,XP下是66,不知道你的40是哪来的。。
查了下XPSP2的40是fnHkINDWORD,不知道你拦截了什么。也能拦键盘钩子?离奇了吧 呵呵
XP SP2的callback函数对照表
01 fnCOPYDATA
02 fnCOPYGLOBALDATA
03 fnDWORD
04 fnNCDESTROY
05 fnDWORDOPTINLPMSG
06 fnINOUTDRAG
07 fnGETTEXTLENGTHS
08 fnINCNTOUTSTRING
09 fnPOUTLPINT
10 fnINLPCOMPAREITEMSTRUCT
11 fnINLPCREATESTRUCT
12 fnINLPDELETEITEMSTRUCT
13 fnINLPDRAWITEMSTRUCT
14 fnINLPHLPSTRUCT
15 fnINLPHLPSTRUCT
16 fnINLPMDICREATESTRUCT
17 fnINOUTLPMEASUREITEMSTRUCT
18 fnINLPWINDOWPOS
19 fnINOUTLPPOINT5
20 fnINOUTLPSCROLLINFO
21 fnINOUTLPRECT
22 fnINOUTNCCALCSIZE
23 fnINOUTLPSCROLLINFO
24 fnINPAINTCLIPBRD
25 fnINSIZECLIPBRD
26 fnINDESTROYCLIPBRD
27 fnINSTRINGNULL
28 fnINSTRINGNULL
29 fnINDEVICECHANGE
30 fnINOUTNEXTMENU
31 fnLOGONNOTIFY
32 fnOPTOUTLPDWORDOPTOUTLPDWORD
33 fnOPTOUTLPDWORDOPTOUTLPDWORD
34 fnOUTDWORDINDWORD
35 fnOUTLPRECT
36 fnPOUTLPINT
37 fnINLPHLPSTRUCT
38 fnPOUTLPINT
39 fnSENTDDEMSG
40 fnINOUTSTYLECHANGE
41 fnHkINDWORD
42 fnHkINLPCBTACTIVATESTRUCT
43 fnHkINLPCBTCREATESTRUCT
44 fnHkINLPDEBUGHOOKSTRUCT
45 fnHkINLPMOUSEHOOKSTRUCTEX
46 fnHkINLPKBDLLHOOKSTRUCT
47 fnHkINLPMSLLHOOKSTRUCT
48 fnHkINLPMSG
49 fnHkINLPRECT
50 fnHkOPTINLPEVENTMSG
51 ClientCopyDDEIn1
52 ClientCopyDDEIn2
53 ClientCopyDDEOut1
54 ClientCopyDDEOut2
55 ClientCopyImage
56 ClientEventCallback
57 ClientFindMnemChar
58 ClientFontSweep
59 ClientFreeDDEHandle
60 ClientFreeLibrary
61 ClientGetCharsetInfo
62 ClientGetDDEFlags
63 ClientGetDDEHookData
64 ClientGetListboxString
65 ClientGetMessageMPH
66 ClientLoadImage
67 ClientLoadLibrary
68 ClientLoadMenu
69 ClientLoadLocalT1Fonts
70 ClientLoadRemoteT1Fonts
71 ClientPSMTextOut
72 ClientLpkDrawTextEx
73 ClientExtTextOutW
74 ClientGetTextExtentPointW
75 ClientCharToWchar
76 ClientAddFontResourceW
77 ClientThreadSetup
78 ClientDeliverUserApc
79 ClientNoMemoryPopup
80 ClientMonitorEnumProc
81 ClientCallWinEventProc
82 ClientWaitMessageExMPH
83 ClientWOWGetProcModule
84 ClientWOWTask16SchedNotify
85 ClientImmLoadLayout
86 ClientImmProcessKey
87 fnIMECONTROL
88 fnINWPARAMDBCSCHAR
89 fnGETTEXTLENGTHS
90 fnINLPKDRAWSWITCHWND
91 ClientLoadStringW
92 ClientLoadOLE
93 ClientRegisterDragDrop
94 ClientRevokeDragDrop
95 fnINOUTMENUGETOBJECT
96 ClientPrinterThunk
97 fnOUTLPCOMBOBOXINFO
98 fnOUTLPSCROLLBARINFO
能力值:
( LV4,RANK:50 )
6 楼
40确实可以拦截键盘钩子
能力值:
( LV4,RANK:50 )
7 楼
case KBD_HOOK_API_NUM: //WH_KEYBOARD 需要在目标进程中加载DLL
{
pKbdHookData = (PFNHKINLPKBDLLHOOKSTRUCTMSG)InputBuffer;
if (pKbdHookData->ghh.nCode == 0x20000) //WH_KEYBOARD
能力值:
( LV9,RANK:780 )
8 楼
关注。。。。
能力值:
( LV2,RANK:10 )
9 楼
关注......
能力值:
( LV12,RANK:420 )
10 楼
看了一下,你这样根本不叫真正拦键盘钩子,确实,在xxxHkCallHook时,最后会调用到fnHkINDWORD的键盘钩子调用,可以通过40拦截
可惜的是,这件事是做在用ClientLoadLibrary把键盘钩子加载到目标进程之后,此时DLL已在目标进程,实际上根本无需再多做一层调用,目标DLL就可以做键盘拦截和过滤动作,即使你拦截了这个调用,也只是表面拦住了常规键盘钩子而已!
能力值:
( LV2,RANK:10 )
11 楼
修正一下 原先说的在xp sp2验证通过说错了 是在win7下测试通过的
能力值:
( LV2,RANK:10 )
12 楼
受教了~ 那么拦ClientLoadLibrary应该可以对吧?
顺便问一下在ring3下有可能防御raw input吗
能力值:
( LV4,RANK:50 )
13 楼
WH_KEYBOARD_LL不需要ClientLoadLibrary吧
我拦截了所有的钩子调用只是为了分析而已
能力值:
( LV12,RANK:420 )
14 楼
WH_KEYBOARD_LL当然需要clientloadlibrary
能力值:
( LV4,RANK:50 )
15 楼
the WH_KEYBOARD_LL hook is not injected into another process. Instead, the context switches back to the process that installed the hook and it is called in its original context.
能力值:
( LV12,RANK:420 )
16 楼
恩,确实不需要,我看的是NT4的源码,原来2K中已经对LL做了不调用LoadhmodIndex的处理,多谢楼上指正。