Skip to content

Commit

Permalink
add missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
snowie2000 committed Sep 2, 2016
1 parent 8508d8d commit f175114
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
55 changes: 55 additions & 0 deletions EventLogging.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,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);

}
27 changes: 27 additions & 0 deletions EventLogging.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// EventLogging.h: interface for the EventLogging class.
//
//////////////////////////////////////////////////////////////////////
#include "common.h"
#if !defined(AFX_EVENTLOGGING_H__4AED0DCC_4C48_4312_BA6F_E6B90AC47F32__INCLUDED_)
#define AFX_EVENTLOGGING_H__4AED0DCC_4C48_4312_BA6F_E6B90AC47F32__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class EventLogging
{
public:
EventLogging();
virtual ~EventLogging();

// Wrapper for ReportEvent that take care of Handle and EventType
virtual void LogIt(WORD CategoryID, DWORD EventID, LPCTSTR ArrayOfStrings[] = NULL,
UINT NumOfArrayStr = 0,LPVOID RawData = NULL,DWORD RawDataSize = 0);
// data member to contain handle to registry
HANDLE m_hEventLinker;


};

#endif // !defined(AFX_EVENTLOGGING_H__4AED0DCC_4C48_4312_BA6F_E6B90AC47F32__INCLUDED_)

0 comments on commit f175114

Please sign in to comment.