I do the following (See below)
I execute this code from TDI_CONNECT.
When I call IoCallDriver - it returns with STATUS_CONNECTION_INVALID
this is not terrible …
But when I close application, which sent this TDI_CONNECT, everything hangs
up
My guess - something wrong with cancelling (maybe some kind of race
conditions ???)
But I dont know for sure…
What is my mistake ?
//--------------------------------------------------------------------
NTSTATUS
TdiCompletionRoutine(
IN PDEVICE_OBJECT pDeviceObject,
IN PIRP pIrp,
IN PKEVENT SynchronizingEvent
)
{
*pIrp->UserIosb = pIrp->IoStatus;
KeSetEvent(SynchronizingEvent, 0, FALSE);
IoFreeIrp(pIrp);
return STATUS_MORE_PROCESSING_REQUIRED;
}
//-------------------------------------------------------------------------
…
KeInitializeEvent(&MyEvent,SynchronizationEvent,FALSE);
KeInitializeEvent(&MyEvent1,SynchronizationEvent,FALSE); // will be sent
to CompletionRoutine as a parameter
pMyIrp = TdiBuildInternalDeviceControlIrp(TDI_QUERY_CONNECTION_INFO,
pDevObj,
FileObject,
&MyEvent,
&ioStatus);
MyAddress = ExAllocatePoolWithTag(NonPagedPool, 500, COMMON_TAG);
MyMdl = IoAllocateMdl(MyAddress,
500,
FALSE,
FALSE,
NULL);
TdiBuildQueryInformation(pMyIrp,
pDevObj,
FileObject,
TdiCompletionRoutine,
&MyEvent1,
TDI_QUERY_CONNECTION_INFO,
MyMdl);
Status = IoCallDriver(pDevObj, pMyIrp);
KeWaitForSingleObject(&MyEvent1, Executive, KernelMode, FALSE, NULL);
IoFreeMdl(MyMdl);
ExFreePool(MyAddress);
…
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com