[EVENTLOG]
authorEric Kohl <eric.kohl@reactos.org>
Thu, 5 May 2011 20:27:05 +0000 (20:27 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Thu, 5 May 2011 20:27:05 +0000 (20:27 +0000)
Fix the calculation of the number of event records.

svn path=/trunk/; revision=51598

reactos/base/services/eventlog/rpc.c

index 5991da7..0f1a8ac 100644 (file)
@@ -199,7 +199,7 @@ NTSTATUS ElfrNumberOfRecords(
     DWORD *NumberOfRecords)
 {
     PLOGHANDLE lpLogHandle;
-    DWORD dwRecords;
+    PLOGFILE lpLogFile;
 
     lpLogHandle = ElfGetLogHandleEntryByHandle(LogHandle);
     if (!lpLogHandle)
@@ -207,9 +207,13 @@ NTSTATUS ElfrNumberOfRecords(
         return STATUS_INVALID_HANDLE;
     }
 
-    dwRecords = lpLogHandle->LogFile->Header.CurrentRecordNumber;
+    lpLogFile = lpLogHandle->LogFile;
 
-    *NumberOfRecords = (dwRecords > 0) ? (dwRecords - 1) : 0;
+    if (lpLogFile->Header.OldestRecordNumber == 0)
+        *NumberOfRecords = 0;
+    else
+        *NumberOfRecords = lpLogFile->Header.CurrentRecordNumber -
+                           lpLogFile->Header.OldestRecordNumber;
 
     return STATUS_SUCCESS;
 }