mirror of
https://github.com/reactos/reactos.git
synced 2025-04-28 09:29:07 +00:00
[EVENTVWR] Additions to the Event Viewer.
- Don't hardcode a buffer length in ExpandEnvironmentStringsW() call. - If no file name is associated to a log (ErrorLog->FileName == NULL), don't try to attempt looking at its file properties. This also allows avoiding a crash in the FindFirstFileW() call under certain conditions on Windows.
This commit is contained in:
parent
ab240d1b6d
commit
bb03da981c
1 changed files with 27 additions and 17 deletions
|
@ -3459,18 +3459,23 @@ Quit:
|
||||||
FileName = EventLog->FileName;
|
FileName = EventLog->FileName;
|
||||||
if (FileName && *FileName)
|
if (FileName && *FileName)
|
||||||
{
|
{
|
||||||
ExpandEnvironmentStringsW(FileName, wszBuf, MAX_PATH);
|
ExpandEnvironmentStringsW(FileName, wszBuf, ARRAYSIZE(wszBuf));
|
||||||
FileName = wszBuf;
|
FileName = wszBuf;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FileName = L"";
|
||||||
|
}
|
||||||
SetDlgItemTextW(hDlg, IDC_LOGFILE, FileName);
|
SetDlgItemTextW(hDlg, IDC_LOGFILE, FileName);
|
||||||
|
|
||||||
|
if (FileName && *FileName)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* The general problem here (and in the shell as well) is that
|
* The general problem here (and in the shell as well) is that
|
||||||
* GetFileAttributesEx fails for files that are opened without
|
* GetFileAttributesEx fails for files that are opened without
|
||||||
* shared access. To retrieve file information for those we need
|
* shared access. To retrieve file information for those we need
|
||||||
* to use something else: FindFirstFile, on the full file name.
|
* to use something else: FindFirstFile, on the full file name.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Success = GetFileAttributesExW(FileName,
|
Success = GetFileAttributesExW(FileName,
|
||||||
GetFileExInfoStandard,
|
GetFileExInfoStandard,
|
||||||
(LPWIN32_FILE_ATTRIBUTE_DATA)&FileInfo);
|
(LPWIN32_FILE_ATTRIBUTE_DATA)&FileInfo);
|
||||||
|
@ -3481,8 +3486,13 @@ Quit:
|
||||||
if (Success)
|
if (Success)
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Success = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// Starting there, FileName is invalid (because it uses wszBuf)
|
/* Starting there, FileName becomes invalid because we are reusing wszBuf */
|
||||||
|
|
||||||
if (Success)
|
if (Success)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue