[ADVAPI32] Add or improve TRACE messages in the service manager functions

This commit is contained in:
Eric Kohl 2018-03-25 03:20:34 +02:00
parent e4cd48813b
commit 51bbab834c

View file

@ -79,7 +79,7 @@ ScCreateStatusBinding(VOID)
LPWSTR pszStringBinding;
RPC_STATUS status;
TRACE("ScCreateStatusBinding() called\n");
TRACE("ScCreateStatusBinding()\n");
status = RpcStringBindingComposeW(NULL,
L"ncacn_np",
@ -116,7 +116,7 @@ ScDestroyStatusBinding(VOID)
{
RPC_STATUS status;
TRACE("ScDestroyStatusBinding() called\n");
TRACE("ScDestroyStatusBinding()\n");
if (hStatusBinding == NULL)
return RPC_S_OK;
@ -141,7 +141,8 @@ ScLookupServiceByServiceName(IN LPCWSTR lpServiceName,
{
DWORD i;
TRACE("ScLookupServiceByServiceName(%S) called\n", lpServiceName);
TRACE("ScLookupServiceByServiceName(%S)\n",
lpServiceName);
if (lpActiveServices[0].bOwnProcess)
{
@ -171,7 +172,7 @@ ScServiceMainStubA(LPVOID Context)
{
PSERVICE_THREAD_PARAMSA ThreadParams = Context;
TRACE("ScServiceMainStubA() called\n");
TRACE("ScServiceMainStubA(%p)\n", Context);
/* Call the main service routine and free the arguments vector */
(ThreadParams->lpServiceMain)(ThreadParams->dwArgCount,
@ -192,7 +193,7 @@ ScServiceMainStubW(LPVOID Context)
{
PSERVICE_THREAD_PARAMSW ThreadParams = Context;
TRACE("ScServiceMainStubW() called\n");
TRACE("ScServiceMainStubW(%p)\n", Context);
/* Call the main service routine and free the arguments vector */
(ThreadParams->lpServiceMain)(ThreadParams->dwArgCount,
@ -219,6 +220,9 @@ ScConnectControlPipe(HANDLE *hPipe)
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
DWORD dwProcessId;
TRACE("ScConnectControlPipe(%p)\n",
hPipe);
/* Get the service number and create the named pipe */
RtlZeroMemory(&QueryTable,
sizeof(QueryTable));
@ -431,12 +435,14 @@ ScStartService(PACTIVE_SERVICE lpService,
PSERVICE_THREAD_PARAMSA ThreadParamsA;
PSERVICE_THREAD_PARAMSW ThreadParamsW;
TRACE("ScStartService(%p %p)\n",
lpService, ControlPacket);
if (lpService == NULL || ControlPacket == NULL)
return ERROR_INVALID_PARAMETER;
TRACE("ScStartService(Size: %lu, Service: '%S') called\n",
ControlPacket->dwSize,
(PWSTR)((ULONG_PTR)ControlPacket + ControlPacket->dwServiceNameOffset));
TRACE("Size: %lu\n", ControlPacket->dwSize);
TRACE("Service: %S\n", (PWSTR)((ULONG_PTR)ControlPacket + ControlPacket->dwServiceNameOffset));
/* Set the service status handle */
lpService->hServiceStatus = ControlPacket->hServiceStatus;
@ -519,12 +525,14 @@ ScControlService(PACTIVE_SERVICE lpService,
{
DWORD dwError;
TRACE("ScControlService(%p %p)\n",
lpService, ControlPacket);
if (lpService == NULL || ControlPacket == NULL)
return ERROR_INVALID_PARAMETER;
TRACE("ScControlService(Size: %lu, Service: '%S') called\n",
ControlPacket->dwSize,
(PWSTR)((ULONG_PTR)ControlPacket + ControlPacket->dwServiceNameOffset));
TRACE("Size: %lu\n", ControlPacket->dwSize);
TRACE("Service: %S\n", (PWSTR)((ULONG_PTR)ControlPacket + ControlPacket->dwServiceNameOffset));
if (lpService->HandlerFunction)
{
@ -539,7 +547,7 @@ ScControlService(PACTIVE_SERVICE lpService,
lpService->HandlerContext);
}
TRACE("ScControlService() done (error %lu)\n", dwError);
TRACE("ScControlService() done (Error %lu)\n", dwError);
return dwError;
}
@ -558,7 +566,8 @@ ScServiceDispatcher(HANDLE hPipe,
SCM_REPLY_PACKET ReplyPacket;
DWORD dwError;
TRACE("ScDispatcherLoop() called\n");
TRACE("ScServiceDispatcher(%p %p %lu)\n",
hPipe, ControlPacket, dwBufferSize);
if (ControlPacket == NULL || dwBufferSize < sizeof(SCM_CONTROL_PACKET))
return FALSE;
@ -648,6 +657,9 @@ RegisterServiceCtrlHandlerA(LPCSTR lpServiceName,
UNICODE_STRING ServiceNameU;
SERVICE_STATUS_HANDLE hServiceStatus;
TRACE("RegisterServiceCtrlHandlerA(%s %p %p)\n",
debugstr_a(lpServiceName), lpHandlerProc);
RtlInitAnsiString(&ServiceNameA, lpServiceName);
if (!NT_SUCCESS(RtlAnsiStringToUnicodeString(&ServiceNameU, &ServiceNameA, TRUE)))
{
@ -676,6 +688,9 @@ RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName,
DWORD dwError;
PACTIVE_SERVICE Service;
TRACE("RegisterServiceCtrlHandlerW(%s %p %p)\n",
debugstr_w(lpServiceName), lpHandlerProc);
dwError = ScLookupServiceByServiceName(lpServiceName, &Service);
if ((dwError != ERROR_SUCCESS) || (Service == NULL))
{
@ -692,7 +707,7 @@ RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName,
Service->HandlerFunction = lpHandlerProc;
Service->HandlerFunctionEx = NULL;
TRACE("RegisterServiceCtrlHandler returning 0x%p\n", Service->hServiceStatus);
TRACE("RegisterServiceCtrlHandler returning %p\n", Service->hServiceStatus);
return Service->hServiceStatus;
}
@ -712,6 +727,9 @@ RegisterServiceCtrlHandlerExA(LPCSTR lpServiceName,
UNICODE_STRING ServiceNameU;
SERVICE_STATUS_HANDLE hServiceStatus;
TRACE("RegisterServiceCtrlHandlerExA(%s %p %p)\n",
debugstr_a(lpServiceName), lpHandlerProc, lpContext);
RtlInitAnsiString(&ServiceNameA, lpServiceName);
if (!NT_SUCCESS(RtlAnsiStringToUnicodeString(&ServiceNameU, &ServiceNameA, TRUE)))
{
@ -742,6 +760,9 @@ RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName,
DWORD dwError;
PACTIVE_SERVICE Service;
TRACE("RegisterServiceCtrlHandlerExW(%s %p %p)\n",
debugstr_w(lpServiceName), lpHandlerProc, lpContext);
dwError = ScLookupServiceByServiceName(lpServiceName, &Service);
if ((dwError != ERROR_SUCCESS) || (Service == NULL))
{
@ -776,6 +797,7 @@ VOID
WINAPI
I_ScIsSecurityProcess(VOID)
{
FIXME("I_ScIsSecurityProcess()\n");
}
@ -794,6 +816,9 @@ I_ScPnPGetServiceName(IN SERVICE_STATUS_HANDLE hServiceStatus,
{
DWORD i;
TRACE("I_ScPnPGetServiceName(%lu %p %lu)\n",
hServiceStatus, lpServiceName, cchServiceName);
for (i = 0; i < dwActiveServiceCount; i++)
{
if (lpActiveServices[i].hServiceStatus == hServiceStatus)
@ -823,6 +848,10 @@ I_ScSetServiceBitsA(SERVICE_STATUS_HANDLE hServiceStatus,
{
BOOL bResult;
TRACE("I_ScSetServiceBitsA(%lu %lx %u %u %s)\n",
hServiceStatus, dwServiceBits, bSetBitsOn, bUpdateImmediately,
debugstr_a(lpString));
RpcTryExcept
{
bResult = RI_ScSetServiceBitsA((RPC_SERVICE_STATUS_HANDLE)hServiceStatus,
@ -858,6 +887,10 @@ I_ScSetServiceBitsW(SERVICE_STATUS_HANDLE hServiceStatus,
{
BOOL bResult;
TRACE("I_ScSetServiceBitsW(%lu %lx %u %u %s)\n",
hServiceStatus, dwServiceBits, bSetBitsOn, bUpdateImmediately,
debugstr_w(lpString));
RpcTryExcept
{
bResult = RI_ScSetServiceBitsW((RPC_SERVICE_STATUS_HANDLE)hServiceStatus,
@ -888,6 +921,9 @@ SetServiceBits(SERVICE_STATUS_HANDLE hServiceStatus,
BOOL bSetBitsOn,
BOOL bUpdateImmediately)
{
TRACE("SetServiceBits(%lu %lx %u %u)\n",
hServiceStatus, dwServiceBits, bSetBitsOn, bUpdateImmediately);
return I_ScSetServiceBitsW(hServiceStatus,
dwServiceBits,
bSetBitsOn,
@ -907,7 +943,8 @@ SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus,
{
DWORD dwError;
TRACE("SetServiceStatus(hServiceStatus %lu) called\n", hServiceStatus);
TRACE("SetServiceStatus(%lu %p)\n",
hServiceStatus, lpServiceStatus);
RpcTryExcept
{
@ -927,7 +964,7 @@ SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus,
return FALSE;
}
TRACE("SetServiceStatus() done (ret %lu)\n", dwError);
TRACE("SetServiceStatus() done\n");
return TRUE;
}
@ -948,7 +985,8 @@ StartServiceCtrlDispatcherA(const SERVICE_TABLE_ENTRYA *lpServiceStartTable)
DWORD dwBufSize;
BOOL bRet = TRUE;
TRACE("StartServiceCtrlDispatcherA() called\n");
TRACE("StartServiceCtrlDispatcherA(%p)\n",
lpServiceStartTable);
i = 0;
while (lpServiceStartTable[i].lpServiceProc != NULL)
@ -1044,7 +1082,8 @@ StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable)
DWORD dwBufSize;
BOOL bRet = TRUE;
TRACE("StartServiceCtrlDispatcherW() called\n");
TRACE("StartServiceCtrlDispatcherW(%p)\n",
lpServiceStartTable);
i = 0;
while (lpServiceStartTable[i].lpServiceProc != NULL)