[NTOS:KD] KdpDebugLogInit: Fix ZwCreateFile flags for appending to debug logging file.

However, ReactOS currently doesn't handle FILE_APPEND_DATA correctly,
so temporarily add a hack for fixing its support.

CORE-18789
This commit is contained in:
Hermès Bélusca-Maïto 2023-01-09 20:42:11 +01:00
parent a8b09eddc4
commit a49732e5b6
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -272,8 +272,9 @@ KdpDebugLogInit(
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ,
FILE_SUPERSEDE,
FILE_WRITE_THROUGH | FILE_SYNCHRONOUS_IO_NONALERT,
FILE_OPEN_IF,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT |
FILE_SEQUENTIAL_ONLY | FILE_WRITE_THROUGH,
NULL,
0);
@ -285,6 +286,39 @@ KdpDebugLogInit(
return;
}
/** HACK for FILE_APPEND_DATA **
** Remove once CORE-18789 is fixed. **
** Enforce to go to the end of file **/
{
FILE_STANDARD_INFORMATION FileInfo;
FILE_POSITION_INFORMATION FilePosInfo;
Status = ZwQueryInformationFile(KdpLogFileHandle,
&Iosb,
&FileInfo,
sizeof(FileInfo),
FileStandardInformation);
DPRINT("Status: 0x%08lx - EOF offset: %I64d\n",
Status, FileInfo.EndOfFile.QuadPart);
Status = ZwQueryInformationFile(KdpLogFileHandle,
&Iosb,
&FilePosInfo,
sizeof(FilePosInfo),
FilePositionInformation);
DPRINT("Status: 0x%08lx - Position: %I64d\n",
Status, FilePosInfo.CurrentByteOffset.QuadPart);
FilePosInfo.CurrentByteOffset.QuadPart = FileInfo.EndOfFile.QuadPart;
Status = ZwSetInformationFile(KdpLogFileHandle,
&Iosb,
&FilePosInfo,
sizeof(FilePosInfo),
FilePositionInformation);
DPRINT("ZwSetInformationFile(FilePositionInfo) returned: 0x%08lx\n", Status);
}
/** END OF HACK **/
KeInitializeEvent(&KdpLoggerThreadEvent, SynchronizationEvent, TRUE);
/* Create the logger thread */