[KERNEL32] Minor enhancements for CreateRemoteThread(). (#804)

- Add some cleanup code in failure code paths, instead of asserting.
- Move BasepNotifyCsrOfThread() helper to the only file where it is used.
- Don't use ERROR_DBGBREAK in failure paths but just DPRINT the error
  message: we handle the failures properly.
- When creating the remote thread, sync its service tag with the parent
  thread's one.
This commit is contained in:
Hermès Bélusca-Maïto 2018-08-23 21:44:53 +02:00
parent effdb6f232
commit 44cddadba8
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 76 additions and 69 deletions

View file

@ -479,36 +479,6 @@ BaseProcessStartup(PPROCESS_START_ROUTINE lpStartAddress)
_SEH2_END;
}
NTSTATUS
WINAPI
BasepNotifyCsrOfThread(IN HANDLE ThreadHandle,
IN PCLIENT_ID ClientId)
{
BASE_API_MESSAGE ApiMessage;
PBASE_CREATE_THREAD CreateThreadRequest = &ApiMessage.Data.CreateThreadRequest;
DPRINT("BasepNotifyCsrOfThread: Thread: %p, Handle %p\n",
ClientId->UniqueThread, ThreadHandle);
/* Fill out the request */
CreateThreadRequest->ClientId = *ClientId;
CreateThreadRequest->ThreadHandle = ThreadHandle;
/* Call CSR */
CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL,
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepCreateThread),
sizeof(*CreateThreadRequest));
if (!NT_SUCCESS(ApiMessage.Status))
{
DPRINT1("Failed to tell CSRSS about new thread: %lx\n", ApiMessage.Status);
return ApiMessage.Status;
}
/* Return Success */
return STATUS_SUCCESS;
}
BOOLEAN
WINAPI
BasePushProcessParameters(IN ULONG ParameterFlags,