[EVENTVWR]

- No need to pop up an error box if we cannot find an event message resource DLL for the current event log.
- Flatten out GetEventMessageFileDLL a bit.
- Fix a comment.

svn path=/trunk/; revision=71678
This commit is contained in:
Hermès Bélusca-Maïto 2016-06-26 19:36:38 +00:00
parent d8eb428154
commit 4fb300ea06

View file

@ -226,40 +226,36 @@ GetEventMessageFileDLL(IN LPCWSTR lpLogName,
szKeyName, szKeyName,
0, 0,
KEY_READ, KEY_READ,
&hAppKey) == ERROR_SUCCESS) &hAppKey) != ERROR_SUCCESS)
{ {
if (RegOpenKeyExW(hAppKey, return FALSE;
SourceName, }
0,
KEY_READ, if (RegOpenKeyExW(hAppKey,
&hSourceKey) == ERROR_SUCCESS) SourceName,
0,
KEY_READ,
&hSourceKey) == ERROR_SUCCESS)
{
dwSize = sizeof(szModuleName);
if (RegQueryValueExW(hSourceKey,
EntryName,
NULL,
NULL,
(LPBYTE)szModuleName,
&dwSize) == ERROR_SUCCESS)
{ {
dwSize = sizeof(szModuleName); /* Returns a string containing the requested substituted environment variable */
if (RegQueryValueExW(hSourceKey, ExpandEnvironmentStringsW(szModuleName, ExpandedName, MAX_PATH);
EntryName,
NULL,
NULL,
(LPBYTE)szModuleName,
&dwSize) == ERROR_SUCCESS)
{
/* Returns a string containing the requested substituted environment variable */
ExpandEnvironmentStringsW(szModuleName, ExpandedName, MAX_PATH);
/* Successful */ /* Successful */
bReturn = TRUE; bReturn = TRUE;
}
} }
}
else
{
ShowLastWin32Error();
}
if (hSourceKey != NULL)
RegCloseKey(hSourceKey); RegCloseKey(hSourceKey);
}
if (hAppKey != NULL) RegCloseKey(hAppKey);
RegCloseKey(hAppKey);
return bReturn; return bReturn;
} }
@ -677,15 +673,14 @@ QueryEventMessages(LPWSTR lpMachineName,
/* Get the computer name */ /* Get the computer name */
lpszComputerName = (LPWSTR)((LPBYTE)pevlr + sizeof(EVENTLOGRECORD) + (wcslen(lpszSourceName) + 1) * sizeof(WCHAR)); lpszComputerName = (LPWSTR)((LPBYTE)pevlr + sizeof(EVENTLOGRECORD) + (wcslen(lpszSourceName) + 1) * sizeof(WCHAR));
/* Compute the event type */ /* Compute the event time */
EventTimeToSystemTime(pevlr->TimeWritten, &time); EventTimeToSystemTime(pevlr->TimeWritten, &time);
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, szLocalDate, ARRAYSIZE(szLocalDate));
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &time, NULL, szLocalTime, ARRAYSIZE(szLocalTime));
/* Get the username that generated the event */ /* Get the username that generated the event */
GetEventUserName(pevlr, szUsername); GetEventUserName(pevlr, szUsername);
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, szLocalDate, ARRAYSIZE(szLocalDate));
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &time, NULL, szLocalTime, ARRAYSIZE(szLocalTime));
GetEventType(pevlr->EventType, szEventTypeText); GetEventType(pevlr->EventType, szEventTypeText);
GetEventCategory(lpLogName, lpszSourceName, pevlr, szCategory); GetEventCategory(lpLogName, lpszSourceName, pevlr, szCategory);