Author: hbelusca
Date: Sat Jan 26 21:23:10 2013
New Revision: 58232
URL:
http://svn.reactos.org/svn/reactos?rev=58232&view=rev
Log:
[CSRSRV]
- 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.…)
and there
(
http://forum.sysinternals.com/csrwalker-processes-detection-from-user-mode_…),
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.
Modified:
branches/ros-csrss/include/reactos/subsys/csr/csrsrv.h
branches/ros-csrss/subsystems/win32/csrsrv/api.c
branches/ros-csrss/subsystems/win32/csrsrv/include/api.h
branches/ros-csrss/subsystems/win32/csrsrv/procsup.c
branches/ros-csrss/subsystems/win32/csrsrv/server.c
branches/ros-csrss/subsystems/win32/csrsrv/session.c
branches/ros-csrss/subsystems/win32/csrsrv/wait.c
Modified: branches/ros-csrss/include/reactos/subsys/csr/csrsrv.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
==============================================================================
--- branches/ros-csrss/include/reactos/subsys/csr/csrsrv.h [iso-8859-1] (original)
+++ branches/ros-csrss/include/reactos/subsys/csr/csrsrv.h [iso-8859-1] Sat Jan 26
21:23:10 2013
@@ -39,7 +39,6 @@
CLIENT_ID ClientId;
LIST_ENTRY ListLink;
LIST_ENTRY ThreadList;
- struct _CSR_PROCESS *Parent;
PCSR_NT_SESSION NtSession;
ULONG ExpectedVersion;
HANDLE ClientPort;
Modified: branches/ros-csrss/subsystems/win32/csrsrv/api.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/api.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/api.c [iso-8859-1] Sat Jan 26 21:23:10
2013
@@ -1171,7 +1171,7 @@
} _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 */
Modified: branches/ros-csrss/subsystems/win32/csrsrv/include/api.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/include/api.h [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/include/api.h [iso-8859-1] Sat Jan 26
21:23:10 2013
@@ -119,8 +119,7 @@
VOID
NTAPI
-CsrInsertProcess(IN PCSR_PROCESS Parent OPTIONAL,
- IN PCSR_PROCESS CurrentProcess OPTIONAL,
+CsrInsertProcess(IN PCSR_PROCESS ParentProcess OPTIONAL,
IN PCSR_PROCESS CsrProcess);
NTSTATUS
Modified: branches/ros-csrss/subsystems/win32/csrsrv/procsup.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/procsup.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/procsup.c [iso-8859-1] Sat Jan 26 21:23:10
2013
@@ -451,11 +451,8 @@
* 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.
@@ -467,17 +464,13 @@
*--*/
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);
@@ -490,7 +483,7 @@
/* Make sure it's valid and that it has callback */
if (ServerDll && ServerDll->NewProcessCallback)
{
- ServerDll->NewProcessCallback(CurrentProcess, CsrProcess);
+ ServerDll->NewProcessCallback(ParentProcess, CsrProcess);
}
}
}
@@ -706,7 +699,7 @@
CsrSetBackgroundPriority(CsrProcess);
/* Insert the Process */
- CsrInsertProcess(NULL, CurrentProcess, CsrProcess);
+ CsrInsertProcess(CurrentProcess, CsrProcess);
/* Release lock and return */
CsrReleaseProcessLock();
Modified: branches/ros-csrss/subsystems/win32/csrsrv/server.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/server.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/server.c [iso-8859-1] Sat Jan 26 21:23:10
2013
@@ -43,11 +43,11 @@
};
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 **********************************************************/
Modified: branches/ros-csrss/subsystems/win32/csrsrv/session.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/session.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/session.c [iso-8859-1] Sat Jan 26 21:23:10
2013
@@ -84,7 +84,7 @@
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 */
@@ -331,7 +331,7 @@
}
/* Insert the Process */
- CsrInsertProcess(NULL, NULL, CsrProcess);
+ CsrInsertProcess(NULL, CsrProcess);
/* Activate the Thread */
ApiMessage->ReturnValue = NtResumeThread(hThread, NULL);
Modified: branches/ros-csrss/subsystems/win32/csrsrv/wait.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/wait.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/wait.c [iso-8859-1] Sat Jan 26 21:23:10
2013
@@ -62,7 +62,7 @@
WaitApiMessage->Header.u1.s1.TotalLength;
/* Allocate the Wait Block */
- WaitBlock = RtlAllocateHeap(CsrHeap, 0, Size);
+ WaitBlock = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, Size);
if (!WaitBlock)
{
/* Fail */