mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 07:56:59 +00:00
Fix closing of LPC ports
svn path=/trunk/; revision=10847
This commit is contained in:
parent
32bd722bb4
commit
2161bebe79
4 changed files with 25 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: proc.c,v 1.64 2004/08/29 14:46:02 weiden Exp $
|
/* $Id: proc.c,v 1.65 2004/09/13 19:10:45 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -639,8 +639,7 @@ ExitProcess(UINT uExitCode)
|
||||||
sizeof(CSRSS_API_REPLY));
|
sizeof(CSRSS_API_REPLY));
|
||||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrReply.Status))
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrReply.Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to tell csrss about terminating process. "
|
DPRINT("Failed to tell csrss about terminating process\n");
|
||||||
"Expect trouble.\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: close.c,v 1.13 2004/08/15 16:39:06 chorns Exp $
|
/* $Id: close.c,v 1.14 2004/09/13 19:10:45 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -33,7 +33,11 @@ NiClosePort (PVOID ObjectBody, ULONG HandleCount)
|
||||||
{
|
{
|
||||||
PEPORT Port = (PEPORT)ObjectBody;
|
PEPORT Port = (PEPORT)ObjectBody;
|
||||||
LPC_MESSAGE Message;
|
LPC_MESSAGE Message;
|
||||||
|
|
||||||
|
/* FIXME Race conditions here! */
|
||||||
|
|
||||||
|
DPRINT("NiClosePort 0x%p OtherPort 0x%p State %d\n", Port, Port->OtherPort, Port->State);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the client has just closed its handle then tell the server what
|
* If the client has just closed its handle then tell the server what
|
||||||
* happened and disconnect this port.
|
* happened and disconnect this port.
|
||||||
|
@ -41,6 +45,7 @@ NiClosePort (PVOID ObjectBody, ULONG HandleCount)
|
||||||
if (HandleCount == 0 && Port->State == EPORT_CONNECTED_CLIENT &&
|
if (HandleCount == 0 && Port->State == EPORT_CONNECTED_CLIENT &&
|
||||||
ObGetObjectPointerCount(Port) == 2)
|
ObGetObjectPointerCount(Port) == 2)
|
||||||
{
|
{
|
||||||
|
DPRINT("Informing server\n");
|
||||||
Message.MessageSize = sizeof(LPC_MESSAGE);
|
Message.MessageSize = sizeof(LPC_MESSAGE);
|
||||||
Message.DataSize = 0;
|
Message.DataSize = 0;
|
||||||
EiReplyOrRequestPort (Port->OtherPort,
|
EiReplyOrRequestPort (Port->OtherPort,
|
||||||
|
@ -61,8 +66,9 @@ NiClosePort (PVOID ObjectBody, ULONG HandleCount)
|
||||||
* don't actually notify the client until it attempts an operation.
|
* don't actually notify the client until it attempts an operation.
|
||||||
*/
|
*/
|
||||||
if (HandleCount == 0 && Port->State == EPORT_CONNECTED_SERVER &&
|
if (HandleCount == 0 && Port->State == EPORT_CONNECTED_SERVER &&
|
||||||
ObGetObjectPointerCount(Port) == 2)
|
ObGetObjectPointerCount(Port) == 1)
|
||||||
{
|
{
|
||||||
|
DPRINT("Cleaning up server\n");
|
||||||
Port->OtherPort->OtherPort = NULL;
|
Port->OtherPort->OtherPort = NULL;
|
||||||
Port->OtherPort->State = EPORT_DISCONNECTED;
|
Port->OtherPort->State = EPORT_DISCONNECTED;
|
||||||
ObDereferenceObject(Port->OtherPort);
|
ObDereferenceObject(Port->OtherPort);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: reply.c,v 1.21 2004/08/15 16:39:06 chorns Exp $
|
/* $Id: reply.c,v 1.22 2004/09/13 19:10:45 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -99,6 +99,12 @@ NtReplyPort (IN HANDLE PortHandle,
|
||||||
DPRINT("NtReplyPort() = %x\n", Status);
|
DPRINT("NtReplyPort() = %x\n", Status);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (EPORT_DISCONNECTED == Port->State)
|
||||||
|
{
|
||||||
|
ObDereferenceObject(Port);
|
||||||
|
return STATUS_PORT_DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
Status = EiReplyOrRequestPort(Port->OtherPort,
|
Status = EiReplyOrRequestPort(Port->OtherPort,
|
||||||
LpcReply,
|
LpcReply,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: send.c,v 1.17 2004/08/31 20:17:18 hbirr Exp $
|
/* $Id: send.c,v 1.18 2004/09/13 19:10:45 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -240,6 +240,12 @@ NtRequestWaitReplyPort (IN HANDLE PortHandle,
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (EPORT_DISCONNECTED == Port->State)
|
||||||
|
{
|
||||||
|
ObDereferenceObject(Port);
|
||||||
|
return STATUS_PORT_DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
/* win32k sometimes needs to KeAttach() the CSRSS process in order to make
|
/* win32k sometimes needs to KeAttach() the CSRSS process in order to make
|
||||||
the PortHandle valid. Now that we've got the EPORT structure from the
|
the PortHandle valid. Now that we've got the EPORT structure from the
|
||||||
handle we can undo this, so everything is normal again. Need to
|
handle we can undo this, so everything is normal again. Need to
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue