From: Owen Smith Date: Wed, 20 Jul 2016 12:02:13 +0000 (+0100) Subject: Log messages to dom0 log (if possible) X-Git-Tag: 8.2.0-rc1~16 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=55c51f58f167a60864801a936bbf1313b2bc68bb;p=pvdrivers%2Fwin%2Fxeniface.git Log messages to dom0 log (if possible) IoctlLog will strip any trailing newline and insert a single newline to enforce log file consistancy Signed-off-by: Owen Smith --- diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp index 55dc8ca..182752f 100644 --- a/src/xenagent/service.cpp +++ b/src/xenagent/service.cpp @@ -81,6 +81,12 @@ static CXenAgent s_service; va_end(args); OutputDebugString(message); + + // if possible, send to xeniface to forward to logs + CCritSec crit(&s_service.m_crit); + if (s_service.m_device) { + s_service.m_device->Log(message); + } } /*static*/ int CXenAgent::ServiceInstall() diff --git a/src/xeniface/ioctls.c b/src/xeniface/ioctls.c index ca94658..ca2cf1c 100644 --- a/src/xeniface/ioctls.c +++ b/src/xeniface/ioctls.c @@ -113,6 +113,7 @@ IoctlLog( ) { NTSTATUS status; + PCHAR ptr; status = STATUS_INVALID_BUFFER_SIZE; if (InLen == 0 || InLen > XENIFACE_LOG_MAX_LENGTH || OutLen != 0) @@ -122,6 +123,11 @@ IoctlLog( if (!__IsValidStr(Buffer, InLen)) goto fail2; + // remove newlines from end of buffer + for (ptr = Buffer + InLen - 1; + ptr != Buffer && *ptr != 0 && *ptr != '\n'; + --ptr) + *ptr = 0; XenIfaceDebugPrint(INFO, "USER: %s\n", Buffer); return STATUS_SUCCESS;