Re: TDI Client and MDL [LONG]

Well, I tried to set a completion routine as has said Vlad G. but I still
got the BSOD. Then I tried to skip MmLockAndProbePages() and the mapping
function and it failed too…
I read somewhere in this newsgroup that the I/O Manager unlocked and freed
the MDL for me and so I have skipped IoFreeMdl()…
After some tries and I got a code which did’nt bring the BSOD (see below).
It is strange that I systematically get the BSOD if MmProbeAndLockPages()
is not present though it is not mandatory with non paged memory…
Now I have a new problem: TdiBuilQueryInformation() returns
STATUS_CONNECTION_INVALID though I created the transport address, the
connection endpoint with success and I associated them both with sucess
too. Should I call TdiBuildConnect() before calling
TdiBuildQueryInformation() ??

BaseAddress=ExAllocatePool(NonPagedPool,sizeof(TDI_CONNECTION_INFO));
if(BaseAddress!=NULL) {
MdlAddress=NULL;

MdlAddress=IoAllocateMdl(BaseAddress,sizeof(TDI_CONNECTION_INFO),FALSE,FALSE,NULL);

if(MdlAddress!=NULL) {
MmBuildMdlForNonPagedPool(MdlAddress);
MmProbeAndLockPages(MdlAddress,KernelMode,IoModifyAccess);
NTStatus=QueryInformation(DevExt->AttachedDevice,
DevExt->Connexion.Object,
TDI_QUERY_CONNECTION_INFO,MdlAddress);
if(NT_SUCCESS(NTStatus)) {
ReadBufferSize=((PTDI_CONNECTION_INFO)MmGetSystemAddressForMdl
(MdlAddress))->SendBufferSize;

WriteBufferSize=((PTDI_CONNECTION_INFO)MmGetSystemAddressForMdl(MdlAddress))->ReceiveBufferSize;

}
}
ExFreePool(BaseAddress);
}