Author: hbelusca Date: Tue Jan 1 02:59:31 2013 New Revision: 58075
URL: http://svn.reactos.org/svn/reactos?rev=58075&view=rev Log: [CONSRV] - 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.
Modified: branches/ros-csrss/subsystems/win32/csrsrv/api.c branches/ros-csrss/subsystems/win32/csrsrv/procsup.c branches/ros-csrss/subsystems/win32/csrsrv/thredsup.c
Modified: branches/ros-csrss/subsystems/win32/csrsrv/api.c URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrsr... ============================================================================== --- branches/ros-csrss/subsystems/win32/csrsrv/api.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/csrsrv/api.c [iso-8859-1] Tue Jan 1 02:59:31 2013 @@ -625,6 +625,9 @@ 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 @@
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 */
Modified: branches/ros-csrss/subsystems/win32/csrsrv/procsup.c URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrsr... ============================================================================== --- branches/ros-csrss/subsystems/win32/csrsrv/procsup.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/csrsrv/procsup.c [iso-8859-1] Tue Jan 1 02:59:31 2013 @@ -268,8 +268,8 @@ { /* Call the generic cleanup code */ DPRINT1("Should kill process: %p\n", CsrProcess); + CsrAcquireProcessLock(); CsrProcessRefcountZero(CsrProcess); - CsrAcquireProcessLock(); } }
@@ -305,7 +305,7 @@ if (CsrProcessSequenceCount < 5) CsrProcessSequenceCount = 5;
/* Increase the reference count */ - CsrProcess->ReferenceCount++; + CsrLockedReferenceProcess(CsrProcess);
/* Initialize the Thread List */ InitializeListHead(&CsrProcess->ThreadList); @@ -1300,7 +1300,7 @@ if (!CsrProcess) break;
/* Increase reference to process */ - CsrProcess->ReferenceCount++; + CsrLockedReferenceProcess(CsrProcess);
FirstTry = TRUE; while (TRUE)
Modified: branches/ros-csrss/subsystems/win32/csrsrv/thredsup.c URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrsr... ============================================================================== --- branches/ros-csrss/subsystems/win32/csrsrv/thredsup.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/csrsrv/thredsup.c [iso-8859-1] Tue Jan 1 02:59:31 2013 @@ -123,11 +123,11 @@
/* 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 @@ if (!LockCount) { /* Call the generic cleanup code */ + CsrAcquireProcessLock(); CsrThreadRefcountZero(CsrThread); - CsrAcquireProcessLock(); } }
@@ -991,7 +991,7 @@ { /* Reference the found thread */ Status = STATUS_SUCCESS; - CurrentThread->ReferenceCount++; + CsrLockedReferenceThread(CurrentThread); *CsrThread = CurrentThread; } else