Hi there
I’m writing a dll for my WDM driver and I use events to signal the appl.
what inerrupt when occur.
For this I create named kernel events in the driver first time an
applications accesses the card (I use an access counter in the device
extension to know how many applications accessing the card in any given
moment). With the object viewer I can see all this kernel events in the
directory "\BaseNamedObjects". The events will all be deleted in the
driver as well, as soon as the last application which accesses the card
closes. They are not visible anymore in the Object Viewer. So far it
works pretty good.
But there is a special case in which it doesn’t seem to work:
If I open the first application let’s call it appl1 and then the secound
let’s call it appl2 and then close appl1 again, all my events are
dissapeared, although I didn’t delete them in the driver! If I first
close appl2 then the events don’t disappear! I don’t really get that. I
mean, why are this events not visible anymore if I just close the
application? The whole controlling of the events (the creation, the set
and the deleting part) is coded in the driver. What’s the problem?
Thanks for your answer
Daniel
Hi Daniel,
Just let me know how are you creating the event being application specific or kernel specific?
Good Luck,
Yogi<
From: Daniel Luethi
>Reply-To: “Windows System Software Devs Interest List”
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] disappearing named kernel events …
>Date: Mon, 09 Feb 2004 17:00:36 +0100
>
>Hi there
>
>I’m writing a dll for my WDM driver and I use events to signal the
>appl. what inerrupt when occur.
>For this I create named kernel events in the driver first time an
>applications accesses the card (I use an access counter in the
>device extension to know how many applications accessing the card in
>any given moment). With the object viewer I can see all this kernel
>events in the directory "\BaseNamedObjects". The events will all be
>deleted in the driver as well, as soon as the last application which
>accesses the card closes. They are not visible anymore in the Object
>Viewer. So far it works pretty good.
>But there is a special case in which it doesn’t seem to work:
>If I open the first application let’s call it appl1 and then the
>secound let’s call it appl2 and then close appl1 again, all my
>events are dissapeared, although I didn’t delete them in the driver!
>If I first close appl2 then the events don’t disappear! I don’t
>really get that. I mean, why are this events not visible anymore if
>I just close the application? The whole controlling of the events
>(the creation, the set and the deleting part) is coded in the
>driver. What’s the problem?
>
>Thanks for your answer
>Daniel
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to
>xxxxx@lists.osr.com
Easiest Money Transfer to India. Send Money To 6000 Indian Towns. Easiest Way To Send Money Home!
Hi Yogi,
I create it like this in the dispatch routine:
HANDLE hEvent[32];
PKEVENT pkEvent[32];
UNICODE_STRING eventName = … L"\BaseNamedObjects\xxx";
pkEvent[i] = IoCreateNotificationEvent (&eventName, hEvent[i]);
and then
KeClearEvent (pkEvent[i]);
This way it’s accessible from user and kernel mode.
Daniel
yatindra vaishnav wrote:
Hi Daniel,
Just let me know how are you creating the event being application
specific or kernel specific?
Good Luck,
>Yogi<
>From: Daniel Luethi
>Reply-To: “Windows System Software Devs Interest List”
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] disappearing named kernel events …
>Date: Mon, 09 Feb 2004 17:00:36 +0100
>
>Hi there
>
>I’m writing a dll for my WDM driver and I use events to signal the
>appl. what inerrupt when occur.
>For this I create named kernel events in the driver first time an
>applications accesses the card (I use an access counter in the
>device extension to know how many applications accessing the card in
>any given moment). With the object viewer I can see all this kernel
>events in the directory "\BaseNamedObjects". The events will all be
>deleted in the driver as well, as soon as the last application which
>accesses the card closes. They are not visible anymore in the Object
>Viewer. So far it works pretty good.
>But there is a special case in which it doesn’t seem to work:
>If I open the first application let’s call it appl1 and then the
>secound let’s call it appl2 and then close appl1 again, all my
>events are dissapeared, although I didn’t delete them in the driver!
>If I first close appl2 then the events don’t disappear! I don’t
>really get that. I mean, why are this events not visible anymore if
>I just close the application? The whole controlling of the events
>(the creation, the set and the deleting part) is coded in the
>driver. What’s the problem?
>
>Thanks for your answer
>Daniel
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to
>xxxxx@lists.osr.com
Easiest Money Transfer to India. Send Money To 6000 Indian Towns.
Easiest Way To Send Money Home! http:</http:>
hi Daniel,
This snippet is called in the context of the process or what?
Good Luck,
Yogi<
From: Daniel Luethi
>Reply-To: “Windows System Software Devs Interest List”
>To: “Windows System Software Devs Interest List”
>Subject: Re:[ntdev] disappearing named kernel events …
>Date: Mon, 09 Feb 2004 18:33:47 +0100
>
>Hi Yogi,
>
>I create it like this in the dispatch routine:
>
>HANDLE hEvent[32];
>PKEVENT pkEvent[32];
>UNICODE_STRING eventName = … L"\BaseNamedObjects\xxx";
>pkEvent[i] = IoCreateNotificationEvent (&eventName, hEvent[i]);
>
>and then
>
>KeClearEvent (pkEvent[i]);
>
>This way it’s accessible from user and kernel mode.
>Daniel
>
>
>
>yatindra vaishnav wrote:
>>Hi Daniel,
>>
>>Just let me know how are you creating the event being application
>>specific or kernel specific?
>>
>>
>>
>>Good Luck,
>>
>> >Yogi<
>>
>> >From: Daniel Luethi
>> >Reply-To: “Windows System Software Devs Interest List”
>> >To: “Windows System Software Devs Interest List”
>> >Subject: [ntdev] disappearing named kernel events …
>> >Date: Mon, 09 Feb 2004 17:00:36 +0100
>> >
>> >Hi there
>> >
>> >I’m writing a dll for my WDM driver and I use events to signal
>>the
>> >appl. what inerrupt when occur.
>> >For this I create named kernel events in the driver first time
>>an
>> >applications accesses the card (I use an access counter in the
>> >device extension to know how many applications accessing the
>>card in
>> >any given moment). With the object viewer I can see all this
>>kernel
>> >events in the directory "\BaseNamedObjects". The events will
>>all be
>> >deleted in the driver as well, as soon as the last application
>>which
>> >accesses the card closes. They are not visible anymore in the
>>Object
>> >Viewer. So far it works pretty good.
>> >But there is a special case in which it doesn’t seem to work:
>> >If I open the first application let’s call it appl1 and then the
>> >secound let’s call it appl2 and then close appl1 again, all my
>> >events are dissapeared, although I didn’t delete them in the
>>driver!
>> >If I first close appl2 then the events don’t disappear! I don’t
>> >really get that. I mean, why are this events not visible anymore
>>if
>> >I just close the application? The whole controlling of the
>>events
>> >(the creation, the set and the deleting part) is coded in the
>> >driver. What’s the problem?
>> >
>> >Thanks for your answer
>> >Daniel
>> >
>> >
>> >—
>> >Questions? First check the Kernel Driver FAQ at
>> >http://www.osronline.com/article.cfm?id=256
>> >
>> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
>> >To unsubscribe send a blank email to
>> >xxxxx@lists.osr.com
>>
>>------------------------------------------------------------------------
>>Easiest Money Transfer to India. Send Money To 6000 Indian Towns.
>>Easiest Way To Send Money Home!
>><http: g.msn.com>
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to
>xxxxx@lists.osr.com
</http:>
Post Classifieds on MSN classifieds. Buy and Sell on MSN Classifieds.
Its is by far better to have “wait for interrupt” IOCTL which will be
pended in the driver till the interrupt will occur. Better and more stable.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: “Daniel Luethi”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Monday, February 09, 2004 7:00 PM
Subject: [ntdev] disappearing named kernel events …
> Hi there
>
> I’m writing a dll for my WDM driver and I use events to signal the appl.
> what inerrupt when occur.
> For this I create named kernel events in the driver first time an
> applications accesses the card (I use an access counter in the device
> extension to know how many applications accessing the card in any given
> moment). With the object viewer I can see all this kernel events in the
> directory "\BaseNamedObjects". The events will all be deleted in the
> driver as well, as soon as the last application which accesses the card
> closes. They are not visible anymore in the Object Viewer. So far it
> works pretty good.
> But there is a special case in which it doesn’t seem to work:
> If I open the first application let’s call it appl1 and then the secound
> let’s call it appl2 and then close appl1 again, all my events are
> dissapeared, although I didn’t delete them in the driver! If I first
> close appl2 then the events don’t disappear! I don’t really get that. I
> mean, why are this events not visible anymore if I just close the
> application? The whole controlling of the events (the creation, the set
> and the deleting part) is coded in the driver. What’s the problem?
>
> Thanks for your answer
> Daniel
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
My testing shows that an event created by the application and passed to
the driver works well too. You need to pend an IoCtl in the driver from
the application so that when the application is terminated without
proper cleanup, the cancel logic will inform the driver that the
matching event should be dereferenced and no longer used by it. That
will permit the application to schedule one or more threads that wait on
the event if the signals may come before the first signal is processed
and the event reset. IoCtls can take more processing, but getting the
code correct is probably easier with them, though for speed having
multiple IoCtls pending on multiple threads is probably necessary.
“Maxim S. Shatskih” wrote in message
news:xxxxx@ntdev…
> Its is by far better to have “wait for interrupt” IOCTL which will
be
> pended in the driver till the interrupt will occur. Better and more
stable.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> ----- Original Message -----
> From: “Daniel Luethi”
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Monday, February 09, 2004 7:00 PM
> Subject: [ntdev] disappearing named kernel events …
>
>
> > Hi there
> >
> > I’m writing a dll for my WDM driver and I use events to signal the
appl.
> > what inerrupt when occur.
> > For this I create named kernel events in the driver first time an
> > applications accesses the card (I use an access counter in the
device
> > extension to know how many applications accessing the card in any
given
> > moment). With the object viewer I can see all this kernel events in
the
> > directory "\BaseNamedObjects". The events will all be deleted in
the
> > driver as well, as soon as the last application which accesses the
card
> > closes. They are not visible anymore in the Object Viewer. So far it
> > works pretty good.
> > But there is a special case in which it doesn’t seem to work:
> > If I open the first application let’s call it appl1 and then the
secound
> > let’s call it appl2 and then close appl1 again, all my events are
> > dissapeared, although I didn’t delete them in the driver! If I first
> > close appl2 then the events don’t disappear! I don’t really get
that. I
> > mean, why are this events not visible anymore if I just close the
> > application? The whole controlling of the events (the creation, the
set
> > and the deleting part) is coded in the driver. What’s the problem?
> >
> > Thanks for your answer
> > Daniel
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to
xxxxx@lists.osr.com
>
>
Also IOCTLs have a great opportunity to send back several bytes of data
which accompanying the event which occured 
IOCTL_SERIAL_WAIT_ON_MASK is a good sample.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: “David J. Craig”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Tuesday, February 10, 2004 3:46 AM
Subject: Re:[ntdev] disappearing named kernel events …
> My testing shows that an event created by the application and passed to
> the driver works well too. You need to pend an IoCtl in the driver from
> the application so that when the application is terminated without
> proper cleanup, the cancel logic will inform the driver that the
> matching event should be dereferenced and no longer used by it. That
> will permit the application to schedule one or more threads that wait on
> the event if the signals may come before the first signal is processed
> and the event reset. IoCtls can take more processing, but getting the
> code correct is probably easier with them, though for speed having
> multiple IoCtls pending on multiple threads is probably necessary.
>
> “Maxim S. Shatskih” wrote in message
> news:xxxxx@ntdev…
> > Its is by far better to have “wait for interrupt” IOCTL which will
> be
> > pended in the driver till the interrupt will occur. Better and more
> stable.
> >
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com
> >
> >
> > ----- Original Message -----
> > From: “Daniel Luethi”
> > Newsgroups: ntdev
> > To: “Windows System Software Devs Interest List”
> > Sent: Monday, February 09, 2004 7:00 PM
> > Subject: [ntdev] disappearing named kernel events …
> >
> >
> > > Hi there
> > >
> > > I’m writing a dll for my WDM driver and I use events to signal the
> appl.
> > > what inerrupt when occur.
> > > For this I create named kernel events in the driver first time an
> > > applications accesses the card (I use an access counter in the
> device
> > > extension to know how many applications accessing the card in any
> given
> > > moment). With the object viewer I can see all this kernel events in
> the
> > > directory "\BaseNamedObjects". The events will all be deleted in
> the
> > > driver as well, as soon as the last application which accesses the
> card
> > > closes. They are not visible anymore in the Object Viewer. So far it
> > > works pretty good.
> > > But there is a special case in which it doesn’t seem to work:
> > > If I open the first application let’s call it appl1 and then the
> secound
> > > let’s call it appl2 and then close appl1 again, all my events are
> > > dissapeared, although I didn’t delete them in the driver! If I first
> > > close appl2 then the events don’t disappear! I don’t really get
> that. I
> > > mean, why are this events not visible anymore if I just close the
> > > application? The whole controlling of the events (the creation, the
> set
> > > and the deleting part) is coded in the driver. What’s the problem?
> > >
> > > Thanks for your answer
> > > Daniel
> > >
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to
> xxxxx@lists.osr.com
> >
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
> ----------
From: xxxxx@yoshimuni.com[SMTP:xxxxx@yoshimuni.com]
Reply To: xxxxx@lists.osr.com
Sent: Tuesday, February 10, 2004 1:46 AM
To: xxxxx@lists.osr.com
Subject: Re:[ntdev] disappearing named kernel events …
My testing shows that an event created by the application and passed to
the driver works well too. You need to pend an IoCtl in the driver from
the application so that when the application is terminated without
proper cleanup, the cancel logic will inform the driver that the
matching event should be dereferenced and no longer used by it. That
will permit the application to schedule one or more threads that wait on
the event if the signals may come before the first signal is processed
and the event reset. IoCtls can take more processing, but getting the
code correct is probably easier with them, though for speed having
multiple IoCtls pending on multiple threads is probably necessary.
Yet another possibility without pending IRPs: create an event in user mode,
send it to driver via IOCTL, reference it, remember file object and complete
IOCTL. When IRP_MJ_CLEANUP is received, compare file object with remembered
one and if matches, dereference event because handle was closed for whatever
reason including application crash. I use this way when application claims
exclusive access to the device and needs to be notified about some events.
Best regards,
Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]
That is one I forgot. If you have data, especially a buffer of data,
then combining it into an IRP is the best solution. I just like events
because of some experience with 9x that allowed me to write one program
for both NT/2000 & 9x that would work. Only a minor code path variation
for who gets the kernel handle of the event. I might be able to do both
using IRPs now, since I know one important thing is to assign the
CTL_CODE for the IoCtls according to NT rules. 9x allows almost any
code except zero and all 0xFFs, while NT should use one properly
formatted to indicate buffering rules etc.
“Maxim S. Shatskih” wrote in message
news:xxxxx@ntdev…
> Also IOCTLs have a great opportunity to send back several bytes of
data
> which accompanying the event which occured 
>
> IOCTL_SERIAL_WAIT_ON_MASK is a good sample.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> ----- Original Message -----
> From: “David J. Craig”
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Tuesday, February 10, 2004 3:46 AM
> Subject: Re:[ntdev] disappearing named kernel events …
>
>
> > My testing shows that an event created by the application and passed
to
> > the driver works well too. You need to pend an IoCtl in the driver
from
> > the application so that when the application is terminated without
> > proper cleanup, the cancel logic will inform the driver that the
> > matching event should be dereferenced and no longer used by it.
That
> > will permit the application to schedule one or more threads that
wait on
> > the event if the signals may come before the first signal is
processed
> > and the event reset. IoCtls can take more processing, but getting
the
> > code correct is probably easier with them, though for speed having
> > multiple IoCtls pending on multiple threads is probably necessary.
> >
> > “Maxim S. Shatskih” wrote in message
> > news:xxxxx@ntdev…
> > > Its is by far better to have “wait for interrupt” IOCTL which
will
> > be
> > > pended in the driver till the interrupt will occur. Better and
more
> > stable.
> > >
> > > Maxim Shatskih, Windows DDK MVP
> > > StorageCraft Corporation
> > > xxxxx@storagecraft.com
> > > http://www.storagecraft.com
> > >
> > >
> > > ----- Original Message -----
> > > From: “Daniel Luethi”
> > > Newsgroups: ntdev
> > > To: “Windows System Software Devs Interest List”
> > > Sent: Monday, February 09, 2004 7:00 PM
> > > Subject: [ntdev] disappearing named kernel events …
> > >
> > >
> > > > Hi there
> > > >
> > > > I’m writing a dll for my WDM driver and I use events to signal
the
> > appl.
> > > > what inerrupt when occur.
> > > > For this I create named kernel events in the driver first time
an
> > > > applications accesses the card (I use an access counter in the
> > device
> > > > extension to know how many applications accessing the card in
any
> > given
> > > > moment). With the object viewer I can see all this kernel events
in
> > the
> > > > directory "\BaseNamedObjects". The events will all be deleted
in
> > the
> > > > driver as well, as soon as the last application which accesses
the
> > card
> > > > closes. They are not visible anymore in the Object Viewer. So
far it
> > > > works pretty good.
> > > > But there is a special case in which it doesn’t seem to work:
> > > > If I open the first application let’s call it appl1 and then the
> > secound
> > > > let’s call it appl2 and then close appl1 again, all my events
are
> > > > dissapeared, although I didn’t delete them in the driver! If I
first
> > > > close appl2 then the events don’t disappear! I don’t really get
> > that. I
> > > > mean, why are this events not visible anymore if I just close
the
> > > > application? The whole controlling of the events (the creation,
the
> > set
> > > > and the deleting part) is coded in the driver. What’s the
problem?
> > > >
> > > > Thanks for your answer
> > > > Daniel
> > > >
> > > >
> > > > —
> > > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > > >
> > > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > > To unsubscribe send a blank email to
> > xxxxx@lists.osr.com
> > >
> > >
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to
xxxxx@lists.osr.com
>
>
David J. Craig wrote:
My testing shows that an event created by the application and passed to
the driver works well too.
What exactly do you pass to the driver? The name or the handle?
You need to pend an IoCtl in the driver from
the application so that when the application is terminated without
proper cleanup, the cancel logic will inform the driver that the
matching event should be dereferenced and no longer used by it. That
will permit the application to schedule one or more threads that wait on
the event if the signals may come before the first signal is processed
and the event reset. IoCtls can take more processing, but getting the
code correct is probably easier with them, though for speed having
multiple IoCtls pending on multiple threads is probably necessary.
“Maxim S. Shatskih” wrote in message
> news:xxxxx@ntdev…
>
>> Its is by far better to have “wait for interrupt” IOCTL which will
>
> be
>
>>pended in the driver till the interrupt will occur. Better and more
>
> stable.
>
>>Maxim Shatskih, Windows DDK MVP
>>StorageCraft Corporation
>>xxxxx@storagecraft.com
>>http://www.storagecraft.com
>>
>>
>>----- Original Message -----
>>From: “Daniel Luethi”
>>Newsgroups: ntdev
>>To: “Windows System Software Devs Interest List”
>>Sent: Monday, February 09, 2004 7:00 PM
>>Subject: [ntdev] disappearing named kernel events …
>>
>>
>>
>>>Hi there
>>>
>>>I’m writing a dll for my WDM driver and I use events to signal the
>
> appl.
>
>>>what inerrupt when occur.
>>>For this I create named kernel events in the driver first time an
>>>applications accesses the card (I use an access counter in the
>
> device
>
>>>extension to know how many applications accessing the card in any
>
> given
>
>>>moment). With the object viewer I can see all this kernel events in
>
> the
>
>>>directory "\BaseNamedObjects". The events will all be deleted in
>
> the
>
>>>driver as well, as soon as the last application which accesses the
>
> card
>
>>>closes. They are not visible anymore in the Object Viewer. So far it
>>>works pretty good.
>>>But there is a special case in which it doesn’t seem to work:
>>>If I open the first application let’s call it appl1 and then the
>
> secound
>
>>>let’s call it appl2 and then close appl1 again, all my events are
>>>dissapeared, although I didn’t delete them in the driver! If I first
>>>close appl2 then the events don’t disappear! I don’t really get
>
> that. I
>
>>>mean, why are this events not visible anymore if I just close the
>>>application? The whole controlling of the events (the creation, the
>
> set
>
>>>and the deleting part) is coded in the driver. What’s the problem?
>>>
>>>Thanks for your answer
>>>Daniel
>>>
>>>
>>>—
>>>Questions? First check the Kernel Driver FAQ at
>>
>>http://www.osronline.com/article.cfm?id=256
>>
>>>You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>>>To unsubscribe send a blank email to
>
> xxxxx@lists.osr.com
>
>>
>
>
>
Maxim S. Shatskih wrote:
Its is by far better to have “wait for interrupt” IOCTL which will be
pended in the driver till the interrupt will occur. Better and more stable.
With events I’m more flexible. i.e. Two different threads can wait for
the same interrupt if I use events, if I do it with IOCTLs two IOCTLs
are queued and the interrupt has to occure twice, the first time it
completes the IRP for the first thread and in the secound time the IRP
from the second thread. Because I’m writing a driver for a card with a
gigabit/s link and I don’t know exactly what the user plans to do with
the card, so I’d like to stay as flexible as possible.
Dani
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: “Daniel Luethi”
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Monday, February 09, 2004 7:00 PM
> Subject: [ntdev] disappearing named kernel events …
>
>
>
>>Hi there
>>
>>I’m writing a dll for my WDM driver and I use events to signal the appl.
>>what inerrupt when occur.
>>For this I create named kernel events in the driver first time an
>>applications accesses the card (I use an access counter in the device
>>extension to know how many applications accessing the card in any given
>>moment). With the object viewer I can see all this kernel events in the
>>directory "\BaseNamedObjects". The events will all be deleted in the
>>driver as well, as soon as the last application which accesses the card
>>closes. They are not visible anymore in the Object Viewer. So far it
>>works pretty good.
>>But there is a special case in which it doesn’t seem to work:
>>If I open the first application let’s call it appl1 and then the secound
>>let’s call it appl2 and then close appl1 again, all my events are
>>dissapeared, although I didn’t delete them in the driver! If I first
>>close appl2 then the events don’t disappear! I don’t really get that. I
>>mean, why are this events not visible anymore if I just close the
>>application? The whole controlling of the events (the creation, the set
>>and the deleting part) is coded in the driver. What’s the problem?
>>
>>Thanks for your answer
>>Daniel
>>
>>
>>—
>>Questions? First check the Kernel Driver FAQ at
>
> http://www.osronline.com/article.cfm?id=256
>
>>You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
It is the event handle. I don’t use named events for this. Since I see
in the next message that you are trying to handle large requests, you
will have problems with obtaining maximum speed with events. The event
has to be signaled, then the thread waiting on the event has to be
scheduled, next the thread has to send a request to get the data. Just
send a bunch of reads down with buffers that can contain the largest
data block that can be transferred. Then you can wait on a completion
port and process the data as it comes in.
“Daniel Luethi” wrote in message
news:xxxxx@ntdev…
> David J. Craig wrote:
> > My testing shows that an event created by the application and passed
to
> > the driver works well too.
>
> What exactly do you pass to the driver? The name or the handle?
>
> You need to pend an IoCtl in the driver from
> > the application so that when the application is terminated without
> > proper cleanup, the cancel logic will inform the driver that the
> > matching event should be dereferenced and no longer used by it.
That
> > will permit the application to schedule one or more threads that
wait on
> > the event if the signals may come before the first signal is
processed
> > and the event reset. IoCtls can take more processing, but getting
the
> > code correct is probably easier with them, though for speed having
> > multiple IoCtls pending on multiple threads is probably necessary.
> >
> > “Maxim S. Shatskih” wrote in message
> > news:xxxxx@ntdev…
> >
> >> Its is by far better to have “wait for interrupt” IOCTL which
will
> >
> > be
> >
> >>pended in the driver till the interrupt will occur. Better and more
> >
> > stable.
> >
> >>Maxim Shatskih, Windows DDK MVP
> >>StorageCraft Corporation
> >>xxxxx@storagecraft.com
> >>http://www.storagecraft.com
> >>
> >>
> >>----- Original Message -----
> >>From: “Daniel Luethi”
> >>Newsgroups: ntdev
> >>To: “Windows System Software Devs Interest List”
> >>Sent: Monday, February 09, 2004 7:00 PM
> >>Subject: [ntdev] disappearing named kernel events …
> >>
> >>
> >>
> >>>Hi there
> >>>
> >>>I’m writing a dll for my WDM driver and I use events to signal the
> >
> > appl.
> >
> >>>what inerrupt when occur.
> >>>For this I create named kernel events in the driver first time an
> >>>applications accesses the card (I use an access counter in the
> >
> > device
> >
> >>>extension to know how many applications accessing the card in any
> >
> > given
> >
> >>>moment). With the object viewer I can see all this kernel events in
> >
> > the
> >
> >>>directory "\BaseNamedObjects". The events will all be deleted in
> >
> > the
> >
> >>>driver as well, as soon as the last application which accesses the
> >
> > card
> >
> >>>closes. They are not visible anymore in the Object Viewer. So far
it
> >>>works pretty good.
> >>>But there is a special case in which it doesn’t seem to work:
> >>>If I open the first application let’s call it appl1 and then the
> >
> > secound
> >
> >>>let’s call it appl2 and then close appl1 again, all my events are
> >>>dissapeared, although I didn’t delete them in the driver! If I
first
> >>>close appl2 then the events don’t disappear! I don’t really get
> >
> > that. I
> >
> >>>mean, why are this events not visible anymore if I just close the
> >>>application? The whole controlling of the events (the creation, the
> >
> > set
> >
> >>>and the deleting part) is coded in the driver. What’s the problem?
> >>>
> >>>Thanks for your answer
> >>>Daniel
> >>>
> >>>
> >>>—
> >>>Questions? First check the Kernel Driver FAQ at
> >>
> >>http://www.osronline.com/article.cfm?id=256
> >>
> >>>You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> >>>To unsubscribe send a blank email to
> >
> > xxxxx@lists.osr.com
> >
> >>
> >
> >
> >
>
>
you could complete all the outstanding wait IRPs on an interrupt and
then you’d be “as flexible” as events.
events actually make you less flexible. Your choices are to let one
user wakeup or let all users wakeup (and then when do you reset the
event?). With irp’s you can control exactly who will get to continue
processing. And you let the clients get notified asynchronously so they
don’t need to burn a thread just to wait for your notification.
if the client wants to wait on an event, let them tie an event to the IO
completion. If they don’t you’ve now given them a choice.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Daniel Luethi
Sent: Tuesday, February 10, 2004 1:30 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] disappearing named kernel events …
Maxim S. Shatskih wrote:
Its is by far better to have “wait for interrupt” IOCTL which will
be pended in the driver till the interrupt will occur. Better and more
stable.
With events I’m more flexible. i.e. Two different threads can wait for
the same interrupt if I use events, if I do it with IOCTLs two IOCTLs
are queued and the interrupt has to occure twice, the first time it
completes the IRP for the first thread and in the secound time the IRP
from the second thread. Because I’m writing a driver for a card with a
gigabit/s link and I don’t know exactly what the user plans to do with
the card, so I’d like to stay as flexible as possible.
Dani
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: “Daniel Luethi”
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Monday, February 09, 2004 7:00 PM
> Subject: [ntdev] disappearing named kernel events …
>
>
>
>>Hi there
>>
>>I’m writing a dll for my WDM driver and I use events to signal the
appl.
>>what inerrupt when occur.
>>For this I create named kernel events in the driver first time an
>>applications accesses the card (I use an access counter in the device
>>extension to know how many applications accessing the card in any
>>given moment). With the object viewer I can see all this kernel events
>>in the directory "\BaseNamedObjects". The events will all be deleted
>>in the driver as well, as soon as the last application which accesses
>>the card closes. They are not visible anymore in the Object Viewer. So
>>far it works pretty good.
>>But there is a special case in which it doesn’t seem to work:
>>If I open the first application let’s call it appl1 and then the
>>secound let’s call it appl2 and then close appl1 again, all my events
>>are dissapeared, although I didn’t delete them in the driver! If I
>>first close appl2 then the events don’t disappear! I don’t really get
>>that. I mean, why are this events not visible anymore if I just close
>>the application? The whole controlling of the events (the creation,
>>the set and the deleting part) is coded in the driver. What’s the
problem?
>>
>>Thanks for your answer
>>Daniel
>>
>>
>>—
>>Questions? First check the Kernel Driver FAQ at
>
> http://www.osronline.com/article.cfm?id=256
>
>>You are currently subscribed to ntdev as: xxxxx@storagecraft.com To
>>unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com