Re: How to Valid Event Handle

From: Kent Lottis [MS] (kentlott_at_online.microsoft.com)
Date: 03/29/04


Date: Mon, 29 Mar 2004 09:23:27 -0800

There are two things you can do
- check the result of DuplicateHandle before referencing your local copy of
the event handle
- keep track of the event handle in the device context you create and return
in XXX_Open. When you get the corresponding XXX_Close, make sure to release
the duplicate event handle using CloseHandle.

Note that you shouldn't have to check the return code of SetEvent once
you've duplicated the handle: if the client application deletes it's copy of
the event handle, the object sticks around until you release it from your
side.

-- 
Kent Lottis
Dev Lead, Windows CE Multimedia
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ©  Microsoft Corporation. All rights
reserved.


Relevant Pages

  • Re: Setting a user (application) event
    ... If your device driver needs to set an event that was created by the ... application it should use DuplicateHandle() to create and Event handle it ... &hevDriverEvent, 0, FALSE, DUPLICATE_SAME_ACCESS); ... This posting is provided "AS IS" with no warranties, and confers no rights. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: How to determine if file handle has write access?
    ... > Try to call DuplicateHandle with GENERIC_WRITE rights. ... If it fails, the ...
    (microsoft.public.win32.programmer.kernel)
  • Re: minifilter context question
    ... How FSD or FSF can know about the _handles_ referencing the file object? ... the FSD/FSF stack is not notified on DuplicateHandle. ...
    (microsoft.public.development.device.drivers)