[EVENTVWR]

- Fix FormatMessage flags sanitization.
- Use "LANG_USER_DEFAULT" instead of MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT) (these are the same, but one is shorter than the other).
- In case LookupAccountSidW fails to retrieve the user name of an associated SID, use ConvertSidToStringSidW to get the SID string directly and display it, instead of claiming there is no associated user for a given event.
- In addition to display (in the status bar) the number of events in the selected log, display the number of events actually listed. This can be useful when events filtering will be completely implemented, and it can be also useful for detecting possible corrupted logs where the number of enumerable events is different (less) than the total number of events in the log...
==> To translators: please update the translations!
CORE-11637

svn path=/trunk/; revision=73043
This commit is contained in:
Hermès Bélusca-Maïto 2016-10-26 20:32:11 +00:00
parent 1ac7d54efd
commit 682cc491e7
24 changed files with 65 additions and 32 deletions

View file

@ -29,9 +29,9 @@
#include "eventvwr.h"
#include "evtdetctl.h"
#include <sddl.h> // For ConvertSidToStringSidW
#include <shellapi.h>
#include <shlwapi.h>
#include <strsafe.h>
// #include "resource.h"
@ -306,6 +306,10 @@ GetMessageStringFromDll(
if (hLibrary == NULL)
return NULL;
/* Sanitize dwFlags */
dwFlags &= ~FORMAT_MESSAGE_FROM_STRING;
dwFlags |= FORMAT_MESSAGE_FROM_HMODULE;
_SEH2_TRY
{
/*
@ -319,7 +323,7 @@ GetMessageStringFromDll(
FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, */
hLibrary,
dwMessageId,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
LANG_USER_DEFAULT,
(LPWSTR)&lpMsgBuf,
nSize,
Arguments);
@ -350,10 +354,10 @@ GetMessageStringFromDll(
dwLength = FormatMessageW(dwFlags,
hLibrary,
dwMessageId,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
LANG_USER_DEFAULT,
(LPWSTR)&lpMsgBuf,
nSize,
Arguments);
NULL /* Arguments */);
}
}
_SEH2_END;
@ -409,7 +413,7 @@ GetMessageStringFromDllList(
szDll = wcstok(szMessageDllList, EVENT_DLL_SEPARATOR);
while ((szDll != NULL) && !Success)
{
// Uses MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)
// Uses LANG_USER_DEFAULT
lpMsgBuf = GetMessageStringFromDll(szDll,
dwFlags,
dwMessageId,
@ -1261,7 +1265,8 @@ BOOL
GetEventUserName(IN PEVENTLOGRECORD pelr,
OUT PWCHAR pszUser) // TODO: Add IN DWORD BufLen
{
PSID lpSid;
PSID pSid;
PWSTR StringSid;
WCHAR szName[1024];
WCHAR szDomain[1024];
SID_NAME_USE peUse;
@ -1269,13 +1274,19 @@ GetEventUserName(IN PEVENTLOGRECORD pelr,
DWORD cchDomain = ARRAYSIZE(szDomain);
/* Point to the SID */
lpSid = (PSID)((LPBYTE)pelr + pelr->UserSidOffset);
pSid = (PSID)((LPBYTE)pelr + pelr->UserSidOffset);
/* User SID */
if (pelr->UserSidLength > 0)
{
/*
* Try to retrieve the user account name and domain name corresponding
* to the SID. If it cannot be retrieved, try to convert the SID to a
* string-form. It should not be bigger than the user-provided buffer
* 'pszUser', otherwise we return an error.
*/
if (LookupAccountSidW(NULL, // FIXME: Use computer name? From the particular event?
lpSid,
pSid,
szName,
&cchName,
szDomain,
@ -1285,6 +1296,27 @@ GetEventUserName(IN PEVENTLOGRECORD pelr,
StringCchCopyW(pszUser, MAX_PATH, szName);
return TRUE;
}
else if (ConvertSidToStringSidW(pSid, &StringSid))
{
BOOL Success;
/* Copy the string only if the user-provided buffer is small enough */
if (wcslen(StringSid) + 1 <= MAX_PATH) // + 1 for NULL-terminator
{
StringCchCopyW(pszUser, MAX_PATH, StringSid);
Success = TRUE;
}
else
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
Success = FALSE;
}
/* Free the allocated buffer */
LocalFree(StringSid);
return Success;
}
}
return FALSE;
@ -1672,7 +1704,8 @@ Cleanup:
sizeof(szStatusText),
szStatusBarTemplate,
EventLog->LogName,
dwTotalRecords);
dwTotalRecords,
ListView_GetItemCount(hwndListView));
}
else
{

View file

@ -131,7 +131,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Преглед на събития"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "Зареждане на събитията. Почакайте..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -131,7 +131,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Prohlížeč událostí"
IDS_APP_TITLE_EX "%s - Protkol %s na \\\\"
IDS_STATUS_MSG "Počet událostí v protokolu %s: %lu"
IDS_STATUS_MSG "Počet událostí v protokolu %s: %lu (listed: %lu)"
IDS_LOADING_WAIT "Načítám protokol událostí. Prosím čekejte..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Ereignisanzeige"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "Ereignis-Protokolle werden geladen. Bitte warten..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Event Viewer"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "Γίνεται φόρτωση των Logs συμβάντων. Παρακαλώ περιμένετε..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -139,7 +139,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Event Viewer"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "Loading Event Logs. Please wait..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Visor de eventos"
IDS_APP_TITLE_EX "%s - Registro de %s en \\\\"
IDS_STATUS_MSG "%s tiene %lu evento(s)"
IDS_STATUS_MSG "%s tiene %lu evento(s) (listed: %lu)"
IDS_LOADING_WAIT "Recuperando eventos. Espere un momento..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Visionneuse d'événements"
IDS_APP_TITLE_EX "%s - Journal %s sur \\\\"
IDS_STATUS_MSG "%s contient %lu événement(s)"
IDS_STATUS_MSG "%s contient %lu événement(s) (listés : %lu)"
IDS_LOADING_WAIT "Chargement des journaux d'événements. Veuillez patienter..."
IDS_NO_ITEMS "Aucun élément à afficher dans cet aperçu." // "No events in this log."
IDS_EVENTLOG_SYSTEM "Journaux système"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "יומן האירועים"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "טוען יומני אירועים, נא להמתין..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Visualizzatore eventi"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "Caricamento eventi in corso. Attendere..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "イベント ビューア"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "イベント ログを読み込んでいます。 お待ちください..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "이벤트 뷰어"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "이벤트 로그 로딩중. 기다려주세요..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -131,7 +131,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Hendelseliste"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "Laster Hendelseliste. Venligst vent..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -135,7 +135,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Podgląd zdarzeń"
IDS_APP_TITLE_EX "%s - %s Log na \\\\"
IDS_STATUS_MSG "%s posiada %lu zdarzeń"
IDS_STATUS_MSG "%s posiada %lu zdarzeń (listed: %lu)"
IDS_LOADING_WAIT "Ładowanie logów zdarzeń. Proszę czekać..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Visualizador de Eventos"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "Carregando Registros de Eventos. Por favor aguarde..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -136,7 +136,7 @@ BEGIN
IDS_COPYRIGHT "Drept de autor (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Observator de evenimente"
IDS_APP_TITLE_EX "%s - %s autentificat pe \\\\"
IDS_STATUS_MSG "%s are %lu eveniment(e)"
IDS_STATUS_MSG "%s are %lu eveniment(e) (listed: %lu)"
IDS_LOADING_WAIT "Se încarcă jurnalul de evenimentele. Așteptați…"
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "Авторские права (С) 2007 Марк Пиулачс (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Просмотр событий"
IDS_APP_TITLE_EX "%s - %s журнал на \\\\"
IDS_STATUS_MSG "%s содержит %lu событие (ий)"
IDS_STATUS_MSG "%s содержит %lu событие(ий) (listed: %lu)"
IDS_LOADING_WAIT "Идет загрузка. Подождите..."
IDS_NO_ITEMS "Нет элементов для отображения в этом представлении." // "No events in this log."
IDS_EVENTLOG_SYSTEM "Системный журнал"

View file

@ -136,7 +136,7 @@ BEGIN
IDS_COPYRIGHT "Autorské práva (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Zobrazovač udalostí"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "Nahrávam záznamy s udalosťami. Počkajte, prosím..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -139,7 +139,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Shikues ngjarjesh"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "Ngarkim loget e ngjarjeve. Ju lutem prisni..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Händelselogg"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "Laddar in Händelseloggen. Vänligen vänta..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -139,7 +139,7 @@ BEGIN
IDS_COPYRIGHT "Telif Hakkı: 2007 - Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Olay Görüntüleyicisi"
IDS_APP_TITLE_EX "%s - %s Oturum Aç \\\\"
IDS_STATUS_MSG "%s -> %lu olay var."
IDS_STATUS_MSG "%s -> %lu olay var (listed: %lu)"
IDS_LOADING_WAIT "Olay kayıtları yükleniyor. Lütfen bekleyiniz..."
IDS_NO_ITEMS "Bu görünümde görüntülenecek bir öğe bile yok." // "No events in this log."
IDS_EVENTLOG_SYSTEM "Dizge Kayıtları"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "Оглядач подій"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "Завантаження Звіту подій. Будь ласка, зачекайте..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "版权所有 (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "事件查看器"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "正在载入日志。请稍候..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"

View file

@ -133,7 +133,7 @@ BEGIN
IDS_COPYRIGHT "版權所有 (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)"
IDS_APP_TITLE "事件檢視器"
IDS_APP_TITLE_EX "%s - %s Log on \\\\"
IDS_STATUS_MSG "%s has %lu event(s)"
IDS_STATUS_MSG "%s has %lu event(s) (listed: %lu)"
IDS_LOADING_WAIT "正在載入日誌。 請稍候..."
IDS_NO_ITEMS "There are no items to show in this view." // "No events in this log."
IDS_EVENTLOG_SYSTEM "System Logs"