Author: hbelusca Date: Mon Nov 7 15:48:34 2016 New Revision: 73169
URL: http://svn.reactos.org/svn/reactos?rev=73169&view=rev Log: [TCPIP] - Enable logging now that IoWriteErrorLogEntry works. - Check for log event size before calling IoAllocateErrorLogEntry. - Reduce code indentation in the logging function.
Modified: trunk/reactos/drivers/network/tcpip/tcpip/main.c
Modified: trunk/reactos/drivers/network/tcpip/tcpip/main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpip... ============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/main.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/main.c [iso-8859-1] Mon Nov 7 15:48:34 2016 @@ -50,7 +50,6 @@ * DumpData = Pointer to dump data for the log entry */ { -#if 0 PIO_ERROR_LOG_PACKET LogEntry; UCHAR EntrySize; ULONG StringSize; @@ -65,35 +64,37 @@ EntrySize += (UCHAR)StringSize; }
- LogEntry = (PIO_ERROR_LOG_PACKET)IoAllocateErrorLogEntry( - DriverContext, EntrySize); - - if (LogEntry) { - LogEntry->MajorFunctionCode = -1; - LogEntry->RetryCount = -1; - 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) - RtlCopyMemory(LogEntry->DumpData, DumpData, DumpDataCount * sizeof(ULONG)); - - pString = ((PUCHAR)LogEntry) + LogEntry->StringOffset; - RtlCopyMemory(pString, DriverName, sizeof(DriverName)); - pString += sizeof(DriverName); - - if (String) - RtlCopyMemory(pString, String, StringSize); - - IoWriteErrorLogEntry(LogEntry); - } -#endif + /* Fail if the required error log entry is too large */ + if (EntrySize > ERROR_LOG_MAXIMUM_SIZE) + return; + + LogEntry = (PIO_ERROR_LOG_PACKET)IoAllocateErrorLogEntry(DriverContext, EntrySize); + if (!LogEntry) + return; + + LogEntry->MajorFunctionCode = -1; + 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; + + if (DumpDataCount) + RtlCopyMemory(LogEntry->DumpData, DumpData, DumpDataCount * sizeof(ULONG)); + + pString = ((PUCHAR)LogEntry) + LogEntry->StringOffset; + RtlCopyMemory(pString, DriverName, sizeof(DriverName)); + pString += sizeof(DriverName); + + if (String) + RtlCopyMemory(pString, String, StringSize); + + IoWriteErrorLogEntry(LogEntry); }
/*