OpenEvent fails

Hi
I use notification even between driver and User.
In the driver I do : IoCreateNotificationEvent(name)
then in user mode I try to : OpenEvent(name)
unfortunately OpenEvent fails but if I use CreateEvent(name) in user mode . so it is working well . both open event on BaseNamedObjects

Any idea why OpenEvent fails in spite of the event is already created ?
thank you in advance

What string literals are you using in the KM and UM code? By the far the simpler way is to allocate an unnamed event in UM and pass the handle value down to KM, convert it to a PKEVENT. This begs the question on why you want to share an event, an inverted call model is a better choice 99.99% of the time

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Thursday, November 7, 2013 4:00 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] OpenEvent fails

Hi
I use notification even between driver and User.
In the driver I do : IoCreateNotificationEvent(name) then in user mode I try to : OpenEvent(name) unfortunately OpenEvent fails but if I use CreateEvent(name) in user mode . so it is working well . both open event on BaseNamedObjects

Any idea why OpenEvent fails in spite of the event is already created ?
thank you in advance


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

On 08-Nov-2013 02:00, xxxxx@hotmail.com wrote:

Hi
I use notification even between driver and User.
In the driver I do : IoCreateNotificationEvent(name)
then in user mode I try to : OpenEvent(name)
unfortunately OpenEvent fails but if I use CreateEvent(name) in user mode . so it is working well . both open event on BaseNamedObjects

Any idea why OpenEvent fails in spite of the event is already created ?
thank you in advance

In such situation, usermode app should create the event (it can be even
unnamed) and pass it to the driver. Otherwise there can be security
complications, name collisions and what not.
– pa

yes I agree that it is better way to day, but I would like to wait on the same event on several threads.

regarding the names :
in kernel : L"\BaseNamedObjects\MY_EVENT"
in user : \Global\MY_EVENT"

if I use in user mode just “MY_EVENT”, it presents in Session\1\ … this why I use the Global .
It works, and I get notifications … but just for curious , why OpenEvent doesn’t work ?

You need to set the proper security descriptor to the event, if you create it in kernel mode.

Just abandon that idea. Create an unnamed event in the usermode and pass it to the driver.

The first thing to do is throw te design away and start over. In nearly
every case where there is an attempt to share an event between the kernel
and user space, it is the result of a failure to understand Windows
architecture, and try to simulate some design idea from some other
operating system, which is almost, but not totally, unlike Windows. It is
often based on misconceptions about “performance” with no data to justify
the design. Instead of trying to solve an inappropriate problem, throw
the bad design out, and look into “inverted call” as the mechanism of
choice. No matter what problem you think your design is solving, it is a
mismatch to Windows, and you have only BEGUN to scratch the surface of the
problems you are about to encounter. It’s not worth the hassle. A
redesign will be faster.
joe

Hi
I use notification even between driver and User.
In the driver I do : IoCreateNotificationEvent(name)
then in user mode I try to : OpenEvent(name)
unfortunately OpenEvent fails but if I use CreateEvent(name) in user mode
. so it is working well . both open event on BaseNamedObjects

Any idea why OpenEvent fails in spite of the event is already created ?
thank you in advance


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

This is still the wrong approach. Use inverted call, and if you need to
ativate several threads, use a UM unnamed event and do it all in UM. In
addition to all the possible problems you can have with your design, named
events are a very dangerous concept to deal with. I used to have a
30-minute lecture on the hazards of named events. The kernel-user
problems will be simple compared to the disaters that named events will
introduce. Since te need to activate many threads is not nearly enough
justification for the quicksand bog you are about to wander into. Did I
mention the bottom of the quickdand bog is littered with live landmines?

This is a design that experts try to avoid. With good reason. We know
all the possible disaters. Whatever you think this design is going to
“simplify”, you are wrong. It appears that your goal is to simplify a
problem that is already trivial, at the cost of a truly unbelievable
amount of complexity you will have to add to your driver. And to add to
the fun, it may take somewhere between weeks and months to get everything
right, except for the problems you will not discover until it has been in
the field for six months. Save yourself a year of agony, and throw this
design out.
joe

yes I agree that it is better way to day, but I would like to wait on the
same event on several threads.

regarding the names :
in kernel : L"\BaseNamedObjects\MY_EVENT"
in user : \Global\MY_EVENT"

if I use in user mode just “MY_EVENT”, it presents in Session\1\ … this
why I use the Global .
It works, and I get notifications … but just for curious , why OpenEvent
doesn’t work ?


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I should add, there is no such thing as “didn’t work”. There is only
“failed, and GetLastError() returned , which translates as
”. You don’t know why it “didn’t work”.

Whatever you are trying to do, this is almost certainly the wrong design.
There is already a mechanism that allows multiple threads to unblock when
I/O is completed, and therefore you are not just solving a trivial
problem, you are creating a complex solution that badly re-implements an
existing, documented, supported solution.

Doron was wrong when he said inverted call is good for 99.99% of the
cases. He didn’t put enough 9s after the decimal point.

