- Do not create process data twice.

- Check message type.

svn path=/trunk/; revision=27175
This commit is contained in:
Dmitry Gorbachev 2007-06-14 16:47:24 +00:00
parent 0743fc87cf
commit 076ca93553
3 changed files with 26 additions and 11 deletions

View file

@ -107,7 +107,7 @@ PCSRSS_PROCESS_DATA STDCALL CsrCreateProcessData(HANDLE ProcessId)
} }
else else
{ {
DPRINT("Process data for pid %d already exist\n", ProcessId); DPRINT1("Process data for pid %d already exist\n", ProcessId);
} }
UNLOCK; UNLOCK;
if (pProcessData == NULL) if (pProcessData == NULL)
@ -249,7 +249,7 @@ CSR_API(CsrCreateProcess)
Status = CsrDuplicateHandleTable(ProcessData, NewProcessData); Status = CsrDuplicateHandleTable(ProcessData, NewProcessData);
} }
} }
/* Set default shutdown parameters */ /* Set default shutdown parameters */
NewProcessData->ShutdownLevel = 0x280; NewProcessData->ShutdownLevel = 0x280;
NewProcessData->ShutdownFlags = 0; NewProcessData->ShutdownFlags = 0;

View file

@ -33,7 +33,7 @@ CsrApiRegisterDefinitions(PCSRSS_API_DEFINITION NewDefinitions)
PCSRSS_API_DEFINITION Scan; PCSRSS_API_DEFINITION Scan;
PCSRSS_API_DEFINITION New; PCSRSS_API_DEFINITION New;
DPRINT("CSR: %s called", __FUNCTION__); DPRINT("CSR: %s called\n", __FUNCTION__);
NewCount = 0; NewCount = 0;
for (Scan = NewDefinitions; 0 != Scan->Handler; Scan++) for (Scan = NewDefinitions; 0 != Scan->Handler; Scan++)
@ -148,13 +148,17 @@ CsrpHandleConnectionRequest (PPORT_MESSAGE Request,
return Status; return Status;
} }
ProcessData = CsrCreateProcessData(Request->ClientId.UniqueProcess); ProcessData = CsrGetProcessData(Request->ClientId.UniqueProcess);
if (ProcessData == NULL) if (ProcessData == NULL)
{ {
DPRINT1("Unable to allocate or find data for process 0x%x\n", ProcessData = CsrCreateProcessData(Request->ClientId.UniqueProcess);
Request->ClientId.UniqueProcess); if (ProcessData == NULL)
Status = STATUS_UNSUCCESSFUL; {
return Status; DPRINT1("Unable to allocate or find data for process 0x%x\n",
Request->ClientId.UniqueProcess);
Status = STATUS_UNSUCCESSFUL;
return Status;
}
} }
ProcessData->CsrSectionViewBase = LpcRead.ViewBase; ProcessData->CsrSectionViewBase = LpcRead.ViewBase;
@ -203,7 +207,7 @@ ClientConnectionThread(HANDLE ServerPort)
PCSR_API_MESSAGE Reply; PCSR_API_MESSAGE Reply;
PCSRSS_PROCESS_DATA ProcessData; PCSRSS_PROCESS_DATA ProcessData;
DPRINT("CSR: %s called", __FUNCTION__); DPRINT("CSR: %s called\n", __FUNCTION__);
/* Reply must be NULL at the first call to NtReplyWaitReceivePort */ /* Reply must be NULL at the first call to NtReplyWaitReceivePort */
Reply = NULL; Reply = NULL;
@ -242,7 +246,15 @@ ClientConnectionThread(HANDLE ServerPort)
if (Request->Header.u2.s2.Type == LPC_CLIENT_DIED) if (Request->Header.u2.s2.Type == LPC_CLIENT_DIED)
{ {
DPRINT("Clietn died, oh well\n"); DPRINT("Client died, oh well\n");
Reply = NULL;
continue;
}
if ((Request->Header.u2.s2.Type != LPC_ERROR_EVENT) &&
(Request->Header.u2.s2.Type != LPC_REQUEST))
{
DPRINT1("CSR: received message %d\n", Request->Header.u2.s2.Type);
Reply = NULL; Reply = NULL;
continue; continue;
} }
@ -285,6 +297,8 @@ ClientConnectionThread(HANDLE ServerPort)
/* Close the port and exit the thread */ /* Close the port and exit the thread */
NtClose(ServerPort); NtClose(ServerPort);
DPRINT("CSR: %s done\n", __FUNCTION__);
RtlExitUserThread(STATUS_SUCCESS); RtlExitUserThread(STATUS_SUCCESS);
} }

View file

@ -528,7 +528,8 @@ CsrpCreateApiPort (int argc, char ** argv, char ** envp)
{ {
DPRINT("CSR: %s called\n", __FUNCTION__); DPRINT("CSR: %s called\n", __FUNCTION__);
CsrInitProcessData(); CsrInitProcessData();
return CsrpCreateListenPort (L"\\Windows\\ApiPort", return CsrpCreateListenPort (L"\\Windows\\ApiPort",
& hApiPort, & hApiPort,
#ifdef NTLPC #ifdef NTLPC