mirror of
https://github.com/snowie2000/mactype.git
synced 2025-01-05 10:17:02 +08:00
add missing files
This commit is contained in:
parent
8508d8d5ce
commit
f17511494f
55
EventLogging.cpp
Normal file
55
EventLogging.cpp
Normal file
@ -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
EventLogging.h
Normal file
27
EventLogging.h
Normal file
@ -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_)
|
Loading…
Reference in New Issue
Block a user