ReactOS 0.4.16-dev-297-gc569aee
EvtLogTest.c File Reference
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include "MyEventProvider.h"
Include dependency graph for EvtLogTest.c:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 
#define PROVIDER_NAME   L"MyEventProvider"
 

Functions

BOOL CreateEventLog (LPCWSTR EventLogName, UINT MaxSize, UINT SourcesCount, LPCWSTR EventLogSources[])
 
BOOL RemoveEventLog (LPCWSTR EventLogName)
 
VOID TestEventsGeneration (VOID)
 
VOID TestMyEventProvider (VOID)
 
int wmain (int argc, WCHAR *argv[])
 

Macro Definition Documentation

◆ PROVIDER_NAME

#define PROVIDER_NAME   L"MyEventProvider"

Definition at line 17 of file EvtLogTest.c.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 12 of file EvtLogTest.c.

Function Documentation

◆ CreateEventLog()

BOOL CreateEventLog ( LPCWSTR  EventLogName,
UINT  MaxSize,
UINT  SourcesCount,
LPCWSTR  EventLogSources[] 
)

Definition at line 19 of file EvtLogTest.c.

23{
25 LONG lRet;
26 HKEY hKey = NULL, hEventKey = NULL, hSrcKey = NULL;
27 UINT i;
28 // WCHAR evtFile[] = L"D:\\myfile.evtx";
29
30 wprintf(L"Creating log %s of MaxSize 0x%x with %d sources...", EventLogName, MaxSize, SourcesCount);
31
33 L"SYSTEM\\CurrentControlSet\\Services\\Eventlog",
35 &hKey);
36 if (lRet != ERROR_SUCCESS)
37 goto Quit;
38
39 /*
40 * At this precise moment, EventLog detects we create a new log registry key
41 * and therefore creates for us the log file in System32\config (<= Win2k3)
42 * or in System32\winevt\Logs (>= Vista).
43 */
44 lRet = RegCreateKeyExW(hKey,
45 EventLogName,
48 &hEventKey, NULL);
49 if (lRet != ERROR_SUCCESS)
50 goto Quit;
51
52 RegSetValueExW(hEventKey, L"MaxSize", 0, REG_DWORD,
53 (LPBYTE)&MaxSize, sizeof(MaxSize));
54
55 i = 0;
56 RegSetValueExW(hEventKey, L"Retention", 0, REG_DWORD,
57 (LPBYTE)&i, sizeof(i));
58
59#if 0
60 /*
61 * Set the flag that will allow EventLog to use an alternative log file name.
62 * If this flag is not set, EventLog will not care about the "File" value.
63 * When the flag is set, EventLog monitors for the "File" value, which can be
64 * changed at run-time, in which case a new event log file is created.
65 */
66 i = 1;
67 RegSetValueExW(hEventKey, L"Flags", 0, REG_DWORD,
68 (LPBYTE)&i, sizeof(i));
69
70 RegSetValueExW(hEventKey, L"File", 0, REG_EXPAND_SZ,
71 (LPBYTE)evtFile, sizeof(evtFile));
72#endif
73
74 for (i = 0; i < SourcesCount; i++)
75 {
76 lRet = RegCreateKeyExW(hEventKey,
77 EventLogSources[i],
80 &hSrcKey, NULL);
81 RegFlushKey(hSrcKey);
82 RegCloseKey(hSrcKey);
83 }
84
85 RegFlushKey(hEventKey);
86
87 Success = TRUE;
88
89Quit:
90 if (Success)
91 wprintf(L"Success\n");
92 else
93 wprintf(L"Failure\n");
94
95 if (hEventKey)
96 RegCloseKey(hEventKey);
97
98 if (hKey)
100
101 return Success;
102}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegFlushKey(HKEY hKey)
Definition: reg.c:2951
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
@ Success
Definition: eventcreate.c:712
unsigned int BOOL
Definition: ntddk_ex.h:94
FxAutoRegKey hKey
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
#define REG_DWORD
Definition: sdbapi.c:596
unsigned char * LPBYTE
Definition: typedefs.h:53
#define wprintf(...)
Definition: whoami.c:18
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by TestEventsGeneration().

