https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0c44925ec1a31e6c0dc66…
commit 0c44925ec1a31e6c0dc66ea8f68a2755d1e4f492
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Feb 25 19:02:38 2018 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Feb 26 00:37:01 2018 +0100
[ADVAPI32] ScStartService(): Just start the thread straight ahead, and return a
suitable error code if thread creation failed.
---
dll/win32/advapi32/service/sctrl.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/dll/win32/advapi32/service/sctrl.c b/dll/win32/advapi32/service/sctrl.c
index 5afa8dfc14..b5e1b8a26b 100644
--- a/dll/win32/advapi32/service/sctrl.c
+++ b/dll/win32/advapi32/service/sctrl.c
@@ -432,9 +432,9 @@ ScStartService(PACTIVE_SERVICE lpService,
if (lpService == NULL || ControlPacket == NULL)
return ERROR_INVALID_PARAMETER;
- TRACE("ScStartService() called\n");
- TRACE("Size: %lu\n", ControlPacket->dwSize);
- TRACE("Service: %S\n", (PWSTR)((PBYTE)ControlPacket +
ControlPacket->dwServiceNameOffset));
+ TRACE("ScStartService(Size: %lu, Service: '%S') called\n",
+ ControlPacket->dwSize,
+ (PWSTR)((ULONG_PTR)ControlPacket + ControlPacket->dwServiceNameOffset));
/* Set the service status handle */
lpService->hServiceStatus = ControlPacket->hServiceStatus;
@@ -458,18 +458,20 @@ ScStartService(PACTIVE_SERVICE lpService,
0,
ScServiceMainStubW,
ThreadParamsW,
- CREATE_SUSPENDED,
+ 0,
&ThreadId);
if (ThreadHandle == NULL)
{
if (ThreadParamsW->lpArgVector != NULL)
{
- HeapFree(GetProcessHeap(),
- 0,
- ThreadParamsW->lpArgVector);
+ HeapFree(GetProcessHeap(), 0, ThreadParamsW->lpArgVector);
}
HeapFree(GetProcessHeap(), 0, ThreadParamsW);
+
+ return ERROR_SERVICE_NO_THREAD;
}
+
+ CloseHandle(ThreadHandle);
}
else
{
@@ -489,22 +491,21 @@ ScStartService(PACTIVE_SERVICE lpService,
0,
ScServiceMainStubA,
ThreadParamsA,
- CREATE_SUSPENDED,
+ 0,
&ThreadId);
if (ThreadHandle == NULL)
{
if (ThreadParamsA->lpArgVector != NULL)
{
- HeapFree(GetProcessHeap(),
- 0,
- ThreadParamsA->lpArgVector);
+ HeapFree(GetProcessHeap(), 0, ThreadParamsA->lpArgVector);
}
HeapFree(GetProcessHeap(), 0, ThreadParamsA);
+
+ return ERROR_SERVICE_NO_THREAD;
}
- }
- ResumeThread(ThreadHandle);
- CloseHandle(ThreadHandle);
+ CloseHandle(ThreadHandle);
+ }
return ERROR_SUCCESS;
}