From 12db7cf9dceac3a1476b810dc0c0a5d1204a60dd Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Fri, 6 May 2016 13:15:29 -0700 Subject: [PATCH] dll: add eventlog.mc and related files --- build/VStudio/winfsp_dll.vcxproj | 1 + build/VStudio/winfsp_dll.vcxproj.filters | 3 ++ src/dll/eventlog.c | 40 ++++---------- src/dll/eventlog/eventlog.h | 63 +++++++++++++++++++++++ src/dll/eventlog/eventlog.mc | 20 +++++++ src/dll/eventlog/eventlog.rc | 2 + src/dll/eventlog/eventlog_MSG00001.bin | Bin 0 -> 88 bytes src/dll/eventlog/runmc.bat | 5 ++ 8 files changed, 103 insertions(+), 31 deletions(-) create mode 100644 src/dll/eventlog/eventlog.h create mode 100644 src/dll/eventlog/eventlog.mc create mode 100644 src/dll/eventlog/eventlog.rc create mode 100644 src/dll/eventlog/eventlog_MSG00001.bin create mode 100644 src/dll/eventlog/runmc.bat diff --git a/build/VStudio/winfsp_dll.vcxproj b/build/VStudio/winfsp_dll.vcxproj index 8b634a97..0f9638e6 100644 --- a/build/VStudio/winfsp_dll.vcxproj +++ b/build/VStudio/winfsp_dll.vcxproj @@ -42,6 +42,7 @@ + _UNICODE;UNICODE;%(PreprocessorDefinitions);MyProductName=$(MyProductName);MyDescription=$(MyDescription);MyCompanyName=$(MyCompanyName);MyCopyright=$(MyCopyright);MyVersion=$(MyVersion);MyVersionWithCommas=$(MyVersionWithCommas) _UNICODE;UNICODE;%(PreprocessorDefinitions);MyProductName=$(MyProductName);MyDescription=$(MyDescription);MyCompanyName=$(MyCompanyName);MyCopyright=$(MyCopyright);MyVersion=$(MyVersion);MyVersionWithCommas=$(MyVersionWithCommas) diff --git a/build/VStudio/winfsp_dll.vcxproj.filters b/build/VStudio/winfsp_dll.vcxproj.filters index bc3fc63d..d015fe01 100644 --- a/build/VStudio/winfsp_dll.vcxproj.filters +++ b/build/VStudio/winfsp_dll.vcxproj.filters @@ -71,5 +71,8 @@ Source + + Source + \ No newline at end of file diff --git a/src/dll/eventlog.c b/src/dll/eventlog.c index c8f3cd0c..e50d06db 100644 --- a/src/dll/eventlog.c +++ b/src/dll/eventlog.c @@ -17,6 +17,7 @@ #include #include +#include "eventlog/eventlog.h" static HANDLE FspEventLogHandle; static INIT_ONCE FspEventLogInitOnce = INIT_ONCE_STATIC_INIT; @@ -46,41 +47,18 @@ FSP_API VOID FspEventLogV(ULONG Type, PWSTR Format, va_list ap) Buf[(sizeof Buf / sizeof Buf[0]) - 1] = L'\0'; Strings[0] = Buf; - /* - * Event Identifier Format: - * - * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 - * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +---+-+-+-----------------------+-------------------------------+ - * |Sev|C|R| Facility | Code | - * +---+-+-+-----------------------+-------------------------------+ - * - * Sev - Severity: - * 00 - Success - * 01 - Informational - * 10 - Warning - * 11 - Error - * - * C - Customer: - * 0 - System code - * 1 - Customer code - * - * R - Reserved - * - * See https://msdn.microsoft.com/en-us/library/windows/desktop/aa363651(v=vs.85).aspx - */ switch (Type) { - case EVENTLOG_ERROR_TYPE: - EventId = 0xd0000001; - break; - case EVENTLOG_WARNING_TYPE: - EventId = 0xc0000001; - break; + default: case EVENTLOG_INFORMATION_TYPE: case EVENTLOG_SUCCESS: - default: - EventId = 0x60000001; + EventId = FSP_EVENTLOG_INFORMATION; + break; + case EVENTLOG_WARNING_TYPE: + EventId = FSP_EVENTLOG_WARNING; + break; + case EVENTLOG_ERROR_TYPE: + EventId = FSP_EVENTLOG_ERROR; break; } diff --git a/src/dll/eventlog/eventlog.h b/src/dll/eventlog/eventlog.h new file mode 100644 index 00000000..30650ada --- /dev/null +++ b/src/dll/eventlog/eventlog.h @@ -0,0 +1,63 @@ +// +// Values are 32 bit values laid out as follows: +// +// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 +// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +// +---+-+-+-----------------------+-------------------------------+ +// |Sev|C|R| Facility | Code | +// +---+-+-+-----------------------+-------------------------------+ +// +// where +// +// Sev - is the severity code +// +// 00 - Success +// 01 - Informational +// 10 - Warning +// 11 - Error +// +// C - is the Customer code flag +// +// R - is a reserved bit +// +// Facility - is the facility code +// +// Code - is the facility's status code +// +// +// Define the facility codes +// + + +// +// Define the severity codes +// + + +// +// MessageId: FSP_EVENTLOG_INFORMATION +// +// MessageText: +// +// %1 +// +#define FSP_EVENTLOG_INFORMATION 0x60000001L + +// +// MessageId: FSP_EVENTLOG_WARNING +// +// MessageText: +// +// %1 +// +#define FSP_EVENTLOG_WARNING 0xA0000001L + +// +// MessageId: FSP_EVENTLOG_ERROR +// +// MessageText: +// +// %1 +// +#define FSP_EVENTLOG_ERROR 0xE0000001L + diff --git a/src/dll/eventlog/eventlog.mc b/src/dll/eventlog/eventlog.mc new file mode 100644 index 00000000..c61c9576 --- /dev/null +++ b/src/dll/eventlog/eventlog.mc @@ -0,0 +1,20 @@ +MessageId=1 +Severity=Informational +SymbolicName=FSP_EVENTLOG_INFORMATION +Language=English +%1 +. + +MessageId=1 +Severity=Warning +SymbolicName=FSP_EVENTLOG_WARNING +Language=English +%1 +. + +MessageId=1 +Severity=Error +SymbolicName=FSP_EVENTLOG_ERROR +Language=English +%1 +. diff --git a/src/dll/eventlog/eventlog.rc b/src/dll/eventlog/eventlog.rc new file mode 100644 index 00000000..a1b5dc5a --- /dev/null +++ b/src/dll/eventlog/eventlog.rc @@ -0,0 +1,2 @@ +LANGUAGE 0x9,0x1 +1 11 "eventlog_MSG00001.bin" diff --git a/src/dll/eventlog/eventlog_MSG00001.bin b/src/dll/eventlog/eventlog_MSG00001.bin new file mode 100644 index 0000000000000000000000000000000000000000..7be1691dddf4a7d0cddd8ca69ebe209f3937d6c8 GIT binary patch literal 88 ucmZQ(U|?WmU`POA4G4PykiEbH!hQf`Kkxvu1%Rql84MYC8MuHv!h8Tidj;$O literal 0 HcmV?d00001 diff --git a/src/dll/eventlog/runmc.bat b/src/dll/eventlog/runmc.bat new file mode 100644 index 00000000..b54bc0e4 --- /dev/null +++ b/src/dll/eventlog/runmc.bat @@ -0,0 +1,5 @@ +@echo off + +call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" + +mc -b -c eventlog.mc