VOID NTAPI SmpDeleteSession(IN ULONG SessionId) { PSMP_SESSION Session; /* Enter the lock and get the session structure */ RtlEnterCriticalSection(&SmpSessionListLock); Session = SmpSessionIdToSession(SessionId); if (Session) { /* Remove it from the list */ RemoveEntryList(&Session->Entry); RtlLeaveCriticalSection(&SmpSessionListLock); /* Now free the structure outside of the lock */ RtlFreeHeap(SmpHeap, 0, Session); } else { /* ID doesn't map to one of our structures, nothing to do... */ RtlLeaveCriticalSection(&SmpSessionListLock); } }
VOID SmpDeleteSession( IN ULONG SessionId, IN BOOLEAN SendSessionComplete, IN NTSTATUS SessionStatus ) /*++ Routine Description: This function locates and deletes a session id. If the SendSessionComplete flag is true, then it also sends a session complete message to the creator subsystem. Arguments: SessionId - Supplies the session id to delete. SendSessionComplete - Specifies whether a session complete message is to be sent to the creator subsystem (if one exists). SessionStatus - Supplies the session completion status Return Value: --*/ { PSMPSESSION Session; PSMPKNOWNSUBSYS CreatorSubsystem; RtlEnterCriticalSection(&SmpSessionListLock); Session = SmpSessionIdToSession(SessionId); if ( Session ) { RemoveEntryList(&Session->SortedSessionIdListLinks); RtlLeaveCriticalSection(&SmpSessionListLock); CreatorSubsystem = Session->CreatorSubsystem; RtlFreeHeap(SmpHeap,0,Session); // // If there is a creator subsystem, and if // told to send a session complete message, then do it. // if ( CreatorSubsystem && SendSessionComplete ) { // // Foreign Session Complete // } } else { RtlLeaveCriticalSection(&SmpSessionListLock); } return; // // Make the compiler happy // SessionStatus; }