From: Sushma on
Hi All,

I want to retrieve the MDL pointer from WDF request and then complete
the request. I want to use the MDL at later point of time.

Is the MDL still valid after completing the request?

Thank You.

Regards,
Sushma
From: Don Burn on
No the MDL goes with the request. You should not assume the memory
described by a request in a MDL (or just a buffer) is valid once the
request is completed. The memory may be deallocated, or be used for
something else. If you want to use the memory you should be pending the
request.


Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr



"Sushma" <sushma.yella(a)gmail.com> wrote in message
news:0ad1fbce-d26a-43df-b17e-ffe6119971bf(a)b36g2000pri.googlegroups.com:

> Hi All,
>
> I want to retrieve the MDL pointer from WDF request and then complete
> the request. I want to use the MDL at later point of time.
>
> Is the MDL still valid after completing the request?
>
> Thank You.
>
> Regards,
> Sushma


__________ Information from ESET Smart Security, version of virus
signature database 4873 (20100217) __________

The message was checked by ESET Smart Security.

http://www.eset.com


From: Sushma on
> No the MDL goes with the request.  You should not assume the memory
> described by a request in a MDL (or just a buffer) is valid once the
> request is completed.  The memory may be deallocated, or be used for
> something else.  If you want to use the memory you should be pending the
> request.
>

Is there a way I can find if memory is deallocated. I cannot pend the
request because requests arrive sequentially. Unless I complete it the
driver does not get next request. I did like:

virtualAddress = (ULONG_PTR) MmGetSystemAddressForMdlSafe(Irp-
>MdlAddress, NormalPagePriority);
totalLength = pUrb->UrbBulkOrInterruptTransfer.TransferBufferLength;

DeviceExtension->newMdl = IoAllocateMdl((PVOID)
virtualAddress,totalLength,FALSE,FALSE,NULL);
IoCompleteRequest(Irp, IO_NO_INCREMENT);

Now, I want to use DeviceExtension->newMdl. If I see the addres of
newMdl, it looks like a valid one. I'm not sure of it.

Any suggestions.

Thank You.

Regards,
Sushma
From: Don Burn on
No there is no way to do this. Your basic design is flawed, all you have
done is create code that will inevitably crash the system.


--
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply



"Sushma" <sushma.yella(a)gmail.com> wrote in message
news:fbc73e55-b16b-4d55-8af8-71ae3d5a4c7e(a)s33g2000prm.googlegroups.com...
> No the MDL goes with the request. You should not assume the memory
> described by a request in a MDL (or just a buffer) is valid once the
> request is completed. The memory may be deallocated, or be used for
> something else. If you want to use the memory you should be pending the
> request.
>

Is there a way I can find if memory is deallocated. I cannot pend the
request because requests arrive sequentially. Unless I complete it the
driver does not get next request. I did like:

virtualAddress = (ULONG_PTR) MmGetSystemAddressForMdlSafe(Irp-
>MdlAddress, NormalPagePriority);
totalLength = pUrb->UrbBulkOrInterruptTransfer.TransferBufferLength;

DeviceExtension->newMdl = IoAllocateMdl((PVOID)
virtualAddress,totalLength,FALSE,FALSE,NULL);
IoCompleteRequest(Irp, IO_NO_INCREMENT);

Now, I want to use DeviceExtension->newMdl. If I see the addres of
newMdl, it looks like a valid one. I'm not sure of it.

Any suggestions.

Thank You.

Regards,
Sushma

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4874 (20100217) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com





__________ Information from ESET NOD32 Antivirus, version of virus signature database 4874 (20100217) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




From: Maxim S. Shatskih on
> Is the MDL still valid after completing the request?

No.

Neither is in WDM.

Pend this IRP for all this long time.

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com