Way of notifyng the application of some event

hi guys,
I am exploring the ways that a application can be notified of a
event in the driver. Can someone suggest me some ways Other than polling the
driver using IOCTL.

thanks
ajitabh


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You can use application created events and then opened in driver.

Regards,
Dennis.

----- Original Message -----
From: “Ajitabh Prakash”
To: “NT Developers Interest List”
Sent: Wednesday, October 17, 2001 6:30 PM
Subject: [ntdev] Way of notifyng the application of some event

> hi guys,
> I am exploring the ways that a application can be notified of
a
> event in the driver. Can someone suggest me some ways Other than polling
the
> driver using IOCTL.
>
>
> thanks
> ajitabh
>
> —
> You are currently subscribed to ntdev as: xxxxx@acronis.ru
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Use Events.

Joe McCloskey
Gamry Instruments, Inc.
xxxxx@gamry.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
Sent: Wednesday, October 17, 2001 10:31 AM
To: NT Developers Interest List
Subject: [ntdev] Way of notifyng the application of some event

hi guys,
I am exploring the ways that a application can be notified of a
event in the driver. Can someone suggest me some ways Other than polling the
driver using IOCTL.

thanks
ajitabh


You are currently subscribed to ntdev as: xxxxx@gamry.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

How about using KeSetEvent()?
-bill

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
Sent: Wednesday, October 17, 2001 10:31 AM
To: NT Developers Interest List
Subject: [ntdev] Way of notifyng the application of some event

hi guys,
I am exploring the ways that a application can be
notified of a
event in the driver. Can someone suggest me some ways Other
than polling the
driver using IOCTL.

thanks
ajitabh


You are currently subscribed to ntdev as: xxxxx@linkeng.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Use overlapped IO


Dennis Merrill
Embedded Systems Engineer
Thermo Nicolet Corporation

-----Original Message-----
From: Ajitabh Prakash [mailto:xxxxx@ami.com]
Sent: Wednesday, October 17, 2001 9:31 AM
To: NT Developers Interest List
Subject: [ntdev] Way of notifyng the application of some event

hi guys,
I am exploring the ways that a application can be notified of a
event in the driver. Can someone suggest me some ways Other than polling the
driver using IOCTL.

thanks
ajitabh


You are currently subscribed to ntdev as: xxxxx@thermonicolet.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

I didn’t experiment the hint that is described in the “Windows NT Device
Driver Development”, OSR Inc book, page 108, but it seams quite logical to
experiment it.
It says that in kernel mode, driver can open an existing named(!)event
(created with WIN32 API CreateEvent()), with IoCreateNotificationEvent and
specify the name as it is in Object Mangers namespace under directory
\BaseNameObjects.… (WinObj.exe will list them).
That’s from the (cook :-)) book.
Wbr Primoz

-----Original Message-----
From: Ajitabh Prakash [mailto:xxxxx@ami.com]
Sent: Wednesday, October 17, 2001 4:31 PM
To: NT Developers Interest List
Subject: [ntdev] Way of notifyng the application of some event

hi guys,
I am exploring the ways that a application can be notified of a
event in the driver. Can someone suggest me some ways Other than polling the
driver using IOCTL.

thanks
ajitabh


You are currently subscribed to ntdev as: xxxxx@hermes.si
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi,

One way to do it is to create an event in user mode, pass it to the
driver via DeviceIoControl then use WaitForSingleObject to wait on it. Then
in the driver all you need to do is call ObReferenceObjectByHandle to get a
KEVENT object that you can use KeSetEvent to signal

-scott

----- Original Message -----
From: “Ajitabh Prakash”
To: “NT Developers Interest List”
Sent: Wednesday, October 17, 2001 10:30 AM
Subject: [ntdev] Way of notifyng the application of some event

> hi guys,
> I am exploring the ways that a application can be notified of
a
> event in the driver. Can someone suggest me some ways Other than polling
the
> driver using IOCTL.
>
>
> thanks
> ajitabh
>
> —
> You are currently subscribed to ntdev as: xxxxx@handsfreenetworks.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

  1. Just create a named event in user-mode application then open it in
    kernel-mode by name. See the samples in NT4 DDK for example.
  2. Or you can use pending IOCTL mechanism. You will not need to poll. Just
    send IOCTL from user-mode from some separate thread and complete it when you
    need in kernel-mode.

Bye,
SaB

