When to use these three things
Irp->AssociatedIrp->AssociatedSystemBuffer
Irp->MdlAddress
Irp->UserBuffer
Can somebody give some info on this
Also if iam going to allocate from Driver for the Read how can i do that
how that memory can be released.
Thanks
2. If DO_DIRECT_IO is set in Flags use MdlAddress with
MmGetSystemAddressForMdl(Irp->MdlAddress).
3. If METHOD_NEITHER then Irp->UserBuffer is supposed to be used. But keep
in mind, this is a virtual address in the context of the user mode process
and this may not be always valid in your drivers context. Sometimes higher
level drivers which execute in the context of user mode process, lock this
buffer and create and MdlAddress. So if MdlAddress is not NULL then it is
safe to use that to get the buffer.
> Also if iam going to allocate from Driver for the Read how can i do
that
> how that memory can be released.
I did not understand what do you mean here?
HTH,
Rushikesh.
Struct something
ReadFile(driverhandle,..&struct,sizeof(struct)..)
here the allocation is from ring 3
say if i am want to allocate @ ring 0 ie at the driver.. how can i do that...
In general in Ring 0 you can allocate memory using kernel mode API
'ExAllocatePoolWithTag'.
And when you pass the Ring3 buffer down to kernel, higher level drivers
either need to lock this buffer using MDL structures or need to implement
this using BUFFERED_IO. In BUFFERED_IO, IO Manager allocates a system(Ring
0) buffer and passes it to driver. After IO completion this buffer is
updated with user mode buffer.
HTH,
Rushikesh.
"Hari" <anon...@discussions.microsoft.com> wrote in message
news:B8C87662-548D-4079...@microsoft.com...
~rushikesh.
http://rushikeshpatil.8m.com
"HAri" <anon...@discussions.microsoft.com> wrote in message
news:644DC58B-5E78-4273...@microsoft.com...
> Hi thanks,
> That is what i am asking.. shall i allocate something in the kernel mode
and pass it to the ring 3 app.
> After passing to the ring3 whose responsible to clear the memory.
>
> Thanks