mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[CSRSRV]: Properly implement CsrSrvCreateThread now that the worker thread issue is fixed. CSR_THREAD's are now created for everyone, and CSRSS succesfully duplicates their thread handle! Also, while connections from unknown threads are still allowed (in case I missed something), we do warn on the console about these guys now.
svn path=/trunk/; revision=55707
This commit is contained in:
parent
07ea12ee5b
commit
8306172b6a
2 changed files with 17 additions and 21 deletions
|
@ -172,50 +172,46 @@ CSR_API(CsrSrvCreateThread)
|
|||
NTSTATUS Status;
|
||||
PCSR_PROCESS CsrProcess;
|
||||
|
||||
/* Get the current CSR thread */
|
||||
CurrentThread = NtCurrentTeb()->CsrClientThread;
|
||||
if (!CurrentThread) return STATUS_SUCCESS; // server-to-server
|
||||
|
||||
/* Get the CSR Process for this request */
|
||||
CsrProcess = CurrentThread->Process;
|
||||
|
||||
if (CsrProcess->ClientId.UniqueProcess != Request->Data.CreateThreadRequest.ClientId.UniqueProcess)
|
||||
if (CsrProcess->ClientId.UniqueProcess !=
|
||||
Request->Data.CreateThreadRequest.ClientId.UniqueProcess)
|
||||
{
|
||||
/* This is a remote thread request -- is it within the server itself? */
|
||||
if (Request->Data.CreateThreadRequest.ClientId.UniqueProcess == NtCurrentTeb()->ClientId.UniqueProcess)
|
||||
{
|
||||
/* Accept this without any further work */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Get the real CSR Process for the remote thread's process */
|
||||
Status = CsrLockProcessByClientId(Request->Data.CreateThreadRequest.ClientId.UniqueProcess,
|
||||
&CsrProcess);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
}
|
||||
|
||||
Status = NtDuplicateObject(CsrProcess->ProcessHandle,
|
||||
|
||||
/* Duplicate the thread handle so we can own it */
|
||||
Status = NtDuplicateObject(CurrentThread->Process->ProcessHandle,
|
||||
Request->Data.CreateThreadRequest.ThreadHandle,
|
||||
NtCurrentProcess(),
|
||||
&ThreadHandle,
|
||||
0,
|
||||
0,
|
||||
DUPLICATE_SAME_ACCESS);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
Status = NtDuplicateObject(CurrentThread->Process->ProcessHandle,
|
||||
Request->Data.CreateThreadRequest.ThreadHandle,
|
||||
NtCurrentProcess(),
|
||||
&ThreadHandle,
|
||||
0,
|
||||
0,
|
||||
DUPLICATE_SAME_ACCESS);
|
||||
}
|
||||
|
||||
Status = STATUS_SUCCESS; // hack
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Call CSRSRV to tell it about the new thread */
|
||||
Status = CsrCreateThread(CsrProcess,
|
||||
ThreadHandle,
|
||||
&Request->Data.CreateThreadRequest.ClientId);
|
||||
ThreadHandle,
|
||||
&Request->Data.CreateThreadRequest.ClientId);
|
||||
}
|
||||
|
||||
if (CsrProcess != CurrentThread->Process) CsrReleaseProcessLock();
|
||||
|
||||
/* Unlock the process and return */
|
||||
if (CsrProcess != CurrentThread->Process) CsrUnlockProcess(CsrProcess);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -1183,7 +1183,7 @@ ClientConnectionThread(IN PVOID Parameter)
|
|||
Thread = CsrLocateThreadByClientId(&Process, &Request->Header.ClientId);
|
||||
if (!Thread)
|
||||
{
|
||||
DPRINT("No thread found for request %lx and clientID %lx.%lx\n",
|
||||
DPRINT1("No thread found for request %lx and clientID %lx.%lx\n",
|
||||
Request->Type & 0xFFFF,
|
||||
Request->Header.ClientId.UniqueProcess,
|
||||
Request->Header.ClientId.UniqueThread);
|
||||
|
|
Loading…
Reference in a new issue