Author: ekohl
Date: Tue May 10 20:19:14 2011
New Revision: 51670
URL:
http://svn.reactos.org/svn/reactos?rev=51670&view=rev
Log:
[EVENTLOG]
Log product info upon startup.
Modified:
trunk/reactos/base/services/eventlog/eventlog.c
trunk/reactos/base/services/eventlog/eventlog.h
trunk/reactos/base/services/eventlog/file.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] Tue May 10 20:19:14 2011
@@ -135,6 +135,71 @@
}
+static VOID
+ReportProductInfoEvent(VOID)
+{
+ OSVERSIONINFOW versionInfo;
+ WCHAR szBuffer[512];
+ DWORD dwLength;
+ HKEY hKey;
+ DWORD dwValueLength;
+ DWORD dwType;
+ LONG lResult = ERROR_SUCCESS;
+
+ ZeroMemory(&versionInfo, sizeof(OSVERSIONINFO));
+ versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+
+ /* Get version information */
+ if (!GetVersionExW(&versionInfo))
+ return;
+
+ ZeroMemory(szBuffer, 512 * sizeof(WCHAR));
+
+ /* Write version into the buffer */
+ dwLength = swprintf(szBuffer,
+ L"%lu.%lu",
+ versionInfo.dwMajorVersion,
+ versionInfo.dwMinorVersion) + 1;
+
+ /* Write build number into the buffer */
+ dwLength += swprintf(&szBuffer[dwLength],
+ L"%lu",
+ versionInfo.dwBuildNumber) + 1;
+
+ /* Write service pack info into the buffer */
+ wcscpy(&szBuffer[dwLength], versionInfo.szCSDVersion);
+ dwLength += wcslen(versionInfo.szCSDVersion) + 1;
+
+ /* Read 'CurrentType' from the registry and write it into the buffer */
+ lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
+ 0,
+ KEY_QUERY_VALUE,
+ &hKey);
+ if (lResult == ERROR_SUCCESS)
+ {
+ dwValueLength = 512 - dwLength;
+ lResult = RegQueryValueEx(hKey,
+ L"CurrentType",
+ NULL,
+ &dwType,
+ (LPBYTE)&szBuffer[dwLength],
+ &dwValueLength);
+
+ RegCloseKey(hKey);
+ }
+
+ /* Log the product information */
+ LogfReportEvent(EVENTLOG_INFORMATION_TYPE,
+ 0,
+ EVENT_EventLogProductInfo,
+ 4,
+ szBuffer,
+ 0,
+ NULL);
+}
+
+
static VOID CALLBACK
ServiceMain(DWORD argc,
LPWSTR *argv)
@@ -169,9 +234,15 @@
DPRINT("Service started\n");
UpdateServiceStatus(SERVICE_RUNNING);
+ ReportProductInfoEvent();
+
LogfReportEvent(EVENTLOG_INFORMATION_TYPE,
0,
- EVENT_EventlogStarted);
+ EVENT_EventlogStarted,
+ 0,
+ NULL,
+ 0,
+ NULL);
}
DPRINT("ServiceMain() done\n");
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] Tue May 10 20:19:14 2011
@@ -12,6 +12,7 @@
#define NDEBUG
#define WIN32_NO_STATUS
+#include <stdio.h>
#include <windows.h>
#include <netevent.h>
#include <lpctypes.h>
@@ -181,7 +182,11 @@
VOID
LogfReportEvent(WORD wType,
WORD wCategory,
- DWORD dwEventId);
+ DWORD dwEventId,
+ WORD wNumStrings,
+ WCHAR *lpStrings,
+ DWORD dwDataSize,
+ LPVOID lpRawData);
/* eventlog.c */
extern HANDLE MyHeap;
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] Tue May 10 20:19:14 2011
@@ -1054,7 +1054,11 @@
VOID
LogfReportEvent(WORD wType,
WORD wCategory,
- DWORD dwEventId)
+ DWORD dwEventId,
+ WORD wNumStrings,
+ WCHAR *lpStrings,
+ DWORD dwDataSize,
+ LPVOID lpRawData)
{
WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwComputerNameLength = MAX_COMPUTERNAME_LENGTH + 1;
@@ -1086,10 +1090,10 @@
(LPCWSTR)szComputerName,
0,
NULL,
- 0, //wNumStrings,
- NULL, //lpStrings,
- 0, //dwDataSize,
- NULL); //lpRawData);
+ wNumStrings,
+ lpStrings,
+ dwDataSize,
+ lpRawData);
dwError = LogfWriteData(pEventSource->LogFile, recSize, logBuffer);
if (!dwError)