阅读:3595回复:2
求助(DriverWorks中的KEvent用法)
DriverWorks中的KEvent用法。
作用。 |
|
最新喜欢:mapofl |
沙发#
发布于:2001-06-08 16:39
其实很简单的。你想知道什么呢?先贴个我自己实现的例子。
KEvent * m_pMicrosecondEvent; switch(I.IoctlCode()) case IVRDRIVER_IOCTL_HookMicrosecondEvent: { HANDLE hMSecondEvent = *(HANDLE *)I.IoctlBuffer(); if(hMSecondEvent == NULL) { t << "Handle is null\n"; I.Information() = 0; status = STATUS_INSUFFICIENT_RESOURCES; break; } if(m_pMicrosecondEvent != NULL) { delete m_pMicrosecondEvent; m_pMicrosecondEvent = NULL; } m_pMicrosecondEvent = new (NonPagedPool) KEvent (hMSecondEvent, OBJECT_TYPE_ALL_ACCESS); if(m_pMicrosecondEvent != NULL) { I.Information() = sizeof(UCHAR); *(UCHAR *)I.IoctlBuffer() = 1; status = STATUS_SUCCESS; t << "Succed in connect OneSecond event\n"; } else { I.Information() = sizeof(UCHAR); *(UCHAR *)I.IoctlBuffer() = 0; status = STATUS_SUCCESS; } } break; m_pMicrosecondEvent->Pulse();//手动 m_pMicrosecondEvent->Set();//自动 应用层调用 HANDLE MicrosecondEvent = CreateEvent(NULL,FALSE,FALSE,NULL);//自动 HANDLE MicrosecondEvent = CreateEvent(NULL,TRUE,FALSE,NULL);//手动 DeviceIoControl(m_hDevice, IVRDRIVER_IOCTL_HookMicrosecondEvent, &MicrosecondEvent, sizeof(MicrosecondEvent), &returnvalue, sizeof(UCHAR), &nOutput, NULL) |
|
板凳#
发布于:2009-09-02 16:48
我也是这样做的
为何 总是死机呢 |
|