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 <strsafe.h>
34 
35 #include <commctrl.h>
36 #include <commdlg.h>
37 
38 #include <richedit.h>
39 
40 /* Missing RichEdit flags in our richedit.h */
41 #define AURL_ENABLEURL          1
42 #define AURL_ENABLEEMAILADDR    2
43 #define AURL_ENABLETELNO        4
44 #define AURL_ENABLEEAURLS       8
45 #define AURL_ENABLEDRIVELETTERS 16
46 
47 #include <windowsx.h>
48 
49 /*
50  * windowsx.h extensions
51  */
52 #define EnableDlgItem(hDlg, nID, bEnable)   \
53     EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))
54 
55 #define ProgressBar_SetPos(hwndCtl,pos)    \
56     ((int)SNDMSG((hwndCtl),PBM_SETPOS,(WPARAM)(int)(pos),(LPARAM)0))
57 #define ProgressBar_SetRange(hwndCtl,range)    \
58     ((int)SNDMSG((hwndCtl),PBM_SETRANGE,(WPARAM)0,(LPARAM)(range)))
59 #define ProgressBar_SetStep(hwndCtl,inc)    \
60     ((int)SNDMSG((hwndCtl),PBM_SETSTEP,(WPARAM)(int)(inc),(LPARAM)0))
61 #define ProgressBar_StepIt(hwndCtl)         \
62     ((int)SNDMSG((hwndCtl),PBM_STEPIT,(WPARAM)0,(LPARAM)0))
63 
64 #define StatusBar_GetItemRect(hwndCtl,index,lprc)   \
65     ((BOOL)SNDMSG((hwndCtl),SB_GETRECT,(WPARAM)(int)(index),(LPARAM)(RECT*)(lprc)))
66 #define StatusBar_SetText(hwndCtl,index,data)   \
67     ((BOOL)SNDMSG((hwndCtl),SB_SETTEXT,(WPARAM)(index),(LPARAM)(data)))
68 
69 #ifndef WM_APP
70     #define WM_APP 0x8000
71 #endif
72 
73 #include "resource.h"
74 
75 extern HINSTANCE hInst;
76 
77 
78 /*
79  * Structure that caches information about an opened event log.
80  */
81 typedef struct _EVENTLOG
82 {
83     LIST_ENTRY ListEntry;
84 
85     // 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.
86 
87     PWSTR ComputerName;     // Computer where the log resides
88 
89 /** Cached information **/
90     PWSTR LogName;          // Internal name (from registry, or file path for user logs)
91     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)
92     // PWSTR DisplayName;     // The default value is the one computed; can be modified by the user for this local session only.
93     // We can use the TreeView' item name for the DisplayName...
94     BOOL Permanent;         // TRUE: system log; FALSE: user log
95 
96 /** Volatile information **/
97     // ULONG Flags;
98     // ULONG MaxSize;          // Always retrieved from registry (only valid for system logs)
99     // ULONG Retention;        // Always retrieved from registry (only valid for system logs)
100 } EVENTLOG, *PEVENTLOG;
101 
102 typedef struct _EVENTLOGFILTER
103 {
104     LIST_ENTRY ListEntry;
105 
106     LONG ReferenceCount;
107 
108     // HANDLE hEnumEventsThread;
109     // HANDLE hStopEnumEvent;
110 
111     // PWSTR DisplayName;     // The default value is the one computed; can be modified by the user for this local session only.
112     // We can use the TreeView' item name for the DisplayName...
113 
114     BOOL Information;
115     BOOL Warning;
116     BOOL Error;
117     BOOL AuditSuccess;
118     BOOL AuditFailure;
119 
120     // ULONG Category;
121     ULONG EventID;
122 
123     /*
124      * The following three string filters are multi-strings that enumerate
125      * the list of sources/users/computers to be shown. If a string points
126      * to an empty string: "\0", it filters for an empty source/user/computer.
127      * If a string points to NULL, it filters for all sources/users/computers.
128      */
129     PWSTR Sources;
130     PWSTR Users;
131     PWSTR ComputerNames;
132 
133     /* List of event logs maintained by this filter */
134     ULONG NumOfEventLogs;
135     PEVENTLOG EventLogs[ANYSIZE_ARRAY];
136 } EVENTLOGFILTER, *PEVENTLOGFILTER;
137 
138 #endif /* _EVENTVWR_PCH_ */
139