◆ RemoveEventLog()

BOOL RemoveEventLog ( LPCWSTR  EventLogName)

Definition at line 104 of file EvtLogTest.c.

105{
107 LONG lRet;
108 HKEY hKey, hEventKey;
109 DWORD MaxKeyNameLen, KeyNameLen;
110 LPWSTR Buf = NULL;
111
112 wprintf(L"Deleting log %s...", EventLogName);
113
115 L"SYSTEM\\CurrentControlSet\\Services\\Eventlog",
117 &hKey);
118 if (lRet != ERROR_SUCCESS)
119 goto Quit;
120
121 lRet = RegOpenKeyExW(hKey,
122 EventLogName,
124 &hEventKey);
125 if (lRet != ERROR_SUCCESS)
126 goto Quit;
127
128 lRet = RegQueryInfoKeyW(hEventKey,
129 NULL, NULL, NULL, NULL,
130 &MaxKeyNameLen,
131 NULL, NULL, NULL, NULL, NULL, NULL);
132 if (lRet != ERROR_SUCCESS)
133 goto Quit;
134
135 MaxKeyNameLen++;
136
137 Buf = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, MaxKeyNameLen * sizeof(WCHAR));
138 if (!Buf)
139 goto Quit;
140
141 KeyNameLen = MaxKeyNameLen;
142 while (RegEnumKeyExW(hEventKey,
143 0,
144 Buf,
145 &KeyNameLen,
147 {
148 RegDeleteKeyW(hEventKey, Buf);
149 KeyNameLen = MaxKeyNameLen;
150 }
151
152 RegFlushKey(hEventKey);
153
154 HeapFree(GetProcessHeap(), 0, Buf);
155
156 Success = TRUE;
157
158Quit:
159 if (Success)
160 {
161 RegCloseKey(hEventKey);
162 RegDeleteKeyW(hKey, EventLogName);
163
164 wprintf(L"Success\n");
165 }
166 else
167 {
168 if (hEventKey)
169 RegCloseKey(hEventKey);
170
171 wprintf(L"Failure\n");
172 }
173
174 if (hKey)
176
177 return Success;
178}
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3662
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
unsigned long DWORD
Definition: ntddk_ex.h:95
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by TestEventsGeneration().

◆ TestEventsGeneration()

VOID TestEventsGeneration ( VOID  )

Definition at line 180 of file EvtLogTest.c.

181{
183 LPCWSTR EvtLog = L"MyLog";
184 LPCWSTR Sources[] = {L"Source1", L"Source2"};
185 HANDLE hEventLog;
186 ULONG MaxSize = max(0x30 + 0x28 + 0x200, 0x010000);
187
188 /* Create the test event log */
189 if (!CreateEventLog(EvtLog, MaxSize, ARRAYSIZE(Sources), Sources))
190 return;
191
192 wprintf(L"Press any key to continue...\n");
193 _getch();
194
195 /* To report events we can either use a handle got from OpenEventLog or from RegisterEventSource! */
196 hEventLog = OpenEventLogW(NULL, EvtLog);
197 wprintf(L"OpenEventLogW(NULL, EvtLog = %s) ", EvtLog);
198 if (hEventLog)
199 {
200 LPCWSTR String = L"Event from OpenEventLog handle with EvtLog";
201
202 wprintf(L"succeeded\n");
203 Success = ReportEventW(hEventLog, EVENTLOG_INFORMATION_TYPE, 1, 1, NULL, 1, 0, &String, NULL);
204 if (!Success)
205 wprintf(L" Failed to report event\n");
206 }
207 else
208 {
209 wprintf(L"failed\n");
210 }
211 CloseEventLog(hEventLog);
212
213 /* This call should fail (where we use a source name for OpenEventLog) */
214 hEventLog = OpenEventLogW(NULL, L"Source1");
215 wprintf(L"OpenEventLogW(NULL, Source = %s) ", L"Source1");
216 if (hEventLog)
217 {
218 LPCWSTR String = L"Event from OpenEventLog handle with Source";
219
220 wprintf(L"succeeded\n");
221 Success = ReportEventW(hEventLog, EVENTLOG_INFORMATION_TYPE, 1, 1, NULL, 1, 0, &String, NULL);
222 if (!Success)
223 wprintf(L" Failed to report event\n");
224 }
225 else
226 {
227 wprintf(L"failed\n");
228 }
229 CloseEventLog(hEventLog);
230
231 /* Now use RegisterEventSource */
232 hEventLog = RegisterEventSourceW(NULL, EvtLog);
233 wprintf(L"RegisterEventSourceW(NULL, EvtLog = %s) ", EvtLog);
234 if (hEventLog)
235 {
236 LPCWSTR String = L"Event from RegisterEventSource handle with EvtLog";
237
238 wprintf(L"succeeded\n");
239 Success = ReportEventW(hEventLog, EVENTLOG_INFORMATION_TYPE, 1, 1, NULL, 1, 0, &String, NULL);
240 if (!Success)
241 wprintf(L" Failed to report event\n");
242 }
243 else
244 {
245 wprintf(L"failed\n");
246 }
247 DeregisterEventSource(hEventLog);
248
249 /* Now use RegisterEventSource */
250 hEventLog = RegisterEventSourceW(NULL, L"Source1");
251 wprintf(L"RegisterEventSourceW(NULL, Source = %s) ", L"Source1");
252 if (hEventLog)
253 {
254 LPCWSTR String = L"Event from RegisterEventSource handle with Source";
255
256 wprintf(L"succeeded\n");
257 Success = ReportEventW(hEventLog, EVENTLOG_INFORMATION_TYPE, 1, 1, NULL, 1, 0, &String, NULL);
258 if (!Success)
259 wprintf(L" Failed to report event\n");
260 }
261 else
262 {
263 wprintf(L"failed\n");
264 }
265 DeregisterEventSource(hEventLog);
266
267 /* Now fill the log with one big event */
268 hEventLog = OpenEventLogW(NULL, EvtLog);
269 wprintf(L"OpenEventLogW(NULL, EvtLog = %s) ", EvtLog);
270 if (hEventLog)
271 {
272 // LPWSTR String = L"Big event";
273 PVOID Data;
274
275 wprintf(L"succeeded\n");
276
277 // MaxSize -= (0x30 + 0x28 + 0x300 + 0x40);
278 MaxSize = 0xFC80 - sizeof(EVENTLOGRECORD); // With a StartOffset of 0x14, that should allow seeing the effect of splitting the EOF record in half...
279 Data = HeapAlloc(GetProcessHeap(), 0, MaxSize);
280 if (Data)
281 {
282 RtlFillMemory(Data, MaxSize, 0xCA);
283 Success = ReportEventW(hEventLog, EVENTLOG_INFORMATION_TYPE, 1, 1, NULL, 0 /* 1 */, MaxSize, NULL /* &String */, Data);
284 if (!Success)
285 wprintf(L" Failed to report event\n");
286
288 }
289 }
290 else
291 {
292 wprintf(L"failed\n");
293 }
294 CloseEventLog(hEventLog);
295
296 wprintf(L"Press any key to continue...\n");
297 _getch();
298
299 /* Delete the test event log */
300 RemoveEventLog(EvtLog);
301}
BOOL RemoveEventLog(LPCWSTR EventLogName)
Definition: EvtLogTest.c:104
BOOL CreateEventLog(LPCWSTR EventLogName, UINT MaxSize, UINT SourcesCount, LPCWSTR EventLogSources[])
Definition: EvtLogTest.c:19
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HANDLE WINAPI OpenEventLogW(IN LPCWSTR lpUNCServerName, IN LPCWSTR lpSourceName)
Definition: eventlog.c:985
BOOL WINAPI CloseEventLog(IN HANDLE hEventLog)
Definition: eventlog.c:427
BOOL WINAPI ReportEventW(IN HANDLE hEventLog, IN WORD wType, IN WORD wCategory, IN DWORD dwEventID, IN PSID lpUserSid, IN WORD wNumStrings, IN DWORD dwDataSize, IN LPCWSTR *lpStrings, IN LPVOID lpRawData)
Definition: eventlog.c:1516
BOOL WINAPI DeregisterEventSource(IN HANDLE hEventLog)
Definition: eventlog.c:473
HANDLE WINAPI RegisterEventSourceW(IN LPCWSTR lpUNCServerName, IN LPCWSTR lpSourceName)
Definition: eventlog.c:1295
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:599
int _getch()
Definition: getch.c:16
#define max(a, b)
Definition: svc.c:63
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
#define EVENTLOG_INFORMATION_TYPE
Definition: winnt_old.h:2865
struct _EVENTLOGRECORD EVENTLOGRECORD
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by wmain().

◆ TestMyEventProvider()

VOID TestMyEventProvider ( VOID  )

Definition at line 307 of file EvtLogTest.c.

308{
309 LONG lRet;
310 HKEY hKey = NULL, hSourceKey = NULL;
312 // WCHAR DllPath[] = L"C:\\Users\\ReactOS\\Desktop\\EvtLogTest\\Debug\\" PROVIDER_NAME L".dll";
313 WCHAR DllPath[] = L"C:\\" PROVIDER_NAME L".dll";
314
315 wprintf(L"Testing \"" PROVIDER_NAME L"\" in 'Application' log...");
316
318 L"SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application",
320 &hKey);
321 if (lRet != ERROR_SUCCESS)
322 goto Quit;
323
324 lRet = RegCreateKeyExW(hKey,
328 &hSourceKey, NULL);
329 if (lRet != ERROR_SUCCESS)
330 goto Quit;
331
332 dwData = 3;
333 RegSetValueExW(hSourceKey, L"CategoryCount", 0, REG_DWORD,
334 (LPBYTE)&dwData, sizeof(dwData));
335
337 RegSetValueExW(hSourceKey, L"TypesSupported", 0, REG_DWORD,
338 (LPBYTE)&dwData, sizeof(dwData));
339
340 RegSetValueExW(hSourceKey, L"CategoryMessageFile", 0, REG_SZ,
341 (LPBYTE)DllPath, sizeof(DllPath));
342
343 RegSetValueExW(hSourceKey, L"EventMessageFile", 0, REG_SZ,
344 (LPBYTE)DllPath, sizeof(DllPath));
345
346 RegSetValueExW(hSourceKey, L"ParameterMessageFile", 0, REG_SZ,
347 (LPBYTE)DllPath, sizeof(DllPath));
348
349 RegFlushKey(hSourceKey);
350
351 {
352 CONST LPWSTR pBadCommand = L"The command that was not valid";
353 CONST LPWSTR pFilename = L"c:\\folder\\file.ext";
354 CONST LPWSTR pNumberOfRetries = L"3";
355 CONST LPWSTR pSuccessfulRetries = L"0";
356 CONST LPWSTR pQuarts = L"8";
357 CONST LPWSTR pGallons = L"2";
358
359 HANDLE hEventLog = NULL;
360 LPWSTR pInsertStrings[2] = {NULL, NULL};
361 DWORD dwEventDataSize = 0;
362
363 // The source name (provider) must exist as a subkey of Application.
365 if (NULL == hEventLog)
366 {
367 wprintf(L"RegisterEventSource failed with 0x%x.\n", GetLastError());
368 goto cleanup;
369 }
370
371 // This event includes user-defined data as part of the event.
372 // The event message does not use insert strings.
373 dwEventDataSize = ((DWORD)wcslen(pBadCommand) + 1) * sizeof(WCHAR);
374 if (!ReportEventW(hEventLog, EVENTLOG_ERROR_TYPE, UI_CATEGORY, MSG_INVALID_COMMAND, NULL, 0, dwEventDataSize, NULL, pBadCommand))
375 {
376 wprintf(L"ReportEvent failed with 0x%x for event 0x%x.\n", GetLastError(), MSG_INVALID_COMMAND);
377 goto cleanup;
378 }
379
380 // This event uses insert strings.
381 pInsertStrings[0] = pFilename;
382 if (!ReportEventW(hEventLog, EVENTLOG_ERROR_TYPE, DATABASE_CATEGORY, MSG_BAD_FILE_CONTENTS, NULL, 1, 0, (LPCWSTR*)pInsertStrings, NULL))
383 {
384 wprintf(L"ReportEvent failed with 0x%x for event 0x%x.\n", GetLastError(), MSG_BAD_FILE_CONTENTS);
385 goto cleanup;
386 }
387
388 // This event uses insert strings.
389 pInsertStrings[0] = pNumberOfRetries;
390 pInsertStrings[1] = pSuccessfulRetries;
391 if (!ReportEventW(hEventLog, EVENTLOG_WARNING_TYPE, NETWORK_CATEGORY, MSG_RETRIES, NULL, 2, 0, (LPCWSTR*)pInsertStrings, NULL))
392 {
393 wprintf(L"ReportEvent failed with 0x%x for event 0x%x.\n", GetLastError(), MSG_RETRIES);
394 goto cleanup;
395 }
396
397 // This event uses insert strings.
398 pInsertStrings[0] = pQuarts;
399 pInsertStrings[1] = pGallons;
400 if (!ReportEventW(hEventLog, EVENTLOG_INFORMATION_TYPE, UI_CATEGORY, MSG_COMPUTE_CONVERSION, NULL, 2, 0, (LPCWSTR*)pInsertStrings, NULL))
401 {
402 wprintf(L"ReportEvent failed with 0x%x for event 0x%x.\n", GetLastError(), MSG_COMPUTE_CONVERSION);
403 goto cleanup;
404 }
405
406 wprintf(L"All events successfully reported.\n");
407
408cleanup:
409
410 if (hEventLog)
411 DeregisterEventSource(hEventLog);
412
413 }
414
415Quit:
416 // RegDeleteKeyW(hKey, PROVIDER_NAME);
417
418 if (hKey)
420}
#define PROVIDER_NAME
Definition: EvtLogTest.c:17
static void cleanup(void)
Definition: main.c:1335
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_SZ
Definition: layer.c:22
static const char const char * DllPath
Definition: image.c:34
static HANDLE ULONG_PTR dwData
Definition: file.c:35
#define DWORD
Definition: nt_native.h:44
#define CONST
Definition: pedump.c:81
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define EVENTLOG_ERROR_TYPE
Definition: winnt_old.h:2863
#define EVENTLOG_WARNING_TYPE
Definition: winnt_old.h:2864

