阅读:1102回复:1
高手帮忙看看,驱动程序和应用程序通信问题
首先我在应用程序中创建一个事件
m_hEvent = CreateEvent(NULL, false, false, NULL); 然后用DeviceIoControl将m_hEvent送到驱动中 DeviceIoControl(hDevice, IOCTL_UPLOAD_EVENT_HANDLE, &hEvent, sizeof(HANDLE), NULL, 0, &dwReturn, NULL); 在驱动中处理IRP的Dispatch函数中 case IOCTL_UPLOAD_EVENT_HANDLE: if(InLength < sizeof(HANDLE)) break; UserBuffer = (char *)Irp->AssociatedIrp.SystemBuffer; hEvent = * ((HANDLE *)UserBuffer); DbgPrint(\"%d\", hEvent); status = ObReferenceObjectByHandle(hEvent, GENERIC_ALL, NULL, KernelMode, &gpEventObject, &objHandleInfo); if (status == STATUS_SUCCESS) { DbgPrint(\"Upload Event Handle OK!\"); } else { DbgPrint(\"Upload Event Handle Error!\"); } break; 我使用softice调试发现将此段case里面的内容清空,只留下break,DeviceIoControl返回TRUE,但如上述代码时,不设任何断点softice会自动断住 且此时应用程序挂起,CPU占用率为100%,无法结束进程。 请高手帮忙! 先谢谢了! |
|
沙发#
发布于:2004-01-13 23:57
ObReferenceObjectByHandle增加了引用技术,必须用ObDeferenceObjectByHandle
|
|
|