Author: ekohl
Date: Fri Oct 8 18:48:54 2010
New Revision: 49055
URL:
http://svn.reactos.org/svn/reactos?rev=49055&view=rev
Log:
[EVENTLOG]
Rename the EVENTSOURCE struct to LOGHANDLE because it is currently used like a handle
object. The EVENTSOURCE struct will be added again in one of the next commits.
Modified:
trunk/reactos/base/services/eventlog/eventlog.h
trunk/reactos/base/services/eventlog/rpc.c
Modified: trunk/reactos/base/services/eventlog/eventlog.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/eve…
==============================================================================
--- trunk/reactos/base/services/eventlog/eventlog.h [iso-8859-1] (original)
+++ trunk/reactos/base/services/eventlog/eventlog.h [iso-8859-1] Fri Oct 8 18:48:54 2010
@@ -93,6 +93,7 @@
LIST_ENTRY ListEntry;
} LOGFILE, *PLOGFILE;
+#if 0
typedef struct _EVENTSOURCE
{
LIST_ENTRY EventSourceListEntry;
@@ -100,6 +101,15 @@
ULONG CurrentRecord;
WCHAR szName[1];
} EVENTSOURCE, *PEVENTSOURCE;
+#endif
+
+typedef struct _LOGHANDLE
+{
+ LIST_ENTRY LogHandleListEntry;
+ PLOGFILE LogFile;
+ ULONG CurrentRecord;
+ WCHAR szName[1];
+} LOGHANDLE, *PLOGHANDLE;
/* file.c */
VOID LogfListInitialize(VOID);
Modified: trunk/reactos/base/services/eventlog/rpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/rpc…
==============================================================================
--- trunk/reactos/base/services/eventlog/rpc.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/eventlog/rpc.c [iso-8859-1] Fri Oct 8 18:48:54 2010
@@ -11,7 +11,7 @@
#include "eventlog.h"
-LIST_ENTRY EventSourceListHead;
+LIST_ENTRY LogHandleListHead;
/* FUNCTIONS ****************************************************************/
@@ -19,7 +19,7 @@
{
RPC_STATUS Status;
- InitializeListHead(&EventSourceListHead);
+ InitializeListHead(&LogHandleListHead);
Status = RpcServerUseProtseqEpW(L"ncacn_np", 20,
L"\\pipe\\EventLog", NULL);
if (Status != RPC_S_OK)
@@ -44,21 +44,21 @@
return 0;
}
-PEVENTSOURCE ElfCreateEventLogHandle(LPCWSTR Name, BOOL Create)
-{
- PEVENTSOURCE lpEventSource;
+PLOGHANDLE ElfCreateEventLogHandle(LPCWSTR Name, BOOL Create)
+{
+ PLOGHANDLE lpLogHandle;
PLOGFILE currentLogFile = NULL;
INT i, LogsActive;
- lpEventSource = HeapAlloc(GetProcessHeap(), 0, sizeof(EVENTSOURCE)
+ lpLogHandle = HeapAlloc(GetProcessHeap(), 0, sizeof(LOGHANDLE)
+ ((wcslen(Name) + 1) * sizeof(WCHAR)));
- if (!lpEventSource)
+ if (!lpLogHandle)
{
DPRINT1("Failed to allocate Heap!\n");
return NULL;
}
- wcscpy(lpEventSource->szName, Name);
+ wcscpy(lpLogHandle->szName, Name);
/* Get the number of Log Files the EventLog service found */
LogsActive = LogfListItemCount();
@@ -70,9 +70,9 @@
/* If Creating, default to the Application Log in case we fail, as documented on MSDN
*/
if (Create == TRUE)
- lpEventSource->LogFile = LogfListItemByName(L"Application");
+ lpLogHandle->LogFile = LogfListItemByName(L"Application");
else
- lpEventSource->LogFile = NULL;
+ lpLogHandle->LogFile = NULL;
for (i = 1; i <= LogsActive; i++)
{
@@ -80,49 +80,50 @@
if (_wcsicmp(Name, currentLogFile->LogName) == 0)
{
- lpEventSource->LogFile = LogfListItemByIndex(i);
- lpEventSource->CurrentRecord =
LogfGetOldestRecord(lpEventSource->LogFile);
+ lpLogHandle->LogFile = LogfListItemByIndex(i);
+ lpLogHandle->CurrentRecord =
LogfGetOldestRecord(lpLogHandle->LogFile);
break;
}
}
- if (!lpEventSource->LogFile)
+ if (!lpLogHandle->LogFile)
goto Cleanup;
- /* Append service record */
- InsertTailList(&EventSourceListHead,
&lpEventSource->EventSourceListEntry);
-
- return lpEventSource;
+ /* Append log handle */
+ InsertTailList(&LogHandleListHead, &lpLogHandle->LogHandleListEntry);
+
+ return lpLogHandle;
Cleanup:
- HeapFree(GetProcessHeap(), 0, lpEventSource);
+ HeapFree(GetProcessHeap(), 0, lpLogHandle);
return NULL;
}
-PEVENTSOURCE ElfGetEventLogSourceEntryByHandle(IELF_HANDLE EventLogHandle)
-{
- PEVENTSOURCE CurrentEventSource;
-
- if (IsListEmpty(&EventSourceListHead))
+PLOGHANDLE ElfGetLogHandleEntryByHandle(IELF_HANDLE EventLogHandle)
+{
+ PLOGHANDLE lpLogHandle;
+
+ if (IsListEmpty(&LogHandleListHead))
{
return NULL;
}
- CurrentEventSource = CONTAINING_RECORD((PEVENTSOURCE)EventLogHandle, EVENTSOURCE,
EventSourceListEntry);
-
- return CurrentEventSource;
+
+ lpLogHandle = CONTAINING_RECORD((PLOGHANDLE)EventLogHandle, LOGHANDLE,
LogHandleListEntry);
+
+ return lpLogHandle;
}
BOOL ElfDeleteEventLogHandle(IELF_HANDLE EventLogHandle)
{
- PEVENTSOURCE lpEventSource = (PEVENTSOURCE)EventLogHandle;
- if (!ElfGetEventLogSourceEntryByHandle(lpEventSource))
+ PLOGHANDLE lpLogHandle = (PLOGHANDLE)EventLogHandle;
+ if (!ElfGetLogHandleEntryByHandle(lpLogHandle))
{
return FALSE;
}
- RemoveEntryList(&lpEventSource->EventSourceListEntry);
- HeapFree(GetProcessHeap(),0,lpEventSource);
+ RemoveEntryList(&lpLogHandle->LogHandleListEntry);
+ HeapFree(GetProcessHeap(),0,lpLogHandle);
return TRUE;
}
@@ -177,15 +178,15 @@
IELF_HANDLE LogHandle,
DWORD *NumberOfRecords)
{
- PEVENTSOURCE lpEventSource;
-
- lpEventSource = ElfGetEventLogSourceEntryByHandle(LogHandle);
- if (!lpEventSource)
+ PLOGHANDLE lpLogHandle;
+
+ lpLogHandle = ElfGetLogHandleEntryByHandle(LogHandle);
+ if (!lpLogHandle)
{
return STATUS_INVALID_HANDLE;
}
- *NumberOfRecords = lpEventSource->LogFile->Header.CurrentRecordNumber;
+ *NumberOfRecords = lpLogHandle->LogFile->Header.CurrentRecordNumber;
return STATUS_SUCCESS;
}
@@ -196,10 +197,10 @@
IELF_HANDLE LogHandle,
DWORD *OldestRecordNumber)
{
- PEVENTSOURCE lpEventSource;
-
- lpEventSource = ElfGetEventLogSourceEntryByHandle(LogHandle);
- if (!lpEventSource)
+ PLOGHANDLE lpLogHandle;
+
+ lpLogHandle = ElfGetLogHandleEntryByHandle(LogHandle);
+ if (!lpLogHandle)
{
return STATUS_INVALID_HANDLE;
}
@@ -210,7 +211,7 @@
}
*OldestRecordNumber = 0;
- *OldestRecordNumber = LogfGetOldestRecord(lpEventSource->LogFile);
+ *OldestRecordNumber = LogfGetOldestRecord(lpLogHandle->LogFile);
return STATUS_SUCCESS;
}
@@ -306,12 +307,12 @@
DWORD *NumberOfBytesRead,
DWORD *MinNumberOfBytesNeeded)
{
- PEVENTSOURCE lpEventSource;
+ PLOGHANDLE lpLogHandle;
DWORD dwError;
DWORD RecordNumber;
- lpEventSource = ElfGetEventLogSourceEntryByHandle(LogHandle);
- if (!lpEventSource)
+ lpLogHandle = ElfGetLogHandleEntryByHandle(LogHandle);
+ if (!lpLogHandle)
{
return STATUS_INVALID_HANDLE;
}
@@ -322,20 +323,20 @@
/* If sequential read, retrieve the CurrentRecord from this log handle */
if (ReadFlags & EVENTLOG_SEQUENTIAL_READ)
{
- RecordNumber = lpEventSource->CurrentRecord;
+ RecordNumber = lpLogHandle->CurrentRecord;
}
else
{
RecordNumber = RecordOffset;
}
- dwError = LogfReadEvent(lpEventSource->LogFile, ReadFlags, &RecordNumber,
+ dwError = LogfReadEvent(lpLogHandle->LogFile, ReadFlags, &RecordNumber,
NumberOfBytesToRead, Buffer, NumberOfBytesRead,
MinNumberOfBytesNeeded);
/* Update the handles CurrentRecord if success*/
if (dwError == ERROR_SUCCESS)
{
- lpEventSource->CurrentRecord = RecordNumber;
+ lpLogHandle->CurrentRecord = RecordNumber;
}
return I_RpcMapWin32Status(dwError);
@@ -361,7 +362,7 @@
{
USHORT i;
PBYTE LogBuffer;
- PEVENTSOURCE lpEventSource;
+ PLOGHANDLE lpLogHandle;
DWORD lastRec;
DWORD recSize;
DWORD dwStringsSize = 0;
@@ -369,8 +370,8 @@
WCHAR *lpStrings;
int pos = 0;
- lpEventSource = ElfGetEventLogSourceEntryByHandle(LogHandle);
- if (!lpEventSource)
+ lpLogHandle = ElfGetLogHandleEntryByHandle(LogHandle);
+ if (!lpLogHandle)
{
return STATUS_INVALID_HANDLE;
}
@@ -381,7 +382,7 @@
return STATUS_INVALID_PARAMETER;
}
- lastRec = LogfGetCurrentRecord(lpEventSource->LogFile);
+ lastRec = LogfGetCurrentRecord(lpLogHandle->LogFile);
for (i = 0; i < NumStrings; i++)
{
@@ -428,7 +429,7 @@
EventType,
EventCategory,
EventID,
- lpEventSource->szName,
+ lpLogHandle->szName,
ComputerName->Buffer,
sizeof(UserSID),
&UserSID,
@@ -437,10 +438,10 @@
DataSize,
Data);
- dwError = LogfWriteData(lpEventSource->LogFile, recSize, LogBuffer);
+ dwError = LogfWriteData(lpLogHandle->LogFile, recSize, LogBuffer);
if (!dwError)
{
- DPRINT1("ERROR WRITING TO EventLog
%S\n",lpEventSource->LogFile->FileName);
+ DPRINT1("ERROR WRITING TO EventLog %S\n",
lpLogHandle->LogFile->FileName);
}
LogfFreeRecord(LogBuffer);