How to share a KSEMAPHORE?

wrote in message news:xxxxx@ntdev…
>
> Well, such change seems to be rather illogical. There is a different
> possible problem here - after all, even if the binary object behind both
> kernel-mode and user-mode semaphores is guaranteed to be KSEMAPHORE (and,
> to be honest, I don’t see any reason why it may get changed), it still
> does not mean that the whole thing will work. Your example with
> mutex/mutant illustrates this.

Anton,

As someone who has written and maintained commercial OS’es you are the
type of developer who we want to send to the competition. Yes it seems
unlikely to you that a user semaphore would ever be anything other than a
pure kernel semaphore, but even if they kept the kernel semaphore, they
could add additional fields for performance monitoring, security or
something we cannot even think of today.

Bottom line you are pushing an undocumented technique, using a private
data structure (the user semaphore) and saying go ahead use it. Of course
if Microsoft does change it in the future you and others believe they don’t
need to use only documented calls and structures will be the first to
complain that compatibility was arbitrarily broken.

The OP’s original question was how to share a KSEMAPHORE the correct
answer is there is no documented safe way to do this. The second part of
the answer is that unless you have an extremely high performance interface,
it is stupid to even try.


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

Don,

Bottom line you are pushing an undocumented technique, using a private
data structure (the user semaphore) and saying go ahead use it.

Actually, from the very, very beginning I am saying that sharing a *semaphore* between driver and app is stupid idea, although it may be done with events (because event is the most primitive dispatcher object)…

Anton Bassov