阅读:1671回复:4
why I can not hook the interrupt?
I copied a small VxD from a book , the codes are below.
I dont know why i can not hook the interrupt, who can help me? ____________________the code____________________ //mouse.h #include <vtoolscp.h> #include <vdw.h> #define DEVICE_CLASS MouseDevice #define MOUSE_DeviceID UNDEFINED_DEVICE_ID #define MOUSE_Init_Order UNDEFINED_INIT_ORDER #define MOUSE_Major 1 #define MOUSE_Minor 0 #define IRQ_3 3 //com2 KTrace T("mouse"); //debugger class MouseInt : public VHardwareInt { public: MouseInt(); virtual VOID OnHardwareInt(); }; class MouseDevice : public VDevice { public: virtual BOOL OnSysDynamicDeviceInit(); virtual BOOL OnSysDynamicDeviceExit(); MouseInt *pMyInt; }; -------------------the code---------------------- // MOUSE.cpp - main module for VxD MOUSE #define DEVICE_MAIN #include "mouse.h" Declare_Virtual_Device(MOUSE) #undef DEVICE_MAIN PDWORD pVal=(PDWORD)0x9fffc;//buffer for counting BOOL MouseDevice::OnSysDynamicDeviceInit() { BYTE x; *pVal=0; pMyInt=new MouseInt(); if(pMyInt == NULL) T.Trace(TraceAlways,"invalid handle!\n"); ////////////////////////////////////////////////////////// //////////driver monitor out put here,that hook failed/// if(!pMyInt->hook()) T.Trace(TraceAlways,"hook failed!\n"); ////////////////////////////////////////////////////////// if(pMyInt&&pMyInt->hook()) { _outp(0x2f9,1); _outp(0x2fa,0); _outp(0x2fc,0x0b); pMyInt->physicalUnmask(); } return TRUE; } BOOL MouseDevice::OnSysDynamicDeviceExit() { _outp(0x2f9,0); _outp(0x2fc,0); T.Trace(TraceAlways,"interrupt Closed\n"); delete pMyInt; return TRUE; } MouseInt::MouseInt() :VHardwareInt(IRQ_3,1,0,0) { } VOID MouseInt::OnHardwareInt() { (*pVal)++; T.Trace(TraceAlways, "interrupt detected!\n"); _inp(0x2fa); _inp(0x2fd); _inp(0x2f8); sendPhysicalEOI(); } |
|
|
沙发#
发布于:2001-08-17 17:29
用softice调一下,看看是不是hook()没有成功
如果你确实装了鼠标,请用VSharedHardwareInt |
|
|
板凳#
发布于:2001-08-17 18:39
这个例子是鼠标中断,但是是对Com端口来进行的。我以前测试也不行!
|
|
|
地板#
发布于:2001-08-18 02:34
我说的是Serial 鼠标啊
如果你的com口上没有设备,哪里来的中断源? 但是如果你的com口上有serial鼠标的话,那么,已经有一个vxd 在管理这个中断了,所以我觉得应该用VSharedHardwareInt 我学这个的时候,想都没想就用VSharedHardwareInt了 此外,据我所知,如果鼠标中断来了以后,读取某一个串口端口 (具体哪个我忘了)会清除中断,所以,我觉得不应该在你自己的vxd 中那样做,应该把那些_inp去掉,并在OnSharedHardwareInt中 return FALSE,不要尝试进行任何操作,比如sendPhysicalEOI 等等 我以前在nt下想截获seiral鼠标中断,但结果是,虽然能够截获 但是这时鼠标不能动作了,可能就是这个原因 |
|
|
地下室#
发布于:2001-08-18 09:03
如果是WIN9X 那应没问题,看一下有没有中断源,即发信息的,如果没有就接一个鼠标。
|
|