- Be sure that we reply to the dying client when he dies.
- "Improve" a debug output (display the client process).
- Use existing helper functions for incrementing reference counts for threads and processes.

svn path=/branches/ros-csrss/; revision=58075
This commit is contained in:
Hermès Bélusca-Maïto 2013-01-01 02:59:31 +00:00
parent fc76ef76f0
commit 0444a3a392
3 changed files with 15 additions and 10 deletions

View file

@ -625,6 +625,9 @@ CsrApiRequestThread(IN PVOID Parameter)
ClientDiedMsg = (PCLIENT_DIED_MSG)&ReceiveMsg;
if (ClientDiedMsg->CreateTime.QuadPart == CsrThread->CreateTime.QuadPart)
{
/* Now we reply to the dying client */
ReplyPort = CsrThread->Process->ClientPort;
/* Reference the thread */
CsrLockedReferenceThread(CsrThread);
@ -773,12 +776,14 @@ CsrApiRequestThread(IN PVOID Parameter)
if (CsrDebug & 2)
{
DPRINT1("[%02x] CSRSS: [%02x,%02x] - %s Api called from %08x\n",
DPRINT1("[%02x] CSRSS: [%02x,%02x] - %s Api called from %08x, Process %08x - %08x\n",
Teb->ClientId.UniqueThread,
ReceiveMsg.Header.ClientId.UniqueProcess,
ReceiveMsg.Header.ClientId.UniqueThread,
ServerDll->NameTable[ApiId],
CsrThread);
CsrThread,
CsrThread->Process,
CsrProcess);
}
/* Assume success */

View file

@ -268,8 +268,8 @@ CsrLockedDereferenceProcess(PCSR_PROCESS CsrProcess)
{
/* Call the generic cleanup code */
DPRINT1("Should kill process: %p\n", CsrProcess);
CsrProcessRefcountZero(CsrProcess);
CsrAcquireProcessLock();
CsrProcessRefcountZero(CsrProcess);
}
}
@ -305,7 +305,7 @@ CsrAllocateProcess(VOID)
if (CsrProcessSequenceCount < 5) CsrProcessSequenceCount = 5;
/* Increase the reference count */
CsrProcess->ReferenceCount++;
CsrLockedReferenceProcess(CsrProcess);
/* Initialize the Thread List */
InitializeListHead(&CsrProcess->ThreadList);
@ -1300,7 +1300,7 @@ CsrShutdownProcesses(IN PLUID CallerLuid,
if (!CsrProcess) break;
/* Increase reference to process */
CsrProcess->ReferenceCount++;
CsrLockedReferenceProcess(CsrProcess);
FirstTry = TRUE;
while (TRUE)

View file

@ -123,11 +123,11 @@ CsrAllocateThread(IN PCSR_PROCESS CsrProcess)
/* Allocate the structure */
CsrThread = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, sizeof(CSR_THREAD));
if (!CsrThread) return(NULL);
if (!CsrThread) return NULL;
/* Reference the Thread and Process */
CsrThread->ReferenceCount++;
CsrProcess->ReferenceCount++;
CsrLockedReferenceThread(CsrThread);
CsrLockedReferenceProcess(CsrProcess);
/* Set the Parent Process */
CsrThread->Process = CsrProcess;
@ -465,8 +465,8 @@ CsrLockedDereferenceThread(IN PCSR_THREAD CsrThread)
if (!LockCount)
{
/* Call the generic cleanup code */
CsrThreadRefcountZero(CsrThread);
CsrAcquireProcessLock();
CsrThreadRefcountZero(CsrThread);
}
}
@ -991,7 +991,7 @@ CsrLockThreadByClientId(IN HANDLE Tid,
{
/* Reference the found thread */
Status = STATUS_SUCCESS;
CurrentThread->ReferenceCount++;
CsrLockedReferenceThread(CurrentThread);
*CsrThread = CurrentThread;
}
else