Stop, throw out your event-based solution. Use async I/O with an event
handle to an unnamed UM event, and the problem is already solved.
joe

> This is still the wrong approach. Use inverted call, and if you need to
> ativate several threads, use a UM unnamed event and do it all in UM. In
> addition to all the possible problems you can have with your design, named
> events are a very dangerous concept to deal with. I used to have a
> 30-minute lecture on the hazards of named events. The kernel-user
> problems will be simple compared to the disaters that named events will
> introduce. Since te need to activate many threads is not nearly enough
> justification for the quicksand bog you are about to wander into. Did I
> mention the bottom of the quickdand bog is littered with live landmines?
>
> This is a design that experts try to avoid. With good reason. We know
> all the possible disaters. Whatever you think this design is going to
> “simplify”, you are wrong. It appears that your goal is to simplify a
> problem that is already trivial, at the cost of a truly unbelievable
> amount of complexity you will have to add to your driver. And to add to
> the fun, it may take somewhere between weeks and months to get everything
> right, except for the problems you will not discover until it has been in
> the field for six months. Save yourself a year of agony, and throw this
> design out.
> joe
>
>> yes I agree that it is better way to day, but I would like to wait on
>> the
>> same event on several threads.
>>
>> regarding the names :
>> in kernel : L"\BaseNamedObjects\MY_EVENT"
>> in user : \Global\MY_EVENT"
>>
>> if I use in user mode just “MY_EVENT”, it presents in Session\1\ …
>> this
>> why I use the Global .
>> It works, and I get notifications … but just for curious , why
>> OpenEvent
>> doesn’t work ?
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Wrong way, use inverted calls (pending IOCTLs).

I don’t think that the namespace handling related to your way is documented, that it is the same with the case of Remote Deskop/Fast User Switching, and that it is same on all Windows versions.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hi
> I use notification even between driver and User.
> In the driver I do : IoCreateNotificationEvent(name)
> then in user mode I try to : OpenEvent(name)
> unfortunately OpenEvent fails but if I use CreateEvent(name) in user mode . so it is working well . both open event on BaseNamedObjects
>
> Any idea why OpenEvent fails in spite of the event is already created ?
> thank you in advance
>

> Just abandon that idea. Create an unnamed event in the usermode and pass it to the driver.

…and inverted call is even simpler, since, for unnamed event, you need to call ObRefxxx properly and then manage its lifetime.

The only thing which inverted call requires is a queue. There are 2 of them - IoCsqXxx and KMDF ones.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

> Just abandon that idea

It does not matter how wrong it is. the more we’re
toying with a design, the more effort we put in it,
the dearer it becomes to us.
– pa

>> Just abandon that idea

It does not matter how wrong it is. the more we’re
toying with a design, the more effort we put in it,
the dearer it becomes to us.
– pa

It’s the “I don’t care if there is a 4-lane highway that will take me to
my destination; I planned this trip to take my VW Bug over these
forty-year-old logging roads across the top of the mountain, through snow
and sleet, because that is the path I chose. What are ‘tire chains’?
What does ‘road clearance’ mean? What is a ‘Jerrycan’ and why should I
take a couple along? I have a spare tire, so I don’t need a tire repair
kit. And what’s a ‘jack’, and how do I use it? Yes, this jacket is warm
enough, and why would I need boots, because I’m not going to be getting
out of the car?”

That’s what is happening here. The design is a disaster, and it will only
become a greater disaster as time progresses. And when the frozen body of
the project is finally located, they’ll have to bury it anyway.

Throw the map away and take the 4-lane highway. Because all too often, I
was called in to do search-and-rescue and it became search-and-recover.
joe


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> It’s the "I don’t care if there is a 4-lane highway that will take me to

my destination;

Oh yes :slight_smile:

What does ‘road clearance’ mean? What is a ‘Jerrycan’ and why should I
take a couple along?

BTW - what is this? sorry, I’m not American.

When being around Mar 1 this year around the ski points near Salt Lake City (Solitude etc), I was just amazed on American driving speed in snow.

It’s like 10km/h.

In Russia, during the same weather/show conditions (you can trivially be hit around Moscow in Feb-Mar by the same heavy snow conditions as in Solitude UT the same season), and on a similar road with similar turn radius - both my wife and I would make like 50 km/h. Yes, 80 km/h is by far unacceptable and you can trivially ditch the car, but why not 50?

Why is this? is show so abnormal in the US so that the drivers are so much scared?

Or maybe there is no such things as winter tires in the US? maybe not so popular?

If I would go the road to Solitude UT around Mar 1 with lots of snow on summer tires, then I would also move <= 10 km/h (and probably pray) :slight_smile:

I have a spare tire, so I don’t need a tire repair kit.

This is more like the artifact of the past :slight_smile: you cannot dismount the modern (tubeless) tire from the disc yourself just on the road. You need a machine tool for this.

Also, if a modern tubeless tire loses the air in a way constant pumping is not enough - then it is usually damaged beyound repair.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

>Or maybe there is no such things as winter tires in the US? maybe not so popular?

People who drive from afar to the ski places don’t use winter tires for they everyday driving.