[EVENTVWR]
[reactos.git] / reactos / base / applications / mscutils / eventvwr / eventvwr.h
1 /*
2 * PROJECT: ReactOS Event Log Viewer
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/applications/mscutils/eventvwr/eventvwr.h
5 * PURPOSE: Event Log Viewer header
6 * PROGRAMMERS: Marc Piulachs (marc.piulachs at codexchange [dot] net)
7 * Eric Kohl
8 * Hermes Belusca-Maito
9 */
10
11 #ifndef _EVENTVWR_PCH_
12 #define _EVENTVWR_PCH_
13
14 // #pragma once
15
16 #include <stdio.h>
17 #include <stdlib.h>
18
19 #define WIN32_NO_STATUS
20
21 #include <windef.h>
22 #include <winbase.h>
23 #include <wingdi.h>
24 #include <winuser.h>
25 #include <winnls.h>
26 #include <winreg.h>
27
28 #include <ndk/rtlfuncs.h>
29
30 #define ROUND_DOWN(n, align) (((ULONG)n) & ~((align) - 1l))
31 #define ROUND_UP(n, align) ROUND_DOWN(((ULONG)n) + (align) - 1, (align))
32
33 #include <commctrl.h>
34 #include <commdlg.h>
35
36 #include <richedit.h>
37
38 /* Missing RichEdit flags in our richedit.h */
39 #define AURL_ENABLEURL 1
40 #define AURL_ENABLEEMAILADDR 2
41 #define AURL_ENABLETELNO 4
42 #define AURL_ENABLEEAURLS 8
43 #define AURL_ENABLEDRIVELETTERS 16
44
45 #include <windowsx.h>
46
47 /*
48 * windowsx.h extensions
49 */
50 #define EnableDlgItem(hDlg, nID, bEnable) \
51 EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))
52
53 #define ProgressBar_SetPos(hwndCtl,pos) \
54 ((int)SNDMSG((hwndCtl),PBM_SETPOS,(WPARAM)(int)(pos),(LPARAM)0))
55 #define ProgressBar_SetRange(hwndCtl,range) \
56 ((int)SNDMSG((hwndCtl),PBM_SETRANGE,(WPARAM)0,(LPARAM)(range)))
57 #define ProgressBar_SetStep(hwndCtl,inc) \
58 ((int)SNDMSG((hwndCtl),PBM_SETSTEP,(WPARAM)(int)(inc),(LPARAM)0))
59 #define ProgressBar_StepIt(hwndCtl) \
60 ((int)SNDMSG((hwndCtl),PBM_STEPIT,(WPARAM)0,(LPARAM)0))
61
62 #define StatusBar_GetItemRect(hwndCtl,index,lprc) \
63 ((BOOL)SNDMSG((hwndCtl),SB_GETRECT,(WPARAM)(int)(index),(LPARAM)(RECT*)(lprc)))
64 #define StatusBar_SetText(hwndCtl,index,data) \
65 ((BOOL)SNDMSG((hwndCtl),SB_SETTEXT,(WPARAM)(index),(LPARAM)(data)))
66
67 #ifndef WM_APP
68 #define WM_APP 0x8000
69 #endif
70
71 #include "resource.h"
72
73 extern HINSTANCE hInst;
74
75
76 /*
77 * Structure that caches information about an opened event log.
78 */
79 typedef struct _EVENTLOG
80 {
81 LIST_ENTRY ListEntry;
82
83 // HANDLE hEventLog; // At least for user logs, a handle is kept opened (by eventlog service) as long as the event viewer has the focus on this log.
84
85 PWSTR ComputerName; // Computer where the log resides
86
87 /** Cached information **/
88 PWSTR LogName; // Internal name (from registry, or file path for user logs)
89 PWSTR FileName; // Cached, for user logs; retrieved once (at startup) from registry for system logs (i.e. may be different from the one opened by the eventlog service)
90 // PWSTR DisplayName; // The default value is the one computed; can be modified by the user for this local session only.
91 // We can use the TreeView' item name for the DisplayName...
92 BOOL Permanent; // TRUE: system log; FALSE: user log
93
94 /** Volatile information **/
95 // ULONG Flags;
96 // ULONG MaxSize; // Always retrieved from registry (only valid for system logs)
97 // ULONG Retention; // Always retrieved from registry (only valid for system logs)
98 } EVENTLOG, *PEVENTLOG;
99
100 typedef struct _EVENTLOGFILTER
101 {
102 LIST_ENTRY ListEntry;
103
104 LONG ReferenceCount;
105
106 // HANDLE hEnumEventsThread;
107 // HANDLE hStopEnumEvent;
108
109 // PWSTR DisplayName; // The default value is the one computed; can be modified by the user for this local session only.
110 // We can use the TreeView' item name for the DisplayName...
111
112 BOOL Information;
113 BOOL Warning;
114 BOOL Error;
115 BOOL AuditSuccess;
116 BOOL AuditFailure;
117
118 // ULONG Category;
119 ULONG EventID;
120
121 /*
122 * The following three string filters are multi-strings that enumerate
123 * the list of sources/users/computers to be shown. If a string points
124 * to an empty string: "\0", it filters for an empty source/user/computer.
125 * If a string points to NULL, it filters for all sources/users/computers.
126 */
127 PWSTR Sources;
128 PWSTR Users;
129 PWSTR ComputerNames;
130
131 /* List of event logs maintained by this filter */
132 ULONG NumOfEventLogs;
133 PEVENTLOG EventLogs[ANYSIZE_ARRAY];
134 } EVENTLOGFILTER, *PEVENTLOGFILTER;
135
136 #endif /* _EVENTVWR_PCH_ */