This commit is contained in:
2024-08-07 09:16:27 -04:00
parent fdfadd5c7e
commit 5f971cf684
5200 changed files with 731717 additions and 0 deletions

19
service/EventLog.cpp Normal file
View File

@@ -0,0 +1,19 @@
#include <service/EventLog.hpp>
bool EventLog::open(const String &strSourceName,const String &strServerName)
{
close();
mServerName=strServerName;
mSourceName=strSourceName;
if(!mSourceName.length())mSourceName="Application";
mhEventLog=::RegisterEventSource(mServerName.isNull()?0:mServerName.str(),mSourceName.isNull()?0:mSourceName.str());
return isOkay();
}
bool EventLog::reportEvent(const String &strMessage,EventType eventType,DWORD eventID,WORD category,PSID userSID)
{
char const *str[]={strMessage.str()};
if(!isOkay()||!strMessage.length())return false;
return ::ReportEvent(mhEventLog,int(eventType),category,eventID,userSID,1,0,str,0)?true:false;
}