-----Original Message-----
From: Ajitabh Prakash [mailto:xxxxx@ami.com]
Sent: Wednesday, October 17, 2001 4:31 PM
To: NT Developers Interest List
Subject: [ntdev] Way of notifyng the application of some event

hi guys,
I am exploring the ways that a application can be
notified of a
event in the driver. Can someone suggest me some ways Other
than polling the
driver using IOCTL.

thanks
ajitabh


You are currently subscribed to ntdev as: xxxxx@mastereye.kiev.ua
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

how do you use it??

-----Original Message-----
From: Bill Christie [SMTP:xxxxx@linkeng.com]
Sent: Wednesday, October 17, 2001 10:51 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

How about using KeSetEvent()?
-bill

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
> Sent: Wednesday, October 17, 2001 10:31 AM
> To: NT Developers Interest List
> Subject: [ntdev] Way of notifyng the application of some event
>
>
> hi guys,
> I am exploring the ways that a application can be
> notified of a
> event in the driver. Can someone suggest me some ways Other
> than polling the
> driver using IOCTL.
>
>
> thanks
> ajitabh
>
> —
> You are currently subscribed to ntdev as: xxxxx@linkeng.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@ami.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

The below Microsoft KB article has additional information concerning
this:
Q262947

-----Original Message-----
From: Ajitabh Prakash [mailto:xxxxx@ami.com]
Sent: Wednesday, October 17, 2001 8:52 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

how do you use it??

-----Original Message-----
From: Bill Christie [SMTP:xxxxx@linkeng.com]
Sent: Wednesday, October 17, 2001 10:51 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some
event

How about using KeSetEvent()?
-bill

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
> Sent: Wednesday, October 17, 2001 10:31 AM
> To: NT Developers Interest List
> Subject: [ntdev] Way of notifyng the application of some event
>
>
> hi guys,
> I am exploring the ways that a application can be
> notified of a
> event in the driver. Can someone suggest me some ways Other
> than polling the
> driver using IOCTL.
>
>
> thanks
> ajitabh
>
> —
> You are currently subscribed to ntdev as: xxxxx@linkeng.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@ami.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Sorry - I was less than thorough…

  1. Create an event your user mode app using the CreateEvent() API.

  2. Pass the handle of the event from step 1 to your driver via an IOCTL
    call.

  3. In your driver, call ObReferenceObjectByHandle(), passing it the handle
    you obtained from step 2. You will get back a handle that you’ll need for
    KeSetEvent().

  4. In your driver, call KeSetEvent() using the handle obtained from step 3.
    Note that KeSetEvent() must be generally be called at <=IRQL_DISPATCH_LEVEL
    and in a nonarbitrary thread context. This means that you will not be able
    to set your event in an interrupt service routine (but you will be able to
    use it in your DPC). See the DDK docs for details.

  5. Don’t forget to call ObDereferenceObject() when you’re done with the
    event (e.g. when your driver or app shuts down).

Hope that helps.
-bill

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
Sent: Wednesday, October 17, 2001 11:52 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

how do you use it??

> -----Original Message-----
> From: Bill Christie [SMTP:xxxxx@linkeng.com]
> Sent: Wednesday, October 17, 2001 10:51 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Way of notifyng the application of
some event
>
> How about using KeSetEvent()?
> -bill
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
> > Sent: Wednesday, October 17, 2001 10:31 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Way of notifyng the application of some event
> >
> >
> > hi guys,
> > I am exploring the ways that a application can be
> > notified of a
> > event in the driver. Can someone suggest me some ways Other
> > than polling the
> > driver using IOCTL.
> >
> >
> > thanks
> > ajitabh
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@linkeng.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
> —
> You are currently subscribed to ntdev as: xxxxx@ami.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@linkeng.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Methinks several of you have the cart in front of the horse. You are
thinking "usermode " instead of “Kernelmode”.

You don’t need, nor want, to pass an event handle to the driver from user
mode. That is a really bad idea, one just begging for a blue screen. You
want to CREATE a named event in the Kernel and then clear it. Creating the
event in the kernel will give you a pointer to an even, and a handle. No,
you do NOT pass that handle to the application via an IOCTL. The User mode
application does an OpenEvent on that named event to get a handle that it
can use for a wait. When a triggering event occurs in the driver it toggles
the event by calling keSetEvent and then KeClearEvent. That toggle is
important.

Now that is what I define a s a pain in the ass, when the easiest way to
wait for a kernel event is to simply mark the IRP as pending in the driver.
If the app did not open the driver for overlapped operation, the app will
the block on that IRP until it is completed. If overlapped IO is used, then
the app tests for one of several pending status codes, calls a WaitFor…
routine or calls GetOverlappedResult with the wait flag set.

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@broadstor.com

