Peter
Thu Oct 28 11:18:46 CDT 2004
If you're mapping Irp->MdlAddress then you don't need to unmap it when
you're done. Whoever created the MDL will take care of that.
If you're mapping your own MDL, then you should unmap it when you're done.
-p
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Vijender Yadav" <VijenderYadav@discussions.microsoft.com> wrote in message
news:4C6DA566-E601-4FF2-BA4D-432033422253@microsoft.com...
> Hi,
>
> After analyzing the problem, I also concluded to use
> MmGetSystemAddressForMdl or MmGetSystemAddressForMdlSafe. But I have one
> doubt. If the MDL ws not mapped by AFD, this call will map it to system
> space. My doubt is that dont I need to unmap these pages when I am done.
>
> Regards
> Vijender
>
> "Eliyas Yakub [MSFT]" wrote:
>
>> Why are you calling MmGetMdlVirtualAddress in the first place? This call
>> returns the actual address (typically the usermode address in your case)
>> that was used to describe the MDL and is valid as long as you are with in
>> that user process context. No matter whether AFD maps the MDL to system
>> address space or not, the address returned by this call is going to be
>> always the same. So you crash while accessing this address as soon as
>> you
>> fall out of the process context - and that happens to you once in a
>> while.
>> Long story short, you should use MmGetSystemAddressForMdl instead of
>> MmGetMdlVirtualAddress.
>>
>> --
>> -Eliyas
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
http://www.microsoft.com/whdc/hwdev/driver/kb-drv.mspx
>>
>>
>>