VOID BowserUninitializeTraceLog() { BOOLEAN ProcessAttached = FALSE; PAGED_CODE(); ExDeleteResource(&BrowserTraceLock); if (BrowserTraceLogHandle != NULL) { if (IoGetCurrentProcess() != BowserFspProcess) { KeAttachProcess(BowserFspProcess); ProcessAttached = TRUE; } ZwClose(BrowserTraceLogHandle); if (ProcessAttached) { KeDetachProcess(); } } BrowserTraceLogHandle = NULL; }
VOID MsDeleteVcb ( IN PVCB Vcb ) /*++ Routine Description: This routine removes the VCB record from our in-memory data structures. It also will remove all associated underlings (i.e., FCB records). Arguments: Vcb - Supplies the Vcb to be removed Return Value: None --*/ { PAGED_CODE(); DebugTrace(+1, Dbg, "MsDeleteVcb, Vcb = %08lx\n", (ULONG)Vcb); ASSERT (Vcb->Header.ReferenceCount == 0); // // Remove the Root Dcb // if (Vcb->RootDcb != NULL) { MsDeleteFcb( Vcb->RootDcb ); } // // Uninitialize the resource variable for the VCB. // ExDeleteResource( &Vcb->Resource ); // // And zero out the Vcb, this will help ensure that any stale data is // wiped clean // RtlZeroMemory( Vcb, sizeof(VCB) ); // // Return to the caller. // DebugTrace(-1, Dbg, "MsDeleteVcb -> VOID\n", 0); return; }
VOID NTAPI PspDeleteJob ( PVOID ObjectBody ) { PEJOB Job = (PEJOB)ObjectBody; /* remove the reference to the completion port if associated */ if(Job->CompletionPort != NULL) { ObDereferenceObject(Job->CompletionPort); } /* unlink the job object */ if(Job->JobLinks.Flink != NULL) { ExAcquireFastMutex(&PsJobListLock); RemoveEntryList(&Job->JobLinks); ExReleaseFastMutex(&PsJobListLock); } ExDeleteResource(&Job->JobLock); }
VOID MsDeleteCcb ( IN PCCB Ccb ) /*++ Routine Description: This routine deallocates and removes the specified CCB record from the our in memory data structures. Arguments: Ccb - Supplies the CCB to remove Return Value: None --*/ { PAGED_CODE(); DebugTrace(+1, Dbg, "MsDeleteCcb, Ccb = %08lx\n", (ULONG)Ccb); // // Case on the type of CCB we are deleting. // switch (Ccb->Header.NodeTypeCode) { case MSFS_NTC_CCB: MsDereferenceFcb( Ccb->Fcb ); ExDeleteResource( &Ccb->Resource ); break; case MSFS_NTC_ROOT_DCB_CCB: if (((PROOT_DCB_CCB)Ccb)->QueryTemplate != NULL) { ExFreePool( ((PROOT_DCB_CCB)Ccb)->QueryTemplate ); } break; } // // Deallocate the Ccb record. // ExFreePool( Ccb ); // // Return to the caller. // DebugTrace(-1, Dbg, "MsDeleteCcb -> VOID\n", 0); return; }
VOID MsDeleteFcb ( IN PFCB Fcb ) /*++ Routine Description: This routine deallocates and removes an FCB from our in-memory data structures. It also will remove all associated underlings. Arguments: Fcb - Supplies the FCB to be removed Return Value: None --*/ { PAGED_CODE(); DebugTrace(+1, Dbg, "MsDeleteFcb, Fcb = %08lx\n", (ULONG)Fcb); // // Release the FCB reference to the VCB. // MsDereferenceVcb( Fcb->Vcb ); ExFreePool( Fcb->FullFileName.Buffer ); // // Free up the data queue. // MsUninitializeDataQueue( &Fcb->DataQueue, Fcb->CreatorProcess ); // // If there is a security descriptor on the mailslot then deassign it // if (Fcb->SecurityDescriptor != NULL) { SeDeassignSecurity( &Fcb->SecurityDescriptor ); } // // Free up the resource variable. // ExDeleteResource( &(Fcb->Resource) ); // // Finally deallocate the FCB record. // ExFreePool( Fcb ); // // Return to the caller // DebugTrace(-1, Dbg, "MsDeleteFcb -> VOID\n", 0); return; }
VOID MsDeleteRootDcb ( IN PROOT_DCB RootDcb ) /*++ Routine Description: This routine deallocates and removes the ROOT DCB record from our in-memory data structures. It also will remove all associated underlings (i.e., Notify queues and child FCB records). Arguments: RootDcb - Supplies the ROOT DCB to be removed Return Value: None --*/ { PLIST_ENTRY links; PIRP irp; PAGED_CODE(); DebugTrace(+1, Dbg, "MsDeleteRootDcb, RootDcb = %08lx\n", (ULONG)RootDcb); // // We can only delete this record if the reference count is zero. // if (RootDcb->Header.ReferenceCount != 0) { DebugDump("Error deleting RootDcb, Still Open\n", 0, RootDcb); KeBugCheck( MAILSLOT_FILE_SYSTEM ); } // // Remove every notify IRP from the two notify queues. // while (!IsListEmpty(&RootDcb->Specific.Dcb.NotifyFullQueue)) { links = RemoveHeadList( &RootDcb->Specific.Dcb.NotifyFullQueue ); irp = CONTAINING_RECORD( links, IRP, Tail.Overlay.ListEntry ); MsCompleteRequest( irp, STATUS_FILE_FORCED_CLOSED ); } while (!IsListEmpty(&RootDcb->Specific.Dcb.NotifyPartialQueue)) { links = RemoveHeadList( &RootDcb->Specific.Dcb.NotifyPartialQueue ); irp = CONTAINING_RECORD( links, IRP, Tail.Overlay.ListEntry ); MsCompleteRequest( irp, STATUS_FILE_FORCED_CLOSED ); } // // We can only be removed if the no other FCB have us referenced // as a their parent DCB. // if (!IsListEmpty(&RootDcb->Specific.Dcb.ParentDcbQueue)) { DebugDump("Error deleting RootDcb\n", 0, RootDcb); KeBugCheck( MAILSLOT_FILE_SYSTEM ); } // // Remove the entry from the prefix table, and then remove the full // file name. // MsAcquirePrefixTableLock(); RtlRemoveUnicodePrefix( &RootDcb->Vcb->PrefixTable, &RootDcb->PrefixTableEntry ); MsReleasePrefixTableLock(); ExFreePool( RootDcb->FullFileName.Buffer ); // // Free up the resource variable. // ExDeleteResource( &(RootDcb->Resource) ); // // Finally deallocate the DCB record. // ExFreePool( RootDcb ); // // Return to the caller. // DebugTrace(-1, Dbg, "MsDeleteRootDcb -> VOID\n", 0); return; }
VOID LfsDeallocateLfcb ( IN PLFCB Lfcb, IN BOOLEAN CompleteTeardown ) /*++ Routine Description: This routine releases the resources associated with a log file control block. Arguments: Lfcb - Supplies a pointer to the log file control block. CompleteTeardown - Indicates if we are to completely remove this Lfcb. Return Value: None --*/ { PLBCB NextLbcb; PAGED_CODE(); DebugTrace( +1, Dbg, "LfsDeallocateLfcb: Entered\n", 0 ); DebugTrace( 0, Dbg, "Lfcb -> %08lx\n", Lfcb ); // // Check that there are no buffer blocks. // ASSERT( IsListEmpty( &Lfcb->LbcbActive )); ASSERT( IsListEmpty( &Lfcb->LbcbWorkque )); // // Check that we have no clients. // ASSERT( IsListEmpty( &Lfcb->LchLinks )); // // If there is a restart area we deallocate it. // if (Lfcb->RestartArea != NULL) { LfsDeallocateRestartArea( Lfcb->RestartArea ); } // // If there are any of the tail Lbcb's, deallocate them now. // if (Lfcb->ActiveTail != NULL) { LfsDeallocateLbcb( Lfcb, Lfcb->ActiveTail ); Lfcb->ActiveTail = NULL; } if (Lfcb->PrevTail != NULL) { LfsDeallocateLbcb( Lfcb, Lfcb->PrevTail ); Lfcb->PrevTail = NULL; } // // Only do the following if we are to remove the Lfcb completely. // if (CompleteTeardown) { // // If there is a resource structure we deallocate it. // if (Lfcb->Sync != NULL) { ExDeleteResource( &Lfcb->Sync->Resource ); ExFreePool( Lfcb->Sync ); } } // // Deallocate all of the spare Lbcb's. // while (!IsListEmpty( &Lfcb->SpareLbcbList )) { NextLbcb = (PLBCB) Lfcb->SpareLbcbList.Flink; RemoveHeadList( &Lfcb->SpareLbcbList ); ExFreePool( NextLbcb ); } // // Discard the Lfcb structure. // ExFreePool( Lfcb ); DebugTrace( -1, Dbg, "LfsDeallocateLfcb: Exit\n", 0 ); return; }
VOID AfdUnload ( IN PDRIVER_OBJECT DriverObject ) { PLIST_ENTRY listEntry; PAFD_TRANSPORT_INFO transportInfo; UNREFERENCED_PARAMETER( DriverObject ); PAGED_CODE( ); KdPrint(( "AfdUnload called.\n" )); // // Kill the transport info list. // while( !IsListEmpty( &AfdTransportInfoListHead ) ) { listEntry = RemoveHeadList( &AfdTransportInfoListHead ); transportInfo = CONTAINING_RECORD( listEntry, AFD_TRANSPORT_INFO, TransportInfoListEntry ); AFD_FREE_POOL( transportInfo, AFD_TRANSPORT_INFO_POOL_TAG ); } // // Kill the resource that protects the executive worker thread queue. // if( AfdResource != NULL ) { ExDeleteResource( AfdResource ); AFD_FREE_POOL( AfdResource, AFD_RESOURCE_POOL_TAG ); } // // Destroy the lookaside lists. // if( AfdLookasideLists != NULL ) { ExDeleteNPagedLookasideList( &AfdLookasideLists->WorkQueueList ); ExDeleteNPagedLookasideList( &AfdLookasideLists->LargeBufferList ); ExDeleteNPagedLookasideList( &AfdLookasideLists->MediumBufferList ); ExDeleteNPagedLookasideList( &AfdLookasideLists->SmallBufferList ); AFD_FREE_POOL( AfdLookasideLists, AFD_LOOKASIDE_LISTS_POOL_TAG ); } // // Terminate the group ID manager. // AfdTerminateGroup(); // // Delete our device object. // IoDeleteDevice( AfdDeviceObject ); } // AfdUnload