2 * PROJECT: ReactOS Automatic Testing Utility
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/applications/rapps/misc.c
5 * PURPOSE: Misc functions
6 * PROGRAMMERS: Dmitry Chapyshev (dmitry@reactos.org)
15 WCHAR szBuf
[MAX_PATH
] = L
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\RosAutotest";
16 WCHAR szPath
[MAX_PATH
];
17 DWORD dwCategoryNum
= 1;
21 if (RegCreateKeyExW(HKEY_LOCAL_MACHINE
,
23 REG_OPTION_NON_VOLATILE
,
24 KEY_WRITE
, NULL
, &hKey
, &dwDisp
) != ERROR_SUCCESS
)
29 if (!GetModuleFileName(NULL
, szPath
, sizeof(szPath
) / sizeof(szPath
[0])))
32 if (RegSetValueExW(hKey
,
37 (DWORD
)(wcslen(szPath
) + 1) * sizeof(WCHAR
)) != ERROR_SUCCESS
)
43 dwData
= EVENTLOG_ERROR_TYPE
| EVENTLOG_WARNING_TYPE
|
44 EVENTLOG_INFORMATION_TYPE
;
46 if (RegSetValueExW(hKey
,
51 sizeof(DWORD
)) != ERROR_SUCCESS
)
57 if (RegSetValueExW(hKey
,
58 L
"CategoryMessageFile",
62 (DWORD
)(wcslen(szPath
) + 1) * sizeof(WCHAR
)) != ERROR_SUCCESS
)
68 if (RegSetValueExW(hKey
,
72 (LPBYTE
)&dwCategoryNum
,
73 sizeof(DWORD
)) != ERROR_SUCCESS
)
81 hLog
= RegisterEventSourceW(NULL
, L
"RosAutotest");
88 if (hLog
) DeregisterEventSource(hLog
);
93 WriteLogMessage(WORD wType
, DWORD dwEventID
, LPWSTR lpMsg
)
95 if (!ReportEventW(hLog
,