- Zero-out some allocated memory.
- During my investigations preceding the implementation of AttachConsole (r58166), I wanted (in a first attempt; finally I've found a better way to achieve what I wanted to do) to retrieve the CSR_PROCESS structure of the parent of a given process. I've found the 'Parent' member in the CSR_PROCESS structure, however this member was always initialized to NULL when new processes were created via CsrCreateProcess (and via the call to CsrInsertProcess). After looking at some informating here (http://svn.reactos.org/svn/reactos/trunk/reactos/include/subsys/csr/server.h?r1=17363&r2=17362&pathrev=17363) and there (http://forum.sysinternals.com/csrwalker-processes-detection-from-user-mode_topic15457.html), I became convinced that the 'Parent' member was unexistent starting from Windows Server 2003. Also, after much more investigation, I've found that the CsrInsertProcess function was called with only two parameters starting from Windows Server 2003 (and still continues in Windows 7), the always-NULL paramater being removed.
Therefore, I remove that unneeded parameter from CsrInsertProcess and the corresponding 'Parent' member from CSR_PROCESS.
svn path=/branches/ros-csrss/; revision=58232
CLIENT_ID ClientId;
LIST_ENTRY ListLink;
LIST_ENTRY ThreadList;
- struct _CSR_PROCESS *Parent;
PCSR_NT_SESSION NtSession;
ULONG ExpectedVersion;
HANDLE ClientPort;
} _SEH2_END;
/* We validated the incoming buffer, now allocate the remote one */
- RemoteCaptureBuffer = RtlAllocateHeap(CsrHeap, 0, Length);
+ RemoteCaptureBuffer = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, Length);
if (!RemoteCaptureBuffer)
{
/* We're out of memory */
VOID
NTAPI
-CsrInsertProcess(IN PCSR_PROCESS Parent OPTIONAL,
- IN PCSR_PROCESS CurrentProcess OPTIONAL,
+CsrInsertProcess(IN PCSR_PROCESS ParentProcess OPTIONAL,
IN PCSR_PROCESS CsrProcess);
NTSTATUS
* 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();
};
PCSR_SERVER_DLL CsrLoadedServerDll[CSR_SERVER_DLL_MAX];
-PVOID CsrSrvSharedSectionHeap;
-PVOID CsrSrvSharedSectionBase;
-PVOID *CsrSrvSharedStaticServerData;
-ULONG CsrSrvSharedSectionSize;
-HANDLE CsrSrvSharedSection;
+PVOID CsrSrvSharedSectionHeap = NULL;
+PVOID CsrSrvSharedSectionBase = NULL;
+PVOID *CsrSrvSharedStaticServerData = NULL;
+ULONG CsrSrvSharedSectionSize = 0;
+HANDLE CsrSrvSharedSection = NULL;
/* PRIVATE FUNCTIONS **********************************************************/
PCSR_NT_SESSION NtSession;
/* Allocate an NT Session Object */
- NtSession = RtlAllocateHeap(CsrHeap, 0, sizeof(CSR_NT_SESSION));
+ NtSession = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, sizeof(CSR_NT_SESSION));
if (NtSession)
{
/* Setup the Session Object */
}
/* Insert the Process */
- CsrInsertProcess(NULL, NULL, CsrProcess);
+ CsrInsertProcess(NULL, CsrProcess);
/* Activate the Thread */
ApiMessage->ReturnValue = NtResumeThread(hThread, NULL);
WaitApiMessage->Header.u1.s1.TotalLength;
/* Allocate the Wait Block */
- WaitBlock = RtlAllocateHeap(CsrHeap, 0, Size);
+ WaitBlock = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, Size);
if (!WaitBlock)
{
/* Fail */