Referenced by wmain().

◆ wmain()

int wmain ( int  argc,
WCHAR argv[] 
)

Definition at line 422 of file EvtLogTest.c.

423{
424 UINT Choice = 0;
425
426 wprintf(L"\n"
427 L"EventLog API interactive tester for ReactOS\n"
428 L"===========================================\n"
429 L"\n");
430
431ChoiceMenu:
432 do
433 {
434 wprintf(L"What do you want to do:\n"
435 L"1) Test events generation.\n"
436 L"2) Test customized event provider.\n"
437 L"\n"
438 L"0) Quit the program.\n"
439 L"(Enter the right number, or 0 to quit): ");
440 wscanf(L"%lu", &Choice);
441 wprintf(L"\n\n");
442 } while ((Choice != 0) && (Choice != 1) && (Choice != 2));
443
444 switch (Choice)
445 {
446 case 0:
447 goto Quit;
448 break;
449
450 case 1:
452 break;
453
454 case 2:
456 break;
457
458 default:
459 break;
460 }
461 wprintf(L"\n\n\n\n");
462 goto ChoiceMenu;
463
464Quit:
465 wprintf(L"Press any key to quit...\n");
466 _getch();
467 return 0;
468}
VOID TestMyEventProvider(VOID)
Definition: EvtLogTest.c:307
VOID TestEventsGeneration(VOID)
Definition: EvtLogTest.c:180
_Check_return_ _CRTIMP int __cdecl wscanf(_In_z_ _Scanf_format_string_ const wchar_t *_Format,...)