[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.

svn path=/trunk/; revision=51558
This commit is contained in:
Eric Kohl
2011-05-02 19:38:23 +00:00
parent 702353b092
commit ec3f21cfa2
2 changed files with 5 additions and 2 deletions
@@ -503,7 +503,7 @@ QueryEventMessages(LPWSTR lpMachineName,
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;
+4 -1
View File
@@ -199,6 +199,7 @@ NTSTATUS ElfrNumberOfRecords(
DWORD *NumberOfRecords)
{
PLOGHANDLE lpLogHandle;
DWORD dwRecords;
lpLogHandle = ElfGetLogHandleEntryByHandle(LogHandle);
if (!lpLogHandle)
@@ -206,7 +207,9 @@ NTSTATUS ElfrNumberOfRecords(
return STATUS_INVALID_HANDLE;
}
*NumberOfRecords = lpLogHandle->LogFile->Header.CurrentRecordNumber;
dwRecords = lpLogHandle->LogFile->Header.CurrentRecordNumber;
*NumberOfRecords = (dwRecords > 0) ? (dwRecords - 1) : 0;
return STATUS_SUCCESS;
}