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
HWND hwndDlg;
HANDLE hEventLog;
EVENTLOGRECORD *pevlr;
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;
LPWSTR lpSourceName;
LPWSTR lpComputerName;
LPSTR lpData;
DWORD *NumberOfRecords)
{
PLOGHANDLE lpLogHandle;
DWORD *NumberOfRecords)
{
PLOGHANDLE lpLogHandle;
lpLogHandle = ElfGetLogHandleEntryByHandle(LogHandle);
if (!lpLogHandle)
lpLogHandle = ElfGetLogHandleEntryByHandle(LogHandle);
if (!lpLogHandle)
return STATUS_INVALID_HANDLE;
}
return STATUS_INVALID_HANDLE;
}
- *NumberOfRecords = lpLogHandle->LogFile->Header.CurrentRecordNumber;
+ dwRecords = lpLogHandle->LogFile->Header.CurrentRecordNumber;
+
+ *NumberOfRecords = (dwRecords > 0) ? (dwRecords - 1) : 0;