How to use shared memory as a semaphore?

Looking for a way to use shared memory (at a specified address) as a
semaphore. Ideally, two drivers would be able to wait on events between
them without having to poll an address looking for changes.

  • Dan

If the driver is PnP you can use a device interface to pass the pointer of a
a KEVENT to another driver, if they are none PnP you can call the driver
with the event with an IOCTL to get the event. In either case be careful to
make sure the driver with the event doesn’t get unloaded. Depending on what
you are doing, you might also checkout ExRegisterCallback and its releated
routines.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

“Dan Randall” wrote in message
news:xxxxx@ntdev…
> Looking for a way to use shared memory (at a specified address) as a
> semaphore. Ideally, two drivers would be able to wait on events between
> them without having to poll an address looking for changes.
>
> - Dan
>

Is there some reason you don’t want to use… say… a *semaphore* as a
semaphore?

Seriously, though, it depends on what you mean. What are you trying to
accomplish, and why are you trying to use something other than the
existing mechanisms?

Dan Randall wrote:

Looking for a way to use shared memory (at a specified address) as a
semaphore. Ideally, two drivers would be able to wait on events between
them without having to poll an address looking for changes.

  • Dan


…/ray..

Please remove “.spamblock” from my email address if you need to contact
me outside the newsgroup.

Once you’ve made it safe enough to use, you’ll have done enough work
that you should have just used a real semaphore as provided by the OS.
Look up the semaphore functions in the DDK; is there any reason you
would rather not use them?

-sd

On Nov 3, 2004, at 3:02 PM, Dan Randall wrote:

Looking for a way to use shared memory (at a specified address) as a
semaphore. Ideally, two drivers would be able to wait on events
between them without having to poll an address looking for changes.

  • Dan

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@positivenetworks.net
To unsubscribe send a blank email to xxxxx@lists.osr.com