From: Alex Ionescu Date: Tue, 25 Jul 2006 20:21:24 +0000 (+0000) Subject: - Fix a bug in LPC creation (missing one handle) and LPC closing (was not properly... X-Git-Tag: backups/clipboard@26030~436 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=986d92076283cffd8ad9d90c1620236dc511d378 - Fix a bug in LPC creation (missing one handle) and LPC closing (was not properly closing the port). This caused LPC_PORT_CLOSED never to be sent, and thus CSRSS never received and never closed its handle of the process, meaning that all win32 processes leaked. - As a result, processes can die again, and also be killed by Task Manager. - And finally, "Exit" in cmd.exe as well as pressing the "x" button work. svn path=/trunk/; revision=23292 --- diff --git a/reactos/ntoskrnl/KrnlFun.c b/reactos/ntoskrnl/KrnlFun.c index 0b0b6b941f2..3d3232e84fd 100644 --- a/reactos/ntoskrnl/KrnlFun.c +++ b/reactos/ntoskrnl/KrnlFun.c @@ -24,7 +24,6 @@ // - Add support for Fast Dispatch I/O. // // Ps: -// - Figure out why processes don't die. // - Generate process cookie for user-more thread. // // Ob: @@ -32,11 +31,9 @@ // - Add Directory Lock. // - Use Object Type Mutex/Lock. // - Implement handle database if anyone needs it. -// - Figure out why cmd.exe won't close anymore. // // Ex: // - Use pushlocks for handle implementation. -// - Figure out why cmd.exe won't close anymore. // /////////////////////////////////////////////////////////////////////////////// diff --git a/reactos/ntoskrnl/lpc/close.c b/reactos/ntoskrnl/lpc/close.c index b74f5015675..cf569dc02b6 100644 --- a/reactos/ntoskrnl/lpc/close.c +++ b/reactos/ntoskrnl/lpc/close.c @@ -57,13 +57,11 @@ LpcpClosePort (IN PEPROCESS Process OPTIONAL, /* 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 * happened and disconnect this port. */ - if (HandleCount == 1 && Port->State == EPORT_CONNECTED_CLIENT) + if (!(HandleCount)&& (Port->State == EPORT_CONNECTED_CLIENT)) { DPRINT("Informing server\n"); Message.u1.s1.TotalLength = sizeof(PORT_MESSAGE); @@ -85,7 +83,7 @@ LpcpClosePort (IN PEPROCESS Process OPTIONAL, * If the server has closed all of its handles then disconnect the port, * don't actually notify the client until it attempts an operation. */ - if (HandleCount == 1 && Port->State == EPORT_CONNECTED_SERVER) + if (!(HandleCount)&& (Port->State == EPORT_CONNECTED_SERVER)) { DPRINT("Cleaning up server\n"); Port->OtherPort->OtherPort = NULL; diff --git a/reactos/ntoskrnl/lpc/connect.c b/reactos/ntoskrnl/lpc/connect.c index 3b5c9c3b42c..6aa36904cfe 100644 --- a/reactos/ntoskrnl/lpc/connect.c +++ b/reactos/ntoskrnl/lpc/connect.c @@ -552,8 +552,8 @@ NtConnectPort (PHANDLE UnsafeConnectedPortHandle, Status = ObInsertObject(ConnectedPort, NULL, PORT_ALL_ACCESS, - 0, - NULL, + 1, + (PVOID*)&ConnectedPort, &ConnectedPortHandle); if (!NT_SUCCESS(Status)) {