12#define WIN32_LEAN_AND_MEAN
15#include "MyEventProvider.h"
17#define PROVIDER_NAME L"MyEventProvider"
30 wprintf(
L"Creating log %s of MaxSize 0x%x with %d sources...", EventLogName, MaxSize, SourcesCount);
33 L"SYSTEM\\CurrentControlSet\\Services\\Eventlog",
53 (
LPBYTE)&MaxSize,
sizeof(MaxSize));
71 (
LPBYTE)evtFile,
sizeof(evtFile));
74 for (
i = 0;
i < SourcesCount;
i++)
109 DWORD MaxKeyNameLen, KeyNameLen;
112 wprintf(
L"Deleting log %s...", EventLogName);
115 L"SYSTEM\\CurrentControlSet\\Services\\Eventlog",
141 KeyNameLen = MaxKeyNameLen;
149 KeyNameLen = MaxKeyNameLen;
184 LPCWSTR Sources[] = {
L"Source1",
L"Source2"};
186 ULONG MaxSize =
max(0x30 + 0x28 + 0x200, 0x010000);
192 wprintf(
L"Press any key to continue...\n");
197 wprintf(
L"OpenEventLogW(NULL, EvtLog = %s) ", EvtLog);
205 wprintf(
L" Failed to report event\n");
215 wprintf(
L"OpenEventLogW(NULL, Source = %s) ",
L"Source1");
223 wprintf(
L" Failed to report event\n");
233 wprintf(
L"RegisterEventSourceW(NULL, EvtLog = %s) ", EvtLog);
236 LPCWSTR String =
L"Event from RegisterEventSource handle with EvtLog";
241 wprintf(
L" Failed to report event\n");
251 wprintf(
L"RegisterEventSourceW(NULL, Source = %s) ",
L"Source1");
254 LPCWSTR String =
L"Event from RegisterEventSource handle with Source";
259 wprintf(
L" Failed to report event\n");
269 wprintf(
L"OpenEventLogW(NULL, EvtLog = %s) ", EvtLog);
285 wprintf(
L" Failed to report event\n");
296 wprintf(
L"Press any key to continue...\n");
318 L"SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application",
352 CONST LPWSTR pBadCommand =
L"The command that was not valid";
361 DWORD dwEventDataSize = 0;
365 if (
NULL == hEventLog)
376 wprintf(
L"ReportEvent failed with 0x%x for event 0x%x.\n",
GetLastError(), MSG_INVALID_COMMAND);
381 pInsertStrings[0] = pFilename;
384 wprintf(
L"ReportEvent failed with 0x%x for event 0x%x.\n",
GetLastError(), MSG_BAD_FILE_CONTENTS);
389 pInsertStrings[0] = pNumberOfRetries;
390 pInsertStrings[1] = pSuccessfulRetries;
398 pInsertStrings[0] = pQuarts;
399 pInsertStrings[1] = pGallons;
402 wprintf(
L"ReportEvent failed with 0x%x for event 0x%x.\n",
GetLastError(), MSG_COMPUTE_CONVERSION);
406 wprintf(
L"All events successfully reported.\n");
427 L"EventLog API interactive tester for ReactOS\n"
428 L"===========================================\n"
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"
438 L"0) Quit the program.\n"
439 L"(Enter the right number, or 0 to quit): ");
442 }
while ((Choice != 0) && (Choice != 1) && (Choice != 2));
465 wprintf(
L"Press any key to quit...\n");
VOID TestMyEventProvider(VOID)
BOOL RemoveEventLog(LPCWSTR EventLogName)
VOID TestEventsGeneration(VOID)
BOOL CreateEventLog(LPCWSTR EventLogName, UINT MaxSize, UINT SourcesCount, LPCWSTR EventLogSources[])
#define RegCloseKey(hKey)
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)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
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)
LONG WINAPI RegFlushKey(HKEY hKey)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
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)
HANDLE WINAPI OpenEventLogW(IN LPCWSTR lpUNCServerName, IN LPCWSTR lpSourceName)
BOOL WINAPI CloseEventLog(IN HANDLE hEventLog)
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)
BOOL WINAPI DeregisterEventSource(IN HANDLE hEventLog)
HANDLE WINAPI RegisterEventSourceW(IN LPCWSTR lpUNCServerName, IN LPCWSTR lpSourceName)
#define HeapFree(x, y, z)
static void cleanup(void)
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
_Check_return_ _CRTIMP int __cdecl wscanf(_In_z_ _Scanf_format_string_ const wchar_t *_Format,...)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define RtlFillMemory(Dest, Length, Fill)
static const char const char * DllPath
static HANDLE ULONG_PTR dwData
#define KEY_CREATE_SUB_KEY
#define REG_OPTION_NON_VOLATILE
#define KEY_ENUMERATE_SUB_KEYS
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
DWORD WINAPI GetLastError(void)
#define EVENTLOG_ERROR_TYPE
#define EVENTLOG_INFORMATION_TYPE
struct _EVENTLOGRECORD EVENTLOGRECORD
#define EVENTLOG_WARNING_TYPE
#define HKEY_LOCAL_MACHINE