阅读:1462回复:2
*贴出源代码,错在哪*
NTSTATUS
NetdiskErrorEvent( IN PVOID TdiEventContext, IN NTSTATUS Status ) { DbgPrint("网络不通或网络出现故障。。。。\n"); return STATUS_SUCCESS; } //--------------------------------- NTSTATUS NetdiskSetEventHandler( IN PDEVICE_EXTENSION pDeviceExt, IN LONG EventType, IN PVOID pEventHandler ) { NTSTATUS status; PIRP pIrp; PDEVICE_OBJECT pDeviceObject; KEVENT Event; IO_STATUS_BLOCK IoStatus; pDeviceObject = IoGetRelatedDeviceObject(pDeviceExt->pEndPointObject); KeInitializeEvent(&Event, NotificationEvent, FALSE); pIrp = TdiBuildInternalDeviceControlIrp( TDI_SET_EVENT_HANDLER, pDeviceObject, pDeviceExt->pEndPointObject, &Event, &IoStatus ); if( pIrp == NULL ) { status = STATUS_INSUFFICIENT_RESOURCES; DbgPrint("Insufficient Resources\n"); return status; } TdiBuildSetEventHandler( pIrp, pDeviceObject, pDeviceExt->pEndPointObject, NULL, NULL, EventType, pEventHandler, NULL ); status = IoCallDriver(pDeviceObject, pIrp); if( status == STATUS_PENDING ) { DbgPrint("step1\n"); status = KeWaitForSingleObject( &Event, UserRequest, KernelMode, FALSE, NULL); } if( !NT_SUCCESS(status) ) { DbgPrint("Fail To SetEventHandler \n"); return status; } DbgPrint("Success to SetEventHandler\n"); return IoStatus.Status; } //--------------------------------- status = NetdiskSetEventHandler( pDeviceExt, TDI_EVENT_DISCONNECT, NetdiskDisconnectEvent ); if( !NT_SUCCESS(status) ) { return status; } ______________________________________________ 为什么老是 Failed to Set EventHandler ? |
|
|
沙发#
发布于:2004-03-19 08:38
怎么没人肯回复呀 :(
|
|
|
板凳#
发布于:2004-03-19 08:58
这是干什么的程序,能否公开啊
|
|
|