mirror of
https://github.com/reactos/reactos.git
synced 2024-11-01 12:26:32 +00:00
fc3eeb61f3
Refactoring and reduce binary size. JIRA issue: CORE-19268 - Add cicero static library in sdk/lib/cicero folder. - Delete sdk/include/reactos/cicero folder. - Adapt the dependencies to these changes. - Make ctfmon, msutb, and msctf modules UNICODE.
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
/*
|
|
* 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@gmail.com>
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "cicbase.h"
|
|
|
|
class CicEvent
|
|
{
|
|
HANDLE m_hEvent;
|
|
LPCTSTR m_pszName;
|
|
|
|
public:
|
|
CicEvent() : m_hEvent(NULL), m_pszName(NULL)
|
|
{
|
|
}
|
|
~CicEvent()
|
|
{
|
|
Close();
|
|
}
|
|
|
|
BOOL Create(LPSECURITY_ATTRIBUTES lpSA, LPCTSTR pszName)
|
|
{
|
|
if (pszName)
|
|
m_pszName = pszName;
|
|
if (!m_pszName)
|
|
return FALSE;
|
|
m_hEvent = ::CreateEvent(lpSA, FALSE, FALSE, m_pszName);
|
|
return (m_hEvent != NULL);
|
|
}
|
|
BOOL Open(LPCTSTR pszName)
|
|
{
|
|
if (pszName)
|
|
m_pszName = pszName;
|
|
m_hEvent = ::OpenEvent(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);
|
|
}
|
|
};
|