mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 19:52:59 +00:00
[EVENTLOG]
LogfInitializeExisting: Do not try to write to a file that has been opened as a backup file. It has been opened read-only. svn path=/trunk/; revision=61026
This commit is contained in:
parent
d8cadc59dc
commit
7a6fccdcf6
1 changed files with 23 additions and 20 deletions
|
@ -82,7 +82,7 @@ LogfInitializeNew(PLOGFILE LogFile)
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
LogfInitializeExisting(PLOGFILE LogFile)
|
LogfInitializeExisting(PLOGFILE LogFile, BOOL Backup)
|
||||||
{
|
{
|
||||||
DWORD dwRead;
|
DWORD dwRead;
|
||||||
DWORD dwRecordsNumber = 0;
|
DWORD dwRecordsNumber = 0;
|
||||||
|
@ -264,6 +264,8 @@ LogfInitializeExisting(PLOGFILE LogFile)
|
||||||
But for now limit EventLog size to just under 5K. */
|
But for now limit EventLog size to just under 5K. */
|
||||||
LogFile->Header.MaxSize = 5000;
|
LogFile->Header.MaxSize = 5000;
|
||||||
|
|
||||||
|
if (!Backup)
|
||||||
|
{
|
||||||
if (SetFilePointer(LogFile->hFile, 0, NULL, FILE_BEGIN) ==
|
if (SetFilePointer(LogFile->hFile, 0, NULL, FILE_BEGIN) ==
|
||||||
INVALID_SET_FILE_POINTER)
|
INVALID_SET_FILE_POINTER)
|
||||||
{
|
{
|
||||||
|
@ -286,6 +288,7 @@ LogfInitializeExisting(PLOGFILE LogFile)
|
||||||
DPRINT1("FlushFileBuffers failed! %d\n", GetLastError());
|
DPRINT1("FlushFileBuffers failed! %d\n", GetLastError());
|
||||||
return STATUS_EVENTLOG_FILE_CORRUPT;
|
return STATUS_EVENTLOG_FILE_CORRUPT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -380,7 +383,7 @@ LogfCreate(PLOGFILE *LogFile,
|
||||||
if (bCreateNew)
|
if (bCreateNew)
|
||||||
Status = LogfInitializeNew(pLogFile);
|
Status = LogfInitializeNew(pLogFile);
|
||||||
else
|
else
|
||||||
Status = LogfInitializeExisting(pLogFile);
|
Status = LogfInitializeExisting(pLogFile, Backup);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue