Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Correct way to release event created by KeInitializeEvent

95 views
Skip to first unread message

Alex F

unread,
Apr 19, 2008, 7:57:00 AM4/19/08
to
IN KMDF driver, I have KEVENT member of DEVICE_CONTEXT. It is initialized in
EvtDevicePrepareHardware function:

KeInitializeEvent(&pDeviceContext->MyEvent, NotificationEvent, FALSE);

I think that I must release it in the EvtDeviceReleaseHardware function,
what function should be used for this?

Don Burn

unread,
Apr 19, 2008, 8:26:49 AM4/19/08
to
There is no converse for Initialize for Events or other Ke objects these
Initialize calls are just set the memory that was already allocated to an
initial state. Note: Ex calls do have a Delete call for their resources,
but those are a higher level abstraction.

--
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

"Alex F" <Al...@discussions.microsoft.com> wrote in message
news:71904F11-37D0-4762...@microsoft.com...

Alex F

unread,
Apr 19, 2008, 9:27:00 AM4/19/08
to
Thank you. Does this mean that only allocation in my case is done by
framework which creates DEVICE_CONTEXT with KEVENT member? Though I call
KeInitializeEvent every time EvtDevicePrepareHardware and don't release
anything in EvtDeviceReleaseHardware, this doesn't create memory and resource
leak.
Sorry for annoying questions, but this is not described in documentation,
and I want to understand this.

Don Burn

unread,
Apr 19, 2008, 9:32:31 AM4/19/08
to
Yes, you have the gist of it. You allocate the space for the event or other
Ke object where you want to and free it as appropriate. KeInitializeEvent
call is only for the initialization of the already allocated memory.


--
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


"Alex F" <Al...@discussions.microsoft.com> wrote in message

news:62E95052-0DC0-4756...@microsoft.com...

Alex F

unread,
Apr 19, 2008, 10:00:00 AM4/19/08
to
Thank you.

Doron Holan [MSFT]

unread,
Apr 22, 2008, 2:15:57 AM4/22/08
to
you should initialize the KEVENT in your AddDevice routine after you create
the device. this way you do not have a problem reinitializing the field on
subsequent PrepareHardware() calls

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Alex F" <Al...@discussions.microsoft.com> wrote in message

news:5725DC18-765E-4FF6...@microsoft.com...
> Thank you.

0 new messages