forked from snowie2000/mactype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EventLogging.cpp
55 lines (44 loc) · 2.09 KB
/
EventLogging.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// EventLogging.cpp: implementation of the EventLogging class.
//
//////////////////////////////////////////////////////////////////////
#include "EventLogging.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
EventLogging::EventLogging()
//*******************************************************************************
// Default Constructor is used register the event source
//******************************************************************************
{
// returns a handle that links the source to the registry
this->m_hEventLinker = RegisterEventSource(NULL,L"MacType");
}
EventLogging::~EventLogging()
//*******************************************************************************
// Destructor is used deregister the event source
//*******************************************************************************
{
// Releases the handle to the registry
DeregisterEventSource(m_hEventLinker);
}
void EventLogging::LogIt(WORD CategoryID, DWORD EventID, LPCTSTR ArrayOfStrings[],
UINT NumOfArrayStr,LPVOID RawData,DWORD RawDataSize)
//*******************************************************************************
// Function is used to log the event into the .evt file.
// Input: CategoryID is the events category classification
// EventID is the events event classification
// ArrayOfStrings is an array of pointers to strings that are passed for additional information gathering
// NumOfArrayStr is the number of of strings in ArrayOfStrings
// RawData is a void pointer to hold additional raw data for event reporting
// RawDataSize is the size of RawData in bytes
//*******************************************************************************
{
// Writes data to the event log
ReportEvent(m_hEventLinker,EVENTLOG_INFORMATION_TYPE,CategoryID,
EventID,NULL,NumOfArrayStr,RawDataSize,ArrayOfStrings,RawData);
}