mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-08 04:52:10 -05:00
dll: eventlog: move source under Application and other improvements
This commit is contained in:
parent
68d79b0c3b
commit
99a1e331b5
@ -28,6 +28,8 @@ static BOOL WINAPI FspEventLogInitialize(
|
|||||||
PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context)
|
PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context)
|
||||||
{
|
{
|
||||||
FspEventLogHandle = RegisterEventSourceW(0, L"" FSP_EVENTLOG_NAME);
|
FspEventLogHandle = RegisterEventSourceW(0, L"" FSP_EVENTLOG_NAME);
|
||||||
|
if (0 == FspEventLogHandle)
|
||||||
|
FspEventLogHandle = RegisterEventSourceW(0, FspDiagIdent());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,13 +62,15 @@ FSP_API VOID FspEventLogV(ULONG Type, PWSTR Format, va_list ap)
|
|||||||
if (0 == FspEventLogHandle)
|
if (0 == FspEventLogHandle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WCHAR Buf[1024], *Strings[1];
|
WCHAR Buf[1024], *Strings[2];
|
||||||
/* wvsprintfW is only safe with a 1024 WCHAR buffer */
|
/* wvsprintfW is only safe with a 1024 WCHAR buffer */
|
||||||
DWORD EventId;
|
DWORD EventId;
|
||||||
|
|
||||||
|
Strings[0] = FspDiagIdent();
|
||||||
|
|
||||||
wvsprintfW(Buf, Format, ap);
|
wvsprintfW(Buf, Format, ap);
|
||||||
Buf[(sizeof Buf / sizeof Buf[0]) - 1] = L'\0';
|
Buf[(sizeof Buf / sizeof Buf[0]) - 1] = L'\0';
|
||||||
Strings[0] = Buf;
|
Strings[1] = Buf;
|
||||||
|
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
@ -83,7 +87,7 @@ FSP_API VOID FspEventLogV(ULONG Type, PWSTR Format, va_list ap)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReportEventW(FspEventLogHandle, (WORD)Type, 0, EventId, 0, 1, 0, Strings, 0);
|
ReportEventW(FspEventLogHandle, (WORD)Type, 0, EventId, 0, 2, 0, Strings, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS FspEventLogRegister(VOID)
|
NTSTATUS FspEventLogRegister(VOID)
|
||||||
@ -97,7 +101,7 @@ NTSTATUS FspEventLogRegister(VOID)
|
|||||||
return FspNtStatusFromWin32(GetLastError());
|
return FspNtStatusFromWin32(GetLastError());
|
||||||
|
|
||||||
RegResult = RegCreateKeyExW(
|
RegResult = RegCreateKeyExW(
|
||||||
HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\System\\" FSP_EVENTLOG_NAME,
|
HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\" FSP_EVENTLOG_NAME,
|
||||||
0, 0, 0, KEY_ALL_ACCESS, 0, &RegKey, 0);
|
0, 0, 0, KEY_ALL_ACCESS, 0, &RegKey, 0);
|
||||||
if (ERROR_SUCCESS != RegResult)
|
if (ERROR_SUCCESS != RegResult)
|
||||||
return FspNtStatusFromWin32(RegResult);
|
return FspNtStatusFromWin32(RegResult);
|
||||||
@ -127,7 +131,7 @@ NTSTATUS FspEventLogUnregister(VOID)
|
|||||||
DWORD RegResult;
|
DWORD RegResult;
|
||||||
|
|
||||||
RegResult = RegDeleteTreeW(
|
RegResult = RegDeleteTreeW(
|
||||||
HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\System\\" FSP_EVENTLOG_NAME);
|
HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\" FSP_EVENTLOG_NAME);
|
||||||
if (ERROR_SUCCESS != RegResult && ERROR_FILE_NOT_FOUND != RegResult)
|
if (ERROR_SUCCESS != RegResult && ERROR_FILE_NOT_FOUND != RegResult)
|
||||||
return FspNtStatusFromWin32(RegResult);
|
return FspNtStatusFromWin32(RegResult);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
//
|
//
|
||||||
// MessageText:
|
// MessageText:
|
||||||
//
|
//
|
||||||
// %1
|
// %1: %2
|
||||||
//
|
//
|
||||||
#define FSP_EVENTLOG_INFORMATION 0x60000001L
|
#define FSP_EVENTLOG_INFORMATION 0x60000001L
|
||||||
|
|
||||||
@ -48,7 +48,7 @@
|
|||||||
//
|
//
|
||||||
// MessageText:
|
// MessageText:
|
||||||
//
|
//
|
||||||
// %1
|
// %1: %2
|
||||||
//
|
//
|
||||||
#define FSP_EVENTLOG_WARNING 0xA0000001L
|
#define FSP_EVENTLOG_WARNING 0xA0000001L
|
||||||
|
|
||||||
@ -57,7 +57,7 @@
|
|||||||
//
|
//
|
||||||
// MessageText:
|
// MessageText:
|
||||||
//
|
//
|
||||||
// %1
|
// %1: %2
|
||||||
//
|
//
|
||||||
#define FSP_EVENTLOG_ERROR 0xE0000001L
|
#define FSP_EVENTLOG_ERROR 0xE0000001L
|
||||||
|
|
||||||
|
@ -2,19 +2,19 @@ MessageId=1
|
|||||||
Severity=Informational
|
Severity=Informational
|
||||||
SymbolicName=FSP_EVENTLOG_INFORMATION
|
SymbolicName=FSP_EVENTLOG_INFORMATION
|
||||||
Language=English
|
Language=English
|
||||||
%1
|
%1: %2
|
||||||
.
|
.
|
||||||
|
|
||||||
MessageId=1
|
MessageId=1
|
||||||
Severity=Warning
|
Severity=Warning
|
||||||
SymbolicName=FSP_EVENTLOG_WARNING
|
SymbolicName=FSP_EVENTLOG_WARNING
|
||||||
Language=English
|
Language=English
|
||||||
%1
|
%1: %2
|
||||||
.
|
.
|
||||||
|
|
||||||
MessageId=1
|
MessageId=1
|
||||||
Severity=Error
|
Severity=Error
|
||||||
SymbolicName=FSP_EVENTLOG_ERROR
|
SymbolicName=FSP_EVENTLOG_ERROR
|
||||||
Language=English
|
Language=English
|
||||||
%1
|
%1: %2
|
||||||
.
|
.
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user