Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9119421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:23:32+00:00 2026-06-17T05:23:32+00:00

Windows allows the creation of (named) Event objects . An Event (the synchronization primitive

  • 0

Windows allows the creation of (named) Event objects.

An Event (the synchronization primitive in Windows) can be of type auto-reset (in which case you could say it’s kind of a semaphore) or it can be of type manual-reset in which case it remains set until someone resets it.

Now, from the docs for CreateEvent, OpenEvent, SetEvent, etc. it does seem that there is no way to determine, once the event has been created, whether it’s auto-reset or maual-reset.

I am in the situation, where one process creates a named Event and a 2nd process will have to operate on this event (it gets passed the name and then’ll open the event and eventually signal it). Since the event should always be a manual-reset event for the whole thing to make sense, I would have liked to add a check in the 2nd process to make sure it is a manual-reset event. Is there any way to check for this?

(And yes, it’s more of a nice-to-have in my situation, as it would be a bug anyway if any code would create a auto-reset event and then pass it to this process. But bugs happen, and the better if I can detect them.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:23:33+00:00Added an answer on June 17, 2026 at 5:23 am

    There’s no documented way to do this, but it’s actually not hard if you venture into undocumented land. (For your purposes, this should be fine since it doesn’t really affect your program’s functionality.)

    The first thing you need to do is figure out if the handle given to you is an event or not. You use NtQueryObject for this. The function is documented here: http://msdn.microsoft.com/en-us/library/bb432383(v=vs.85).aspx. It comes with the usual provisios for native APIs that it might disappear or change without notice. Partial example:

    #include <winternl.h>
    
    typedef NTSTATUS (NTAPI * PFN_NtQueryObject)(
        HANDLE Handle,
        OBJECT_INFORMATION_CLASS ObjectInformationClass,
        PVOID ObjectInformation,
        ULONG ObjectInformationLength,
        PULONG ReturnLength );
    
    HMODULE ntdll = GetModuleHandle( L"ntdll.dll" );
    
    auto NtQueryObject = (PFN_NtQueryObject)GetProcAddress( ntdll, "NtQueryObject" );
    
    NTSTATUS result = NtQueryObject(
        eventHandle,
        ObjectTypeInformation,
        buffer,
        length,
        &length );
    

    This will give you a PUBLIC_OBJECT_TYPE_INFORMATION structure. The TypeName field will be “Event” if the object is actually an event.

    Next, you call NtQueryEvent to get the event’s type. All this is completely undocumented.

    typedef enum _EVENT_INFORMATION_CLASS {
        EventBasicInformation
    } EVENT_INFORMATION_CLASS, *PEVENT_INFORMATION_CLASS;
    
    typedef enum _EVENT_TYPE {
        NotificationEvent,
        SynchronizationEvent
    } EVENT_TYPE, *PEVENT_TYPE;
    
    typedef struct _EVENT_BASIC_INFORMATION {
      EVENT_TYPE              EventType;
      LONG                    EventState;
    } EVENT_BASIC_INFORMATION, *PEVENT_BASIC_INFORMATION;
    
    typedef NTSTATUS (NTAPI * PFN_NtQueryEvent)(
        HANDLE EventHandle,
        EVENT_INFORMATION_CLASS EventInformationClass,
        PVOID EventInformation,
        ULONG EventInformationLength,
        PULONG ReturnLength );
    
    auto NtQueryEvent = (PFN_NtQueryEvent)GetProcAddress( ntdll, "NtQueryEvent" );
    
    EVENT_BASIC_INFORMATION info;
    ULONG length = sizeof( info );
    
    NTSTATUS result = NtQueryEvent(
        eventHandle,
        EventBasicInformation,
        &info,
        length,
        &length );
    

    Now, just examine the EventType field in the info and you’re done. “NotificationEvent” means manual reset and “SynchronizationEvent” means auto reset.

    If you’re wondering how I figured that second part out, I didn’t. The information comes from here: http://undocumented.ntinternals.net/. Please use responsibly!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an open source project that allows for an auto-update of windows binaries?
To provide some context, I'm interested in the creation of an app which allows
I am writing an app that allows creation of pppoe in windows phone 7.goal
I've created a Windows Forms Application in C# which allows users to add controls
I have created a windows service which allows communications via namedpipes. This code worked
Windows Forms allows you to develop Components, non-visual elements that can have a designer.
I have found an interesting issue in windows which allows me to cause the
I would like to create a Delphi application for Windows XP which allows dropping
Windows allows configuration of Measurement system to Metric or U.S. Is there a way
I read that Windows wp8 allows native code. So how then have ports such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.