Skip to content

Commit

Permalink
Missing Cr in the log
Browse files Browse the repository at this point in the history
  • Loading branch information
tandasat committed Jul 17, 2015
1 parent d168934 commit e400353
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions RemoteWriteMonitor/RemoteWriteMonitor/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ EXTERN_C static NTSTATUS LogpMakePrefix(_In_ ULONG Level,
EXTERN_C static const char *LogpFindBaseFunctionName(
_In_ const char *FunctionName);

EXTERN_C static NTSTATUS LogpPut(_In_ const char *Message,
EXTERN_C static NTSTATUS LogpPut(_In_ char *Message,
_In_ ULONG Attribute);

EXTERN_C static NTSTATUS LogpWriteLogBufferToFile(_In_opt_ LogBufferInfo *Info);
Expand Down Expand Up @@ -433,7 +433,7 @@ EXTERN_C static NTSTATUS LogpMakePrefix(_In_ ULONG Level,
// not quite sure. The former way works as expected.
//
status = RtlStringCchPrintfA(
LogBuffer, LogBufferLength, "%s%s\t%5lu\t%5lu\t%-15s\t%s%s\n", timeBuffer,
LogBuffer, LogBufferLength, "%s%s\t%5lu\t%5lu\t%-15s\t%s%s\r\n", timeBuffer,
levelString,
reinterpret_cast<ULONG_PTR>(PsGetProcessId(PsGetCurrentProcess())),
reinterpret_cast<ULONG_PTR>(PsGetCurrentThreadId()),
Expand Down Expand Up @@ -461,7 +461,7 @@ EXTERN_C static const char *LogpFindBaseFunctionName(
}

// Logs the entry according to Attribute and the thread condition.
EXTERN_C static NTSTATUS LogpPut(_In_ const char *Message,
EXTERN_C static NTSTATUS LogpPut(_In_ char *Message,
_In_ ULONG Attribute) {
auto status = STATUS_SUCCESS;

Expand All @@ -485,6 +485,9 @@ EXTERN_C static NTSTATUS LogpPut(_In_ const char *Message,
return STATUS_UNSUCCESSFUL;
}

const auto cr = strlen(Message) - 2;
Message[cr] = '\n';
Message[cr + 1] = '\0';
DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_ERROR_LEVEL, "%s", Message);
return status;
}
Expand Down

0 comments on commit e400353

Please sign in to comment.