https://git.reactos.org/?p=reactos.git;a=commitdiff;h=91b740f9001e2ad7edb36…
commit 91b740f9001e2ad7edb36db8d57e976849922094
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Fri Dec 22 12:26:43 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Fri Dec 22 12:26:43 2023 +0900
[SDK] Add <cicero/cicevent.h>
CORE-19361
---
sdk/include/reactos/cicero/cicevent.h | 55 +++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/sdk/include/reactos/cicero/cicevent.h
b/sdk/include/reactos/cicero/cicevent.h
new file mode 100644
index 00000000000..a783872b2c2
--- /dev/null
+++ b/sdk/include/reactos/cicero/cicevent.h
@@ -0,0 +1,55 @@
+/*
+ * PROJECT: ReactOS Cicero
+ * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
+ * PURPOSE: Cicero event object handling
+ * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ
<katayama.hirofumi.mz(a)gmail.com>
+ */
+
+#pragma once
+
+#include "cicbase.h"
+
+class CicEvent
+{
+ HANDLE m_hEvent;
+ LPCWSTR m_pszName;
+
+public:
+ CicEvent() : m_hEvent(NULL), m_pszName(NULL)
+ {
+ }
+ ~CicEvent()
+ {
+ Close();
+ }
+
+ BOOL Create(LPSECURITY_ATTRIBUTES lpSA, LPCWSTR pszName)
+ {
+ if (pszName)
+ m_pszName = pszName;
+ if (!m_pszName)
+ return FALSE;
+ m_hEvent = ::CreateEventW(lpSA, FALSE, FALSE, m_pszName);
+ return (m_hEvent != NULL);
+ }
+ BOOL Open(LPCWSTR pszName)
+ {
+ if (pszName)
+ m_pszName = pszName;
+ m_hEvent = ::OpenEventW(EVENT_ALL_ACCESS, FALSE, m_pszName);
+ return (m_hEvent != NULL);
+ }
+ void Close()
+ {
+ if (m_hEvent)
+ {
+ ::CloseHandle(m_hEvent);
+ m_hEvent = NULL;
+ }
+ }
+
+ BOOL Wait(DWORD dwMilliseconds)
+ {
+ return (::WaitForSingleObject(m_hEvent, dwMilliseconds) == WAIT_OBJECT_0);
+ }
+};