Great work on event service and event viewer... keep it up Eric :)


> Date: Mon, 2 May 2011 19:38:24 +0000
> To: ros-diffs@reactos.org
> From: ekohl@svn.reactos.org
> Subject: [ros-diffs] [ekohl] 51558: [EVENTVWR/EVENTLOG] Fix a double off-by-one bug: - The eventlog service was reporting one event more than was available (+1). - The event viewer did not display the latest event from...
>
> Author: ekohl
> Date: Mon May 2 19:38:23 2011
> New Revision: 51558
>
> URL: http://svn.reactos.org/svn/reactos?rev=51558&view=rev
> Log:
> [EVENTVWR/EVENTLOG]
> Fix a double off-by-one bug:
> - The eventlog service was reporting one event more than was available (+1).
> - The event viewer did not display the latest event from the eventlog service (-1).
>
> See issue #6182 for more details.
>
> Modified:
> trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c
> trunk/reactos/base/services/eventlog/rpc.c
>
> Modified: trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c?rev=51558&r1=51557&r2=51558&view=diff
> ==============================================================================
> --- trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c [iso-8859-1] (original)
> +++ trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c [iso-8859-1] Mon May 2 19:38:23 2011
> @@ -503,7 +503,7 @@
> HWND hwndDlg;
> HANDLE hEventLog;
> EVENTLOGRECORD *pevlr;
> - DWORD dwRead, dwNeeded, dwThisRecord, dwTotalRecords = 0, dwCurrentRecord = 1, dwRecordsToRead = 0, dwFlags, dwMaxLength;
> + DWORD dwRead, dwNeeded, dwThisRecord, dwTotalRecords = 0, dwCurrentRecord = 0, dwRecordsToRead = 0, dwFlags, dwMaxLength;
> LPWSTR lpSourceName;
> LPWSTR lpComputerName;
> LPSTR lpData;
>
> Modified: trunk/reactos/base/services/eventlog/rpc.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/rpc.c?rev=51558&r1=51557&r2=51558&view=diff
> ==============================================================================
> --- trunk/reactos/base/services/eventlog/rpc.c [iso-8859-1] (original)
> +++ trunk/reactos/base/services/eventlog/rpc.c [iso-8859-1] Mon May 2 19:38:23 2011
> @@ -199,6 +199,7 @@
> DWORD *NumberOfRecords)
> {
> PLOGHANDLE lpLogHandle;
> + DWORD dwRecords;
>
> lpLogHandle = ElfGetLogHandleEntryByHandle(LogHandle);
> if (!lpLogHandle)
> @@ -206,7 +207,9 @@
> return STATUS_INVALID_HANDLE;
> }
>
> - *NumberOfRecords = lpLogHandle->LogFile->Header.CurrentRecordNumber;
> + dwRecords = lpLogHandle->LogFile->Header.CurrentRecordNumber;
> +
> + *NumberOfRecords = (dwRecords > 0) ? (dwRecords - 1) : 0;
>
> return STATUS_SUCCESS;
> }
>
>