mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 08:25:48 +00:00
Receive a client service handle from advapi32 so we can get a permenant link between the SCM and the service
svn path=/trunk/; revision=29013
This commit is contained in:
parent
873c9d539e
commit
b29eee1b73
3 changed files with 12 additions and 12 deletions
|
@ -116,12 +116,12 @@ ScmGetServiceEntryByResumeCount(DWORD dwResumeCount)
|
||||||
|
|
||||||
|
|
||||||
PSERVICE
|
PSERVICE
|
||||||
ScmGetServiceEntryByServiceStatusHandle(ULONG Handle)
|
ScmGetServiceEntryByClientHandle(ULONG Handle)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY ServiceEntry;
|
PLIST_ENTRY ServiceEntry;
|
||||||
PSERVICE CurrentService;
|
PSERVICE CurrentService;
|
||||||
|
|
||||||
DPRINT("ScmGetServiceEntryByServiceStatusHandle() called\n");
|
DPRINT("ScmGetServiceEntryByClientHandle() called\n");
|
||||||
DPRINT("looking for %lu\n", Handle);
|
DPRINT("looking for %lu\n", Handle);
|
||||||
|
|
||||||
ServiceEntry = ServiceListHead.Flink;
|
ServiceEntry = ServiceListHead.Flink;
|
||||||
|
@ -131,7 +131,7 @@ ScmGetServiceEntryByServiceStatusHandle(ULONG Handle)
|
||||||
SERVICE,
|
SERVICE,
|
||||||
ServiceListEntry);
|
ServiceListEntry);
|
||||||
|
|
||||||
if (CurrentService->hServiceStatus == Handle)
|
if (CurrentService->hClient == Handle)
|
||||||
{
|
{
|
||||||
DPRINT1("Found service: '%S'\n", CurrentService->lpDisplayName);
|
DPRINT1("Found service: '%S'\n", CurrentService->lpDisplayName);
|
||||||
return CurrentService;
|
return CurrentService;
|
||||||
|
@ -640,13 +640,14 @@ ScmSendStartCommand(PSERVICE Service,
|
||||||
DPRINT("ArgsLength: %ld TotalLength: %ld\n", ArgsLength, TotalLength);
|
DPRINT("ArgsLength: %ld TotalLength: %ld\n", ArgsLength, TotalLength);
|
||||||
|
|
||||||
/* Allocate a control packet */
|
/* Allocate a control packet */
|
||||||
ControlPacket = (SCM_CONTROL_PACKET*) HeapAlloc(GetProcessHeap(),
|
ControlPacket = (SCM_CONTROL_PACKET*)HeapAlloc(GetProcessHeap(),
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
sizeof(SCM_CONTROL_PACKET) + (TotalLength - 1) * sizeof(WCHAR));
|
sizeof(SCM_CONTROL_PACKET) + (TotalLength - 1) * sizeof(WCHAR));
|
||||||
if (ControlPacket == NULL)
|
if (ControlPacket == NULL)
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
|
||||||
ControlPacket->dwControl = SERVICE_CONTROL_START;
|
ControlPacket->dwControl = SERVICE_CONTROL_START;
|
||||||
|
ControlPacket->hClient = Service->hClient;
|
||||||
ControlPacket->dwSize = TotalLength;
|
ControlPacket->dwSize = TotalLength;
|
||||||
Ptr = &ControlPacket->szArguments[0];
|
Ptr = &ControlPacket->szArguments[0];
|
||||||
wcscpy(Ptr, Service->lpServiceName);
|
wcscpy(Ptr, Service->lpServiceName);
|
||||||
|
@ -793,7 +794,7 @@ ScmStartUserModeService(PSERVICE Service,
|
||||||
|
|
||||||
/* Read SERVICE_STATUS_HANDLE from pipe */
|
/* Read SERVICE_STATUS_HANDLE from pipe */
|
||||||
if (!ReadFile(Service->ControlPipeHandle,
|
if (!ReadFile(Service->ControlPipeHandle,
|
||||||
(LPVOID)&Service->hServiceStatus,
|
(LPVOID)&Service->hClient,
|
||||||
sizeof(DWORD),
|
sizeof(DWORD),
|
||||||
&dwRead,
|
&dwRead,
|
||||||
NULL))
|
NULL))
|
||||||
|
@ -804,8 +805,7 @@ ScmStartUserModeService(PSERVICE Service,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT("Received service status %lu\n", Service->hServiceStatus);
|
DPRINT("Received service status %lu\n", Service->hClient);
|
||||||
DPRINT("calling ScmSendStartCommand on %S\n", Service->lpDisplayName);
|
|
||||||
|
|
||||||
/* Send start command */
|
/* Send start command */
|
||||||
dwError = ScmSendStartCommand(Service, lpArgs);
|
dwError = ScmSendStartCommand(Service, lpArgs);
|
||||||
|
|
|
@ -717,7 +717,7 @@ ScmrSetServiceStatus(handle_t BindingHandle,
|
||||||
if (ScmShutdown)
|
if (ScmShutdown)
|
||||||
return ERROR_SHUTDOWN_IN_PROGRESS;
|
return ERROR_SHUTDOWN_IN_PROGRESS;
|
||||||
|
|
||||||
lpService = ScmGetServiceEntryByServiceStatusHandle((ULONG)hServiceStatus);
|
lpService = ScmGetServiceEntryByClientHandle((ULONG)hServiceStatus);
|
||||||
if (lpService == NULL)
|
if (lpService == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1("lpService == NULL!\n");
|
DPRINT1("lpService == NULL!\n");
|
||||||
|
|
|
@ -41,7 +41,7 @@ typedef struct _SERVICE
|
||||||
BOOL bDeleted;
|
BOOL bDeleted;
|
||||||
DWORD dwResumeCount;
|
DWORD dwResumeCount;
|
||||||
|
|
||||||
SERVICE_STATUS_HANDLE hServiceStatus;
|
CLIENT_HANDLE hClient;
|
||||||
SERVICE_STATUS Status;
|
SERVICE_STATUS Status;
|
||||||
DWORD dwStartType;
|
DWORD dwStartType;
|
||||||
DWORD dwErrorControl;
|
DWORD dwErrorControl;
|
||||||
|
@ -105,7 +105,7 @@ DWORD ScmStartService(PSERVICE Service,
|
||||||
PSERVICE ScmGetServiceEntryByName(LPWSTR lpServiceName);
|
PSERVICE ScmGetServiceEntryByName(LPWSTR lpServiceName);
|
||||||
PSERVICE ScmGetServiceEntryByDisplayName(LPWSTR lpDisplayName);
|
PSERVICE ScmGetServiceEntryByDisplayName(LPWSTR lpDisplayName);
|
||||||
PSERVICE ScmGetServiceEntryByResumeCount(DWORD dwResumeCount);
|
PSERVICE ScmGetServiceEntryByResumeCount(DWORD dwResumeCount);
|
||||||
PSERVICE ScmGetServiceEntryByServiceStatusHandle(ULONG ThreadId);
|
PSERVICE ScmGetServiceEntryByClientHandle(ULONG ThreadId);
|
||||||
DWORD ScmCreateNewServiceRecord(LPWSTR lpServiceName,
|
DWORD ScmCreateNewServiceRecord(LPWSTR lpServiceName,
|
||||||
PSERVICE *lpServiceRecord);
|
PSERVICE *lpServiceRecord);
|
||||||
DWORD ScmMarkServiceForDelete(PSERVICE pService);
|
DWORD ScmMarkServiceForDelete(PSERVICE pService);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue