[ADVAPI32] Pass PnP data to services on SERVICE_CONTROL_DEVICEEVENT

Services can now receive PnP events.
This commit is contained in:
Eric Kohl
2025-05-25 14:34:25 +02:00
parent 55b6f3455c
commit 16e620d647

View File

@@ -551,6 +551,8 @@ ScControlService(PACTIVE_SERVICE lpService,
PSCM_CONTROL_PACKET ControlPacket)
{
DWORD dwError = ERROR_SUCCESS;
DWORD dwEventType = 0;
PVOID pEventData = NULL;
TRACE("ScControlService(%p %p)\n",
lpService, ControlPacket);
@@ -578,11 +580,17 @@ ScControlService(PACTIVE_SERVICE lpService,
}
else if (lpService->HandlerFunctionEx)
{
if (ControlPacket->dwControl == SERVICE_CONTROL_DEVICEEVENT)
{
dwEventType = *(LPDWORD)((ULONG_PTR)ControlPacket + sizeof(SCM_CONTROL_PACKET));
pEventData = (PVOID)((ULONG_PTR)ControlPacket + sizeof(SCM_CONTROL_PACKET) + sizeof(DWORD));
}
_SEH2_TRY
{
/* FIXME: Send correct 2nd and 3rd parameters */
(lpService->HandlerFunctionEx)(ControlPacket->dwControl,
0, NULL,
dwEventType,
pEventData,
lpService->HandlerContext);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)