Thank you all.
Then I think, I misunderstood the line,
“…Although the stack is mapped into system space, it is considered
part of the thread context of the original calling routine, not part of
the driver itself…”
from a Microsoft’s article,
http://www.microsoft.com/whdc/Driver/tips/KMstack.mspx
Regards,
Raja
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
Sent: Thursday, March 01, 2007 8:19 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] kernel-stack
Anton,
You can take a pointer to the event. For example this is the
classic approach for a synchronous IoCallDriver, you allocate the event
on the stack, then take a pointer which is passed into the completion
routine (or
DPC) and it signals the event. Note: waiting in KernelMode locks the
stack into memory.
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
wrote in message news:xxxxx@ntdev…
> Bob,
>
>> I’m not going to pretend I know all the reasons why, but one good
>> point is that if you specify “KernelMode”, then you can safely assume
>> you can signal the event from a DPC
>
> Again, the same story - how can DPC routine access this event if it
> has been allocated by function X on the stack??? The only one who can
> get access to it is function X itself (plus all other function that
> calls if it passes them a pointer to this event as an argument).
> Furthermore, event has been allocated on the stack by the function X
> in context of thread A is different from the one that has been
> allocated on the stack by the same function X in context of thread A.
> However, if this function X is DPC routine itself… well, then who
> is going to wait on this event or check its state???
>
> Therefore, no matter how you look at it, if you want to make any
> practical use of this event, you have to save a pointer to it
> somewhere in a global memory location, which simly defeats the purpose
> of allocating event on the stack, in the first place…
>
> Anton Bassov
>
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer