2 * PROJECT: ReactOS Automatic Testing Utility
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Functions for writing to the Event Log
5 * COPYRIGHT: Copyright 2009 Dmitry Chapyshev (dmitry@reactos.org)
14 WCHAR szBuf
[MAX_PATH
] = L
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\RosAutotest";
15 WCHAR szPath
[MAX_PATH
];
16 DWORD dwCategoryNum
= 1;
20 if (RegCreateKeyExW(HKEY_LOCAL_MACHINE
,
22 REG_OPTION_NON_VOLATILE
,
23 KEY_WRITE
, NULL
, &hKey
, &dwDisp
) != ERROR_SUCCESS
)
28 if (!GetModuleFileName(NULL
, szPath
, sizeof(szPath
) / sizeof(szPath
[0])))
31 if (RegSetValueExW(hKey
,
36 (DWORD
)(wcslen(szPath
) + 1) * sizeof(WCHAR
)) != ERROR_SUCCESS
)
42 dwData
= EVENTLOG_ERROR_TYPE
| EVENTLOG_WARNING_TYPE
|
43 EVENTLOG_INFORMATION_TYPE
;
45 if (RegSetValueExW(hKey
,
50 sizeof(DWORD
)) != ERROR_SUCCESS
)
56 if (RegSetValueExW(hKey
,
57 L
"CategoryMessageFile",
61 (DWORD
)(wcslen(szPath
) + 1) * sizeof(WCHAR
)) != ERROR_SUCCESS
)
67 if (RegSetValueExW(hKey
,
71 (LPBYTE
)&dwCategoryNum
,
72 sizeof(DWORD
)) != ERROR_SUCCESS
)
80 hLog
= RegisterEventSourceW(NULL
, L
"RosAutotest");
87 if (hLog
) DeregisterEventSource(hLog
);
92 WriteLogMessage(WORD wType
, DWORD dwEventID
, LPWSTR lpMsg
)
94 if (!ReportEventW(hLog
,