Author: ekohl
Date: Sat Nov 1 15:37:04 2008
New Revision: 37138
URL:
http://svn.reactos.org/svn/reactos?rev=37138&view=rev
Log:
SEH protect all remote calls to the Eventlog Service.
Modified:
trunk/reactos/dll/win32/advapi32/service/eventlog.c
Modified: trunk/reactos/dll/win32/advapi32/service/eventlog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/service/eventlog.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/service/eventlog.c [iso-8859-1] Sat Nov 1 15:37:04
2008
@@ -156,8 +156,17 @@
BackupFileName.Length = BackupFileName.MaximumLength =
lpBackupFileName ? strlen(lpBackupFileName) : 0;
- Status = ElfrBackupELFA(hEventLog,
- &BackupFileName);
+ _SEH_TRY
+ {
+ Status = ElfrBackupELFA(hEventLog,
+ &BackupFileName);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -187,8 +196,17 @@
BackupFileName.Length = BackupFileName.MaximumLength =
lpBackupFileName ? wcslen(lpBackupFileName) * sizeof(WCHAR) : 0;
- Status = ElfrBackupELFW(hEventLog,
- &BackupFileName);
+ _SEH_TRY
+ {
+ Status = ElfrBackupELFW(hEventLog,
+ &BackupFileName);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -215,8 +233,17 @@
BackupFileName.Length = BackupFileName.MaximumLength =
lpBackupFileName ? strlen(lpBackupFileName) : 0;
- Status = ElfrClearELFA(hEventLog,
- &BackupFileName);
+ _SEH_TRY
+ {
+ Status = ElfrClearELFA(hEventLog,
+ &BackupFileName);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -243,8 +270,17 @@
BackupFileName.Length = BackupFileName.MaximumLength =
lpBackupFileName ? wcslen(lpBackupFileName) * sizeof(WCHAR) : 0;
- Status = ElfrClearELFW(hEventLog,
- &BackupFileName);
+ _SEH_TRY
+ {
+ Status = ElfrClearELFW(hEventLog,
+ &BackupFileName);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -265,7 +301,16 @@
TRACE("%p\n", hEventLog);
- Status = ElfrCloseEL(&hEventLog);
+ _SEH_TRY
+ {
+ Status = ElfrCloseEL(&hEventLog);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -292,7 +337,16 @@
TRACE("%p\n", hEventLog);
- Status = ElfrDeregisterEventSource(&hEventLog);
+ _SEH_TRY
+ {
+ Status = ElfrDeregisterEventSource(&hEventLog);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -319,8 +373,17 @@
TRACE("%p, %p\n", hEventLog, NumberOfRecords);
- Status = ElfrNumberOfRecords(hEventLog,
- &Records);
+ _SEH_TRY
+ {
+ Status = ElfrNumberOfRecords(hEventLog,
+ &Records);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -349,8 +412,17 @@
TRACE("%p, %p\n", hEventLog, OldestRecord);
- Status = ElfrOldestRecord(hEventLog,
- &Oldest);
+ _SEH_TRY
+ {
+ Status = ElfrOldestRecord(hEventLog,
+ &Oldest);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -438,11 +510,20 @@
FileName.Length = FileName.MaximumLength =
lpFileName ? wcslen(lpFileName) * sizeof(WCHAR) : 0;
- Status = ElfrOpenBELW((LPWSTR)lpUNCServerName,
- &FileName,
- 0,
- 0,
- &LogHandle);
+ _SEH_TRY
+ {
+ Status = ElfrOpenBELW((LPWSTR)lpUNCServerName,
+ &FileName,
+ 0,
+ 0,
+ &LogHandle);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -508,12 +589,21 @@
SourceName.Length = SourceName.MaximumLength =
lpSourceName ? wcslen(lpSourceName) * sizeof(WCHAR) : 0;
- Status = ElfrOpenELW((LPWSTR)lpUNCServerName,
- &SourceName,
- &EmptyString,
- 0,
- 0,
- &LogHandle);
+ _SEH_TRY
+ {
+ Status = ElfrOpenELW((LPWSTR)lpUNCServerName,
+ &SourceName,
+ &EmptyString,
+ 0,
+ 0,
+ &LogHandle);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -543,13 +633,22 @@
hEventLog, dwReadFlags, dwRecordOffset, lpBuffer,
nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
- Status = ElfrReadELA(hEventLog,
- dwReadFlags,
- dwRecordOffset,
- nNumberOfBytesToRead,
- lpBuffer,
- &bytesRead,
- &minNumberOfBytesNeeded);
+ _SEH_TRY
+ {
+ Status = ElfrReadELA(hEventLog,
+ dwReadFlags,
+ dwRecordOffset,
+ nNumberOfBytesToRead,
+ lpBuffer,
+ &bytesRead,
+ &minNumberOfBytesNeeded);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -591,13 +690,22 @@
hEventLog, dwReadFlags, dwRecordOffset, lpBuffer,
nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
- Status = ElfrReadELW(hEventLog,
- dwReadFlags,
- dwRecordOffset,
- nNumberOfBytesToRead,
- lpBuffer,
- &bytesRead,
- &minNumberOfBytesNeeded);
+ _SEH_TRY
+ {
+ Status = ElfrReadELW(hEventLog,
+ dwReadFlags,
+ dwRecordOffset,
+ nNumberOfBytesToRead,
+ lpBuffer,
+ &bytesRead,
+ &minNumberOfBytesNeeded);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -673,12 +781,21 @@
SourceName.Length = SourceName.MaximumLength =
lpSourceName ? wcslen(lpSourceName) * sizeof(WCHAR) : 0;
- Status = ElfrRegisterEventSourceW((LPWSTR)lpUNCServerName,
- &SourceName,
- &EmptyString,
- 0,
- 0,
- &LogHandle);
+ _SEH_TRY
+ {
+ Status = ElfrRegisterEventSourceW((LPWSTR)lpUNCServerName,
+ &SourceName,
+ &EmptyString,
+ 0,
+ 0,
+ &LogHandle);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
if (!NT_SUCCESS(Status))
{
SetLastError(RtlNtStatusToDosError(Status));
@@ -792,8 +909,8 @@
WORD i;
TRACE("%p, %u, %u, %lu, %p, %u, %lu, %p, %p\n",
- hEventLog, wType, wCategory, dwEventID, lpUserSid,
- wNumStrings, dwDataSize, lpStrings, lpRawData);
+ hEventLog, wType, wCategory, dwEventID, lpUserSid,
+ wNumStrings, dwDataSize, lpStrings, lpRawData);
Strings = HeapAlloc(GetProcessHeap(),
0,
@@ -807,20 +924,29 @@
for (i = 0; i < wNumStrings; i++)
RtlInitUnicodeString(&Strings[i], lpStrings[i]);
- Status = ElfrReportEventW(hEventLog,
- 0, /* FIXME: Time */
- wType,
- wCategory,
- dwEventID,
- wNumStrings,
- dwDataSize,
- L"", /* FIXME: ComputerName */
- lpUserSid,
- (LPWSTR *)lpStrings, /* FIXME: should be Strings */
- lpRawData,
- 0,
- NULL,
- NULL);
+ _SEH_TRY
+ {
+ Status = ElfrReportEventW(hEventLog,
+ 0, /* FIXME: Time */
+ wType,
+ wCategory,
+ dwEventID,
+ wNumStrings,
+ dwDataSize,
+ L"", /* FIXME: ComputerName */
+ lpUserSid,
+ (LPWSTR *)lpStrings, /* FIXME: should be Strings */
+ lpRawData,
+ 0,
+ NULL,
+ NULL);
+ }
+ _SEH_HANDLE
+ {
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ _SEH_END;
+
HeapFree(GetProcessHeap(), 0, Strings);
if (!NT_SUCCESS(Status))