{
/* 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);
* The CsrInsertProcess routine inserts a CSR Process into the Process List
* and notifies Server DLLs of the creation of a new CSR Process.
*
- * @param Parent
- * Optional pointer to the CSR Process creating this CSR Process.
- *
- * @param CurrentProcess
- * Optional pointer to the current CSR Process.
+ * @param ParentProcess
+ * Optional pointer to the Parent Process creating this CSR Process.
*
* @param CsrProcess
* Pointer to the CSR Process which is to be inserted.
*--*/
VOID
NTAPI
-CsrInsertProcess(IN PCSR_PROCESS Parent OPTIONAL, // ParentProcess
- IN PCSR_PROCESS CurrentProcess OPTIONAL, // CallingProcess
- IN PCSR_PROCESS CsrProcess) // Process
+CsrInsertProcess(IN PCSR_PROCESS ParentProcess OPTIONAL,
+ IN PCSR_PROCESS CsrProcess)
{
PCSR_SERVER_DLL ServerDll;
ULONG i;
ASSERT(ProcessStructureListLocked());
- /* Set the parent */
- CsrProcess->Parent = Parent;
-
/* Insert it into the Root List */
InsertTailList(&CsrRootProcess->ListLink, &CsrProcess->ListLink);
/* Make sure it's valid and that it has callback */
if (ServerDll && ServerDll->NewProcessCallback)
{
- ServerDll->NewProcessCallback(CurrentProcess, CsrProcess);
+ ServerDll->NewProcessCallback(ParentProcess, CsrProcess);
}
}
}
CsrSetBackgroundPriority(CsrProcess);
/* Insert the Process */
- CsrInsertProcess(NULL, CurrentProcess, CsrProcess);
+ CsrInsertProcess(CurrentProcess, CsrProcess);
/* Release lock and return */
CsrReleaseProcessLock();
/* Get the current thread entry */
CsrThread = CONTAINING_RECORD(NextEntry, CSR_THREAD, Link);
+ /* Move to the next entry */
+ NextEntry = NextEntry->Flink;
+
/* Make sure the thread isn't already dead */
if (CsrThread->Flags & CsrThreadTerminated)
{
- NextEntry = NextEntry->Flink;
+ /* Go the the next thread */
continue;
}
/* Dereference the thread */
CsrLockedDereferenceThread(CsrThread);
- NextEntry = CsrProcess->ThreadList.Flink;
}
/* Release the Process Lock and return success */
* @param CsrThread
* Pointer to the CSR Thread to impersonate.
*
- * @return TRUE if impersionation suceeded, false otherwise.
+ * @return TRUE if impersonation succeeded, false otherwise.
*
* @remarks Impersonation can be recursive.
*
{
PLIST_ENTRY NextEntry;
PCSR_PROCESS CurrentProcess = NULL;
- NTSTATUS Status;
+ NTSTATUS Status = STATUS_UNSUCCESSFUL;
/* Acquire the lock */
CsrAcquireProcessLock();
break;
}
- /* Next entry */
+ /* Move to the next entry */
NextEntry = NextEntry->Flink;
} while (NextEntry != &CsrRootProcess->ListLink);
CsrLockedReferenceProcess(CurrentProcess);
*CsrProcess = CurrentProcess;
}
-
+
/* Return the result */
return Status;
}
/* Get the Process */
CsrProcess = CONTAINING_RECORD(NextEntry, CSR_PROCESS, ListLink);
- /* Remove the skip flag, set shutdown flags to 0*/
+ /* Move to the next entry */
+ NextEntry = NextEntry->Flink;
+
+ /* Remove the skip flag, set shutdown flags to 0 */
CsrProcess->Flags &= ~CsrProcessSkipShutdown;
CsrProcess->ShutdownFlags = 0;
-
- /* Move to the next */
- NextEntry = NextEntry->Flink;
}
/* Set shudown Priority */
if (!CsrProcess) break;
/* Increase reference to process */
- CsrProcess->ReferenceCount++;
+ CsrLockedReferenceProcess(CsrProcess);
FirstTry = TRUE;
while (TRUE)
/* Get the Process */
CsrProcess = CONTAINING_RECORD(NextEntry, CSR_PROCESS, ListLink);
- /* Remove the skip flag, set shutdown flags to 0*/
+ /* Move to the next entry */
+ NextEntry = NextEntry->Flink;
+
+ /* Remove the skip flag, set shutdown flags to 0 */
CsrProcess->Flags &= ~CsrProcessSkipShutdown;
CsrProcess->ShutdownFlags = 0;
-
- /* Move to the next */
- NextEntry = NextEntry->Flink;
}
/* Set shudown Priority */