diff --git a/PInvoke/Kernel32/SynchApi.cs b/PInvoke/Kernel32/SynchApi.cs index 92758952..266f1e9f 100644 --- a/PInvoke/Kernel32/SynchApi.cs +++ b/PInvoke/Kernel32/SynchApi.cs @@ -1425,6 +1425,23 @@ namespace Vanara.PInvoke [return: MarshalAs(UnmanagedType.Bool)] public static extern bool ResetEvent([In] SafeEventHandle hEvent); + /// Sets the specified event object to the nonsignaled state. + /// + /// A handle to the event object. The CreateEvent or OpenEvent function returns this handle. + /// + /// The handle must have the EVENT_MODIFY_STATE access right. For more information, see Synchronization Object Security and Access Rights. + /// + /// + /// + /// If the function succeeds, the return value is nonzero. + /// If the function fails, the return value is zero. To get extended error information, call GetLastError. + /// + // BOOL WINAPI ResetEvent( _In_ HANDLE hEvent); https://msdn.microsoft.com/en-us/library/windows/desktop/ms685081(v=vs.85).aspx + [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] + [PInvokeData("WinBase.h", MSDNShortId = "ms685081")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool ResetEvent([In] IntPtr hEvent); + /// /// Sets the spin count for the specified critical section. Spinning means that when a thread tries to acquire a critical section /// that is locked, the thread enters a loop, checks to see if the lock is released, and if the lock is not released, the thread goes @@ -1460,6 +1477,23 @@ namespace Vanara.PInvoke [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetEvent([In] SafeEventHandle hEvent); + /// Sets the specified event object to the signaled state. + /// + /// A handle to the event object. The CreateEvent or OpenEvent function returns this handle. + /// + /// The handle must have the EVENT_MODIFY_STATE access right. For more information, see Synchronization Object Security and Access Rights. + /// + /// + /// + /// If the function succeeds, the return value is nonzero. + /// If the function fails, the return value is zero. To get extended error information, call GetLastError. + /// + // BOOL WINAPI SetEvent( _In_ HANDLE hEvent); https://msdn.microsoft.com/en-us/library/windows/desktop/ms686211(v=vs.85).aspx + [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] + [PInvokeData("WinBase.h", MSDNShortId = "ms686211")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SetEvent([In] IntPtr hEvent); + /// /// Activates the specified waitable timer. When the due time arrives, the timer is signaled and the thread that set the timer calls /// the optional completion routine. @@ -2393,6 +2427,11 @@ namespace Vanara.PInvoke /// Gets a null event handle. public static SafeEventHandle Null => new SafeEventHandle(IntPtr.Zero, false); + + /// Performs an explicit conversion from to . + /// The event handle. + /// The resulting instance from the conversion. + public static explicit operator IntPtr(SafeEventHandle h) => h.handle; } /// Provides a to a mutex that is automatically disposed using CloseHandle.