A few small changes

svn path=/trunk/; revision=32817
This commit is contained in:
Ged Murphy 2008-04-02 08:54:50 +00:00
parent 1c556f1df5
commit 304e3452f8
2 changed files with 9 additions and 7 deletions

View file

@ -52,13 +52,15 @@ UpdateStatus(PSERVICEINFO pServInfo,
if (NewStatus > 0) if (NewStatus > 0)
pServInfo->servStatus.dwCurrentState = NewStatus; 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); LogEvent(szSet, 0, 0, LOG_FILE);
if (!SetServiceStatus(pServInfo->hStatus, &pServInfo->servStatus)) if (!SetServiceStatus(pServInfo->hStatus, &pServInfo->servStatus))
LogEvent(_T("Cannot set service status"), GetLastError(), 0, LOG_ALL); LogEvent(_T("Cannot set service status"), GetLastError(), 0, LOG_ALL);
return;
} }
static BOOL static BOOL

View file

@ -82,7 +82,7 @@ LogToFile(LPCTSTR lpMsg,
0, 0,
NULL); NULL);
msgLen = msgLen + eMsgLen + 26; msgLen = msgLen + eMsgLen + 40;
lpFullMsg = HeapAlloc(GetProcessHeap(), lpFullMsg = HeapAlloc(GetProcessHeap(),
0, 0,
@ -91,7 +91,7 @@ LogToFile(LPCTSTR lpMsg,
{ {
_sntprintf(lpFullMsg, _sntprintf(lpFullMsg,
msgLen, msgLen,
_T("%s %s ErrNum = %lu ExitCode = %lu\r\n"), _T("%s : %s\tErrNum = %lu ExitCode = %lu\r\n"),
lpMsg, lpMsg,
lpSysMsg, lpSysMsg,
errNum, errNum,
@ -125,7 +125,7 @@ LogToFile(LPCTSTR lpMsg,
WriteFile(hLogFile, WriteFile(hLogFile,
lpFullMsg, lpFullMsg,
msgLen * sizeof(TCHAR), _tcslen(lpFullMsg) * sizeof(TCHAR),
&bytesWritten, &bytesWritten,
NULL); NULL);
if (bytesWritten == 0) if (bytesWritten == 0)
@ -155,7 +155,7 @@ LogEvent(LPCTSTR lpMsg,
UINT flags) UINT flags)
{ {
#ifdef DEBUG #ifdef DEBUG
if (flags & LOG_FILE) if (flags & LOG_FILE || flags & LOG_ERROR)
LogToFile(lpMsg, errNum, exitCode, flags); LogToFile(lpMsg, errNum, exitCode, flags);
#endif #endif
if (flags & LOG_EVENTLOG) if (flags & LOG_EVENTLOG)