Initial
This commit is contained in:
19
service/EventLog.cpp
Normal file
19
service/EventLog.cpp
Normal 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user