阅读:1167回复:0
VhardwareInt hook的问题。
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); x=_inp(0x2f9); _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(); } |
|
|