Author: ekohl
Date: Sun Dec 25 00:57:16 2011
New Revision: 54751
URL:
http://svn.reactos.org/svn/reactos?rev=54751&view=rev
Log:
[EVENTLOG]
Partially revert r54678.
Modified:
trunk/reactos/base/services/eventlog/eventlog.c
trunk/reactos/base/services/eventlog/eventlog.h
trunk/reactos/base/services/eventlog/file.c
trunk/reactos/base/services/eventlog/logport.c
trunk/reactos/base/services/eventlog/rpc.c
Modified: trunk/reactos/base/services/eventlog/eventlog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/eve…
==============================================================================
--- trunk/reactos/base/services/eventlog/eventlog.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/eventlog/eventlog.c [iso-8859-1] Sun Dec 25 00:57:16 2011
@@ -463,6 +463,20 @@
uUCT.ll = uUCT.ll * 10000000 + u1970.ll;
FileTimeToLocalFileTime(&uUCT.ft, &ftLocal);
FileTimeToSystemTime(&ftLocal, pSystemTime);
+}
+
+VOID SystemTimeToEventTime(SYSTEMTIME * pSystemTime, DWORD * pEventTime)
+{
+ SYSTEMTIME st1970 = { 1970, 1, 0, 1, 0, 0, 0, 0 };
+ union
+ {
+ FILETIME ft;
+ ULONGLONG ll;
+ } Time, u1970;
+
+ SystemTimeToFileTime(pSystemTime, &Time.ft);
+ SystemTimeToFileTime(&st1970, &u1970.ft);
+ *pEventTime = (DWORD)((Time.ll - u1970.ll) / 10000000ull);
}
VOID PRINT_HEADER(PEVENTLOGHEADER header)
Modified: trunk/reactos/base/services/eventlog/eventlog.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/eve…
==============================================================================
--- trunk/reactos/base/services/eventlog/eventlog.h [iso-8859-1] (original)
+++ trunk/reactos/base/services/eventlog/eventlog.h [iso-8859-1] Sun Dec 25 00:57:16 2011
@@ -16,7 +16,6 @@
#include <windows.h>
#include <netevent.h>
#include <lpctypes.h>
-#include <kefuncs.h>
#include <lpcfuncs.h>
#include <rtlfuncs.h>
#include <obfuncs.h>
@@ -169,7 +168,6 @@
PBYTE LogfAllocAndBuildNewRecord(LPDWORD lpRecSize,
DWORD dwRecordNumber,
- DWORD dwTime,
WORD wType,
WORD wCategory,
DWORD dwEventId,
@@ -201,6 +199,9 @@
VOID EventTimeToSystemTime(DWORD EventTime,
SYSTEMTIME * SystemTime);
+VOID SystemTimeToEventTime(SYSTEMTIME * pSystemTime,
+ DWORD * pEventTime);
+
/* eventsource.c */
VOID InitEventSourceList(VOID);
Modified: trunk/reactos/base/services/eventlog/file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/fil…
==============================================================================
--- trunk/reactos/base/services/eventlog/file.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/eventlog/file.c [iso-8859-1] Sun Dec 25 00:57:16 2011
@@ -870,18 +870,18 @@
{
DWORD dwWritten;
DWORD dwRead;
+ SYSTEMTIME st;
EVENTLOGEOF EofRec;
PEVENTLOGRECORD RecBuf;
LARGE_INTEGER logFileSize;
- LARGE_INTEGER SystemTime;
ULONG RecOffSet;
ULONG WriteOffSet;
if (!Buffer)
return FALSE;
- NtQuerySystemTime(&SystemTime);
- RtlTimeToSecondsSince1970(&SystemTime, &((PEVENTLOGRECORD)
Buffer)->TimeWritten);
+ GetSystemTime(&st);
+ SystemTimeToEventTime(&st, &((PEVENTLOGRECORD) Buffer)->TimeWritten);
EnterCriticalSection(&LogFile->cs);
@@ -1125,7 +1125,6 @@
PBYTE LogfAllocAndBuildNewRecord(LPDWORD lpRecSize,
DWORD dwRecordNumber,
- DWORD dwTime,
WORD wType,
WORD wCategory,
DWORD dwEventId,
@@ -1140,6 +1139,7 @@
{
DWORD dwRecSize;
PEVENTLOGRECORD pRec;
+ SYSTEMTIME SysTime;
WCHAR *str;
UINT i, pos;
PBYTE Buffer;
@@ -1148,8 +1148,8 @@
sizeof(EVENTLOGRECORD) + (lstrlenW(ComputerName) +
lstrlenW(SourceName) + 2) * sizeof(WCHAR);
- if (dwRecSize % sizeof(DWORD) != 0)
- dwRecSize += sizeof(DWORD) - (dwRecSize % sizeof(DWORD));
+ if (dwRecSize % 4 != 0)
+ dwRecSize += 4 - (dwRecSize % 4);
dwRecSize += dwSidLength;
@@ -1160,10 +1160,10 @@
}
dwRecSize += dwDataSize;
- if (dwRecSize % sizeof(DWORD) != 0)
- dwRecSize += sizeof(DWORD) - (dwRecSize % sizeof(DWORD));
-
- dwRecSize += sizeof(DWORD);
+ if (dwRecSize % 4 != 0)
+ dwRecSize += 4 - (dwRecSize % 4);
+
+ dwRecSize += 4;
Buffer = HeapAlloc(MyHeap, HEAP_ZERO_MEMORY, dwRecSize);
@@ -1178,8 +1178,9 @@
pRec->Reserved = LOGFILE_SIGNATURE;
pRec->RecordNumber = dwRecordNumber;
- pRec->TimeGenerated = dwTime;
- pRec->TimeWritten = dwTime;
+ GetSystemTime(&SysTime);
+ SystemTimeToEventTime(&SysTime, &pRec->TimeGenerated);
+ SystemTimeToEventTime(&SysTime, &pRec->TimeWritten);
pRec->EventID = dwEventId;
pRec->EventType = wType;
@@ -1194,8 +1195,8 @@
pRec->UserSidOffset = pos;
- if (pos % sizeof(DWORD) != 0)
- pos += sizeof(DWORD) - (pos % sizeof(DWORD));
+ if (pos % 4 != 0)
+ pos += 4 - (pos % 4);
if (dwSidLength)
{
@@ -1222,8 +1223,8 @@
pos += dwDataSize;
}
- if (pos % sizeof(DWORD) != 0)
- pos += sizeof(DWORD) - (pos % sizeof(DWORD));
+ if (pos % 4 != 0)
+ pos += 4 - (pos % 4);
*((PDWORD) (Buffer + pos)) = dwRecSize;
@@ -1248,8 +1249,6 @@
DWORD lastRec;
DWORD recSize;
DWORD dwError;
- DWORD dwTime;
- LARGE_INTEGER SystemTime;
if (!GetComputerNameW(szComputerName, &dwComputerNameLength))
{
@@ -1262,13 +1261,9 @@
return;
}
- NtQuerySystemTime(&SystemTime);
- RtlTimeToSecondsSince1970(&SystemTime, &dwTime);
-
lastRec = LogfGetCurrentRecord(pEventSource->LogFile);
logBuffer = LogfAllocAndBuildNewRecord(&recSize,
- dwTime,
lastRec,
wType,
wCategory,
Modified: trunk/reactos/base/services/eventlog/logport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/log…
==============================================================================
--- trunk/reactos/base/services/eventlog/logport.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/eventlog/logport.c [iso-8859-1] Sun Dec 25 00:57:16 2011
@@ -109,8 +109,6 @@
DWORD dwRecSize;
NTSTATUS Status;
PLOGFILE SystemLog = NULL;
- LARGE_INTEGER SystemTime;
- ULONG Seconds;
DPRINT("ProcessPortMessage() called\n");
@@ -147,10 +145,7 @@
Message = (PIO_ERROR_LOG_MESSAGE) & Request.Message;
ulRecNum = SystemLog ? SystemLog->Header.CurrentRecordNumber : 0;
- NtQuerySystemTime(&SystemTime);
- RtlTimeToSecondsSince1970(&SystemTime, &Seconds);
-
- pRec = (PEVENTLOGRECORD) LogfAllocAndBuildNewRecord(&dwRecSize, Seconds,
+ pRec = (PEVENTLOGRECORD) LogfAllocAndBuildNewRecord(&dwRecSize,
ulRecNum, Message->Type, Message->EntryData.EventCategory,
Message->EntryData.ErrorCode,
(WCHAR *) (((PBYTE) Message) + Message->DriverNameOffset),
Modified: trunk/reactos/base/services/eventlog/rpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/rpc…
==============================================================================
--- trunk/reactos/base/services/eventlog/rpc.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/eventlog/rpc.c [iso-8859-1] Sun Dec 25 00:57:16 2011
@@ -496,7 +496,6 @@
if (UserSID)
dwUserSidLength = FIELD_OFFSET(SID,
SubAuthority[UserSID->SubAuthorityCount]);
LogBuffer = LogfAllocAndBuildNewRecord(&recSize,
- Time,
lastRec,
EventType,
EventCategory,