VOID NTAPI NpDeleteFcb(IN PNP_FCB Fcb, IN PLIST_ENTRY ListEntry) { PNP_DCB Dcb; PAGED_CODE(); Dcb = Fcb->ParentDcb; if (Fcb->CurrentInstances) NpBugCheck(0, 0, 0); NpCancelWaiter(&NpVcb->WaitQueue, &Fcb->FullName, STATUS_OBJECT_NAME_NOT_FOUND, ListEntry); RemoveEntryList(&Fcb->DcbEntry); if (Fcb->SecurityDescriptor) { ObDereferenceSecurityDescriptor(Fcb->SecurityDescriptor, 1); } RtlRemoveUnicodePrefix(&NpVcb->PrefixTable, &Fcb->PrefixTableEntry); ExFreePool(Fcb->FullName.Buffer); ExFreePool(Fcb); NpCheckForNotify(Dcb, TRUE, ListEntry); }
VOID NTAPI NpDeleteCcb(IN PNP_CCB Ccb, IN PLIST_ENTRY ListEntry) { PNP_ROOT_DCB_FCB RootDcbCcb; PAGED_CODE(); RootDcbCcb = (PNP_ROOT_DCB_FCB)Ccb; if (Ccb->NodeType == NPFS_NTC_CCB) { RemoveEntryList(&Ccb->CcbEntry); --Ccb->Fcb->CurrentInstances; NpDeleteEventTableEntry(&NpVcb->EventTable, Ccb->NonPagedCcb->EventBuffer[FILE_PIPE_CLIENT_END]); NpDeleteEventTableEntry(&NpVcb->EventTable, Ccb->NonPagedCcb->EventBuffer[FILE_PIPE_SERVER_END]); NpUninitializeDataQueue(&Ccb->DataQueue[FILE_PIPE_INBOUND]); NpUninitializeDataQueue(&Ccb->DataQueue[FILE_PIPE_OUTBOUND]); NpCheckForNotify(Ccb->Fcb->ParentDcb, FALSE, ListEntry); ExDeleteResourceLite(&Ccb->NonPagedCcb->Lock); NpUninitializeSecurity(Ccb); if (Ccb->ClientSession) { ExFreePool(Ccb->ClientSession); Ccb->ClientSession = NULL; } ExFreePool(Ccb->NonPagedCcb); } else if (RootDcbCcb->NodeType == NPFS_NTC_ROOT_DCB_CCB && RootDcbCcb->Unknown) { ExFreePool(RootDcbCcb->Unknown); } ExFreePool(Ccb); }
NTSTATUS NpSetPipeInfo ( IN PFCB Fcb, IN PCCB Ccb, IN PFILE_PIPE_INFORMATION Buffer, IN NAMED_PIPE_END NamedPipeEnd ) /*++ Routine Description: This routine sets the pipe information for a named pipe. Arguments: Fcb - Supplies the Fcb for the named pipe being modified Ccb - Supplies the ccb for the named pipe being modified Buffer - Supplies the buffer containing the data being set NamedPipeEnd - Supplies the server/client end doing the operation Return Value: NTSTATUS - Returns our completion status --*/ { PDATA_QUEUE ReadQueue; PDATA_QUEUE WriteQueue; UNREFERENCED_PARAMETER( Ccb ); PAGED_CODE(); DebugTrace(0, Dbg, "NpSetPipeInfo...\n", 0); // // If the caller requests message mode reads but the pipe is // byte stream then its an invalid parameter // if ((Buffer->ReadMode == FILE_PIPE_MESSAGE_MODE) && (Fcb->Specific.Fcb.NamedPipeType == FILE_PIPE_BYTE_STREAM_MODE)) { return STATUS_INVALID_PARAMETER; } // // Get a reference to our read queue // switch (NamedPipeEnd) { case FILE_PIPE_SERVER_END: ReadQueue = &Ccb->DataQueue[ FILE_PIPE_INBOUND ]; WriteQueue = &Ccb->DataQueue[ FILE_PIPE_OUTBOUND ]; break; case FILE_PIPE_CLIENT_END: ReadQueue = &Ccb->DataQueue[ FILE_PIPE_OUTBOUND ]; WriteQueue = &Ccb->DataQueue[ FILE_PIPE_INBOUND ]; break; default: NpBugCheck( NamedPipeEnd, 0, 0 ); } // // If the completion mode is complete operations and the current mode // is queue operations and there and the data queues are not empty // then its pipe busy // if ((Buffer->CompletionMode == FILE_PIPE_COMPLETE_OPERATION) && (Ccb->CompletionMode[ NamedPipeEnd ] == FILE_PIPE_QUEUE_OPERATION) && ((NpIsDataQueueReaders(ReadQueue)) || (NpIsDataQueueWriters(WriteQueue)))) { return STATUS_PIPE_BUSY; } // // Everything is fine so update the pipe // Ccb->ReadMode[ NamedPipeEnd ] = Buffer->ReadMode; Ccb->CompletionMode[ NamedPipeEnd ] = Buffer->CompletionMode; // // Check for notify // NpCheckForNotify( Fcb->ParentDcb, FALSE ); // // And return to our caller // return STATUS_SUCCESS; }