mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 20:36:35 +00:00
[ADVAPI32] ScStartService(): Just start the thread straight ahead, and return a suitable error code if thread creation failed.
This commit is contained in:
parent
91b50f9ccb
commit
0c44925ec1
1 changed files with 16 additions and 15 deletions
|
@ -432,9 +432,9 @@ ScStartService(PACTIVE_SERVICE lpService,
|
||||||
if (lpService == NULL || ControlPacket == NULL)
|
if (lpService == NULL || ControlPacket == NULL)
|
||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
TRACE("ScStartService() called\n");
|
TRACE("ScStartService(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));
|
||||||
|
|
||||||
/* Set the service status handle */
|
/* Set the service status handle */
|
||||||
lpService->hServiceStatus = ControlPacket->hServiceStatus;
|
lpService->hServiceStatus = ControlPacket->hServiceStatus;
|
||||||
|
@ -458,18 +458,20 @@ ScStartService(PACTIVE_SERVICE lpService,
|
||||||
0,
|
0,
|
||||||
ScServiceMainStubW,
|
ScServiceMainStubW,
|
||||||
ThreadParamsW,
|
ThreadParamsW,
|
||||||
CREATE_SUSPENDED,
|
0,
|
||||||
&ThreadId);
|
&ThreadId);
|
||||||
if (ThreadHandle == NULL)
|
if (ThreadHandle == NULL)
|
||||||
{
|
{
|
||||||
if (ThreadParamsW->lpArgVector != NULL)
|
if (ThreadParamsW->lpArgVector != NULL)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(),
|
HeapFree(GetProcessHeap(), 0, ThreadParamsW->lpArgVector);
|
||||||
0,
|
|
||||||
ThreadParamsW->lpArgVector);
|
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, ThreadParamsW);
|
HeapFree(GetProcessHeap(), 0, ThreadParamsW);
|
||||||
|
|
||||||
|
return ERROR_SERVICE_NO_THREAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CloseHandle(ThreadHandle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -489,22 +491,21 @@ ScStartService(PACTIVE_SERVICE lpService,
|
||||||
0,
|
0,
|
||||||
ScServiceMainStubA,
|
ScServiceMainStubA,
|
||||||
ThreadParamsA,
|
ThreadParamsA,
|
||||||
CREATE_SUSPENDED,
|
0,
|
||||||
&ThreadId);
|
&ThreadId);
|
||||||
if (ThreadHandle == NULL)
|
if (ThreadHandle == NULL)
|
||||||
{
|
{
|
||||||
if (ThreadParamsA->lpArgVector != NULL)
|
if (ThreadParamsA->lpArgVector != NULL)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(),
|
HeapFree(GetProcessHeap(), 0, ThreadParamsA->lpArgVector);
|
||||||
0,
|
|
||||||
ThreadParamsA->lpArgVector);
|
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, ThreadParamsA);
|
HeapFree(GetProcessHeap(), 0, ThreadParamsA);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ResumeThread(ThreadHandle);
|
return ERROR_SERVICE_NO_THREAD;
|
||||||
CloseHandle(ThreadHandle);
|
}
|
||||||
|
|
||||||
|
CloseHandle(ThreadHandle);
|
||||||
|
}
|
||||||
|
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue