ReactOS  0.4.11-dev-946-g431643b
eventlog.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS EventLog Service
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: base/services/eventlog/eventlog.h
5  * PURPOSE: Precompiled Header for the Event logging service
6  * COPYRIGHT: Copyright 2005 Saveliy Tretiakov
7  */
8 
9 #ifndef __EVENTLOG_H__
10 #define __EVENTLOG_H__
11 
12 #include <stdarg.h>
13 
14 /* PSDK/NDK Headers */
15 #define WIN32_NO_STATUS
16 #include <windef.h>
17 #include <winbase.h>
18 
19 #define NTOS_MODE_USER
20 #include <ndk/rtlfuncs.h>
21 #include <ndk/obfuncs.h>
22 
23 #define ROUND_DOWN(n, align) (((ULONG)n) & ~((align) - 1l))
24 #define ROUND_UP(n, align) ROUND_DOWN(((ULONG)n) + (align) - 1, (align))
25 
26 #include <evtlib.h>
27 
28 #include <eventlogrpc_s.h>
29 #include <strsafe.h>
30 
31 /* Defined in evtlib.h */
32 // #define LOGFILE_SIGNATURE 0x654c664c // "LfLe"
33 
34 typedef struct _LOGFILE
35 {
42 } LOGFILE, *PLOGFILE;
43 
44 typedef struct _EVENTSOURCE
45 {
47  PLOGFILE LogFile;
50 
51 
52 /* Log Handle Flags */
53 #define LOG_HANDLE_BACKUP_FILE 1
54 
55 typedef struct _LOGHANDLE
56 {
58  PEVENTSOURCE EventSource;
59  PLOGFILE LogFile;
64 
65 
66 /* eventlog.c */
67 extern PEVENTSOURCE EventLogSource;
68 
70 
71 
72 /* eventsource.c */
74 
75 BOOL
77  PLOGFILE pLogFile);
78 
79 PEVENTSOURCE
81 
82 
83 /* file.c */
88 // DWORD LogfListItemIndexByName(WCHAR * Name);
89 
91 LogfCreate(PLOGFILE* LogFile,
94  ULONG MaxSize,
95  ULONG Retention,
97  BOOLEAN Backup);
98 
99 VOID
100 LogfClose(PLOGFILE LogFile,
101  BOOLEAN ForceClose);
102 
104 
105 NTSTATUS
106 LogfClearFile(PLOGFILE LogFile,
107  PUNICODE_STRING BackupFileName);
108 
109 NTSTATUS
110 LogfBackupFile(PLOGFILE LogFile,
111  PUNICODE_STRING BackupFileName);
112 
113 NTSTATUS
114 LogfReadEvents(PLOGFILE LogFile,
115  ULONG Flags,
116  PULONG RecordNumber,
117  ULONG BufSize,
118  PBYTE Buffer,
120  PULONG BytesNeeded,
121  BOOLEAN Ansi);
122 
123 NTSTATUS
124 LogfWriteRecord(PLOGFILE LogFile,
126  SIZE_T BufSize);
127 
130  ULONG Time,
131  USHORT wType,
132  USHORT wCategory,
133  ULONG dwEventId,
135  PUNICODE_STRING ComputerName,
136  ULONG dwSidLength,
137  PSID pUserSid,
138  USHORT wNumStrings,
139  PWSTR pStrings,
140  ULONG dwDataSize,
141  PVOID pRawData);
142 
143 static __inline void LogfFreeRecord(PEVENTLOGRECORD Record)
144 {
145  RtlFreeHeap(GetProcessHeap(), 0, Record);
146 }
147 
148 VOID
149 LogfReportEvent(USHORT wType,
150  USHORT wCategory,
151  ULONG dwEventId,
152  USHORT wNumStrings,
153  PWSTR pStrings,
154  ULONG dwDataSize,
155  PVOID pRawData);
156 
157 
158 /* logport.c */
160 
162 
164 
165 /* rpc.c */
167 
168 #endif /* __EVENTLOG_H__ */
struct _EVENTSOURCE * PEVENTSOURCE
NTSTATUS ProcessPortMessage(VOID)
Definition: logport.c:104
VOID LogfCloseAll(VOID)
Definition: file.c:452
VOID InitEventSourceList(VOID)
Definition: eventsource.c:22
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _LOGFILE * PLOGFILE
VOID LogfClose(PLOGFILE LogFile, BOOLEAN ForceClose)
Definition: file.c:428
NTSTATUS WINAPI PortThreadRoutine(PVOID Param)
Definition: logport.c:27
uint16_t * PWSTR
Definition: typedefs.h:54
NTSTATUS LogfClearFile(PLOGFILE LogFile, PUNICODE_STRING BackupFileName)
Definition: file.c:467
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
static __inline void LogfFreeRecord(PEVENTLOGRECORD Record)
Definition: eventlog.h:143
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LIST_ENTRY LogHandleListEntry
Definition: eventlog.h:57
NTSTATUS LogfReadEvents(PLOGFILE LogFile, ULONG Flags, PULONG RecordNumber, ULONG BufSize, PBYTE Buffer, PULONG BytesRead, PULONG BytesNeeded, BOOLEAN Ansi)
Definition: file.c:721
PEVENTSOURCE EventSource
Definition: eventlog.h:58
DWORD LogfListItemCount(VOID)
Definition: file.c:118
struct _LOGHANDLE * PLOGHANDLE
EVTLOGFILE LogFile
Definition: eventlog.h:36
_In_ struct _KBUGCHECK_REASON_CALLBACK_RECORD * Record
Definition: ketypes.h:256
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID LogfListInitialize(VOID)
Definition: file.c:27
VOID LogfReportEvent(USHORT wType, USHORT wCategory, ULONG dwEventId, USHORT wNumStrings, PWSTR pStrings, ULONG dwDataSize, PVOID pRawData)
Definition: file.c:1037
ULONG_PTR * PSIZE_T
Definition: typedefs.h:78
LIST_ENTRY EventSourceListEntry
Definition: eventlog.h:46
BOOL LoadEventSources(HKEY hKey, PLOGFILE pLogFile)
Definition: eventsource.c:82
NTSTATUS LogfBackupFile(PLOGFILE LogFile, PUNICODE_STRING BackupFileName)
Definition: file.c:499
PLOGFILE LogFile
Definition: eventlog.h:47
DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter)
Definition: rpc.c:26
unsigned char BOOLEAN
Definition: bufpool.h:45
PEVENTSOURCE GetEventSourceByName(LPCWSTR Name)
Definition: eventsource.c:202
#define BufSize
Definition: FsRtlTunnel.c:28
ULONG CurrentRecord
Definition: eventlog.h:60
ULONG Flags
Definition: eventlog.h:61
PLOGFILE LogFile
Definition: eventlog.h:59
LIST_ENTRY ListEntry
Definition: eventlog.h:41
VOID PRINT_RECORD(PEVENTLOGRECORD pRec)
Definition: eventlog.c:544
HANDLE FileHandle
Definition: eventlog.h:37
unsigned int BOOL
Definition: ntddk_ex.h:94
PLOGFILE LogfListItemByIndex(DWORD Index)
Definition: file.c:93
#define GetProcessHeap()
Definition: compat.h:395
BOOL Permanent
Definition: eventlog.h:40
struct _LOGHANDLE LOGHANDLE
RTL_RESOURCE Lock
Definition: eventlog.h:39
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
WCHAR * LogName
Definition: eventlog.h:38
LPVOID lpParameter
Definition: kernel32.h:232
PEVENTLOGRECORD LogfAllocAndBuildNewRecord(PSIZE_T pRecSize, ULONG Time, USHORT wType, USHORT wCategory, ULONG dwEventId, PUNICODE_STRING SourceName, PUNICODE_STRING ComputerName, ULONG dwSidLength, PSID pUserSid, USHORT wNumStrings, PWSTR pStrings, ULONG dwDataSize, PVOID pRawData)
Definition: file.c:896
struct _EVENTSOURCE EVENTSOURCE
Definition: typedefs.h:117
#define WINAPI
Definition: msvc.h:20
PEVENTSOURCE EventLogSource
Definition: eventlog.c:35
ULONG_PTR SIZE_T
Definition: typedefs.h:78
unsigned short USHORT
Definition: pedump.c:61
unsigned int * PULONG
Definition: retypes.h:1
NTSTATUS LogfWriteRecord(PLOGFILE LogFile, PEVENTLOGRECORD Record, SIZE_T BufSize)
Definition: file.c:858
WCHAR SourceName[256]
Definition: arping.c:28
NTSTATUS InitLogPort(VOID)
Definition: logport.c:47
NTSTATUS LogfCreate(PLOGFILE *LogFile, PCWSTR LogName, PUNICODE_STRING FileName, ULONG MaxSize, ULONG Retention, BOOLEAN Permanent, BOOLEAN Backup)
Definition: file.c:294
static const WCHAR szName[]
Definition: msipriv.h:1194
unsigned int ULONG
Definition: retypes.h:1
const uint16_t * PCWSTR
Definition: typedefs.h:55
struct _LOGFILE LOGFILE
PLOGFILE LogfListItemByName(LPCWSTR Name)
Definition: file.c:33
BYTE * PBYTE
Definition: pedump.c:66
static PLARGE_INTEGER Time
Definition: time.c:105
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255