PLPCP_CONNECTION_MESSAGE ConnectMessage;
PLPCP_PORT_OBJECT ClientPort = NULL;
PETHREAD Thread = NULL;
- BOOLEAN LockHeld = (LockFlags & LPCP_LOCK_OWNED);
+ BOOLEAN LockHeld = (LockFlags & LPCP_LOCK_HELD);
BOOLEAN ReleaseLock = (LockFlags & LPCP_LOCK_RELEASE);
PAGED_CODE();
Thread->LpcReplyMessage = NULL;
/* And remove the message from the port zone */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD);
NextEntry = Port->LpcReplyChainHead.Flink;
}
InitializeListHead(&Message->Entry);
/* Remove it from the port zone */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD);
}
/* Release the lock */
/* Free queued messages */
RemoveEntryList(&Message->Entry);
InitializeListHead(&Message->Entry);
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD);
/* Restart at the head */
NextEntry = ListHead->Flink;
/* Remove it */
RemoveEntryList(&Message->Entry);
InitializeListHead(&Message->Entry);
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD);
/* Restart at the head */
NextEntry = ListHead->Flink;
/* Dereference the object unless it's the same port */
if (ConnectionPort != Port) ObDereferenceObject(ConnectionPort);
+
+ /* Check if this is a connection port with a server process */
+ if (((Port->Flags & LPCP_PORT_TYPE_MASK) == LPCP_CONNECTION_PORT) &&
+ (ConnectionPort->ServerProcess))
+ {
+ /* Dereference the server process */
+ ObDereferenceObject(ConnectionPort->ServerProcess);
+ ConnectionPort->ServerProcess = NULL;
+ }
}
else
{
KeReleaseGuardedMutex(&LpcpLock);
}
- /* Check if this is a connection port with a server process*/
- if (((Port->Flags & LPCP_PORT_TYPE_MASK) == LPCP_CONNECTION_PORT) &&
- (ConnectionPort->ServerProcess))
- {
- /* Dereference the server process */
- ObDereferenceObject(ConnectionPort->ServerProcess);
- ConnectionPort->ServerProcess = NULL;
- }
-
/* Free client security */
LpcpFreePortClientSecurity(Port);
LPCTRACE(LPC_CLOSE_DEBUG, "Port: %p deleted\n", Port);