- 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
This commit is contained in:
Hermès Bélusca-Maïto 2013-01-26 21:23:10 +00:00
parent 7846f054ff
commit b75ee7fd14
7 changed files with 16 additions and 25 deletions

View file

@ -39,7 +39,6 @@ typedef struct _CSR_PROCESS
CLIENT_ID ClientId;
LIST_ENTRY ListLink;
LIST_ENTRY ThreadList;
struct _CSR_PROCESS *Parent;
PCSR_NT_SESSION NtSession;
ULONG ExpectedVersion;
HANDLE ClientPort;

View file

@ -1171,7 +1171,7 @@ CsrCaptureArguments(IN PCSR_THREAD CsrThread,
} _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 */

View file

@ -119,8 +119,7 @@ CsrRemoveProcess(IN PCSR_PROCESS CsrProcess);
VOID
NTAPI
CsrInsertProcess(IN PCSR_PROCESS Parent OPTIONAL,
IN PCSR_PROCESS CurrentProcess OPTIONAL,
CsrInsertProcess(IN PCSR_PROCESS ParentProcess OPTIONAL,
IN PCSR_PROCESS CsrProcess);
NTSTATUS

View file

@ -451,11 +451,8 @@ CsrRemoveProcess(IN PCSR_PROCESS CsrProcess)
* 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 @@ CsrRemoveProcess(IN PCSR_PROCESS CsrProcess)
*--*/
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 @@ CsrInsertProcess(IN PCSR_PROCESS Parent OPTIONAL, // ParentProcess
/* 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 @@ CsrCreateProcess(IN HANDLE hProcess,
CsrSetBackgroundPriority(CsrProcess);
/* Insert the Process */
CsrInsertProcess(NULL, CurrentProcess, CsrProcess);
CsrInsertProcess(CurrentProcess, CsrProcess);
/* Release lock and return */
CsrReleaseProcessLock();

View file

@ -43,11 +43,11 @@ PCHAR CsrServerApiNameTable[CsrpMaxApiNumber] =
};
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 **********************************************************/

View file

@ -84,7 +84,7 @@ CsrAllocateNtSession(IN ULONG SessionId)
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 @@ CsrSbCreateSession(IN PSB_API_MSG ApiMessage)
}
/* Insert the Process */
CsrInsertProcess(NULL, NULL, CsrProcess);
CsrInsertProcess(NULL, CsrProcess);
/* Activate the Thread */
ApiMessage->ReturnValue = NtResumeThread(hThread, NULL);

View file

@ -62,7 +62,7 @@ CsrInitializeWait(IN CSR_WAIT_FUNCTION WaitFunction,
WaitApiMessage->Header.u1.s1.TotalLength;
/* Allocate the Wait Block */
WaitBlock = RtlAllocateHeap(CsrHeap, 0, Size);
WaitBlock = RtlAllocateHeap(CsrHeap, HEAP_ZERO_MEMORY, Size);
if (!WaitBlock)
{
/* Fail */