[ADVAPI32] Take into account the service handler context when dispatching a control notification to a service. (Used e.g. by tcpsvcs.)

This commit is contained in:
Hermès Bélusca-Maïto 2018-02-25 18:53:05 +01:00
parent 635aabb011
commit 91b50f9ccb
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 14 additions and 9 deletions

View file

@ -10,7 +10,7 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <advapi32.h> #include <advapi32.h>
WINE_DEFAULT_DEBUG_CHANNEL(advapi); WINE_DEFAULT_DEBUG_CHANNEL(advapi_service);
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/

View file

@ -12,7 +12,7 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <advapi32.h> #include <advapi32.h>
WINE_DEFAULT_DEBUG_CHANNEL(advapi); WINE_DEFAULT_DEBUG_CHANNEL(advapi_service);
/* TYPES *********************************************************************/ /* TYPES *********************************************************************/
@ -514,26 +514,31 @@ static DWORD
ScControlService(PACTIVE_SERVICE lpService, ScControlService(PACTIVE_SERVICE lpService,
PSCM_CONTROL_PACKET ControlPacket) PSCM_CONTROL_PACKET ControlPacket)
{ {
DWORD dwError;
if (lpService == NULL || ControlPacket == NULL) if (lpService == NULL || ControlPacket == NULL)
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
TRACE("ScControlService() called\n"); TRACE("ScControlService(Size: %lu, Service: '%S') called\n",
TRACE("Size: %lu\n", ControlPacket->dwSize); ControlPacket->dwSize,
TRACE("Service: %S\n", (PWSTR)((PBYTE)ControlPacket + ControlPacket->dwServiceNameOffset)); (PWSTR)((ULONG_PTR)ControlPacket + ControlPacket->dwServiceNameOffset));
if (lpService->HandlerFunction) if (lpService->HandlerFunction)
{ {
(lpService->HandlerFunction)(ControlPacket->dwControl); (lpService->HandlerFunction)(ControlPacket->dwControl);
dwError = ERROR_SUCCESS;
} }
else if (lpService->HandlerFunctionEx) else if (lpService->HandlerFunctionEx)
{ {
/* FIXME: send correct params */ /* FIXME: Send correct 2nd and 3rd parameters */
(lpService->HandlerFunctionEx)(ControlPacket->dwControl, 0, NULL, NULL); dwError = (lpService->HandlerFunctionEx)(ControlPacket->dwControl,
0, NULL,
lpService->HandlerContext);
} }
TRACE("ScControlService() done\n"); TRACE("ScControlService() done (error %lu)\n", dwError);
return ERROR_SUCCESS; return dwError;
} }