I’m suprised that this works at all since the driver code creates the
event in global namespace but the application is creating the event in
the session local namespace. Unless the application is running as a
system service, i.e. in session zero, they are not sharing the same event.
An app running as ordinary user cannot create objects in the global
namespace but it can access already created objects. To do that the app
should prepend "Global" to the name. In your case, you should let the
driver create the event in the global namespace first and then “create”
the event in the app with "Global" prepended to the name.
I’ll give your idea about adding Global a try. This code is basically cut and paste from the article I mentioned in my original post. The only addition I made was the resetevent( ) call. Surprised it wouldn’t work as written.
I should have mentioned that on XP everything is usually running in
session zero. The other sessions come in play when you use fast user
switching or logon to a terminal server. What I tried to explain applies
to Vista and later.
I’ll give your idea about adding Global a try. This code is basically cut and paste from the article I mentioned in my original post. The only addition I made was the resetevent( ) call. Surprised it wouldn’t work as written.
Have you noticed that the article is almost 8 years old? Things changed
since then. In addition, read carefully the part about passing and
referencing the event handle instead of using name. If you have a
tightly coupled driver and app, it can be better way. The article seems
to discourage this technique but not generally and it can work better
for you.
Last but not least: ask yourself if you really want to share event?
Wouldn’t inverted call model work better for your purposes? It mostly
does unless the only thing you want is to inform an app about some event
which is unlikely. If the event is tied with data app has to read,
inverted call model is better.
I’ll give your idea about adding Global a try. This code is
basically cut and paste from the article I mentioned in my
original post. The only addition I made was the resetevent(
) call. Surprised it wouldn’t work as written.
I’m testing on XP but I need it to work on Vista and later too.
Despite the articles age I could find nothing more up to date. I previously tried passing the handle but since the article discouraged it, as you mentioned, I tried this method. It seemed simpler too. With Robert’s warnings I think I ought to go back to passing the handle.
I’m unfamiliar with the inverted call model and will look into this. Any suggestions on where to find good information on this? The event in this case is indeed an indicator of data that can now be read.
Inverted call model is discussed in this periodically at least once per
month. Try to seach list archives. In addition, WDK samples and also OSR
web: http://www.osronline.com/article.cfm?id=94 which is the first
Google hit.
And please. Don’t blindly copy&&paste the code. Try to understand it at
first. I’m saying this because your decision about using named event
instead of handle seems to be based on first impression instead of real
understanding.
I’m testing on XP but I need it to work on Vista and later too.
Despite the articles age I could find nothing more up to
date. I previously tried passing the handle but since the
article discouraged it, as you mentioned, I tried this
method. It seemed simpler too. With Robert’s warnings I
think I ought to go back to passing the handle.
I’m unfamiliar with the inverted call model and will look
into this. Any suggestions on where to find good information
on this? The event in this case is indeed an indicator of
data that can now be read.