[EVENTLOG]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 31 Dec 2011 15:23:59 +0000 (15:23 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 31 Dec 2011 15:23:59 +0000 (15:23 +0000)
Fix the record number hacks in ElfrNumberOfRecords and LogfWriteData by initializing the oldest record number to 1.

svn path=/trunk/; revision=54794

reactos/base/services/eventlog/file.c
reactos/base/services/eventlog/rpc.c

index 8e5c2a1..7d27b95 100644 (file)
@@ -34,6 +34,7 @@ BOOL LogfInitializeNew(PLOGFILE LogFile)
     LogFile->Header.MajorVersion = MAJORVER;
     LogFile->Header.MinorVersion = MINORVER;
     LogFile->Header.CurrentRecordNumber = 1;
+    LogFile->Header.OldestRecordNumber = 1;
     /* FIXME: Read MaxSize from registry for this LogFile.
        But for now limit EventLog size to just under 5K. */
     LogFile->Header.MaxSize = 5000;
@@ -986,9 +987,6 @@ BOOL LogfWriteData(PLOGFILE LogFile, DWORD BufSize, PBYTE Buffer)
 
     LogFile->Header.CurrentRecordNumber++;
 
-    if (LogFile->Header.OldestRecordNumber == 0)
-        LogFile->Header.OldestRecordNumber = 1;
-
     if (WriteOffSet == LogFile->Header.EndOffset)
     {
         LogFile->Header.EndOffset += dwWritten;
index 8c7ec4e..915e35d 100644 (file)
@@ -243,11 +243,8 @@ NTSTATUS ElfrNumberOfRecords(
            lpLogFile->Header.OldestRecordNumber,
            lpLogFile->Header.CurrentRecordNumber);
 
-    if (lpLogFile->Header.OldestRecordNumber == 0)
-        *NumberOfRecords = 0;
-    else
-        *NumberOfRecords = lpLogFile->Header.CurrentRecordNumber -
-                           lpLogFile->Header.OldestRecordNumber;
+    *NumberOfRecords = lpLogFile->Header.CurrentRecordNumber -
+                       lpLogFile->Header.OldestRecordNumber;
 
     return STATUS_SUCCESS;
 }
@@ -271,8 +268,8 @@ NTSTATUS ElfrOldestRecord(
         return STATUS_INVALID_PARAMETER;
     }
 
-    *OldestRecordNumber = 0;
     *OldestRecordNumber = LogfGetOldestRecord(lpLogHandle->LogFile);
+
     return STATUS_SUCCESS;
 }