- Enable logging now that IoWriteErrorLogEntry works.
- Check for log event size before calling IoAllocateErrorLogEntry.
- Reduce code indentation in the logging function.

svn path=/trunk/; revision=73169
This commit is contained in:
Hermès Bélusca-Maïto 2016-11-07 15:48:34 +00:00
parent 323bd18771
commit 12e8ef0213

View file

@ -50,7 +50,6 @@ VOID TiWriteErrorLog(
* DumpData = Pointer to dump data for the log entry * DumpData = Pointer to dump data for the log entry
*/ */
{ {
#if 0
PIO_ERROR_LOG_PACKET LogEntry; PIO_ERROR_LOG_PACKET LogEntry;
UCHAR EntrySize; UCHAR EntrySize;
ULONG StringSize; ULONG StringSize;
@ -65,35 +64,37 @@ VOID TiWriteErrorLog(
EntrySize += (UCHAR)StringSize; EntrySize += (UCHAR)StringSize;
} }
LogEntry = (PIO_ERROR_LOG_PACKET)IoAllocateErrorLogEntry( /* Fail if the required error log entry is too large */
DriverContext, EntrySize); if (EntrySize > ERROR_LOG_MAXIMUM_SIZE)
return;
if (LogEntry) { LogEntry = (PIO_ERROR_LOG_PACKET)IoAllocateErrorLogEntry(DriverContext, EntrySize);
LogEntry->MajorFunctionCode = -1; if (!LogEntry)
LogEntry->RetryCount = -1; return;
LogEntry->DumpDataSize = (USHORT)(DumpDataCount * sizeof(ULONG));
LogEntry->NumberOfStrings = (String == NULL) ? 1 : 2;
LogEntry->StringOffset = sizeof(IO_ERROR_LOG_PACKET) + (DumpDataCount-1) * sizeof(ULONG);
LogEntry->EventCategory = 0;
LogEntry->ErrorCode = ErrorCode;
LogEntry->UniqueErrorValue = UniqueErrorValue;
LogEntry->FinalStatus = FinalStatus;
LogEntry->SequenceNumber = -1;
LogEntry->IoControlCode = 0;
if (DumpDataCount) LogEntry->MajorFunctionCode = -1;
RtlCopyMemory(LogEntry->DumpData, DumpData, DumpDataCount * sizeof(ULONG)); LogEntry->RetryCount = -1;
LogEntry->DumpDataSize = (USHORT)(DumpDataCount * sizeof(ULONG));
LogEntry->NumberOfStrings = (String == NULL) ? 1 : 2;
LogEntry->StringOffset = sizeof(IO_ERROR_LOG_PACKET) + (DumpDataCount * sizeof(ULONG));
LogEntry->EventCategory = 0;
LogEntry->ErrorCode = ErrorCode;
LogEntry->UniqueErrorValue = UniqueErrorValue;
LogEntry->FinalStatus = FinalStatus;
LogEntry->SequenceNumber = -1;
LogEntry->IoControlCode = 0;
pString = ((PUCHAR)LogEntry) + LogEntry->StringOffset; if (DumpDataCount)
RtlCopyMemory(pString, DriverName, sizeof(DriverName)); RtlCopyMemory(LogEntry->DumpData, DumpData, DumpDataCount * sizeof(ULONG));
pString += sizeof(DriverName);
if (String) pString = ((PUCHAR)LogEntry) + LogEntry->StringOffset;
RtlCopyMemory(pString, String, StringSize); RtlCopyMemory(pString, DriverName, sizeof(DriverName));
pString += sizeof(DriverName);
IoWriteErrorLogEntry(LogEntry); if (String)
} RtlCopyMemory(pString, String, StringSize);
#endif
IoWriteErrorLogEntry(LogEntry);
} }
/* /*