diff --git a/rosapps/skel_service/ServiceMain.c b/rosapps/skel_service/ServiceMain.c index 2f6d1ef9759..0dc58482f8e 100644 --- a/rosapps/skel_service/ServiceMain.c +++ b/rosapps/skel_service/ServiceMain.c @@ -52,13 +52,15 @@ UpdateStatus(PSERVICEINFO pServInfo, if (NewStatus > 0) pServInfo->servStatus.dwCurrentState = NewStatus; - _sntprintf(szSet, 49, _T("Setting service to 0x%lu, CheckPoint %lu"), NewStatus, pServInfo->servStatus.dwCheckPoint); + _sntprintf(szSet, + 49, + _T("Service state 0x%lu, CheckPoint %lu"), + pServInfo->servStatus.dwCurrentState, + pServInfo->servStatus.dwCheckPoint); LogEvent(szSet, 0, 0, LOG_FILE); if (!SetServiceStatus(pServInfo->hStatus, &pServInfo->servStatus)) LogEvent(_T("Cannot set service status"), GetLastError(), 0, LOG_ALL); - - return; } static BOOL diff --git a/rosapps/skel_service/log.c b/rosapps/skel_service/log.c index ec9a768f4f2..cb17f572d61 100644 --- a/rosapps/skel_service/log.c +++ b/rosapps/skel_service/log.c @@ -82,7 +82,7 @@ LogToFile(LPCTSTR lpMsg, 0, NULL); - msgLen = msgLen + eMsgLen + 26; + msgLen = msgLen + eMsgLen + 40; lpFullMsg = HeapAlloc(GetProcessHeap(), 0, @@ -91,7 +91,7 @@ LogToFile(LPCTSTR lpMsg, { _sntprintf(lpFullMsg, msgLen, - _T("%s %s ErrNum = %lu ExitCode = %lu\r\n"), + _T("%s : %s\tErrNum = %lu ExitCode = %lu\r\n"), lpMsg, lpSysMsg, errNum, @@ -125,7 +125,7 @@ LogToFile(LPCTSTR lpMsg, WriteFile(hLogFile, lpFullMsg, - msgLen * sizeof(TCHAR), + _tcslen(lpFullMsg) * sizeof(TCHAR), &bytesWritten, NULL); if (bytesWritten == 0) @@ -155,7 +155,7 @@ LogEvent(LPCTSTR lpMsg, UINT flags) { #ifdef DEBUG - if (flags & LOG_FILE) + if (flags & LOG_FILE || flags & LOG_ERROR) LogToFile(lpMsg, errNum, exitCode, flags); #endif if (flags & LOG_EVENTLOG)