mecoo
驱动牛犊
驱动牛犊
  • 注册日期2001-07-29
  • 最后登录
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1167回复:0

VhardwareInt hook的问题。

楼主#
更多 发布于:2001-08-17 16:26
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();
}
金鳞不是池中物, 一遇风云变化虫。
游客

返回顶部