#include 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; }