-----Original Message-----
From: Scott Noone [mailto:xxxxx@handsfreenetworks.com]
Sent: Wednesday, October 17, 2001 8:12 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Way of notifyng the application of some event

Hi,

One way to do it is to create an event in user mode, pass it to the
driver via DeviceIoControl then use WaitForSingleObject to wait on it. Then
in the driver all you need to do is call ObReferenceObjectByHandle to get a
KEVENT object that you can use KeSetEvent to signal

-scott

----- Original Message -----
From: “Ajitabh Prakash”
To: “NT Developers Interest List”
Sent: Wednesday, October 17, 2001 10:30 AM
Subject: [ntdev] Way of notifyng the application of some event

> hi guys,
> I am exploring the ways that a application can be notified of
a
> event in the driver. Can someone suggest me some ways Other than polling
the
> driver using IOCTL.
>
>
> thanks
> ajitabh
>
> —
> You are currently subscribed to ntdev as: xxxxx@handsfreenetworks.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@broadstor.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

IoCreateNotificationEvent(&unicodeString, &EventHandle) will work

Jamey
xxxxx@storagecraft.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ajitabh Prakash
Sent: Wednesday, October 17, 2001 7:31 AM
To: NT Developers Interest List
Subject: [ntdev] Way of notifyng the application of some event

hi guys,
I am exploring the ways that a application can be notified
of a event in the driver. Can someone suggest me some ways Other than
polling the driver using IOCTL.

thanks
ajitabh


You are currently subscribed to ntdev as: xxxxx@storagecraft.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Bill,

If you use IoCreateNoficationEvent to create a named event, and then use
OpenEvent to open a handle to the same named event you needn’t pass anything
between the user app and the driver via an IOCTL. It seems this is much
cleaner, though I still prefer blocking the app by marking an IRP as PEND.

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@broadstor.com

-----Original Message-----
From: Bill Christie [mailto:xxxxx@linkeng.com]
Sent: Wednesday, October 17, 2001 10:00 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

Sorry - I was less than thorough…

  1. Create an event your user mode app using the CreateEvent() API.

  2. Pass the handle of the event from step 1 to your driver via an IOCTL
    call.

  3. In your driver, call ObReferenceObjectByHandle(), passing it the handle
    you obtained from step 2. You will get back a handle that you’ll need for
    KeSetEvent().

  4. In your driver, call KeSetEvent() using the handle obtained from step 3.
    Note that KeSetEvent() must be generally be called at <=IRQL_DISPATCH_LEVEL
    and in a nonarbitrary thread context. This means that you will not be able
    to set your event in an interrupt service routine (but you will be able to
    use it in your DPC). See the DDK docs for details.

  5. Don’t forget to call ObDereferenceObject() when you’re done with the
    event (e.g. when your driver or app shuts down).

Hope that helps.
-bill

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
Sent: Wednesday, October 17, 2001 11:52 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

how do you use it??

> -----Original Message-----
> From: Bill Christie [SMTP:xxxxx@linkeng.com]
> Sent: Wednesday, October 17, 2001 10:51 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Way of notifyng the application of
some event
>
> How about using KeSetEvent()?
> -bill
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
> > Sent: Wednesday, October 17, 2001 10:31 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Way of notifyng the application of some event
> >
> >
> > hi guys,
> > I am exploring the ways that a application can be
> > notified of a
> > event in the driver. Can someone suggest me some ways Other
> > than polling the
> > driver using IOCTL.
> >
> >
> > thanks
> > ajitabh
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@linkeng.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
> —
> You are currently subscribed to ntdev as: xxxxx@ami.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@linkeng.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@broadstor.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Imagine this:

  • You have user-mode code coded to talk to driver via IOCTL.

  • Driver group is late in delivering working driver code (not that this
    happens)

  • User-mode group would like to do some preliminary testing?

  • Screwed!

  • You have user-mode code coded to use named event.

  • Driver group is late in delivering working driver code (not that this
    happens)

  • User-mode group would like to do some preliminary testing?

  • Write some user-mode simulation code to perform activities on your
    event code.

At least the user-mode group isn’t twiddling their thumbs waiting on
those late driver guys :slight_smile:

My point is this: it is architecturally better to couple modules as
loosely as possible. Relying on an IOCTL to a driver is far from loosely
coupled. Yes, there are times where this may be required ad we have all
written code we are not so proud of, but, you should strive for elegance
before relying on a hack.

