- 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
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);
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 */
{
/* Call the generic cleanup code */
DPRINT1("Should kill process: %p\n", CsrProcess);
- CsrProcessRefcountZero(CsrProcess);
CsrAcquireProcessLock();
+ CsrProcessRefcountZero(CsrProcess);
}
}
if (CsrProcessSequenceCount < 5) CsrProcessSequenceCount = 5;
/* Increase the reference count */
- CsrProcess->ReferenceCount++;
+ CsrLockedReferenceProcess(CsrProcess);
/* Initialize the Thread List */
InitializeListHead(&CsrProcess->ThreadList);
if (!CsrProcess) break;
/* Increase reference to process */
- CsrProcess->ReferenceCount++;
+ CsrLockedReferenceProcess(CsrProcess);
FirstTry = TRUE;
while (TRUE)
/* 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;
if (!LockCount)
{
/* Call the generic cleanup code */
- CsrThreadRefcountZero(CsrThread);
CsrAcquireProcessLock();
+ CsrThreadRefcountZero(CsrThread);
}
}
{
/* Reference the found thread */
Status = STATUS_SUCCESS;
- CurrentThread->ReferenceCount++;
+ CsrLockedReferenceThread(CurrentThread);
*CsrThread = CurrentThread;
}
else