驱动老牛
|
阅读:5081回复:1
关于DRIVER_UNLOADED_WITHOUT_CANCELLING_PENDING_OPERATIONS
我在驱动中创建线程并在DriverUnload 里释放。 但是驱动停止时会产生异常DRIVER_UNLOADED_WITHOUT_CANCELLING_PENDING_OPERATIONS
而以前经常这个做也没发现这种错误。不知道为什么? VOID BusEnumWorker(PVOID pContext) { while(!m_EnumBreak) { LARGE_INTEGER duetime; duetime.QuadPart=-5000000; KeDelayExecutionThread(KernelMode,FALSE,&duetime); } KeSetEvent(&m_EnumFinish,IO_NO_INCREMENT,FALSE); PsTerminateSystemThread(STATUS_SUCCESS); } void DriverUnload(PDRIVER_OBJECT pDriver) { KeInitializeEvent(&m_EnumFinish,NotificationEvent,FALSE); m_EnumBreak=TRUE; KeWaitForSingleObject(&m_EnumFinish,Executive,KernelMode,FALSE,NULL); ZwClose(m_hEnumThread); } |
|
沙发#
发布于:2009-06-26 14:44
you must wait until the thread exit.like that:
KeWaitFor..(m_thread, ......); |
|