Jamey
xxxxx@storagecraft.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Gary Little
Sent: Wednesday, October 17, 2001 11:26 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

Bill,

If you use IoCreateNoficationEvent to create a named event, and then use
OpenEvent to open a handle to the same named event you needn’t pass
anything between the user app and the driver via an IOCTL. It seems this
is much cleaner, though I still prefer blocking the app by marking an
IRP as PEND.

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@broadstor.com

-----Original Message-----
From: Bill Christie [mailto:xxxxx@linkeng.com]
Sent: Wednesday, October 17, 2001 10:00 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

Sorry - I was less than thorough…

  1. Create an event your user mode app using the CreateEvent() API.

  2. Pass the handle of the event from step 1 to your driver via an IOCTL
    call.

  3. In your driver, call ObReferenceObjectByHandle(), passing it the
    handle you obtained from step 2. You will get back a handle that you’ll
    need for KeSetEvent().

  4. In your driver, call KeSetEvent() using the handle obtained from step

  1. Note that KeSetEvent() must be generally be called at
    <=IRQL_DISPATCH_LEVEL and in a nonarbitrary thread context. This means
    that you will not be able to set your event in an interrupt service
    routine (but you will be able to use it in your DPC). See the DDK docs
    for details.
  1. Don’t forget to call ObDereferenceObject() when you’re done with the
    event (e.g. when your driver or app shuts down).

Hope that helps.
-bill

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
Sent: Wednesday, October 17, 2001 11:52 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

how do you use it??

> -----Original Message-----
> From: Bill Christie [SMTP:xxxxx@linkeng.com]
> Sent: Wednesday, October 17, 2001 10:51 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Way of notifyng the application of
some event
>
> How about using KeSetEvent()?
> -bill
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
> > Sent: Wednesday, October 17, 2001 10:31 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Way of notifyng the application of some event
> >
> >
> > hi guys,
> > I am exploring the ways that a application can be
> > notified of a event in the driver. Can someone suggest me some
> > ways Other than polling the
> > driver using IOCTL.
> >
> >
> > thanks
> > ajitabh
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@linkeng.com
> > To unsubscribe send a blank email to
> > leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
> —
> You are currently subscribed to ntdev as: xxxxx@ami.com To
> unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@linkeng.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@broadstor.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@storagecraft.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Yes, I agree. It is a lot cleaner. Wish I’d done that in my driver :slight_smile:
-bill

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Gary Little
Sent: Wednesday, October 17, 2001 2:26 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

Bill,

If you use IoCreateNoficationEvent to create a named event,
and then use
OpenEvent to open a handle to the same named event you
needn’t pass anything
between the user app and the driver via an IOCTL. It seems
this is much
cleaner, though I still prefer blocking the app by marking an
IRP as PEND.

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@broadstor.com

-----Original Message-----
From: Bill Christie [mailto:xxxxx@linkeng.com]
Sent: Wednesday, October 17, 2001 10:00 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

Sorry - I was less than thorough…

  1. Create an event your user mode app using the CreateEvent() API.

  2. Pass the handle of the event from step 1 to your driver
    via an IOCTL
    call.

  3. In your driver, call ObReferenceObjectByHandle(), passing
    it the handle
    you obtained from step 2. You will get back a handle that
    you’ll need for
    KeSetEvent().

  4. In your driver, call KeSetEvent() using the handle
    obtained from step 3.
    Note that KeSetEvent() must be generally be called at
    <=IRQL_DISPATCH_LEVEL
    and in a nonarbitrary thread context. This means that you
    will not be able
    to set your event in an interrupt service routine (but you
    will be able to
    use it in your DPC). See the DDK docs for details.

  5. Don’t forget to call ObDereferenceObject() when you’re
    done with the
    event (e.g. when your driver or app shuts down).

Hope that helps.
-bill

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
> Sent: Wednesday, October 17, 2001 11:52 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Way of notifyng the application of some event
>
>
> how do you use it??
>
> > -----Original Message-----
> > From: Bill Christie [SMTP:xxxxx@linkeng.com]
> > Sent: Wednesday, October 17, 2001 10:51 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] RE: Way of notifyng the application of
> some event
> >
> > How about using KeSetEvent()?
> > -bill
> >
> >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com]On Behalf Of
Ajitabh Prakash
> > > Sent: Wednesday, October 17, 2001 10:31 AM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Way of notifyng the application of some event
> > >
> > >
> > > hi guys,
> > > I am exploring the ways that a application can be
> > > notified of a
> > > event in the driver. Can someone suggest me some ways Other
> > > than polling the
> > > driver using IOCTL.
> > >
> > >
> > > thanks
> > > ajitabh
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@linkeng.com
> > > To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@ami.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
> —
> You are currently subscribed to ntdev as: xxxxx@linkeng.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@broadstor.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@linkeng.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Yes - I agree, it’s a lot cleaner.

In my case, I was the “user-mode group” AND the “driver group”! And I must
admit I did this a while ago when I was struggling to learn drivers, and the
driver was for a proprietary in-house, closed project. Heck, talk about
loosely coupled - that driver was so tightly coupled it used shared memory
to transfer data back & forth to the user app.

I don’t write drivers much anymore (although I still subscribe to this list
because I love the level of expertise (and the signal/noise ratio).

But enough excuses - your solution (and Gary’s) is the better one.

-bill

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Wednesday, October 17, 2001 3:32 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

Imagine this:

  • You have user-mode code coded to talk to driver via IOCTL.

  • Driver group is late in delivering working driver code (not
    that this
    happens)

  • User-mode group would like to do some preliminary testing?

  • Screwed!

  • You have user-mode code coded to use named event.

  • Driver group is late in delivering working driver code (not
    that this
    happens)

  • User-mode group would like to do some preliminary testing?

  • Write some user-mode simulation code to perform activities on your
    event code.

At least the user-mode group isn’t twiddling their thumbs waiting on
those late driver guys :slight_smile:

My point is this: it is architecturally better to couple modules as
loosely as possible. Relying on an IOCTL to a driver is far
from loosely
coupled. Yes, there are times where this may be required ad
we have all
written code we are not so proud of, but, you should strive
for elegance
before relying on a hack.

Jamey
xxxxx@storagecraft.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Gary Little
Sent: Wednesday, October 17, 2001 11:26 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

Bill,

If you use IoCreateNoficationEvent to create a named event,
and then use
OpenEvent to open a handle to the same named event you needn’t pass
anything between the user app and the driver via an IOCTL. It
seems this
is much cleaner, though I still prefer blocking the app by marking an
IRP as PEND.

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@broadstor.com

-----Original Message-----
From: Bill Christie [mailto:xxxxx@linkeng.com]
Sent: Wednesday, October 17, 2001 10:00 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Way of notifyng the application of some event

Sorry - I was less than thorough…

  1. Create an event your user mode app using the CreateEvent() API.

  2. Pass the handle of the event from step 1 to your driver
    via an IOCTL
    call.

  3. In your driver, call ObReferenceObjectByHandle(), passing it the
    handle you obtained from step 2. You will get back a handle
    that you’ll
    need for KeSetEvent().

  4. In your driver, call KeSetEvent() using the handle
    obtained from step

  1. Note that KeSetEvent() must be generally be called at
    <=IRQL_DISPATCH_LEVEL and in a nonarbitrary thread context.
    This means
    that you will not be able to set your event in an interrupt service
    routine (but you will be able to use it in your DPC). See the DDK docs
    for details.
  1. Don’t forget to call ObDereferenceObject() when you’re
    done with the
    event (e.g. when your driver or app shuts down).

Hope that helps.
-bill

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Ajitabh Prakash
> Sent: Wednesday, October 17, 2001 11:52 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Way of notifyng the application of some event
>
>
> how do you use it??
>
> > -----Original Message-----
> > From: Bill Christie [SMTP:xxxxx@linkeng.com]
> > Sent: Wednesday, October 17, 2001 10:51 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] RE: Way of notifyng the application of
> some event
> >
> > How about using KeSetEvent()?
> > -bill
> >
> >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com]On Behalf Of
Ajitabh Prakash
> > > Sent: Wednesday, October 17, 2001 10:31 AM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Way of notifyng the application of some event
> > >
> > >
> > > hi guys,
> > > I am exploring the ways that a application can be
> > > notified of a event in the driver. Can someone suggest me some
> > > ways Other than polling the
> > > driver using IOCTL.
> > >
> > >
> > > thanks
> > > ajitabh
> > >
> > > —
> > > You are currently subscribed to ntdev as:
xxxxx@linkeng.com
> > > To unsubscribe send a blank email to
> > > leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@ami.com To
> > unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
> —
> You are currently subscribed to ntdev as: xxxxx@linkeng.com To
> unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@broadstor.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@storagecraft.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@linkeng.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com