ReactOS  0.4.13-dev-247-g0f29b3f
rxce.c File Reference
#include <rx.h>
#include <pseh/pseh2.h>
#include <dfs.h>
#include <debug.h>
Include dependency graph for rxce.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID RxAssert (PVOID Assert, PVOID File, ULONG Line, PVOID Message)
 
VOID NTAPI RxCreateSrvCallCallBack (IN OUT PMRX_SRVCALL_CALLBACK_CONTEXT Context)
 
NTSTATUS RxFinishSrvCallConstruction (PMRX_SRVCALLDOWN_STRUCTURE Calldown)
 
VOID NTAPI RxFinishSrvCallConstructionDispatcher (IN PVOID Context)
 
NTSTATUS RxInsertWorkQueueItem (PRDBSS_DEVICE_OBJECT pMRxDeviceObject, WORK_QUEUE_TYPE WorkQueueType, PRX_WORK_QUEUE_ITEM WorkQueueItem)
 
PVOID RxNewMapUserBuffer (PRX_CONTEXT RxContext)
 
VOID NTAPI RxpDestroySrvCall (IN PVOID Context)
 
VOID RxpDispatchChangeBufferingStateRequests (PSRV_CALL SrvCall, PSRV_OPEN SrvOpen, PLIST_ENTRY DiscardedRequests)
 
VOID NTAPI RxScavengerTimerRoutine (PVOID Context)
 
VOID NTAPI RxTimerDispatch (_In_ struct _KDPC *Dpc, _In_opt_ PVOID DeferredContext, _In_opt_ PVOID SystemArgument1, _In_opt_ PVOID SystemArgument2)
 
VOID NTAPI RxWorkItemDispatcher (PVOID Context)
 
PVOID NTAPI _RxAllocatePoolWithTag (_In_ POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag)
 
VOID NTAPI _RxFreePool (_In_ PVOID Buffer)
 
VOID NTAPI _RxFreePoolWithTag (_In_ PVOID Buffer, _In_ ULONG Tag)
 
NTSTATUS NTAPI RxAcquireExclusiveFcbResourceInMRx (_Inout_ PMRX_FCB Fcb)
 
BOOLEAN NTAPI RxAcquireFcbForLazyWrite (PVOID Context, BOOLEAN Wait)
 
BOOLEAN NTAPI RxAcquireFcbForReadAhead (PVOID Context, BOOLEAN Wait)
 
VOID NTAPI RxAcquireFileForNtCreateSection (PFILE_OBJECT FileObject)
 
NTSTATUS NTAPI RxAcquireForCcFlush (PFILE_OBJECT FileObject, PDEVICE_OBJECT DeviceObject)
 
VOID RxAddVirtualNetRootToNetRoot (PNET_ROOT NetRoot, PV_NET_ROOT VNetRoot)
 
PVOID RxAllocateFcbObject (PRDBSS_DEVICE_OBJECT RxDeviceObject, NODE_TYPE_CODE NodeType, POOL_TYPE PoolType, ULONG NameSize, PVOID AlreadyAllocatedObject)
 
PVOID RxAllocateObject (NODE_TYPE_CODE NodeType, PMINIRDR_DISPATCH MRxDispatch, ULONG NameLength)
 
VOID NTAPI RxBootstrapWorkerThreadDispatcher (IN PVOID WorkQueue)
 
VOID RxCancelBlockingOperation (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS NTAPI RxChangeBufferingState (PSRV_OPEN SrvOpen, PVOID Context, BOOLEAN ComputeNewState)
 
NTSTATUS RxCheckVNetRootCredentials (PRX_CONTEXT RxContext, PV_NET_ROOT VNetRoot, PLUID LogonId, PUNICODE_STRING UserName, PUNICODE_STRING UserDomain, PUNICODE_STRING Password, ULONG Flags)
 
NTSTATUS RxCompleteRequest (PRX_CONTEXT Context, NTSTATUS Status)
 
VOID RxCompleteRequest_Real (IN PRX_CONTEXT RxContext, IN PIRP Irp, IN NTSTATUS Status)
 
VOID RxCompleteSrvOpenKeyAssociation (IN OUT PSRV_OPEN SrvOpen)
 
NTSTATUS RxConstructNetRoot (IN PRX_CONTEXT RxContext, IN PSRV_CALL SrvCall, IN PNET_ROOT NetRoot, IN PV_NET_ROOT VirtualNetRoot, OUT PLOCK_HOLDING_STATE LockHoldingState)
 
NTSTATUS RxConstructSrvCall (IN PRX_CONTEXT RxContext, IN PSRV_CALL SrvCall, OUT PLOCK_HOLDING_STATE LockHoldingState)
 
NTSTATUS RxConstructVirtualNetRoot (IN PRX_CONTEXT RxContext, IN PUNICODE_STRING CanonicalName, IN NET_ROOT_TYPE NetRootType, OUT PV_NET_ROOT *VirtualNetRootPointer, OUT PLOCK_HOLDING_STATE LockHoldingState, OUT PRX_CONNECTION_ID RxConnectionId)
 
PFCB RxCreateNetFcb (IN PRX_CONTEXT RxContext, IN PV_NET_ROOT VNetRoot, IN PUNICODE_STRING Name)
 
PMRX_FOBX NTAPI RxCreateNetFobx (OUT PRX_CONTEXT RxContext, IN PMRX_SRV_OPEN MrxSrvOpen)
 
PNET_ROOT RxCreateNetRoot (IN PSRV_CALL SrvCall, IN PUNICODE_STRING Name, IN ULONG NetRootFlags, IN PRX_CONNECTION_ID OPTIONAL RxConnectionId)
 
VOID NTAPI RxCreateNetRootCallBack (IN PMRX_CREATENETROOT_CONTEXT CreateNetRootContext)
 
PRX_CONTEXT NTAPI RxCreateRxContext (IN PIRP Irp, IN PRDBSS_DEVICE_OBJECT RxDeviceObject, IN ULONG InitialContextFlags)
 
PSRV_CALL RxCreateSrvCall (IN PRX_CONTEXT RxContext, IN PUNICODE_STRING Name, IN PUNICODE_STRING InnerNamePrefix OPTIONAL, IN PRX_CONNECTION_ID RxConnectionId)
 
PSRV_OPEN RxCreateSrvOpen (IN PV_NET_ROOT VNetRoot, IN OUT PFCB Fcb)
 
PV_NET_ROOT RxCreateVNetRoot (IN PRX_CONTEXT RxContext, IN PNET_ROOT NetRoot, IN PUNICODE_STRING CanonicalName, IN PUNICODE_STRING LocalNetRootName, IN PUNICODE_STRING FilePath, IN PRX_CONNECTION_ID RxConnectionId)
 
VOID RxDereference (IN OUT PVOID Instance, IN LOCK_HOLDING_STATE LockHoldingState)
 
VOID NTAPI RxDereferenceAndDeleteRxContext_Real (IN PRX_CONTEXT RxContext)
 
VOID NTAPI RxDispatchChangeBufferingStateRequests (PVOID Context)
 
NTSTATUS NTAPI RxDispatchToWorkerThread (IN PRDBSS_DEVICE_OBJECT pMRxDeviceObject, IN WORK_QUEUE_TYPE WorkQueueType, IN PRX_WORKERTHREAD_ROUTINE Routine, IN PVOID pContext)
 
VOID RxExclusivePrefixTableLockToShared (PRX_PREFIX_TABLE Table)
 
VOID RxExtractServerName (IN PUNICODE_STRING FilePathName, OUT PUNICODE_STRING SrvCallName, OUT PUNICODE_STRING RestOfName)
 
NTSTATUS RxFcbTableInsertFcb (IN OUT PRX_FCB_TABLE FcbTable, IN OUT PFCB Fcb)
 
PFCB RxFcbTableLookupFcb (IN PRX_FCB_TABLE FcbTable, IN PUNICODE_STRING Path)
 
NTSTATUS RxFcbTableRemoveFcb (IN OUT PRX_FCB_TABLE FcbTable, IN OUT PFCB Fcb)
 
NTSTATUS NTAPI RxFinalizeConnection (IN OUT PNET_ROOT NetRoot, IN OUT PV_NET_ROOT VNetRoot OPTIONAL, IN LOGICAL ForceFilesClosed)
 
VOID RxFinalizeFcbTable (IN OUT PRX_FCB_TABLE FcbTable)
 
BOOLEAN RxFinalizeNetFcb (OUT PFCB ThisFcb, IN BOOLEAN RecursiveFinalize, IN BOOLEAN ForceFinalize, IN LONG ReferenceCount)
 
BOOLEAN RxFinalizeNetFobx (_Out_ PFOBX ThisFobx, _In_ BOOLEAN RecursiveFinalize, _In_ BOOLEAN ForceFinalize)
 
BOOLEAN RxFinalizeNetRoot (OUT PNET_ROOT ThisNetRoot, IN BOOLEAN RecursiveFinalize, IN BOOLEAN ForceFinalize)
 
BOOLEAN RxFinalizeSrvCall (OUT PSRV_CALL ThisSrvCall, IN BOOLEAN RecursiveFinalize, IN BOOLEAN ForceFinalize)
 
BOOLEAN RxFinalizeSrvOpen (OUT PSRV_OPEN ThisSrvOpen, IN BOOLEAN RecursiveFinalize, IN BOOLEAN ForceFinalize)
 
BOOLEAN RxFinalizeVNetRoot (OUT PV_NET_ROOT ThisVNetRoot, IN BOOLEAN RecursiveFinalize, IN BOOLEAN ForceFinalize)
 
NTSTATUS RxFindOrConstructVirtualNetRoot (IN PRX_CONTEXT RxContext, IN PUNICODE_STRING CanonicalName, IN NET_ROOT_TYPE NetRootType, IN PUNICODE_STRING RemainingName)
 
NTSTATUS RxFindOrCreateConnections (_In_ PRX_CONTEXT RxContext, _In_ PUNICODE_STRING CanonicalName, _In_ NET_ROOT_TYPE NetRootType, _Out_ PUNICODE_STRING LocalNetRootName, _Out_ PUNICODE_STRING FilePathName, _Inout_ PLOCK_HOLDING_STATE LockState, _In_ PRX_CONNECTION_ID RxConnectionId)
 
VOID NTAPI RxFinishFcbInitialization (IN OUT PMRX_FCB Fcb, IN RX_FILE_TYPE FileType, IN PFCB_INIT_PACKET InitPacket OPTIONAL)
 
NTSTATUS RxFlushFcbInSystemCache (IN PFCB Fcb, IN BOOLEAN SynchronizeWithLazyWriter)
 
VOID RxFreeFcbObject (PVOID Object)
 
VOID RxFreeObject (PVOID pObject)
 
VOID RxGatherRequestsForSrvOpen (IN OUT PSRV_CALL SrvCall, IN PSRV_OPEN SrvOpen, IN OUT PLIST_ENTRY RequestsListHead)
 
PRDBSS_DEVICE_OBJECT RxGetDeviceObjectOfInstance (PVOID Instance)
 
VOID RxGetFileSizeWithLock (IN PFCB Fcb, OUT PLONGLONG FileSize)
 
PEPROCESS NTAPI RxGetRDBSSProcess (VOID)
 
NTSTATUS RxInitializeBufferingManager (PSRV_CALL SrvCall)
 
VOID NTAPI RxInitializeContext (IN PIRP Irp, IN PRDBSS_DEVICE_OBJECT RxDeviceObject, IN ULONG InitialContextFlags, IN OUT PRX_CONTEXT RxContext)
 
VOID NTAPI RxInitializeDebugSupport (VOID)
 
NTSTATUS NTAPI RxInitializeDispatcher (VOID)
 
VOID RxInitializeFcbTable (IN OUT PRX_FCB_TABLE FcbTable, IN BOOLEAN CaseInsensitiveMatch)
 
VOID NTAPI RxInitializeLowIoContext (OUT PLOWIO_CONTEXT LowIoContext, IN ULONG Operation)
 
VOID RxInitializeLowIoPerFcbInfo (PLOWIO_PER_FCB_INFO LowIoPerFcbInfo)
 
NTSTATUS RxInitializeMRxDispatcher (IN OUT PRDBSS_DEVICE_OBJECT pMRxDeviceObject)
 
VOID RxInitializePrefixTable (IN OUT PRX_PREFIX_TABLE ThisTable, IN ULONG TableSize OPTIONAL, IN BOOLEAN CaseInsensitiveMatch)
 
VOID RxInitializePurgeSyncronizationContext (PPURGE_SYNCHRONIZATION_CONTEXT PurgeSyncronizationContext)
 
NTSTATUS RxInitializeSrvCallParameters (IN PRX_CONTEXT RxContext, IN OUT PSRV_CALL SrvCall)
 
NTSTATUS NTAPI RxInitializeRxTimer (VOID)
 
NTSTATUS RxInitializeVNetRootParameters (PRX_CONTEXT RxContext, OUT LUID *LogonId, OUT PULONG SessionId, OUT PUNICODE_STRING *UserNamePtr, OUT PUNICODE_STRING *UserDomainNamePtr, OUT PUNICODE_STRING *PasswordPtr, OUT PULONG Flags)
 
VOID RxInitializeWorkQueue (PRX_WORK_QUEUE WorkQueue, WORK_QUEUE_TYPE WorkQueueType, ULONG MaximumNumberOfWorkerThreads, ULONG MinimumNumberOfWorkerThreads)
 
NTSTATUS RxInitializeWorkQueueDispatcher (PRX_WORK_QUEUE_DISPATCHER Dispatcher)
 
VOID RxInitiateSrvOpenKeyAssociation (IN OUT PSRV_OPEN SrvOpen)
 
BOOLEAN RxIsThisACscAgentOpen (IN PRX_CONTEXT RxContext)
 
VOID RxLockUserBuffer (IN PRX_CONTEXT RxContext, IN LOCK_OPERATION Operation, IN ULONG BufferLength)
 
NTSTATUS RxLowIoCompletionTail (IN PRX_CONTEXT RxContext)
 
NTSTATUS NTAPI RxLowIoPopulateFsctlInfo (IN PRX_CONTEXT RxContext)
 
NTSTATUS NTAPI RxLowIoSubmit (IN PRX_CONTEXT RxContext, IN PLOWIO_COMPLETION_ROUTINE CompletionRoutine)
 
PVOID RxMapSystemBuffer (IN PRX_CONTEXT RxContext)
 
VOID RxMarkFobxOnCleanup (PFOBX pFobx, PBOOLEAN NeedPurge)
 
VOID RxMarkFobxOnClose (PFOBX Fobx)
 
BOOLEAN NTAPI RxNoOpAcquire (IN PVOID Fcb, IN BOOLEAN Wait)
 
VOID NTAPI RxNoOpRelease (IN PVOID Fcb)
 
VOID RxOrphanThisFcb (PFCB Fcb)
 
VOID RxOrphanSrvOpens (IN PV_NET_ROOT ThisVNetRoot)
 
VOID RxOrphanSrvOpensForThisFcb (IN PFCB Fcb, IN PV_NET_ROOT ThisVNetRoot, IN BOOLEAN OrphanAll)
 
BOOLEAN RxpAcquirePrefixTableLockShared (PRX_PREFIX_TABLE pTable, BOOLEAN Wait, BOOLEAN ProcessBufferingStateChangeRequests)
 
BOOLEAN RxpAcquirePrefixTableLockExclusive (PRX_PREFIX_TABLE pTable, BOOLEAN Wait, BOOLEAN ProcessBufferingStateChangeRequests)
 
BOOLEAN RxpDereferenceAndFinalizeNetFcb (OUT PFCB ThisFcb, IN PRX_CONTEXT RxContext, IN BOOLEAN RecursiveFinalize, IN BOOLEAN ForceFinalize)
 
LONG RxpDereferenceNetFcb (PFCB Fcb)
 
VOID RxpDiscardChangeBufferingStateRequests (_Inout_ PLIST_ENTRY DiscardedRequests)
 
NTSTATUS RxpLookupSrvOpenForRequestLite (IN PSRV_CALL SrvCall, IN OUT PCHANGE_BUFFERING_STATE_REQUEST Request)
 
VOID RxpMarkInstanceForScavengedFinalization (PVOID Instance)
 
NTSTATUS NTAPI RxPostOneShotTimerRequest (IN PRDBSS_DEVICE_OBJECT pDeviceObject, IN PRX_WORK_ITEM pWorkItem, IN PRX_WORKERTHREAD_ROUTINE Routine, IN PVOID pContext, IN LARGE_INTEGER TimeInterval)
 
NTSTATUS NTAPI RxPostToWorkerThread (_In_ PRDBSS_DEVICE_OBJECT pMRxDeviceObject, _In_ WORK_QUEUE_TYPE WorkQueueType, _In_ PRX_WORK_QUEUE_ITEM pWorkQueueItem, _In_ PRX_WORKERTHREAD_ROUTINE Routine, _In_ PVOID pContext)
 
VOID RxpProcessChangeBufferingStateRequests (PSRV_CALL SrvCall, BOOLEAN UpdateHandlerState)
 
PRX_PREFIX_ENTRY RxPrefixTableInsertName (IN OUT PRX_PREFIX_TABLE ThisTable, IN OUT PRX_PREFIX_ENTRY ThisEntry, IN PVOID Container, IN PULONG ContainerRefCount, IN USHORT CaseInsensitiveLength, IN PRX_CONNECTION_ID ConnectionId)
 
PVOID RxPrefixTableLookupName (IN PRX_PREFIX_TABLE ThisTable, IN PUNICODE_STRING CanonicalName, OUT PUNICODE_STRING RemainingName, IN PRX_CONNECTION_ID ConnectionId)
 
LONG RxpReferenceNetFcb (PFCB Fcb)
 
VOID RxpReleasePrefixTableLock (PRX_PREFIX_TABLE pTable, BOOLEAN ProcessBufferingStateChangeRequests)
 
VOID NTAPI RxPrepareContextForReuse (IN OUT PRX_CONTEXT RxContext)
 
VOID RxPrepareRequestForReuse (PCHANGE_BUFFERING_STATE_REQUEST Request)
 
VOID NTAPI RxProcessChangeBufferingStateRequests (_In_ PVOID SrvCall)
 
VOID RxProcessChangeBufferingStateRequestsForSrvOpen (PSRV_OPEN SrvOpen)
 
VOID RxProcessFcbChangeBufferingStateRequest (PFCB Fcb)
 
VOID RxpScavengeFobxs (PRDBSS_SCAVENGER Scavenger, PLIST_ENTRY FobxToScavenge)
 
BOOLEAN RxpTrackDereference (_In_ ULONG TraceType, _In_ PCSTR FileName, _In_ ULONG Line, _In_ PVOID Instance)
 
VOID RxpTrackReference (_In_ ULONG TraceType, _In_ PCSTR FileName, _In_ ULONG Line, _In_ PVOID Instance)
 
VOID RxpUndoScavengerFinalizationMarking (PVOID Instance)
 
VOID RxPurgeChangeBufferingStateRequestsForSrvOpen (PSRV_OPEN SrvOpen)
 
VOID RxPurgeFcb (IN PFCB Fcb)
 
NTSTATUS RxPurgeFcbInSystemCache (IN PFCB Fcb, IN PLARGE_INTEGER FileOffset OPTIONAL, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps, IN BOOLEAN FlushFile)
 
BOOLEAN RxPurgeFobx (PFOBX pFobx)
 
NTSTATUS RxPurgeFobxFromCache (PFOBX FobxToBePurged)
 
NTSTATUS RxPurgeRelatedFobxs (PNET_ROOT NetRoot, PRX_CONTEXT RxContext, BOOLEAN AttemptFinalization, PFCB PurgingFcb)
 
VOID RxpWorkerThreadDispatcher (IN PRX_WORK_QUEUE WorkQueue, IN PLARGE_INTEGER WaitInterval)
 
VOID RxReference (IN OUT PVOID Instance)
 
VOID NTAPI RxReinitializeContext (IN OUT PRX_CONTEXT RxContext)
 
VOID NTAPI RxReleaseFcbFromLazyWrite (PVOID Context)
 
VOID NTAPI RxReleaseFcbFromReadAhead (PVOID Context)
 
VOID NTAPI RxReleaseFileForNtCreateSection (PFILE_OBJECT FileObject)
 
NTSTATUS NTAPI RxReleaseForCcFlush (PFILE_OBJECT FileObject, PDEVICE_OBJECT DeviceObject)
 
VOID RxRemoveNameNetFcb (OUT PFCB ThisFcb)
 
VOID RxRemoveOperationFromBlockingQueue (IN OUT PRX_CONTEXT RxContext)
 
VOID RxRemovePrefixTableEntry (IN OUT PRX_PREFIX_TABLE ThisTable, IN OUT PRX_PREFIX_ENTRY Entry)
 
VOID RxRemoveVirtualNetRootFromNetRoot (PNET_ROOT NetRoot, PV_NET_ROOT VNetRoot)
 
VOID RxResumeBlockedOperations_ALL (IN OUT PRX_CONTEXT RxContext)
 
VOID NTAPI RxResumeBlockedOperations_Serially (IN OUT PRX_CONTEXT RxContext, IN OUT PLIST_ENTRY BlockingIoQ)
 
VOID RxSetFileSizeWithLock (IN OUT PFCB Fcb, IN PLONGLONG FileSize)
 
VOID RxScavengeFobxsForNetRoot (PNET_ROOT NetRoot, PFCB PurgingFcb, BOOLEAN SynchronizeWithScavenger)
 
BOOLEAN RxScavengeRelatedFobxs (PFCB Fcb)
 
VOID RxScavengerFinalizeEntries (PRDBSS_DEVICE_OBJECT DeviceObject)
 
BOOLEAN RxScavengeVNetRoots (PRDBSS_DEVICE_OBJECT RxDeviceObject)
 
VOID NTAPI RxSpinUpRequestsDispatcher (PVOID Dispatcher)
 
NTSTATUS RxSpinUpWorkerThread (PRX_WORK_QUEUE WorkQueue, PRX_WORKERTHREAD_ROUTINE Routine, PVOID Parameter)
 
VOID RxSpinUpWorkerThreads (PRX_WORK_QUEUE WorkQueue)
 
VOID RxSynchronizeWithScavenger (IN PRX_CONTEXT RxContext)
 
ULONG RxTableComputeHashValue (IN PUNICODE_STRING Name)
 
ULONG RxTableComputePathHashValue (IN PUNICODE_STRING Name)
 
PVOID RxTableLookupName (IN PRX_PREFIX_TABLE ThisTable, IN PUNICODE_STRING Name, OUT PUNICODE_STRING RemainingName, IN PRX_CONNECTION_ID OPTIONAL RxConnectionId)
 
PRX_PREFIX_ENTRY RxTableLookupName_ExactLengthMatch (IN PRX_PREFIX_TABLE ThisTable, IN PUNICODE_STRING Name, IN ULONG HashValue, IN PRX_CONNECTION_ID OPTIONAL RxConnectionId)
 
NTSTATUS RxTearDownBufferingManager (PSRV_CALL SrvCall)
 
VOID RxTrackPagingIoResource (_Inout_ PVOID Instance, _In_ ULONG Type, _In_ ULONG Line, _In_ PCSTR File)
 
VOID RxUndoScavengerFinalizationMarking (PVOID Instance)
 
VOID RxUninitializeVNetRootParameters (IN PUNICODE_STRING UserName, IN PUNICODE_STRING UserDomainName, IN PUNICODE_STRING Password, OUT PULONG Flags)
 
VOID RxUpdateCondition (IN RX_BLOCK_CONDITION NewConditionValue, OUT PRX_BLOCK_CONDITION Condition, IN OUT PLIST_ENTRY TransitionWaitList)
 
VOID RxVerifyOperationIsLegal (IN PRX_CONTEXT RxContext)
 
VOID RxWaitForStableCondition (IN PRX_BLOCK_CONDITION Condition, IN OUT PLIST_ENTRY TransitionWaitList, IN OUT PRX_CONTEXT RxContext, OUT NTSTATUS *AsyncStatus OPTIONAL)
 
NTSTATUS __RxAcquireFcb (_Inout_ PFCB Fcb, _Inout_opt_ PRX_CONTEXT RxContext OPTIONAL, _In_ ULONG Mode)
 
VOID __RxItsTheSameContext (_In_ PRX_CONTEXT RxContext, _In_ ULONG CapturedRxContextSerialNumber, _In_ ULONG Line, _In_ PCSTR File)
 
VOID __RxReleaseFcb (_Inout_opt_ PRX_CONTEXT RxContext, _Inout_ PMRX_FCB MrxFcb)
 
VOID __RxReleaseFcbForThread (_Inout_opt_ PRX_CONTEXT RxContext, _Inout_ PMRX_FCB MrxFcb, _In_ ERESOURCE_THREAD ResourceThreadId)
 

Variables

ULONG ReadAheadGranularity
 
volatile LONG RxNumberOfActiveFcbs = 0
 
ULONG SerialNumber = 1
 
PVOID RxNull = NULL
 
volatile ULONG RxContextSerialNumberCounter
 
BOOLEAN RxStopOnLoudCompletion = TRUE
 
BOOLEAN RxSrvCallConstructionDispatcherActive = FALSE
 
LIST_ENTRY RxSrvCalldownList
 
RX_SPIN_LOCK RxStrucSupSpinLock
 
ULONG RdbssReferenceTracingValue = 0
 
LARGE_INTEGER RxWorkQueueWaitInterval [RxMaximumWorkQueue]
 
LARGE_INTEGER RxSpinUpDispatcherWaitInterval
 
RX_DISPATCHER RxDispatcher
 
RX_WORK_QUEUE_DISPATCHER RxDispatcherWorkQueues
 
FAST_MUTEX RxLowIoPagingIoSyncMutex
 
BOOLEAN RxContinueFromAssert = TRUE
 
ULONG RxExplodePoolTags = 1
 
LARGE_INTEGER RxTimerInterval
 
RX_SPIN_LOCK RxTimerLock
 
LIST_ENTRY RxTimerQueueHead
 
LIST_ENTRY RxRecurrentWorkItemsList
 
KDPC RxTimerDpc
 
KTIMER RxTimer
 
ULONG RxTimerTickCount
 
FAST_MUTEX RxContextPerFileSerializationMutex
 
BOOLEAN DumpDispatchRoutine = FALSE
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 33 of file rxce.c.

Function Documentation

◆ __RxAcquireFcb()

NTSTATUS __RxAcquireFcb ( _Inout_ PFCB  Fcb,
_Inout_opt_ PRX_CONTEXT RxContext  OPTIONAL,
_In_ ULONG  Mode 
)

Definition at line 8973 of file rxce.c.

8984 {
8985  NTSTATUS Status;
8986  BOOLEAN SpecialContext, CanWait, Acquired, ContextIsPresent;
8987 
8988  PAGED_CODE();
8989 
8990  DPRINT("__RxAcquireFcb(%p, %p, %d, %d, %s, %d)\n", Fcb, RxContext, Mode, LineNumber, FileName, SerialNumber);
8991 
8992  SpecialContext = FALSE;
8993  ContextIsPresent = FALSE;
8994  /* Check for special context */
8996  {
8997  SpecialContext = TRUE;
8998  }
8999 
9000  /* We don't handle buffering state change yet... */
9001  if (!RxIsFcbAcquired(Fcb) && !SpecialContext &&
9003  {
9004  UNIMPLEMENTED;
9005  }
9006 
9007  /* Nor special contexts */
9008  if (SpecialContext)
9009  {
9010  UNIMPLEMENTED;
9011  }
9012 
9013  /* If we don't have a context, assume we can wait! */
9014  if (RxContext == NULL)
9015  {
9016  CanWait = TRUE;
9017  }
9018  else
9019  {
9020  /* That said: we have a real context! */
9021  ContextIsPresent = TRUE;
9022 
9023  /* If we've been cancelled in between, give up */
9025  if (!NT_SUCCESS(Status))
9026  {
9027  return Status;
9028  }
9029 
9030  /* Can we wait? */
9031  CanWait = BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_WAIT);
9032  }
9033 
9034  while (TRUE)
9035  {
9036  /* Assume we cannot lock */
9038 
9039  /* Lock according to what the caller asked */
9040  switch (Mode)
9041  {
9042  case FCB_MODE_EXCLUSIVE:
9043  Acquired = ExAcquireResourceExclusiveLite(Fcb->Header.Resource, CanWait);
9044  break;
9045 
9046  case FCB_MODE_SHARED:
9047  Acquired = ExAcquireResourceSharedLite(Fcb->Header.Resource, CanWait);
9048  break;
9049 
9051  Acquired = ExAcquireSharedWaitForExclusive(Fcb->Header.Resource, CanWait);
9052  break;
9053 
9054  default:
9056  Acquired = ExAcquireSharedStarveExclusive(Fcb->Header.Resource, CanWait);
9057  break;
9058  }
9059 
9060  /* Lock granted! */
9061  if (Acquired)
9062  {
9065 
9066  /* Handle paging write - not implemented */
9067  if (Fcb->NonPaged->OutstandingAsyncWrites != 0)
9068  {
9069  UNIMPLEMENTED;
9070  }
9071  }
9072 
9073  /* And break, that cool! */
9074  if (Acquired)
9075  {
9076  break;
9077  }
9078 
9079  /* If it failed, return immediately */
9080  if (!NT_SUCCESS(Status))
9081  {
9082  return Status;
9083  }
9084  }
9085 
9086  /* If we don't have to check for valid operation, job done, nothing more to do */
9087  if (!ContextIsPresent || BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_BYPASS_VALIDOP_CHECK))
9088  {
9089  if (NT_SUCCESS(Status))
9090  {
9091  RxTrackerUpdateHistory(RxContext, RX_GET_MRX_FCB(Fcb), TRACKER_ACQUIRE_FCB, LineNumber, FileName, SerialNumber);
9092  }
9093 
9094  return Status;
9095  }
9096 
9097  /* Verify operation */
9098  _SEH2_TRY
9099  {
9100  RxVerifyOperationIsLegal(RxContext);
9101  }
9103  {
9104  /* If it failed, release lock and fail */
9106  {
9107  ExReleaseResourceLite(Fcb->Header.Resource);
9109  }
9110  }
9111  _SEH2_END;
9112 
9113  if (NT_SUCCESS(Status))
9114  {
9115  RxTrackerUpdateHistory(RxContext, RX_GET_MRX_FCB(Fcb), TRACKER_ACQUIRE_FCB, LineNumber, FileName, SerialNumber);
9116  }
9117 
9118  DPRINT("Status: %x\n", Status);
9119  return Status;
9120 }
BOOLEAN NTAPI ExAcquireSharedWaitForExclusive(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:1217
#define TRUE
Definition: types.h:120
_In_ ULONG Mode
Definition: hubbusif.h:303
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
#define CHANGE_BUFFERING_STATE_CONTEXT
Definition: rxprocs.h:135
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
VOID RxVerifyOperationIsLegal(IN PRX_CONTEXT RxContext)
Definition: rxce.c:8759
#define FCB_MODE_SHARED_STARVE_EXCLUSIVE
Definition: rxprocs.h:133
LONG NTSTATUS
Definition: precomp.h:26
#define CHANGE_BUFFERING_STATE_CONTEXT_WAIT
Definition: rxprocs.h:136
#define RxIsFcbAcquired(Fcb)
Definition: rxprocs.h:230
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
#define RxTrackerUpdateHistory(R, F, O, L, F, S)
Definition: rxprocs.h:218
#define FCB_MODE_EXCLUSIVE
Definition: rxprocs.h:130
PNON_PAGED_FCB NonPaged
Definition: fatstruc.h:807
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:13
void DPRINT(...)
Definition: polytest.cpp:61
#define RX_GET_MRX_FCB(F)
Definition: rxprocs.h:157
#define STATUS_LOCK_NOT_GRANTED
Definition: ntstatus.h:307
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define FCB_MODE_SHARED
Definition: rxprocs.h:131
ULONG SerialNumber
Definition: rxce.c:117
Status
Definition: gdiplustypes.h:24
BOOLEAN NTAPI ExAcquireSharedStarveExclusive(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:1063
_SEH2_END
Definition: create.c:4424
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1194
_SEH2_FINALLY
Definition: create.c:4395
#define FCB_MODE_SHARED_WAIT_FOR_EXCLUSIVE
Definition: rxprocs.h:132
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
#define UNIMPLEMENTED
Definition: debug.h:114
#define ASSERT_CORRECT_FCB_STRUCTURE(Fcb)
Definition: fcb.h:562
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2745
ULONG FcbState
Definition: cdstruc.h:977
#define FCB_STATE_BUFFERING_STATE_CHANGE_PENDING
Definition: fcb.h:207
ULONG OutstandingAsyncWrites
Definition: fatstruc.h:733

◆ __RxItsTheSameContext()

VOID __RxItsTheSameContext ( _In_ PRX_CONTEXT  RxContext,
_In_ ULONG  CapturedRxContextSerialNumber,
_In_ ULONG  Line,
_In_ PCSTR  File 
)

Definition at line 9126 of file rxce.c.

9131 {
9132  /* Check we have a context with the same serial number */
9133  if (NodeType(RxContext) != RDBSS_NTC_RX_CONTEXT ||
9134  RxContext->SerialNumber != CapturedRxContextSerialNumber)
9135  {
9136  /* Just be noisy */
9137  DPRINT1("Context %p has changed at line %d in file %s\n", RxContext, Line, File);
9138  }
9139 }
#define RDBSS_NTC_RX_CONTEXT
Definition: nodetype.h:58
NodeType
Definition: Node.h:5
Definition: ncftp.h:79
#define DPRINT1
Definition: precomp.h:8
Definition: File.h:15

◆ __RxReleaseFcb()

VOID __RxReleaseFcb ( _Inout_opt_ PRX_CONTEXT  RxContext,
_Inout_ PMRX_FCB  MrxFcb 
)

Definition at line 9142 of file rxce.c.

9152 {
9153  BOOLEAN IsExclusive, BufferingPending;
9154 
9156 
9157  BufferingPending = BooleanFlagOn(MrxFcb->FcbState, FCB_STATE_BUFFERING_STATE_CHANGE_PENDING);
9158  IsExclusive = !!RxIsResourceOwnershipStateExclusive(MrxFcb->Header.Resource);
9159 
9160  /* If no buffering pending, or no exclusive lock (we can only handle with an exclusive lock),
9161  * then just release the FCB
9162  */
9163  if (!BufferingPending || !IsExclusive)
9164  {
9165  RxTrackerUpdateHistory(RxContext, MrxFcb, (!BufferingPending ? TRACKER_RELEASE_FCB_NO_BUFF_PENDING : TRACKER_RELEASE_NON_EXCL_FCB_BUFF_PENDING),
9167  ExReleaseResourceLite(MrxFcb->Header.Resource);
9168  }
9169 
9171 
9172  /* And finally leave */
9173  if (!BufferingPending || !IsExclusive)
9174  {
9175  return;
9176  }
9177 
9179 
9180  /* Otherwise, handle buffering state and release */
9182 
9183  RxTrackerUpdateHistory(RxContext, MrxFcb, TRACKER_RELEASE_EXCL_FCB_BUFF_PENDING, LineNumber, FileName, SerialNumber);
9184  ExReleaseResourceLite(MrxFcb->Header.Resource);
9185 }
#define RxIsResourceOwnershipStateExclusive(Resource)
Definition: ntrxdef.h:28
Definition: cdstruc.h:908
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define RxTrackerUpdateHistory(R, F, O, L, F, S)
Definition: rxprocs.h:218
unsigned char BOOLEAN
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define RxReleaseSerializationMutex()
Definition: rxdata.h:9
VOID RxProcessFcbChangeBufferingStateRequest(PFCB Fcb)
Definition: rxce.c:6685
ULONG SerialNumber
Definition: rxce.c:117
#define RxIsFcbAcquiredExclusive(Fcb)
Definition: rxprocs.h:229
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1194
#define RxAcquireSerializationMutex()
Definition: rxdata.h:8
#define FCB_STATE_BUFFERING_STATE_CHANGE_PENDING
Definition: fcb.h:207

◆ __RxReleaseFcbForThread()

VOID __RxReleaseFcbForThread ( _Inout_opt_ PRX_CONTEXT  RxContext,
_Inout_ PMRX_FCB  MrxFcb,
_In_ ERESOURCE_THREAD  ResourceThreadId 
)

Definition at line 9188 of file rxce.c.

9199 {
9200  BOOLEAN IsExclusive, BufferingPending;
9201 
9203 
9204  BufferingPending = BooleanFlagOn(MrxFcb->FcbState, FCB_STATE_BUFFERING_STATE_CHANGE_PENDING);
9205  IsExclusive = !!RxIsResourceOwnershipStateExclusive(MrxFcb->Header.Resource);
9206 
9207  /* If no buffering pending, or no exclusive lock (we can only handle with an exclusive lock),
9208  * then just release the FCB
9209  */
9210  if (!BufferingPending || !IsExclusive)
9211  {
9212  RxTrackerUpdateHistory(RxContext, MrxFcb,
9213  (!BufferingPending ? TRACKER_RELEASE_FCB_FOR_THRD_NO_BUFF_PENDING : TRACKER_RELEASE_NON_EXCL_FCB_FOR_THRD_BUFF_PENDING),
9215  ExReleaseResourceForThreadLite(MrxFcb->Header.Resource, ResourceThreadId);
9216  }
9217 
9219 
9220  /* And finally leave */
9221  if (!BufferingPending || !IsExclusive)
9222  {
9223  return;
9224  }
9225 
9226  /* Otherwise, handle buffering state and release */
9227  RxTrackerUpdateHistory(RxContext, MrxFcb, TRACKER_RELEASE_EXCL_FCB_FOR_THRD_BUFF_PENDING, LineNumber, FileName, SerialNumber);
9229  ExReleaseResourceForThreadLite(MrxFcb->Header.Resource, ResourceThreadId);
9230 }
#define RxIsResourceOwnershipStateExclusive(Resource)
Definition: ntrxdef.h:28
Definition: cdstruc.h:908
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define RxTrackerUpdateHistory(R, F, O, L, F, S)
Definition: rxprocs.h:218
unsigned char BOOLEAN
_In_ ERESOURCE_THREAD ResourceThreadId
Definition: exfuncs.h:844
#define RxReleaseSerializationMutex()
Definition: rxdata.h:9
VOID RxProcessFcbChangeBufferingStateRequest(PFCB Fcb)
Definition: rxce.c:6685
ULONG SerialNumber
Definition: rxce.c:117
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1194
#define RxAcquireSerializationMutex()
Definition: rxdata.h:8
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define FCB_STATE_BUFFERING_STATE_CHANGE_PENDING
Definition: fcb.h:207

◆ _RxAllocatePoolWithTag()

PVOID NTAPI _RxAllocatePoolWithTag ( _In_ POOL_TYPE  PoolType,
_In_ SIZE_T  NumberOfBytes,
_In_ ULONG  Tag 
)

Definition at line 8941 of file rxce.c.

8945 {
8947 }
PVOID NTAPI ExAllocatePoolWithTagPriority(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag, IN EX_POOL_PRIORITY Priority)
Definition: expool.c:2915
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:997
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444

◆ _RxFreePool()

VOID NTAPI _RxFreePool ( _In_ PVOID  Buffer)

Definition at line 8954 of file rxce.c.

8956 {
8958 }
Definition: bufpool.h:45
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

◆ _RxFreePoolWithTag()

VOID NTAPI _RxFreePoolWithTag ( _In_ PVOID  Buffer,
_In_ ULONG  Tag 
)

Definition at line 8965 of file rxce.c.

8968 {
8970 }
Definition: bufpool.h:45
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

◆ RxAcquireExclusiveFcbResourceInMRx()

NTSTATUS NTAPI RxAcquireExclusiveFcbResourceInMRx ( _Inout_ PMRX_FCB  Fcb)

Definition at line 183 of file rxce.c.

185 {
187 }
#define RxAcquireExclusiveFcb(R, F)
Definition: rxprocs.h:154
Definition: cdstruc.h:908
smooth NULL
Definition: ftsmooth.c:416
_In_ PFCB Fcb
Definition: cdprocs.h:151

◆ RxAcquireFcbForLazyWrite()

BOOLEAN NTAPI RxAcquireFcbForLazyWrite ( PVOID  Context,
BOOLEAN  Wait 
)

Definition at line 194 of file rxce.c.

197 {
198  PFCB Fcb;
199  BOOLEAN Ret;
200 
201  PAGED_CODE();
202 
203  Fcb = Context;
204  /* The received context is a FCB */
207  ASSERT(Fcb->Specific.Fcb.LazyWriteThread == NULL);
208 
209  /* Acquire the paging resource (shared) */
210  Ret = ExAcquireResourceSharedLite(Fcb->Header.PagingIoResource, Wait);
211  if (Ret)
212  {
213  /* Update tracker information */
214  Fcb->PagingIoResourceFile = __FILE__;
215  Fcb->PagingIoResourceLine = __LINE__;
216  /* Lazy writer thread is the current one */
217  Fcb->Specific.Fcb.LazyWriteThread = PsGetCurrentThread();
218 
219  /* There is no top level IRP */
221  /* Now, there will be! */
224  /* In case of failure, release the lock and reset everything */
225  if (!Ret)
226  {
229  ExReleaseResourceLite(Fcb->Header.PagingIoResource);
230  Fcb->Specific.Fcb.LazyWriteThread = NULL;
231  }
232  }
233 
234  return Ret;
235 }
#define TRUE
Definition: types.h:120
union _FCB::@684 Specific
ULONG PagingIoResourceLine
Definition: fcb.h:199
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
Definition: cdstruc.h:908
#define PAGED_CODE()
Definition: video.h:57
struct _FCB::@684::@687 Fcb
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NodeType
Definition: Node.h:5
#define RDBSS_NTC_FCB
Definition: nodetype.h:66
PCHAR PagingIoResourceFile
Definition: fcb.h:198
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOLEAN RxTryToBecomeTheTopLevelIrp(_Inout_ PRX_TOPLEVELIRP_CONTEXT TopLevelContext, _In_ PIRP Irp, _In_ PRDBSS_DEVICE_OBJECT RxDeviceObject, _In_ BOOLEAN ForceTopLevel)
PRDBSS_DEVICE_OBJECT RxDeviceObject
Definition: fcb.h:149
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
BOOLEAN RxIsThisTheTopLevelIrp(_In_ PIRP Irp)
struct tagContext Context
Definition: acpixf.h:1012
#define ASSERT_CORRECT_FCB_STRUCTURE(Fcb)
Definition: fcb.h:562
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
IN BOOLEAN Wait
Definition: fatprocs.h:1529

◆ RxAcquireFcbForReadAhead()

BOOLEAN NTAPI RxAcquireFcbForReadAhead ( PVOID  Context,
BOOLEAN  Wait 
)

Definition at line 242 of file rxce.c.

245 {
246  PFCB Fcb;
247  BOOLEAN Ret;
248 
249  PAGED_CODE();
250 
251  Fcb = Context;
252  /* The received context is a FCB */
255 
256  Ret = ExAcquireResourceSharedLite(Fcb->Header.Resource, Wait);
257  if (Ret)
258  {
259  /* There is no top level IRP */
261  /* Now, there will be! */
264  /* In case of failure, release the lock and reset everything */
265  if (!Ret)
266  {
267  ExReleaseResourceLite(Fcb->Header.Resource);
268  }
269  }
270 
271  return Ret;
272 }
#define TRUE
Definition: types.h:120
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
Definition: cdstruc.h:908
#define PAGED_CODE()
Definition: video.h:57
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NodeType
Definition: Node.h:5
#define RDBSS_NTC_FCB
Definition: nodetype.h:66
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOLEAN RxTryToBecomeTheTopLevelIrp(_Inout_ PRX_TOPLEVELIRP_CONTEXT TopLevelContext, _In_ PIRP Irp, _In_ PRDBSS_DEVICE_OBJECT RxDeviceObject, _In_ BOOLEAN ForceTopLevel)
PRDBSS_DEVICE_OBJECT RxDeviceObject
Definition: fcb.h:149
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
BOOLEAN RxIsThisTheTopLevelIrp(_In_ PIRP Irp)
struct tagContext Context
Definition: acpixf.h:1012
#define ASSERT_CORRECT_FCB_STRUCTURE(Fcb)
Definition: fcb.h:562
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
IN BOOLEAN Wait
Definition: fatprocs.h:1529

◆ RxAcquireFileForNtCreateSection()

VOID NTAPI RxAcquireFileForNtCreateSection ( PFILE_OBJECT  FileObject)

Definition at line 276 of file rxce.c.

278 {
280 }
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by RxInitializeDispatchVectors().

◆ RxAcquireForCcFlush()

NTSTATUS NTAPI RxAcquireForCcFlush ( PFILE_OBJECT  FileObject,
PDEVICE_OBJECT  DeviceObject 
)

Definition at line 284 of file rxce.c.

287 {
289  return STATUS_NOT_IMPLEMENTED;
290 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by RxInitializeDispatchVectors().

◆ RxAddVirtualNetRootToNetRoot()

VOID RxAddVirtualNetRootToNetRoot ( PNET_ROOT  NetRoot,
PV_NET_ROOT  VNetRoot 
)

Definition at line 296 of file rxce.c.

299 {
300  PAGED_CODE();
301 
302  DPRINT("RxAddVirtualNetRootToNetRoot(%p, %p)\n", NetRoot, VNetRoot);
303 
304  /* Insert in the VNetRoot list - make sure lock is held */
305  ASSERT(RxIsPrefixTableLockExclusive(NetRoot->SrvCall->RxDeviceObject->pRxNetNameTable));
306 
307  VNetRoot->pNetRoot = (PMRX_NET_ROOT)NetRoot;
308  ++NetRoot->NumberOfVirtualNetRoots;
309  InsertTailList(&NetRoot->VirtualNetRoots, &VNetRoot->NetRootListEntry);
310 }
struct _MRX_NET_ROOT_ * PMRX_NET_ROOT
ULONG NumberOfVirtualNetRoots
Definition: fcb.h:51
#define InsertTailList(ListHead, Entry)
#define PAGED_CODE()
Definition: video.h:57
LIST_ENTRY VirtualNetRoots
Definition: fcb.h:50
void DPRINT(...)
Definition: polytest.cpp:61
#define RxIsPrefixTableLockExclusive(T)
Definition: prefix.h:112
LIST_ENTRY NetRootListEntry
Definition: fcb.h:75
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PSRV_CALL SrvCall
Definition: fcb.h:41

Referenced by RxCreateVNetRoot().

◆ RxAllocateFcbObject()

PVOID RxAllocateFcbObject ( PRDBSS_DEVICE_OBJECT  RxDeviceObject,
NODE_TYPE_CODE  NodeType,
POOL_TYPE  PoolType,
ULONG  NameSize,
PVOID  AlreadyAllocatedObject 
)

Definition at line 316 of file rxce.c.

322 {
323  PFCB Fcb;
324  PFOBX Fobx;
325  PSRV_OPEN SrvOpen;
326  PVOID Buffer, PAPNBuffer;
327  PNON_PAGED_FCB NonPagedFcb;
329  ULONG NonPagedSize, FobxSize, SrvOpenSize, FcbSize;
330 
331  PAGED_CODE();
332 
333  Dispatch = RxDeviceObject->Dispatch;
334 
335  NonPagedSize = 0;
336  FobxSize = 0;
337  SrvOpenSize = 0;
338  FcbSize = 0;
339 
340  Fcb = NULL;
341  Fobx = NULL;
342  SrvOpen = NULL;
343  NonPagedFcb = NULL;
344  PAPNBuffer = NULL;
345 
346  /* If we ask for FOBX, just allocate FOBX and its extension if asked */
347  if (NodeType == RDBSS_NTC_FOBX)
348  {
349  FobxSize = sizeof(FOBX);
351  {
352  FobxSize += QuadAlign(Dispatch->MRxFobxSize);
353  }
354  }
355  /* If we ask for SRV_OPEN, also allocate the "internal" FOBX and the extensions if asked */
357  {
358  SrvOpenSize = sizeof(SRV_OPEN);
360  {
361  SrvOpenSize += QuadAlign(Dispatch->MRxSrvOpenSize);
362  }
363 
364  FobxSize = sizeof(FOBX);
366  {
367  FobxSize += QuadAlign(Dispatch->MRxFobxSize);
368  }
369  }
370  /* Otherwise, we're asked to allocate a FCB */
371  else
372  {
373  /* So, allocate the FCB and its extension if asked */
374  FcbSize = sizeof(FCB);
376  {
377  FcbSize += QuadAlign(Dispatch->MRxFcbSize);
378  }
379 
380  /* If we're asked to allocate from nonpaged, also allocate the NON_PAGED_FCB
381  * Otherwise, it will be allocated later on, specifically
382  */
383  if (PoolType == NonPagedPool)
384  {
385  NonPagedSize = sizeof(NON_PAGED_FCB);
386  }
387 
388  /* And if it's not for a rename operation also allcoate the internal SRV_OPEN and FOBX and their extensions */
390  {
391  SrvOpenSize = sizeof(SRV_OPEN);
393  {
394  SrvOpenSize += QuadAlign(Dispatch->MRxSrvOpenSize);
395  }
396 
397  FobxSize = sizeof(FOBX);
399  {
400  FobxSize += QuadAlign(Dispatch->MRxFobxSize);
401  }
402  }
403  }
404 
405  /* If we already have a buffer, go ahead */
406  if (AlreadyAllocatedObject != NULL)
407  {
408  Buffer = AlreadyAllocatedObject;
409  }
410  /* Otherwise, allocate it */
411  else
412  {
413  Buffer = RxAllocatePoolWithTag(PoolType, NameSize + FcbSize + SrvOpenSize + FobxSize + NonPagedSize, RX_FCB_POOLTAG);
414  if (Buffer == NULL)
415  {
416  return NULL;
417  }
418  }
419 
420  /* Now, get the pointers - FOBX is easy */
421  if (NodeType == RDBSS_NTC_FOBX)
422  {
423  Fobx = Buffer;
424  }
425  /* SRV_OPEN first, FOBX next */
426  else if (NodeType == RDBSS_NTC_SRVOPEN)
427  {
428  SrvOpen = Buffer;
429  Fobx = Add2Ptr(Buffer, SrvOpenSize);
430  }
432  {
433  SrvOpen = Buffer;
434  }
435  else
436  {
437  /* FCB first, and if needed, SRV_OPEN next, FOBX last */
438  Fcb = Buffer;
440  {
441  SrvOpen = Add2Ptr(Buffer, FcbSize);
442  Fobx = Add2Ptr(Buffer, FcbSize + SrvOpenSize);
443  }
444 
445  /* If we were not allocated from non paged, allocate the NON_PAGED_FCB now */
446  if (PoolType != NonPagedPool)
447  {
449  if (NonPagedFcb == NULL)
450  {
451  RxFreePoolWithTag(Buffer, RX_FCB_POOLTAG);
452  return NULL;
453  }
454 
455  PAPNBuffer = Add2Ptr(Buffer, FcbSize + SrvOpenSize + FobxSize);
456  }
457  /* Otherwise, just point at the right place in what has been allocated previously */
458  else
459  {
460  NonPagedFcb = Add2Ptr(Fobx, FobxSize);
461  PAPNBuffer = Add2Ptr(Fobx, FobxSize + NonPagedSize);
462  }
463  }
464 
465  /* If we have allocated a SRV_OPEN, initialize it */
466  if (SrvOpen != NULL)
467  {
468  ZeroAndInitializeNodeType(SrvOpen, RDBSS_NTC_SRVOPEN, SrvOpenSize);
469 
471  {
472  SrvOpen->InternalFobx = Fobx;
473  }
474  else
475  {
476  SrvOpen->InternalFobx = NULL;
477  SrvOpen->Flags |= SRVOPEN_FLAG_FOBX_USED;
478  }
479 
481  {
482  SrvOpen->Context = Add2Ptr(SrvOpen, sizeof(SRV_OPEN));
483  }
484 
485  InitializeListHead(&SrvOpen->SrvOpenQLinks);
486  }
487 
488  /* If we have allocated a FOBX, initialize it */
489  if (Fobx != NULL)
490  {
491  ZeroAndInitializeNodeType(Fobx, RDBSS_NTC_FOBX, FobxSize);
492 
494  {
495  Fobx->Context = Add2Ptr(Fobx, sizeof(FOBX));
496  }
497  }
498 
499  /* If we have allocated a FCB, initialize it */
500  if (Fcb != NULL)
501  {
503 
504  Fcb->NonPaged = NonPagedFcb;
506 #if DBG
507  Fcb->CopyOfNonPaged = NonPagedFcb;
508  NonPagedFcb->FcbBackPointer = Fcb;
509 #endif
510 
511  Fcb->InternalSrvOpen = SrvOpen;
512  Fcb->InternalFobx = Fobx;
513 
516  Fcb->PrivateAlreadyPrefixedName.Buffer = PAPNBuffer;
517 
519  {
520  Fcb->Context = Add2Ptr(Fcb, sizeof(FCB));
521  }
522 
524 
526  InterlockedIncrement((volatile long *)&RxDeviceObject->NumberOfActiveFcbs);
527 
529  FsRtlSetupAdvancedHeader(Fcb, &NonPagedFcb->AdvancedFcbHeaderMutex);
530  }
531 
532  DPRINT("Allocated %p\n", Buffer);
533 
534  return Buffer;
535 }
volatile ULONG NumberOfActiveFcbs
Definition: rxstruc.h:98
#define RDBSS_NTC_OPENTARGETDIR_FCB
Definition: nodetype.h:44
volatile LONG RxNumberOfActiveFcbs
Definition: rxce.c:116
#define Add2Ptr(PTR, INC)
PFOBX InternalFobx
Definition: fcb.h:280
PMINIRDR_DISPATCH Dispatch
Definition: rxstruc.h:89
USHORT MaximumLength
Definition: env_spec_w32.h:370
Definition: cdstruc.h:908
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define RDBSS_NTC_SRVOPEN
Definition: nodetype.h:52
Definition: fcb.h:304
#define PAGED_CODE()
Definition: video.h:57
#define RDBSS_MANAGE_FCB_EXTENSION
Definition: mrx.h:332
#define RDBSS_NTC_NONPAGED_FCB
Definition: nodetype.h:63
PNON_PAGED_FCB NonPaged
Definition: fatstruc.h:807
struct _FCB FCB
smooth NULL
Definition: ftsmooth.c:416
RX_FCB_TABLE_ENTRY FcbTableEntry
Definition: fcb.h:144
void DPRINT(...)
Definition: polytest.cpp:61
struct _NON_PAGED_FCB NON_PAGED_FCB
Definition: bufpool.h:45
NodeType
Definition: Node.h:5
#define RDBSS_MANAGE_SRV_OPEN_EXTENSION
Definition: mrx.h:333
#define RxAllocatePoolWithTag
Definition: ntrxdef.h:25
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
UNICODE_STRING PrivateAlreadyPrefixedName
Definition: fcb.h:145
#define SRVOPEN_FLAG_FOBX_USED
Definition: fcb.h:257
FAST_MUTEX AdvancedFcbHeaderMutex
Definition: fatstruc.h:746
#define RDBSS_STORAGE_NTC(x)
Definition: nodetype.h:32
struct _SRV_OPEN SRV_OPEN
PSRV_OPEN InternalSrvOpen
Definition: fcb.h:152
#define ZeroAndInitializeNodeType(Node, Type, Size)
Definition: nodetype.h:25
Definition: fcb.h:260
#define RDBSS_NTC_FCB_TABLE_ENTRY
Definition: nodetype.h:62
#define RDBSS_NTC_FOBX
Definition: nodetype.h:57
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH * Dispatch
Definition: wsk.h:182
#define RX_FCB_POOLTAG
Definition: rxpooltg.h:7
#define InterlockedIncrement
Definition: armddk.h:53
#define RX_NONPAGEDFCB_POOLTAG
Definition: rxpooltg.h:8
struct _FOBX FOBX
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define RDBSS_NTC_INTERNAL_SRVOPEN
Definition: nodetype.h:53
#define RDBSS_MANAGE_FOBX_EXTENSION
Definition: mrx.h:334
unsigned int ULONG
Definition: retypes.h:1
#define QuadAlign(Ptr)
Definition: cdprocs.h:1582
_In_ PFCB Fcb
Definition: cdprocs.h:151
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
Definition: fcbtable.h:4
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444
PFOBX InternalFobx
Definition: fcb.h:153

Referenced by RxCreateNetFcb(), RxCreateNetFobx(), and RxCreateSrvOpen().

◆ RxAllocateObject()

PVOID RxAllocateObject ( NODE_TYPE_CODE  NodeType,
PMINIRDR_DISPATCH  MRxDispatch,
ULONG  NameLength 
)

Definition at line 541 of file rxce.c.

545 {
546  ULONG Tag, ObjectSize;
548  PRX_PREFIX_ENTRY PrefixEntry;
549  USHORT StructSize, ExtensionSize;
550 
551  PAGED_CODE();
552 
553  /* Select the node to allocate and always deal with the fact we may have to manage its extension */
554  ExtensionSize = 0;
555  switch (NodeType)
556  {
557  case RDBSS_NTC_SRVCALL:
559  StructSize = sizeof(SRV_CALL);
560  if (MRxDispatch != NULL && BooleanFlagOn(MRxDispatch->MRxFlags, RDBSS_MANAGE_SRV_CALL_EXTENSION))
561  {
562  ExtensionSize = QuadAlign(MRxDispatch->MRxSrvCallSize);
563  }
564  break;
565 
566  case RDBSS_NTC_NETROOT:
568  StructSize = sizeof(NET_ROOT);
570  {
571  ExtensionSize = QuadAlign(MRxDispatch->MRxNetRootSize);
572  }
573  break;
574 
575  case RDBSS_NTC_V_NETROOT:
577  StructSize = sizeof(V_NET_ROOT);
579  {
580  ExtensionSize = QuadAlign(MRxDispatch->MRxVNetRootSize);
581  }
582  break;
583 
584  default:
585  ASSERT(FALSE);
586  break;
587  }
588 
589  /* Now, allocate the object */
590  ObjectSize = ExtensionSize + StructSize + NameLength;
592  if (Object == NULL)
593  {
594  return NULL;
595  }
596  /* Initialize it */
598 
599  /* For SRV_CALL and NETROOT, the name points to the prefix table name */
600  switch (NodeType)
601  {
602  case RDBSS_NTC_SRVCALL:
603  PrefixEntry = &((PSRV_CALL)Object)->PrefixEntry;
604  Extension = &((PSRV_CALL)Object)->Context;
605  ((PSRV_CALL)Object)->pSrvCallName = &PrefixEntry->Prefix;
606  break;
607 
608  case RDBSS_NTC_NETROOT:
609  PrefixEntry = &((PNET_ROOT)Object)->PrefixEntry;
610  Extension = &((PNET_ROOT)Object)->Context;
611  ((PNET_ROOT)Object)->pNetRootName = &PrefixEntry->Prefix;
612  break;
613 
614  case RDBSS_NTC_V_NETROOT:
615  PrefixEntry = &((PV_NET_ROOT)Object)->PrefixEntry;
616  Extension = &((PV_NET_ROOT)Object)->Context;
617  break;
618 
619  default:
620  ASSERT(FALSE);
621  break;
622  }
623 
624  /* Set the prefix table unicode string */
625  RtlZeroMemory(PrefixEntry, sizeof(RX_PREFIX_ENTRY));
626  PrefixEntry->NodeTypeCode = RDBSS_NTC_PREFIX_ENTRY;
627  PrefixEntry->NodeByteSize = sizeof(RX_PREFIX_ENTRY);
628  PrefixEntry->Prefix.Length = NameLength;
629  PrefixEntry->Prefix.MaximumLength = NameLength;
630  PrefixEntry->Prefix.Buffer = Add2Ptr(Object, ExtensionSize + StructSize);
631 
632  /* Return the extension if we are asked to manage it */
633  if (ExtensionSize != 0)
634  {
635  *Extension = Add2Ptr(Object, StructSize);
636  }
637 
638  return Object;
639 }
ULONG MRxNetRootSize
Definition: mrx.h:343
struct _SRV_CALL * PSRV_CALL
ULONG MRxFlags
Definition: mrx.h:341
#define Add2Ptr(PTR, INC)
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
NODE_BYTE_SIZE NodeByteSize
Definition: prefix.h:47
#define RDBSS_MANAGE_NET_ROOT_EXTENSION
Definition: mrx.h:330
#define PAGED_CODE()
Definition: video.h:57
#define RX_V_NETROOT_POOLTAG
Definition: rxpooltg.h:6
smooth NULL
Definition: ftsmooth.c:416
NodeType
Definition: Node.h:5
#define RX_NETROOT_POOLTAG
Definition: rxpooltg.h:5
#define RX_SRVCALL_POOLTAG
Definition: rxpooltg.h:4
#define RxAllocatePoolWithTag
Definition: ntrxdef.h:25
struct _V_NET_ROOT * PV_NET_ROOT
ULONG MRxVNetRootSize
Definition: mrx.h:344
struct _RX_PREFIX_ENTRY RX_PREFIX_ENTRY
#define RDBSS_NTC_V_NETROOT
Definition: nodetype.h:50
static IUnknown Object
Definition: main.c:512
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ZeroAndInitializeNodeType(Node, Type, Size)
Definition: nodetype.h:25
struct _NET_ROOT * PNET_ROOT
struct _SRV_CALL SRV_CALL
#define RDBSS_MANAGE_V_NET_ROOT_EXTENSION
Definition: mrx.h:331
#define RDBSS_MANAGE_SRV_CALL_EXTENSION
Definition: mrx.h:329
#define RDBSS_NTC_SRVCALL
Definition: nodetype.h:48
unsigned short USHORT
Definition: pedump.c:61
#define RDBSS_NTC_NETROOT
Definition: nodetype.h:49
NODE_TYPE_CODE NodeTypeCode
Definition: prefix.h:46
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
unsigned int ULONG
Definition: retypes.h:1
#define RDBSS_NTC_PREFIX_ENTRY
Definition: nodetype.h:60
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define QuadAlign(Ptr)
Definition: cdprocs.h:1582
struct _V_NET_ROOT V_NET_ROOT
struct _NET_ROOT NET_ROOT
Definition: prefix.h:44
_Inout_opt_ PUNICODE_STRING Extension
Definition: fltkernel.h:1092
ULONG MRxSrvCallSize
Definition: mrx.h:342
UNICODE_STRING Prefix
Definition: prefix.h:53

Referenced by RxCreateNetRoot(), RxCreateSrvCall(), and RxCreateVNetRoot().

◆ RxAssert()

VOID RxAssert ( PVOID  Assert,
PVOID  File,
ULONG  Line,
PVOID  Message 
)

Definition at line 645 of file rxce.c.

650 {
651  CHAR Response[2];
653 
654  /* If we're not asked to continue, just stop the system */
656  {
657  KeBugCheckEx(RDBSS_FILE_SYSTEM, RDBSS_BUG_CHECK_ASSERT | Line, 0, 0, 0);
658  }
659 
660  /* Otherwise, capture context to offer the user to dump it */
662 
663  /* Loop until the user hits 'i' */
664  while (TRUE)
665  {
666  /* If no file provided, use empty name */
667  if (File == NULL)
668  {
669  File = "";
670  }
671 
672  /* If no message provided, use empty one */
673  if (Message == NULL)
674  {
675  Message = "";
676  }
677 
678  /* Display the message */
679  DbgPrint("\n*** Assertion failed: %s%s\n*** Source File: %s, line %ld\n\n", Message, Assert, File, Line);
680  /* And ask the user */
681  DbgPrompt("Break, Ignore (bi)? ", Response, sizeof(Response));
682  /* If he asks for ignore, quit
683  * In case of invalid input, ask again
684  */
685  if (Response[0] != 'B' && Response[0] != 'b')
686  {
687  if (Response[0] == 'I' || Response[0] == 'i')
688  {
689  return;
690  }
691 
692  continue;
693  }
694 
695  /* Break: offer the user to dump the context and break */
696  DbgPrint("Execute '!cxr %lx' to dump context\n", &Context);
697  DbgBreakPoint();
698 
699  /* Continue looping, so that after dump, execution can continue (with ignore) */
700  }
701 }
#define TRUE
Definition: types.h:120
#define DbgPrint
Definition: loader.c:25
NTSYSAPI ULONG NTAPI DbgPrompt(_In_z_ PCCH Prompt, _Out_writes_bytes_(MaximumResponseLength) PCH Response, _In_ ULONG MaximumResponseLength)
#define RDBSS_FILE_SYSTEM
Definition: nodetype.h:84
char CHAR
Definition: xmlstorage.h:175
void DbgBreakPoint()
Definition: mach.c:558
NTSYSAPI VOID NTAPI RtlCaptureContext(_Out_ PCONTEXT ContextRecord)
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN RxContinueFromAssert
Definition: rxce.c:137
#define Assert(cond, msg)
Definition: zutil.h:196
Definition: ncftp.h:89
CHAR Message[80]
Definition: alive.c:5
Definition: ncftp.h:79
struct tagContext Context
Definition: acpixf.h:1012
Definition: File.h:15
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:107

◆ RxBootstrapWorkerThreadDispatcher()

VOID NTAPI RxBootstrapWorkerThreadDispatcher ( IN PVOID  WorkQueue)

Definition at line 708 of file rxce.c.

710 {
711  PRX_WORK_QUEUE RxWorkQueue;
712 
713  PAGED_CODE();
714 
715  RxWorkQueue = WorkQueue;
716  RxpWorkerThreadDispatcher(RxWorkQueue, NULL);
717 }
#define PAGED_CODE()
Definition: video.h:57
LIST_ENTRY WorkQueue
Definition: workqueue.c:20
smooth NULL
Definition: ftsmooth.c:416
VOID RxpWorkerThreadDispatcher(IN PRX_WORK_QUEUE WorkQueue, IN PLARGE_INTEGER WaitInterval)
Definition: rxce.c:7282

Referenced by RxInitializeWorkQueueDispatcher().

◆ RxCancelBlockingOperation()

VOID RxCancelBlockingOperation ( IN OUT PRX_CONTEXT  RxContext)

Definition at line 723 of file rxce.c.

725 {
726  PFOBX Fobx;
727  BOOLEAN PostRequest;
728 
729  PAGED_CODE();
730 
731  Fobx = (PFOBX)RxContext->pFobx;
732  PostRequest = FALSE;
733 
734  /* Acquire the pipe mutex */
736 
737  /* If that's a blocking pipe operation which is not the CCB one, then handle it */
738  if (BooleanFlagOn(RxContext->FlagsForLowIo, RXCONTEXT_FLAG4LOWIO_PIPE_SYNC_OPERATION) &&
739  RxContext->RxContextSerializationQLinks.Flink != NULL &&
740  RxContext != CONTAINING_RECORD(&Fobx->Specific.NamedPipe.ReadSerializationQueue, RX_CONTEXT, RxContextSerializationQLinks) &&
741  RxContext != CONTAINING_RECORD(&Fobx->Specific.NamedPipe.WriteSerializationQueue, RX_CONTEXT, RxContextSerializationQLinks))
742  {
743  /* Clear it! */
744  ClearFlag(RxContext->FlagsForLowIo, RXCONTEXT_FLAG4LOWIO_PIPE_SYNC_OPERATION);
745 
746  /* Drop it off the list */
747  RemoveEntryList(&RxContext->RxContextSerializationQLinks);
748  RxContext->RxContextSerializationQLinks.Flink = NULL;
749  RxContext->RxContextSerializationQLinks.Blink = NULL;
750 
751  /* Set we've been cancelled */
752  RxContext->IoStatusBlock.Status = STATUS_CANCELLED;
753 
754  /*
755  * If it's async, we'll post completion, otherwise, we signal to waiters
756  * it's being cancelled
757  */
758  if (BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_ASYNC_OPERATION))
759  {
760  PostRequest = TRUE;
761  }
762  else
763  {
764  RxSignalSynchronousWaiter(RxContext);
765  }
766  }
767 
768  /* Done */
770 
771  /* Post if async */
772  if (PostRequest)
773  {
774  RxFsdPostRequest(RxContext);
775  }
776 }
#define TRUE
Definition: types.h:120
FAST_MUTEX RxContextPerFileSerializationMutex
Definition: rxce.c:146
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
struct _FOBX::@1871::@1874 NamedPipe
#define RxSignalSynchronousWaiter(RxContext)
Definition: rxcontx.h:417
union _FOBX::@1871 Specific
Definition: fcb.h:304
struct _FOBX * PFOBX
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
#define PAGED_CODE()
Definition: video.h:57
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
NTSTATUS RxFsdPostRequest(_In_ PRX_CONTEXT RxContext)
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23

◆ RxChangeBufferingState()

NTSTATUS NTAPI RxChangeBufferingState ( PSRV_OPEN  SrvOpen,
PVOID  Context,
BOOLEAN  ComputeNewState 
)

Definition at line 783 of file rxce.c.

787 {
788  PFCB Fcb;
790  ULONG NewBufferingState, OldBufferingState;
791 
792  PAGED_CODE();
793 
794  DPRINT("RxChangeBufferingState(%p, %p, %d)\n", SrvOpen, Context, ComputeNewState);
795 
796  Fcb = (PFCB)SrvOpen->pFcb;
798  /* First of all, mark that buffering state is changing */
800 
801  /* Assume success */
803  _SEH2_TRY
804  {
805  /* If we're asked to compute a new state, ask the mini-rdr for it */
806  if (ComputeNewState)
807  {
808  MINIRDR_CALL_THROUGH(MiniStatus, Fcb->MRxDispatch, MRxComputeNewBufferingState,
809  ((PMRX_SRV_OPEN)SrvOpen, Context, &NewBufferingState));
810  if (MiniStatus != STATUS_SUCCESS)
811  {
812  NewBufferingState = 0;
813  }
814  }
815  else
816  {
817  /* If not, use SRV_OPEN state */
818  NewBufferingState = SrvOpen->BufferingFlags;
819  }
820 
821  /* If no shared access, and if we're not asked to compute a new state, use maximum flags set */
822  if ((Fcb->ShareAccess.SharedRead + Fcb->ShareAccess.SharedWrite + Fcb->ShareAccess.SharedDelete) == 0 && !ComputeNewState)
823  {
824  SetFlag(NewBufferingState, FCB_STATE_BUFFERING_STATE_WITH_NO_SHARES);
825  }
826 
827  /* If there's a lock operation to complete, clear that flag */
828  if (Fcb->OutstandingLockOperationsCount != 0)
829  {
830  ClearFlag(NewBufferingState, FCB_STATE_LOCK_BUFFERING_ENABLED);
831  }
832 
833  /* Get the old state */
834  OldBufferingState = Fcb->FcbState & FCB_STATE_BUFFERING_STATE_MASK;
835  DPRINT("ChangeBufferingState %x -> %x (%x)\n", OldBufferingState, NewBufferingState, SrvOpen->BufferingFlags);
836 
837  /* If we're dropping write cache, then flush the FCB */
838  if (BooleanFlagOn(OldBufferingState, FCB_STATE_WRITECACHING_ENABLED) &&
839  !BooleanFlagOn(NewBufferingState, FCB_STATE_WRITECACHING_ENABLED))
840  {
841  DPRINT("Flushing\n");
842 
844  }
845 
846  /* If we're dropping read cache, then purge */
847  if (Fcb->UncleanCount == 0 ||
848  (BooleanFlagOn(OldBufferingState, FCB_STATE_READCACHING_ENABLED) &&
849  !BooleanFlagOn(NewBufferingState, FCB_STATE_READCACHING_ENABLED)) ||
850  BooleanFlagOn(NewBufferingState, FCB_STATE_DELETE_ON_CLOSE))
851  {
852  DPRINT("Purging\n");
853 
854  if (!NT_SUCCESS(Status))
855  {
856  DPRINT("Previous flush failed with status: %lx\n", Status);
857  }
858 
860  }
861 
862  /* If there's already a change pending in SRV_OPEN */
863  if (ComputeNewState && BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_BUFFERING_STATE_CHANGE_PENDING))
864  {
865  /* If there's a FOBX at least */
866  if (!IsListEmpty(&SrvOpen->FobxList))
867  {
868  PRX_CONTEXT RxContext;
869 
870  /* Create a fake context to pass to the mini-rdr */
872  if (RxContext != NULL)
873  {
874  PFOBX Fobx;
875 
876  RxContext->pFcb = RX_GET_MRX_FCB(Fcb);
877 
878  /* Give the first FOBX */
879  Fobx = CONTAINING_RECORD(SrvOpen->FobxList.Flink, FOBX, FobxQLinks);
880  RxContext->pFobx = (PMRX_FOBX)Fobx;
881  RxContext->pRelevantSrvOpen = Fobx->pSrvOpen;
882 
883  /* If there was a delayed close, perform it */
884  if (BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_CLOSE_DELAYED))
885  {
886  DPRINT("Oplock break close for %p\n", SrvOpen);
887 
888  RxCloseAssociatedSrvOpen(Fobx, RxContext);
889  }
890  /* Otherwise, inform the mini-rdr about completion */
891  else
892  {
893  MINIRDR_CALL_THROUGH(MiniStatus, Fcb->MRxDispatch, MRxCompleteBufferingStateChangeRequest,
894  (RxContext, (PMRX_SRV_OPEN)SrvOpen, Context));
895  (void)MiniStatus;
896  }
897 
899  }
900  }
901  }
902 
903  /* Set the new state */
904  Fcb->FcbState ^= (NewBufferingState ^ Fcb->FcbState) & FCB_STATE_BUFFERING_STATE_MASK;
905  }
907  {
908  /* Job done, clear the flag */
910 
911  if (!BooleanFlagOn(NewBufferingState, FCB_STATE_FILETIMECACHEING_ENABLED))
912  {
914  }
915  }
916  _SEH2_END;
917 
918  return Status;
919 }
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
Definition: fssup.c:384
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
Definition: cdstruc.h:908
PMRX_FCB pFcb
Definition: rxcontx.h:112
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define NodeTypeIsFcb(FCB)
Definition: nodetype.h:68
PRX_CONTEXT NTAPI RxCreateRxContext(IN PIRP Irp, IN PRDBSS_DEVICE_OBJECT RxDeviceObject, IN ULONG InitialContextFlags)
Definition: rxce.c:1797
LONG NTSTATUS
Definition: precomp.h:26
PMRX_FOBX pFobx
Definition: rxcontx.h:113
struct _MRX_FOBX_ * PMRX_FOBX
SECTION_OBJECT_POINTERS SectionObjectPointers
Definition: fatstruc.h:725
Definition: fcb.h:304
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
#define FCB_STATE_BUFFERING_STATE_MASK
Definition: fcb.h:232
#define FCB_STATE_WRITECACHING_ENABLED
Definition: fcb.h:226
VOID NTAPI MiniStatus(IN NDIS_HANDLE MiniportHandle, IN NDIS_STATUS GeneralStatus, IN PVOID StatusBuffer, IN UINT StatusBufferSize)
Definition: miniport.c:1383
PNON_PAGED_FCB NonPaged
Definition: fatstruc.h:807
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define RX_GET_MRX_FCB(F)
Definition: rxprocs.h:157
ULONG SharedWrite
Definition: iotypes.h:497
#define FCB_STATE_READCACHING_ENABLED
Definition: fcb.h:224
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define FCB_STATE_FILETIMECACHEING_ENABLED
Definition: fcb.h:218
SHARE_ACCESS ShareAccess
Definition: cdstruc.h:1015
NTSTATUS RxCloseAssociatedSrvOpen(_In_ PFOBX Fobx, _In_opt_ PRX_CONTEXT RxContext)
#define SRVOPEN_FLAG_BUFFERING_STATE_CHANGE_PENDING
Definition: mrxfcb.h:136
#define FCB_STATE_DELETE_ON_CLOSE
Definition: fatstruc.h:1189
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FCB * PFCB
Definition: cdstruc.h:1046
NTSTATUS RxFlushFcbInSystemCache(IN PFCB Fcb, IN BOOLEAN SynchronizeWithLazyWriter)
Definition: rxce.c:4249
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PMINIRDR_DISPATCH MRxDispatch
Definition: fcb.h:150
CLONG UncleanCount
Definition: fatstruc.h:869
ULONG SharedRead
Definition: iotypes.h:496
#define FCB_STATE_LOCK_BUFFERING_ENABLED
Definition: fcb.h:220
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
PRDBSS_DEVICE_OBJECT RxDeviceObject
Definition: fcb.h:149
Status
Definition: gdiplustypes.h:24
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
_SEH2_END
Definition: create.c:4424
#define FCB_STATE_TIME_AND_SIZE_ALREADY_SET
Definition: fcb.h:217
_SEH2_FINALLY
Definition: create.c:4395
LIST_ENTRY FobxList
Definition: fcb.h:279
unsigned int ULONG
Definition: retypes.h:1
#define MINIRDR_CALL_THROUGH(STATUS, DISPATCH, FUNC, ARGLIST)
Definition: rxcontx.h:375
ULONG SharedDelete
Definition: iotypes.h:498
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2745
#define RxDereferenceAndDeleteRxContext(RXCONTEXT)
Definition: rxcontx.h:514
ULONG FcbState
Definition: cdstruc.h:977
#define FCB_STATE_BUFFERSTATE_CHANGING
Definition: fcb.h:215
#define SRVOPEN_FLAG_CLOSE_DELAYED
Definition: mrxfcb.h:133
PMRX_SRV_OPEN pRelevantSrvOpen
Definition: rxcontx.h:114

Referenced by enable_caching(), and RxCreateFromNetRoot().

◆ RxCheckVNetRootCredentials()

NTSTATUS RxCheckVNetRootCredentials ( PRX_CONTEXT  RxContext,
PV_NET_ROOT  VNetRoot,
PLUID  LogonId,
PUNICODE_STRING  UserName,
PUNICODE_STRING  UserDomain,
PUNICODE_STRING  Password,
ULONG  Flags 
)

Definition at line 922 of file rxce.c.

930 {
931  PAGED_CODE();
932 
933  /* If that's a UNC name, there's nothing to process */
935  (BooleanFlagOn(VNetRoot->Flags, VNETROOT_FLAG_CSCAGENT_INSTANCE) ||
936  Flags != 0))
937  {
939  }
940 
941  /* Compare the logon ID in the VNetRoot with the one provided */
942  if (RtlCompareMemory(&VNetRoot->LogonId, LogonId, sizeof(LUID)) != sizeof(LUID))
943  {
945  }
946 
947  /* No credential provided? That's OK */
948  if (UserName == NULL && UserDomain == NULL && Password == NULL)
949  {
950  return STATUS_SUCCESS;
951  }
952 
953  /* Left to do! */
955  return STATUS_NOT_IMPLEMENTED;
956 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:63
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define PAGED_CODE()
Definition: video.h:57
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
smooth NULL
Definition: ftsmooth.c:416
ULONG Flags
Definition: rxcontx.h:124
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID LogonId
#define UNIMPLEMENTED
Definition: debug.h:114
return STATUS_SUCCESS
Definition: btrfs.c:2745
#define VNETROOT_FLAG_CSCAGENT_INSTANCE
Definition: mrxfcb.h:88
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465

Referenced by RxFindOrConstructVirtualNetRoot().

◆ RxCompleteRequest()

NTSTATUS RxCompleteRequest ( PRX_CONTEXT  Context,
NTSTATUS  Status 
)

Definition at line 959 of file rxce.c.

962 {
963  PIRP Irp;
964 
965  PAGED_CODE();
966 
967  DPRINT("RxCompleteRequest(%p, %lx)\n", Context, Status);
968 
969  ASSERT(Context != NULL);
970  ASSERT(Context->CurrentIrp != NULL);
971  Irp = Context->CurrentIrp;
972 
973  /* Debug what the caller asks for */
974  if (Context->LoudCompletionString != NULL)
975  {
976  DPRINT("LoudCompletion: %lx/%lx with %wZ\n", Status, Irp->IoStatus.Information, Context->LoudCompletionString);
977  /* Does the user asks to stop on failed completion */
979  {
980  DPRINT1("LoudFailure: %lx/%lx with %wZ\n", Status, Irp->IoStatus.Information, Context->LoudCompletionString);
981  }
982  }
983 
984  /* Complete for real */
985  Context->CurrentIrp = NULL;
987 
988  DPRINT("Status: %lx\n", Status);
989  return Status;
990 }
_In_ PIRP Irp
Definition: csq.h:116
BOOLEAN RxStopOnLoudCompletion
Definition: rxce.c:120
VOID RxCompleteRequest_Real(IN PRX_CONTEXT RxContext, IN PIRP Irp, IN NTSTATUS Status)
Definition: rxce.c:996
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
#define DPRINT1
Definition: precomp.h:8

Referenced by RxFinishSrvCallConstruction(), and RxLowIoCompletionTail().

◆ RxCompleteRequest_Real()

VOID RxCompleteRequest_Real ( IN PRX_CONTEXT  RxContext,
IN PIRP  Irp,
IN NTSTATUS  Status 
)

Definition at line 996 of file rxce.c.

1000 {
1001  CCHAR Boost;
1002  KIRQL OldIrql;
1003  PIO_STACK_LOCATION Stack;
1004 
1005  DPRINT("RxCompleteRequest_Real(%p, %p, %lx)\n", RxContext, Irp, Status);
1006 
1007  /* Nothing to complete, just free context */
1008  if (Irp == NULL)
1009  {
1010  DPRINT("NULL IRP for %p\n", RxContext);
1011  if (RxContext != NULL)
1012  {
1014  }
1015 
1016  return;
1017  }
1018 
1019  /* Remove cancel routine */
1023 
1024  /* Select the boost, given the success/paging operation */
1026  {
1027  Boost = IO_DISK_INCREMENT;
1028  }
1029  else
1030  {
1031  Irp->IoStatus.Information = 0;
1032  Boost = IO_NO_INCREMENT;
1033  }
1034  Irp->IoStatus.Status = Status;
1035 
1036  if (RxContext != NULL)
1037  {
1038  ASSERT(RxContext->MajorFunction <= IRP_MJ_MAXIMUM_FUNCTION);
1039  if (RxContext->MajorFunction != IRP_MJ_DEVICE_CONTROL)
1040  {
1041  DPRINT("Completing: MN: %d, Context: %p, IRP: %p, Status: %lx, Info: %lx, #%lx\n",
1042  RxContext->MinorFunction, RxContext, Irp,
1043  Status, Irp->IoStatus.Information, RxContext->SerialNumber);
1044  }
1045  }
1046 
1047  /* If that's an opening, there might be a canonical name allocated,
1048  * if completion isn't pending, release it
1049  */
1051  if (Stack->MajorFunction == IRP_MJ_CREATE && Status != STATUS_PENDING &&
1052  RxContext != NULL)
1053  {
1054  if (BooleanFlagOn(RxContext->Create.Flags, 2))
1055  {
1056  Stack->FileObject->FileName.Length += sizeof(WCHAR);
1057  }
1058 
1060  ASSERT(RxContext->Create.CanonicalNameBuffer == NULL);
1061  }
1062 
1063  /* If it's a write, validate the correct behavior of the operation */
1064  if (Stack->MajorFunction == IRP_MJ_WRITE)
1065  {
1066  if (NT_SUCCESS(Irp->IoStatus.Status))
1067  {
1068  ASSERT(Irp->IoStatus.Information <= Stack->Parameters.Write.Length);
1069  }
1070  }
1071 
1072  /* If it's pending, make sure IRP is marked as such */
1073  if (RxContext != NULL)
1074  {
1075  if (RxContext->PendingReturned)
1076  {
1078  }
1079  }
1080 
1081  /* Complete now */
1082  DPRINT("Completing IRP with %x/%x\n", Irp->IoStatus.Status, Irp->IoStatus.Information);
1083  IoCompleteRequest(Irp, Boost);
1084 
1085  /* If there's a context, dereference it */
1086  if (RxContext != NULL)
1087  {
1089  }
1090 }
VOID NTAPI RxDereferenceAndDeleteRxContext_Real(IN PRX_CONTEXT RxContext)
Definition: rxce.c:2309
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define SL_PENDING_RETURNED
Definition: iotypes.h:2968
_In_ PIRP Irp
Definition: csq.h:116
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define IRP_MJ_MAXIMUM_FUNCTION
VOID NTAPI IoAcquireCancelSpinLock(OUT PKIRQL Irql)
Definition: util.c:56
IoSetCancelRoutine(Irp, CancelRoutine)
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define IO_DISK_INCREMENT
Definition: iotypes.h:567
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
char CCHAR
Definition: typedefs.h:50
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
Definition: util.c:150
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
#define IO_NO_INCREMENT
Definition: iotypes.h:565
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
VOID RxpPrepareCreateContextForReuse(_In_ PRX_CONTEXT RxContext)
#define IRP_SYNCHRONOUS_PAGING_IO
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

Referenced by RxCompleteRequest().

◆ RxCompleteSrvOpenKeyAssociation()

VOID RxCompleteSrvOpenKeyAssociation ( IN OUT PSRV_OPEN  SrvOpen)

Definition at line 1096 of file rxce.c.

1098 {
1099  PSRV_CALL SrvCall;
1100 
1101  SrvCall = (PSRV_CALL)((PFCB)SrvOpen->pFcb)->VNetRoot->pNetRoot->pSrvCall;
1102  /* Only handle requests if opening was a success */
1103  if (SrvOpen->Condition == Condition_Good)
1104  {
1105  KIRQL OldIrql;
1106  BOOLEAN ProcessChange;
1107  LIST_ENTRY DiscardedRequests;
1108 
1109  /* Initialize our discarded requests list */
1110  InitializeListHead(&DiscardedRequests);
1111 
1113 
1114  /* Transfer our requests in the SRV_CALL */
1115  RxTransferList(&SrvCall->BufferingManager.SrvOpenLists[0], &SrvOpen->SrvOpenKeyList);
1116 
1117  /* Was increased in RxInitiateSrvOpenKeyAssociation(), opening is done */
1119 
1120  /* Dispatch requests and get the discarded ones */
1121  RxpDispatchChangeBufferingStateRequests(SrvCall, SrvOpen, &DiscardedRequests);
1122 
1124 
1125  /* Is there still anything to process? */
1127  if (IsListEmpty(&SrvCall->BufferingManager.HandlerList))
1128  {
1129  ProcessChange = FALSE;
1130  }
1131  else
1132  {
1133  ProcessChange = (SrvCall->BufferingManager.HandlerInactive == FALSE);
1134  if (ProcessChange)
1135  {
1137  }
1138  }
1140 
1141  /* Yes? Go ahead! */
1142  if (ProcessChange)
1143  {
1144  RxReferenceSrvCall(SrvCall);
1148  }
1149 
1150  /* And discard left requests */
1151  RxpDiscardChangeBufferingStateRequests(&DiscardedRequests);
1152  }
1153  else
1154  {
1156  }
1157 }
struct _SRV_CALL * PSRV_CALL
#define TRUE
Definition: types.h:120
#define RxTransferList(Destination, Source)
Definition: rxcontx.h:449
RX_BUFFERING_MANAGER BufferingManager
Definition: fcb.h:27
#define RxAcquireBufferingManagerMutex(BufMan)
Definition: buffring.h:42
Definition: cdstruc.h:908
RX_WORK_QUEUE_ITEM HandlerWorkItem
Definition: buffring.h:33
#define RxReferenceSrvCall(SrvCall)
Definition: fcb.h:391
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
volatile LONG NumberOfOutstandingOpens
Definition: buffring.h:28
KSPIN_LOCK SpinLock
Definition: buffring.h:24
UCHAR KIRQL
Definition: env_spec_w32.h:591
NTSTATUS NTAPI RxPostToWorkerThread(_In_ PRDBSS_DEVICE_OBJECT pMRxDeviceObject, _In_ WORK_QUEUE_TYPE WorkQueueType, _In_ PRX_WORK_QUEUE_ITEM pWorkQueueItem, _In_ PRX_WORKERTHREAD_ROUTINE Routine, _In_ PVOID pContext)
Definition: rxce.c:6400
PRDBSS_DEVICE_OBJECT RxFileSystemDeviceObject
Definition: rdbss.c:573
VOID RxpDiscardChangeBufferingStateRequests(_Inout_ PLIST_ENTRY DiscardedRequests)
Definition: rxce.c:6065
unsigned char BOOLEAN
BOOLEAN HandlerInactive
Definition: buffring.h:21
LIST_ENTRY HandlerList
Definition: buffring.h:30
Definition: fcb.h:9
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define InterlockedDecrement
Definition: armddk.h:52
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Definition: typedefs.h:117
VOID NTAPI RxProcessChangeBufferingStateRequests(_In_ PVOID SrvCall)
Definition: rxce.c:6643
VOID RxpDispatchChangeBufferingStateRequests(PSRV_CALL SrvCall, PSRV_OPEN SrvOpen, PLIST_ENTRY DiscardedRequests)
Definition: rxce.c:6098
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
LIST_ENTRY SrvOpenLists[1]
Definition: buffring.h:36
#define RxReleaseBufferingManagerMutex(BufMan)
Definition: buffring.h:50

◆ RxConstructNetRoot()

NTSTATUS RxConstructNetRoot ( IN PRX_CONTEXT  RxContext,
IN PSRV_CALL  SrvCall,
IN PNET_ROOT  NetRoot,
IN PV_NET_ROOT  VirtualNetRoot,
OUT PLOCK_HOLDING_STATE  LockHoldingState 
)

Definition at line 1163 of file rxce.c.

1169 {
1170  NTSTATUS Status;
1171  PRX_PREFIX_TABLE PrefixTable;
1173  RX_BLOCK_CONDITION RootCondition, VRootCondition;
1174 
1175  PAGED_CODE();
1176 
1177  DPRINT("RxConstructNetRoot(%p, %p, %p, %p, %p)\n", RxContext, SrvCall, NetRoot,
1178  VirtualNetRoot, LockHoldingState);
1179 
1180  /* Validate the lock is exclusively held */
1181  PrefixTable = RxContext->RxDeviceObject->pRxNetNameTable;
1182  ASSERT(*LockHoldingState == LHS_ExclusiveLockHeld);
1183 
1184  /* Allocate the context */
1186  if (Context == NULL)
1187  {
1189  }
1190 
1191  /* We can release lock now */
1192  RxReleasePrefixTableLock(PrefixTable);
1193  *LockHoldingState = LHS_LockNotHeld;
1194 
1195  RootCondition = Condition_Bad;
1196  VRootCondition = Condition_Bad;
1197 
1198  /* Initialize the context */
1201  Context->RxContext = RxContext;
1202  Context->pVNetRoot = VirtualNetRoot;
1203  Context->Callback = RxCreateNetRootCallBack;
1204 
1205  /* And call the mini-rdr */
1206  MINIRDR_CALL_THROUGH(Status, SrvCall->RxDeviceObject->Dispatch, MRxCreateVNetRoot, (Context));
1207  if (Status == STATUS_PENDING)
1208  {
1209  /* Wait for the mini-rdr to be done */
1211  /* Update the structures condition according to mini-rdr return */
1212  if (NT_SUCCESS(Context->NetRootStatus))
1213  {
1214  if (NT_SUCCESS(Context->VirtualNetRootStatus))
1215  {
1216  RootCondition = Condition_Good;
1217  VRootCondition = Condition_Good;
1219  }
1220  else
1221  {
1222  RootCondition = Condition_Good;
1223  Status = Context->VirtualNetRootStatus;
1224  }
1225  }
1226  else
1227  {
1228  Status = Context->VirtualNetRootStatus;
1229  if (NT_SUCCESS(Status))
1230  {
1231  Status = Context->NetRootStatus;
1232  }
1233  }
1234  }
1235  else
1236  {
1237  /* It has to return STATUS_PENDING! */
1238  ASSERT(FALSE);
1239  }
1240 
1241  /* Acquire lock again - for caller lock status will remain unchanged */
1242  ASSERT(*LockHoldingState == LHS_LockNotHeld);
1244  *LockHoldingState = LHS_ExclusiveLockHeld;
1245 
1246  /* Do the transition to the condition got from mini-rdr */
1247  RxTransitionNetRoot(NetRoot, RootCondition);
1248  RxTransitionVNetRoot(VirtualNetRoot, VRootCondition);
1249 
1250  /* Context is not longer needed */
1251  RxFreePoolWithTag(Context, RX_SRVCALL_POOLTAG);
1252 
1253  DPRINT("Status: %x\n", Status);
1254 
1255  return Status;
1256 }
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONG NTSTATUS
Definition: precomp.h:26
#define RxReleasePrefixTableLock(T)
Definition: prefix.h:84
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define RX_SRVCALL_POOLTAG
Definition: rxpooltg.h:4
#define RxAllocatePoolWithTag
Definition: ntrxdef.h:25
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI RxCreateNetRootCallBack(IN PMRX_CREATENETROOT_CONTEXT CreateNetRootContext)
Definition: rxce.c:1784
Status
Definition: gdiplustypes.h:24
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define RxAcquirePrefixTableLockExclusive(T, W)
Definition: prefix.h:83
#define RxTransitionNetRoot(N, C)
Definition: fcb.h:474
#define RxTransitionVNetRoot(V, C)
Definition: fcb.h:515
enum _RX_BLOCK_CONDITION RX_BLOCK_CONDITION
struct tagContext Context
Definition: acpixf.h:1012
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define MINIRDR_CALL_THROUGH(STATUS, DISPATCH, FUNC, ARGLIST)
Definition: rxcontx.h:375
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by RxConstructVirtualNetRoot(), and RxFindOrCreateConnections().

◆ RxConstructSrvCall()

NTSTATUS RxConstructSrvCall ( IN PRX_CONTEXT  RxContext,
IN PSRV_CALL  SrvCall,
OUT PLOCK_HOLDING_STATE  LockHoldingState 
)

Definition at line 1262 of file rxce.c.

1266 {
1267  NTSTATUS Status;
1268  PRX_PREFIX_TABLE PrefixTable;
1269  PRDBSS_DEVICE_OBJECT RxDeviceObject;
1270  PMRX_SRVCALLDOWN_STRUCTURE Calldown;
1272 
1273  PAGED_CODE();
1274 
1275  DPRINT("RxConstructSrvCall(%p, %p, %p)\n", RxContext, SrvCall, LockHoldingState);
1276 
1277  /* Validate the lock is exclusively held */
1278  RxDeviceObject = RxContext->RxDeviceObject;
1279  PrefixTable = RxDeviceObject->pRxNetNameTable;
1280  ASSERT(*LockHoldingState == LHS_ExclusiveLockHeld);
1281 
1282  /* Allocate the context for mini-rdr */
1284  if (Calldown == NULL)
1285  {
1286  SrvCall->Context = NULL;
1287  SrvCall->Condition = Condition_Bad;
1288  RxReleasePrefixTableLock(PrefixTable);
1289  *LockHoldingState = LHS_LockNotHeld;
1291  }
1292 
1293  /* Initialize it */
1294  RtlZeroMemory(Calldown, sizeof(MRX_SRVCALLDOWN_STRUCTURE));
1295 
1296  SrvCall->Context = NULL;
1297  SrvCall->Condition = Condition_InTransition;
1298 
1299  RxReleasePrefixTableLock(PrefixTable);
1300  *LockHoldingState = LHS_LockNotHeld;
1301 
1302  CallbackContext = &Calldown->CallbackContexts[0];
1303  DPRINT("CalldownContext %p for %wZ\n", CallbackContext, &RxDeviceObject->DeviceName);
1304  DPRINT("With calldown %p and SrvCall %p\n", Calldown, SrvCall);
1305  CallbackContext->SrvCalldownStructure = Calldown;
1306  CallbackContext->CallbackContextOrdinal = 0;
1307  CallbackContext->RxDeviceObject = RxDeviceObject;
1308 
1309  RxReferenceSrvCall(SrvCall);
1310 
1311  /* If we're async, we'll post, otherwise, we'll have to wait for completion */
1312  if (BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_ASYNC_OPERATION))
1313  {
1314  RxPrePostIrp(RxContext, RxContext->CurrentIrp);
1315  }
1316  else
1317  {
1319  }
1320 
1321  Calldown->NumberToWait = 1;
1322  Calldown->NumberRemaining = 1;
1323  Calldown->RxContext = RxContext;
1324  Calldown->SrvCall = (PMRX_SRV_CALL)SrvCall;
1325  Calldown->CallBack = RxCreateSrvCallCallBack;
1326  Calldown->BestFinisher = NULL;
1328  InitializeListHead(&Calldown->SrvCalldownList);
1329 
1330  /* Call the mini-rdr */
1331  ASSERT(RxDeviceObject->Dispatch != NULL);
1332  ASSERT(NodeType(RxDeviceObject->Dispatch) == RDBSS_NTC_MINIRDR_DISPATCH);
1333  ASSERT(RxDeviceObject->Dispatch->MRxCreateSrvCall != NULL);
1334  Status = RxDeviceObject->Dispatch->MRxCreateSrvCall((PMRX_SRV_CALL)SrvCall, CallbackContext);
1335  /* It has to return STATUS_PENDING! */
1337 
1338  /* No async, start completion */
1339  if (!BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_ASYNC_OPERATION))
1340  {
1342 
1343  /* Finish construction - we'll notify mini-rdr it's the winner */
1344  Status = RxFinishSrvCallConstruction(Calldown);
1345  if (!NT_SUCCESS(Status))
1346  {
1347  RxReleasePrefixTableLock(PrefixTable);
1348  *LockHoldingState = LHS_LockNotHeld;
1349  }
1350  else
1351  {
1352  ASSERT(RxIsPrefixTableLockAcquired(PrefixTable));
1353  *LockHoldingState = LHS_ExclusiveLockHeld;
1354  }
1355  }
1356 
1357  DPRINT("RxConstructSrvCall() = Status: %x\n", Status);
1358  return Status;
1359 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG _In_ ULONGLONG _In_opt_ PEVENT_FILTER_DESCRIPTOR _Inout_opt_ PVOID CallbackContext
Definition: wmitypes.h:55
PMINIRDR_DISPATCH Dispatch
Definition: rxstruc.h:89
NTSTATUS RxFinishSrvCallConstruction(PMRX_SRVCALLDOWN_STRUCTURE Calldown)
Definition: rxce.c:4089
PRX_CONTEXT RxContext
Definition: mrx.h:135
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
PMRX_SRVCALL_CALLBACK CallBack
Definition: mrx.h:137
VOID RxPrePostIrp(_In_ PVOID Context, _In_ PIRP Irp)
#define RxReferenceSrvCall(SrvCall)
Definition: fcb.h:391
LONG NTSTATUS
Definition: precomp.h:26
PMRX_CREATE_SRVCALL MRxCreateSrvCall
Definition: mrx.h:393
VOID NTAPI RxCreateSrvCallCallBack(IN OUT PMRX_SRVCALL_CALLBACK_CONTEXT Context)
Definition: rxce.c:1895
#define RxReleasePrefixTableLock(T)
Definition: prefix.h:84
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define PAGED_CODE()
Definition: video.h:57
PRDBSS_DEVICE_OBJECT BestFinisher
Definition: mrx.h:142
#define STATUS_BAD_NETWORK_PATH
Definition: ntstatus.h:412
#define RDBSS_NTC_MINIRDR_DISPATCH
Definition: nodetype.h:64
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define RxIsPrefixTableLockAcquired(T)
Definition: prefix.h:113
NodeType
Definition: Node.h:5
#define RX_SRVCALL_POOLTAG
Definition: rxpooltg.h:4
#define RxAllocatePoolWithTag
Definition: ntrxdef.h:25
MRX_SRVCALL_CALLBACK_CONTEXT CallbackContexts[1]
Definition: mrx.h:143
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
LIST_ENTRY SrvCalldownList
Definition: mrx.h:134
PRX_PREFIX_TABLE pRxNetNameTable
Definition: rxstruc.h:127
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PMRX_SRV_CALL SrvCall
Definition: mrx.h:136
UNICODE_STRING DeviceName
Definition: rxstruc.h:90
Status
Definition: gdiplustypes.h:24
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
struct _MRX_SRV_CALL_ * PMRX_SRV_CALL
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261

Referenced by RxFindOrCreateConnections().

◆ RxConstructVirtualNetRoot()

NTSTATUS RxConstructVirtualNetRoot ( IN PRX_CONTEXT  RxContext,
IN PUNICODE_STRING  CanonicalName,
IN NET_ROOT_TYPE  NetRootType,
OUT PV_NET_ROOT VirtualNetRootPointer,
OUT PLOCK_HOLDING_STATE  LockHoldingState,
OUT PRX_CONNECTION_ID  RxConnectionId 
)

Definition at line 1365 of file rxce.c.

1372 {
1373  NTSTATUS Status;
1374  PV_NET_ROOT VNetRoot;
1376  UNICODE_STRING LocalNetRootName, FilePathName;
1377 
1378  PAGED_CODE();
1379 
1380  ASSERT(*LockHoldingState != LHS_LockNotHeld);
1381 
1382  VNetRoot = NULL;
1384  /* Before creating the VNetRoot, try to find the appropriate connection */
1385  Status = RxFindOrCreateConnections(RxContext, CanonicalName, NetRootType,
1386  &LocalNetRootName, &FilePathName,
1387  LockHoldingState, RxConnectionId);
1388  /* Found and active */
1390  {
1391  /* We need a new VNetRoot */
1392  VNetRoot = RxCreateVNetRoot(RxContext, (PNET_ROOT)RxContext->Create.pVNetRoot->pNetRoot,
1393  CanonicalName, &LocalNetRootName, &FilePathName, RxConnectionId);
1394  if (VNetRoot != NULL)
1395  {
1396  RxReferenceVNetRoot(VNetRoot);
1397  }
1398 
1399  /* Dereference previous VNetRoot */
1400  RxDereferenceVNetRoot(RxContext->Create.pVNetRoot->pNetRoot, *LockHoldingState);
1401  /* Reset and start construct (new structures will replace old ones) */
1402  RxContext->Create.pSrvCall = NULL;
1403  RxContext->Create.pNetRoot = NULL;
1404  RxContext->Create.pVNetRoot = NULL;
1405 
1406  /* Construct new NetRoot */
1407  if (VNetRoot != NULL)
1408  {
1409  Status = RxConstructNetRoot(RxContext, (PSRV_CALL)VNetRoot->pNetRoot->pSrvCall,
1410  (PNET_ROOT)VNetRoot->pNetRoot, VNetRoot, LockHoldingState);
1411  if (NT_SUCCESS(Status))
1412  {
1414  }
1415  }
1416  else
1417  {
1419  }
1420  }
1421  else
1422  {
1423  /* If it failed creating the connection, leave */
1424  if (Status != STATUS_SUCCESS)
1425  {
1426  if (*LockHoldingState != LHS_LockNotHeld)
1427  {
1428  RxReleasePrefixTableLock(RxContext->RxDeviceObject->pRxNetNameTable);
1429  *LockHoldingState = LHS_LockNotHeld;
1430  }
1431 
1432  *VirtualNetRootPointer = VNetRoot;
1433  DPRINT("RxConstructVirtualNetRoot() = Status: %x\n", Status);
1434  return Status;
1435  }
1436 
1437  *LockHoldingState = LHS_ExclusiveLockHeld;
1438 
1439  VNetRoot = (PV_NET_ROOT)RxContext->Create.pVNetRoot;
1441  }
1442 
1443  /* We have a non stable VNetRoot - transition it */
1444  if (VNetRoot != NULL && !StableCondition(VNetRoot->Condition))
1445  {
1446  RxTransitionVNetRoot(VNetRoot, Condition);
1447  }
1448 
1449  /* If recreation failed */
1450  if (Status != STATUS_SUCCESS)
1451  {
1452  /* Dereference potential VNetRoot */
1453  if (VNetRoot != NULL)
1454  {
1455  ASSERT(*LockHoldingState != LHS_LockNotHeld);
1456  RxDereferenceVNetRoot(VNetRoot, *LockHoldingState);
1457  VNetRoot = NULL;
1458  }
1459 
1460  /* Release lock */
1461  if (*LockHoldingState != LHS_LockNotHeld)
1462  {
1463  RxReleasePrefixTableLock(RxContext->RxDeviceObject->pRxNetNameTable);
1464  *LockHoldingState = LHS_LockNotHeld;
1465  }
1466 
1467  /* Set NULL ptr */
1468  *VirtualNetRootPointer = VNetRoot;
1469  return Status;
1470  }
1471 
1472  /* Return the allocated VNetRoot */
1473  *VirtualNetRootPointer = VNetRoot;
1474  return Status;
1475 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONG NTSTATUS
Definition: precomp.h:26
Definition: fcb.h:33
#define RxReleasePrefixTableLock(T)
Definition: prefix.h:84
#define PAGED_CODE()
Definition: video.h:57
#define StableCondition(X)
Definition: mrx.h:81
#define RxReferenceVNetRoot(VNetRoot)
Definition: fcb.h:407
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
IN ULONG IN UCHAR Condition
NTSTATUS RxConstructNetRoot(IN PRX_CONTEXT RxContext, IN PSRV_CALL SrvCall, IN PNET_ROOT NetRoot, IN PV_NET_ROOT VirtualNetRoot, OUT PLOCK_HOLDING_STATE LockHoldingState)
Definition: rxce.c:1163
struct _V_NET_ROOT * PV_NET_ROOT
#define RxDereferenceVNetRoot(VNetRoot, LockHoldingState)
Definition: fcb.h:411
Definition: fcb.h:9
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
RX_BLOCK_CONDITION Condition
Definition: fcb.h:70
Status
Definition: gdiplustypes.h:24
PV_NET_ROOT RxCreateVNetRoot(IN PRX_CONTEXT RxContext, IN PNET_ROOT NetRoot, IN PUNICODE_STRING CanonicalName, IN PUNICODE_STRING LocalNetRootName, IN PUNICODE_STRING FilePath, IN PRX_CONNECTION_ID RxConnectionId)
Definition: rxce.c:2052
#define STATUS_CONNECTION_ACTIVE
Definition: ntstatus.h:689
#define RxTransitionVNetRoot(V, C)
Definition: fcb.h:515
enum _RX_BLOCK_CONDITION RX_BLOCK_CONDITION
NTSTATUS RxFindOrCreateConnections(_In_ PRX_CONTEXT RxContext, _In_ PUNICODE_STRING CanonicalName, _In_ NET_ROOT_TYPE NetRootType, _Out_ PUNICODE_STRING LocalNetRootName, _Out_ PUNICODE_STRING FilePathName, _Inout_ PLOCK_HOLDING_STATE LockState, _In_ PRX_CONNECTION_ID RxConnectionId)
Definition: rxce.c:3675
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by RxFindOrConstructVirtualNetRoot().

◆ RxCreateNetFcb()

PFCB RxCreateNetFcb ( IN PRX_CONTEXT  RxContext,
IN PV_NET_ROOT  VNetRoot,
IN PUNICODE_STRING  Name 
)

Definition at line 1481 of file rxce.c.

1485 {
1486  PFCB Fcb;
1487  BOOLEAN FakeFcb;
1488  PNET_ROOT NetRoot;
1491  PIO_STACK_LOCATION Stack;
1492  PRDBSS_DEVICE_OBJECT RxDeviceObject;
1493 
1494  PAGED_CODE();
1495 
1496  /* We need a decent VNetRoot */
1497  ASSERT(VNetRoot != NULL && NodeType(VNetRoot) == RDBSS_NTC_V_NETROOT);
1498 
1499  NetRoot = (PNET_ROOT)VNetRoot->pNetRoot;
1500  ASSERT(NodeType(NetRoot) == RDBSS_NTC_NETROOT);
1501  ASSERT((PMRX_NET_ROOT)NetRoot == RxContext->Create.pNetRoot);
1502 
1503  RxDeviceObject = NetRoot->pSrvCall->RxDeviceObject;
1504  ASSERT(RxDeviceObject == RxContext->RxDeviceObject);
1505 
1506  Stack = RxContext->CurrentIrpSp;
1507 
1508  /* Do we need to create a fake FCB? Like for renaming */
1509  FakeFcb = BooleanFlagOn(Stack->Flags, SL_OPEN_TARGET_DIRECTORY) &&
1511  ASSERT(FakeFcb || RxIsFcbTableLockExclusive(&NetRoot->FcbTable));
1512 
1515 
1516  /* Allocate the FCB */
1517  Fcb = RxAllocateFcbObject(RxDeviceObject, NodeType, PoolType,
1518  NetRoot->InnerNamePrefix.Length + Name->Length, NULL);
1519  if (Fcb == NULL)
1520  {
1521  return NULL;
1522  }
1523 
1524  /* Initialize the FCB */
1525  Fcb->CachedNetRootType = NetRoot->Type;
1526  Fcb->RxDeviceObject = RxDeviceObject;
1527  Fcb->MRxDispatch = RxDeviceObject->Dispatch;
1528  Fcb->VNetRoot = VNetRoot;
1529  Fcb->pNetRoot = VNetRoot->pNetRoot;
1530 
1531  InitializeListHead(&Fcb->SrvOpenList);
1532  Fcb->SrvOpenListVersion = 0;
1533 
1534  Fcb->FcbTableEntry.Path.Length = Name->Length;
1536  Fcb->FcbTableEntry.Path.Buffer = Add2Ptr(Fcb->PrivateAlreadyPrefixedName.Buffer, NetRoot->InnerNamePrefix.Length);
1537  RtlMoveMemory(Fcb->PrivateAlreadyPrefixedName.Buffer, NetRoot->InnerNamePrefix.Buffer,
1538  NetRoot->InnerNamePrefix.Length);
1539  RtlMoveMemory(Fcb->FcbTableEntry.Path.Buffer, Name->Buffer, Name->Length);
1540 
1541  /* Copy back parameters from RxContext */
1542  if (BooleanFlagOn(RxContext->Create.Flags, RX_CONTEXT_CREATE_FLAG_ADDEDBACKSLASH))
1543  {
1545  }
1546 
1548 
1550  {
1552  }
1553 
1554  if (RxContext->MajorFunction == IRP_MJ_CREATE && BooleanFlagOn(RxContext->Create.Flags, RX_CONTEXT_CREATE_FLAG_SPECIAL_PATH))
1555  {
1557  }
1558 
1559  Fcb->Header.Resource = &Fcb->NonPaged->HeaderResource;
1560  ExInitializeResourceLite(Fcb->Header.Resource);
1561 
1562  Fcb->Header.PagingIoResource = &Fcb->NonPaged->PagingIoResource;
1563  ExInitializeResourceLite(Fcb->Header.PagingIoResource);
1564 
1567 
1568  /* Fake FCB doesn't go in prefix table */
1569  if (FakeFcb)
1570  {
1573  DPRINT("Fake FCB: %p\n", Fcb);
1574  }
1575  else
1576  {
1577  RxFcbTableInsertFcb(&NetRoot->FcbTable, Fcb);
1578  }
1579 
1580  RxReferenceVNetRoot(VNetRoot);
1581  InterlockedIncrement((volatile long *)&Fcb->pNetRoot->NumberOfFcbs);
1582 
1583  Fcb->ulFileSizeVersion = 0;
1584 
1585  DPRINT("FCB %p for %wZ\n", Fcb, &Fcb->FcbTableEntry.Path);
1587 
1588  return Fcb;
1589 }
ERESOURCE BufferedLocksResource
Definition: fcb.h:97
#define RxReferenceNetFcb(Fcb)
Definition: fcb.h:431
#define FCB_STATE_ADDEDBACKSLASH
Definition: fcb.h:228
NTSTATUS RxFcbTableInsertFcb(IN OUT PRX_FCB_TABLE FcbTable, IN OUT PFCB Fcb)
Definition: rxce.c:2492
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define RDBSS_NTC_OPENTARGETDIR_FCB
Definition: nodetype.h:44
#define Add2Ptr(PTR, INC)
PMINIRDR_DISPATCH Dispatch
Definition: rxstruc.h:89
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
USHORT MaximumLength
Definition: env_spec_w32.h:370
FCB_BUFFERED_LOCKS BufferedLocks
Definition: fcb.h:188
#define SL_OPEN_PAGING_FILE
Definition: iotypes.h:1773
Definition: cdstruc.h:908
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define FCB_STATE_NAME_ALREADY_REMOVED
Definition: fcb.h:227
RX_FCB_TABLE FcbTable
Definition: fcb.h:54
LIST_ENTRY HashLinks
Definition: fcbtable.h:9
ERESOURCE PagingIoResource
Definition: fcb.h:87
ULONG ulFileSizeVersion
Definition: fcb.h:164
Definition: fcb.h:33
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define PAGED_CODE()
Definition: video.h:57
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define FCB_STATE_FAKEFCB
Definition: fcb.h:211
#define FCB_STATE_PAGING_FILE
Definition: fatstruc.h:1191
#define RxReferenceVNetRoot(VNetRoot)
Definition: fcb.h:407
PNON_PAGED_FCB NonPaged
Definition: fatstruc.h:807
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
RX_FCB_TABLE_ENTRY FcbTableEntry
Definition: fcb.h:144
void DPRINT(...)
Definition: polytest.cpp:61
NodeType
Definition: Node.h:5
#define RxIsFcbTableLockExclusive(T)
Definition: fcbtable.h:58
INT POOL_TYPE
Definition: typedefs.h:76
PV_NET_ROOT VNetRoot
Definition: fcb.h:139
UNICODE_STRING PrivateAlreadyPrefixedName
Definition: fcb.h:145
#define RDBSS_NTC_V_NETROOT
Definition: nodetype.h:50
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define RDBSS_STORAGE_NTC(x)
Definition: nodetype.h:32
#define FCB_STATE_SPECIAL_PATH
Definition: fcb.h:216
PMINIRDR_DISPATCH MRxDispatch
Definition: fcb.h:150
struct _NET_ROOT * PNET_ROOT
PRDBSS_DEVICE_OBJECT RxDeviceObject
Definition: fcb.h:149
ERESOURCE HeaderResource
Definition: fcb.h:86
#define SL_OPEN_TARGET_DIRECTORY
Definition: iotypes.h:1774
#define InterlockedIncrement
Definition: armddk.h:53
#define RDBSS_NTC_NETROOT
Definition: nodetype.h:49
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
PVOID RxAllocateFcbObject(PRDBSS_DEVICE_OBJECT RxDeviceObject, NODE_TYPE_CODE NodeType, POOL_TYPE PoolType, ULONG NameSize, PVOID AlreadyAllocatedObject)
Definition: rxce.c:316
LIST_ENTRY TransitionWaitList
Definition: fcb.h:91
PERESOURCE Resource
Definition: fcb.h:125
USHORT NODE_TYPE_CODE
Definition: nodetype.h:22
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define NETROOT_FLAG_SUPPORTS_SYMBOLIC_LINKS
Definition: mrxfcb.h:44
UNICODE_STRING Path
Definition: fcbtable.h:8
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444
ULONG FcbState
Definition: cdstruc.h:977

◆ RxCreateNetFobx()

PMRX_FOBX NTAPI RxCreateNetFobx ( OUT PRX_CONTEXT  RxContext,
IN PMRX_SRV_OPEN  MrxSrvOpen 
)

Definition at line 1596 of file rxce.c.

1599 {
1600  PFCB Fcb;
1601  PFOBX Fobx;
1602  ULONG Flags;
1603  PNET_ROOT NetRoot;
1604  PSRV_OPEN SrvOpen;
1606 
1607  PAGED_CODE();
1608 
1609  SrvOpen = (PSRV_OPEN)MrxSrvOpen;
1610  ASSERT(NodeType(SrvOpen) == RDBSS_NTC_SRVOPEN);
1611  ASSERT(NodeTypeIsFcb(SrvOpen->Fcb));
1612  ASSERT(RxIsFcbAcquiredExclusive(SrvOpen->Fcb));
1613 
1614  Fcb = SrvOpen->Fcb;
1616  /* Can we use pre-allocated FOBX? */
1618  {
1619  Fobx = Fcb->InternalFobx;
1620  /* Call allocate to initialize the FOBX */
1622  /* Mark it used now */
1625  }
1626  else if (!BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_FOBX_USED))
1627  {
1628  Fobx = SrvOpen->InternalFobx;
1629  /* Call allocate to initialize the FOBX */
1631  /* Mark it used now */
1632  SrvOpen->Flags |= SRVOPEN_FLAG_FOBX_USED;
1634  }
1635  else
1636  {
1637  /* Last case, we cannot, allocate a FOBX */
1639  Flags = 0;
1640  }
1641 
1642  /* Allocation failed! */
1643  if (Fobx == NULL)
1644  {
1645  return NULL;
1646  }
1647 
1648  /* Set flags */
1649  Fobx->Flags = Flags;
1650 
1651  /* Initialize throttling */
1652  NetRoot = (PNET_ROOT)RxContext->Create.pNetRoot;
1653  if (NetRoot != NULL)
1654  {
1655  if (NetRoot->DeviceType == FILE_DEVICE_DISK)
1656  {
1657  RxInitializeThrottlingState(&Fobx->Specific.DiskFile.LockThrottlingState,
1658  NetRoot->DiskParameters.LockThrottlingParameters.Increment,
1659  NetRoot->DiskParameters.LockThrottlingParameters.MaximumDelay);
1660  }
1661  else if (NetRoot->DeviceType == FILE_DEVICE_NAMED_PIPE)
1662  {
1663  RxInitializeThrottlingState(&Fobx->Specific.NamedPipe.ThrottlingState,
1664  NetRoot->NamedPipeParameters.PipeReadThrottlingParameters.Increment,
1665  NetRoot->NamedPipeParameters.PipeReadThrottlingParameters.MaximumDelay);
1666  }
1667  }
1668 
1669  /* Propagate flags fron RxContext */
1670  if (BooleanFlagOn(RxContext->Create.Flags, RX_CONTEXT_CREATE_FLAG_UNC_NAME))
1671  {
1672  Fobx->Flags |= FOBX_FLAG_UNC_NAME;
1673  }
1674 
1675  if (BooleanFlagOn(RxContext->Create.NtCreateParameters.CreateOptions, FILE_OPEN_FOR_BACKUP_INTENT))
1676  {
1677  Fobx->Flags |= FOBX_FLAG_BACKUP_INTENT;
1678  }
1679 
1680  /* Continue init */
1681  Fobx->FobxSerialNumber = 0;
1682  Fobx->SrvOpen = (PSRV_OPEN)MrxSrvOpen;
1683  Fobx->NodeReferenceCount = 1;
1685 
1686  RxReferenceSrvOpen(SrvOpen);
1687  InterlockedIncrement((volatile long *)&SrvOpen->pVNetRoot->NumberOfFobxs);
1688 
1689  InsertTailList(&SrvOpen->FobxList, &Fobx->FobxQLinks);
1692 
1693  Fobx->CloseTime.QuadPart = 0;
1694  Fobx->fOpenCountDecremented = FALSE;
1695 
1696  DPRINT("FOBX %p for SRV_OPEN %p FCB %p\n", Fobx, Fobx->SrvOpen, Fobx->SrvOpen->pFcb);
1697 
1698  return (PMRX_FOBX)Fobx;
1699 }
volatile ULONG FobxSerialNumber
Definition: fcb.h:315
#define FILE_DEVICE_DISK
Definition: winioctl.h:112
PFOBX InternalFobx
Definition: fcb.h:280
LARGE_INTEGER CloseTime
Definition: fcb.h:319
Definition: cdstruc.h:908
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define NodeTypeIsFcb(FCB)
Definition: nodetype.h:68
#define FILE_DEVICE_NAMED_PIPE
Definition: winioctl.h:122
struct _FOBX::@1871::@1874 NamedPipe
LIST_ENTRY ScavengerFinalizationList
Definition: fcb.h:317
union _FOBX::@1871 Specific
#define FOBX_FLAG_UNC_NAME
Definition: fcb.h:297
Definition: fcb.h:33
#define RDBSS_NTC_SRVOPEN
Definition: nodetype.h:52
PSRV_OPEN SrvOpen
Definition: fcb.h:312
#define RxReferenceSrvOpen(SrvOpen)
Definition: fcb.h:423
Definition: fcb.h:304
#define InsertTailList(ListHead, Entry)
#define RxInitializeThrottlingState(BP, Inc, MaxDelay)
Definition: backpack.h:13
#define PAGED_CODE()
Definition: video.h:57
struct _FOBX::@1871::@1875 DiskFile
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define FCB_STATE_PAGING_FILE
Definition: fatstruc.h:1191
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
PRDBSS_DEVICE_OBJECT RxDeviceObject
Definition: fcb.h:346
NodeType
Definition: Node.h:5
BOOLEAN fOpenCountDecremented
Definition: fcb.h:322
#define FOBX_FLAG_ENCLOSED_ALLOCATED
Definition: fcb.h:298
if(!(yy_init))
Definition: macro.lex.yy.c:714
INT POOL_TYPE
Definition: typedefs.h:76
#define FOBX_FLAG_BACKUP_INTENT
Definition: mrxfcb.h:183
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define SRVOPEN_FLAG_FOBX_USED
Definition: fcb.h:257
LIST_ENTRY ClosePendingList
Definition: fcb.h:318
PSRV_OPEN InternalSrvOpen
Definition: fcb.h:152
struct _NET_ROOT * PNET_ROOT
Definition: fcb.h:260
LIST_ENTRY FobxQLinks
Definition: fcb.h:316
#define RxIsFcbAcquiredExclusive(Fcb)
Definition: rxprocs.h:229
PRDBSS_DEVICE_OBJECT RxDeviceObject
Definition: fcb.h:149
#define RDBSS_NTC_FOBX
Definition: nodetype.h:57
#define InterlockedIncrement
Definition: armddk.h:53
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define FILE_OPEN_FOR_BACKUP_INTENT
Definition: from_kernel.h:42
PVOID RxAllocateFcbObject(PRDBSS_DEVICE_OBJECT RxDeviceObject, NODE_TYPE_CODE NodeType, POOL_TYPE PoolType, ULONG NameSize, PVOID AlreadyAllocatedObject)
Definition: rxce.c:316
#define FCB_STATE_FOBX_USED
Definition: fcb.h:229
struct _SRV_OPEN * PSRV_OPEN
LIST_ENTRY FobxList
Definition: fcb.h:279
unsigned int ULONG
Definition: retypes.h:1
PFCB Fcb
Definition: fcb.h:268
_In_ PFCB Fcb
Definition: cdprocs.h:151
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444
PFOBX InternalFobx
Definition: fcb.h:153
ULONG FcbState
Definition: cdstruc.h:977
LONGLONG QuadPart
Definition: typedefs.h:112

◆ RxCreateNetRoot()

PNET_ROOT RxCreateNetRoot ( IN PSRV_CALL  SrvCall,
IN PUNICODE_STRING  Name,
IN ULONG  NetRootFlags,
IN PRX_CONNECTION_ID OPTIONAL  RxConnectionId 
)

Definition at line 1705 of file rxce.c.

1710 {
1711  PNET_ROOT NetRoot;
1712  USHORT CaseInsensitiveLength;
1713  PRX_PREFIX_TABLE PrefixTable;
1714 
1715  DPRINT("RxCreateNetRoot(%p, %wZ, %x, %p)\n", SrvCall, Name, NetRootFlags, RxConnectionId);
1716 
1717  PAGED_CODE();
1718 
1719  /* We need a SRV_CALL */
1720  ASSERT(SrvCall != NULL);
1721 
1722  PrefixTable = SrvCall->RxDeviceObject->pRxNetNameTable;
1723  ASSERT(RxIsPrefixTableLockExclusive(PrefixTable));
1724 
1725  /* Get name length */
1726  CaseInsensitiveLength = SrvCall->PrefixEntry.Prefix.Length + Name->Length;
1727  if (CaseInsensitiveLength > MAXUSHORT)
1728  {
1729  return NULL;
1730  }
1731 
1732  /* Allocate the NetRoot */
1733  NetRoot = RxAllocateObject(RDBSS_NTC_NETROOT, SrvCall->RxDeviceObject->Dispatch,
1734  CaseInsensitiveLength);
1735  if (NetRoot == NULL)
1736  {
1737  return NULL;
1738  }
1739 
1740  /* Construct name */
1741  RtlMoveMemory(Add2Ptr(NetRoot->PrefixEntry.Prefix.Buffer, SrvCall->PrefixEntry.Prefix.Length),
1742  Name->Buffer, Name->Length);
1743  if (SrvCall->PrefixEntry.Prefix.Length != 0)
1744  {
1745  RtlMoveMemory(NetRoot->PrefixEntry.Prefix.Buffer, SrvCall->PrefixEntry.Prefix.Buffer,
1746  SrvCall->PrefixEntry.Prefix.Length);
1747  }
1748 
1750  {
1751  CaseInsensitiveLength = SrvCall->PrefixEntry.CaseInsensitiveLength;
1752  }
1753  /* Inisert in prefix table */
1754  RxPrefixTableInsertName(PrefixTable, &NetRoot->PrefixEntry, NetRoot,
1755  (PULONG)&NetRoot->NodeReferenceCount, CaseInsensitiveLength,
1756  RxConnectionId);
1757 
1758  /* Prepare the FCB table */
1759  RxInitializeFcbTable(&NetRoot->FcbTable, TRUE);
1760 
1764 
1766 
1767  NetRoot->SerialNumberForEnum = SerialNumber++;
1768  NetRoot->Flags |= NetRootFlags;
1769  NetRoot->DiskParameters.ClusterSize = 1;
1770  NetRoot->DiskParameters.ReadAheadGranularity = ReadAheadGranularity;
1771  NetRoot->SrvCall = SrvCall;
1772 
1773  RxReferenceSrvCall(SrvCall);
1774 
1775  DPRINT("NetRootName: %wZ (%p)\n", NetRoot->pNetRootName, NetRoot);
1776  return NetRoot;
1777 }
#define TRUE
Definition: types.h:120
#define Add2Ptr(PTR, INC)
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define RxReferenceSrvCall(SrvCall)
Definition: fcb.h:391
PURGE_SYNCHRONIZATION_CONTEXT PurgeSyncronizationContext
Definition: fcb.h:48
RX_FCB_TABLE FcbTable
Definition: fcb.h:54
Definition: fcb.h:33
ULONG SerialNumberForEnum
Definition: fcb.h:52
LIST_ENTRY TransitionWaitList
Definition: fcb.h:46
#define PAGED_CODE()
Definition: video.h:57
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define SRVCALL_FLAG_CASE_INSENSITIVE_NETROOTS
Definition: mrxfcb.h:11
ULONG ReadAheadGranularity
Definition: rdbss.c:534
LIST_ENTRY VirtualNetRoots
Definition: fcb.h:50
PRX_PREFIX_ENTRY RxPrefixTableInsertName(IN OUT PRX_PREFIX_TABLE ThisTable, IN OUT PRX_PREFIX_ENTRY ThisEntry, IN PVOID Container, IN PULONG ContainerRefCount, IN USHORT CaseInsensitiveLength, IN PRX_CONNECTION_ID ConnectionId)
Definition: rxce.c:6428
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define RxIsPrefixTableLockExclusive(T)
Definition: prefix.h:112
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
LIST_ENTRY ScavengerFinalizationList
Definition: fcb.h:47
ULONG SerialNumber
Definition: rxce.c:117
PSRV_CALL SrvCall
Definition: fcb.h:41
VOID RxInitializePurgeSyncronizationContext(PPURGE_SYNCHRONIZATION_CONTEXT PurgeSyncronizationContext)
Definition: rxce.c:4911
PVOID RxAllocateObject(NODE_TYPE_CODE NodeType, PMINIRDR_DISPATCH MRxDispatch, ULONG NameLength)
Definition: rxce.c:541
RX_PREFIX_ENTRY PrefixEntry
Definition: fcb.h:53
unsigned short USHORT
Definition: pedump.c:61
#define RDBSS_NTC_NETROOT
Definition: nodetype.h:49
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
unsigned int * PULONG
Definition: retypes.h:1
#define MAXUSHORT
Definition: typedefs.h:81
VOID RxInitializeFcbTable(IN OUT PRX_FCB_TABLE FcbTable, IN BOOLEAN CaseInsensitiveMatch)
Definition: rxce.c:4742
UNICODE_STRING Prefix
Definition: prefix.h:53

Referenced by RxFindOrCreateConnections().

◆ RxCreateNetRootCallBack()

VOID NTAPI RxCreateNetRootCallBack ( IN PMRX_CREATENETROOT_CONTEXT  CreateNetRootContext)

Definition at line 1784 of file rxce.c.

1786 {
1787  PAGED_CODE();
1788 
1789  KeSetEvent(&CreateNetRootContext->FinishEvent, IO_NETWORK_INCREMENT, FALSE);
1790 }
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
#define PAGED_CODE()
Definition: video.h:57
#define IO_NETWORK_INCREMENT
Definition: tcpip.h:43

Referenced by RxConstructNetRoot().

◆ RxCreateRxContext()

PRX_CONTEXT NTAPI RxCreateRxContext ( IN PIRP  Irp,
IN PRDBSS_DEVICE_OBJECT  RxDeviceObject,
IN ULONG  InitialContextFlags 
)

Definition at line 1797 of file rxce.c.

1801 {
1802  KIRQL OldIrql;
1804 
1805  ASSERT(RxDeviceObject != NULL);
1806 
1807  DPRINT("RxCreateRxContext(%p, %p, %u)\n", Irp, RxDeviceObject, InitialContextFlags);
1808 
1809 #if DBG
1811 #endif
1812  InterlockedIncrement((volatile LONG *)&RxDeviceObject->NumberOfActiveContexts);
1813 
1814  /* Allocate the context from our lookaside list */
1815  Context = ExAllocateFromNPagedLookasideList(&RxContextLookasideList);
1816  if (Context == NULL)
1817  {
1818  return NULL;
1819  }
1820 
1821  /* Zero it */
1822  RtlZeroMemory(Context, sizeof(RX_CONTEXT));
1823 
1824  /* It was allocated on NP pool, keep track of it! */
1826  /* And initialize it */
1827  RxInitializeContext(Irp, RxDeviceObject, InitialContextFlags, Context);
1829 
1830  /* Add it to our global list */
1832  InsertTailList(&RxActiveContexts, &Context->ContextListEntry);
1834 
1835  DPRINT("Context: %p\n", Context);
1836  return Context;
1837 }
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
_In_ PIRP Irp
Definition: csq.h:116
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
NPAGED_LOOKASIDE_LIST RxContextLookasideList
Definition: rdbss.c:536
#define InsertTailList(ListHead, Entry)
UCHAR KIRQL
Definition: env_spec_w32.h:591
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
VOID NTAPI RxInitializeContext(IN PIRP Irp, IN PRDBSS_DEVICE_OBJECT RxDeviceObject, IN ULONG InitialContextFlags, IN OUT PRX_CONTEXT RxContext)
Definition: rxce.c:4529
LIST_ENTRY RxActiveContexts
Definition: rdbss.c:535
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
ULONG RxFsdEntryCount
Definition: rdbss.c:605
#define InterlockedIncrement
Definition: armddk.h:53
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
struct tagContext Context
Definition: acpixf.h:1012
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
RX_SPIN_LOCK RxStrucSupSpinLock
Definition: rxce.c:123

Referenced by RxChangeBufferingState().

◆ RxCreateSrvCall()

PSRV_CALL RxCreateSrvCall ( IN PRX_CONTEXT  RxContext,
IN PUNICODE_STRING  Name,
IN PUNICODE_STRING InnerNamePrefix  OPTIONAL,
IN PRX_CONNECTION_ID  RxConnectionId 
)

Definition at line 1843 of file rxce.c.

1848 {
1849  ULONG NameLength;
1850  PSRV_CALL SrvCall;
1851 
1852  PAGED_CODE();
1853 
1854  DPRINT("RxCreateSrvCall(%p, %wZ, %wZ, %p)\n", RxContext, Name, InnerNamePrefix, RxConnectionId);
1855 
1856  ASSERT(RxIsPrefixTableLockExclusive(RxContext->RxDeviceObject->pRxNetNameTable));
1857 
1858  /* Get the name length */
1859  NameLength = Name->Length + 2 * sizeof(WCHAR);
1860  if (InnerNamePrefix != NULL)
1861  {
1862  NameLength += InnerNamePrefix->Length;
1863  }
1864 
1865  /* Allocate the object */
1866  SrvCall = RxAllocateObject(RDBSS_NTC_SRVCALL, NULL, NameLength);
1867  if (SrvCall == NULL)
1868  {
1869  return NULL;
1870  }
1871 
1872  /* Initialize it */
1873  SrvCall->SerialNumberForEnum = SerialNumber++;
1874  SrvCall->RxDeviceObject = RxContext->RxDeviceObject;
1879  RxInitializeSrvCallParameters(RxContext, SrvCall);
1880  RtlMoveMemory(SrvCall->PrefixEntry.Prefix.Buffer, Name->Buffer, Name->Length);
1881  SrvCall->PrefixEntry.Prefix.MaximumLength = Name->Length + 2 * sizeof(WCHAR);
1882  SrvCall->PrefixEntry.Prefix.Length = Name->Length;
1883  RxPrefixTableInsertName(RxContext->RxDeviceObject->pRxNetNameTable, &SrvCall->PrefixEntry,
1884  SrvCall, (PULONG)&SrvCall->NodeReferenceCount, Name->Length, RxConnectionId);
1885 
1886  DPRINT("SrvCallName: %wZ (%p)\n", SrvCall->pSrvCallName, SrvCall);
1887  return SrvCall;
1888 }
NTSTATUS RxInitializeSrvCallParameters(IN PRX_CONTEXT RxContext, IN OUT PSRV_CALL SrvCall)
Definition: rxce.c:4921
NTSTATUS RxInitializeBufferingManager(PSRV_CALL SrvCall)
Definition: rxce.c:4507
LIST_ENTRY ScavengerFinalizationList
Definition: fcb.h:25
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define PAGED_CODE()
Definition: video.h:57
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
LIST_ENTRY TransitionWaitList
Definition: fcb.h:24
PRX_PREFIX_ENTRY RxPrefixTableInsertName(IN OUT PRX_PREFIX_TABLE ThisTable, IN OUT PRX_PREFIX_ENTRY ThisEntry, IN PVOID Container, IN PULONG ContainerRefCount, IN USHORT CaseInsensitiveLength, IN PRX_CONNECTION_ID ConnectionId)
Definition: rxce.c:6428
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define RxIsPrefixTableLockExclusive(T)
Definition: prefix.h:112
Definition: fcb.h:9
__wchar_t WCHAR
Definition: xmlstorage.h:180
PURGE_SYNCHRONIZATION_CONTEXT PurgeSyncronizationContext
Definition: fcb.h:26
ULONG SerialNumberForEnum
Definition: fcb.h:22
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG SerialNumber
Definition: rxce.c:117
VOID RxInitializePurgeSyncronizationContext(PPURGE_SYNCHRONIZATION_CONTEXT PurgeSyncronizationContext)
Definition: rxce.c:4911
PVOID RxAllocateObject(NODE_TYPE_CODE NodeType, PMINIRDR_DISPATCH MRxDispatch, ULONG NameLength)
Definition: rxce.c:541
#define RDBSS_NTC_SRVCALL
Definition: nodetype.h:48
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
unsigned int * PULONG
Definition: retypes.h:1
RX_PREFIX_ENTRY PrefixEntry
Definition: fcb.h:20
unsigned int ULONG
Definition: retypes.h:1
UNICODE_STRING Prefix
Definition: prefix.h:53

Referenced by RxFindOrCreateConnections().

◆ RxCreateSrvCallCallBack()

VOID NTAPI RxCreateSrvCallCallBack ( IN OUT PMRX_SRVCALL_CALLBACK_CONTEXT  Context)

Definition at line 1895 of file rxce.c.

1897 {
1898  KIRQL OldIrql;
1899  PSRV_CALL SrvCall;
1900  PRX_CONTEXT RxContext;
1901  ULONG NumberRemaining;
1902  BOOLEAN StartDispatcher;
1903  PMRX_SRVCALLDOWN_STRUCTURE Calldown;
1904 
1905  DPRINT("RxCreateSrvCallCallBack(%p)\n", Context);
1906 
1907  /* Get our context structures */
1908  Calldown = Context->SrvCalldownStructure;
1909  SrvCall = (PSRV_CALL)Calldown->SrvCall;
1910 
1911  /* If it is a success, that's the winner */
1913  if (Context->Status == STATUS_SUCCESS)
1914  {
1915  Calldown->BestFinisherOrdinal = Context->CallbackContextOrdinal;
1916  Calldown->BestFinisher = Context->RxDeviceObject;
1917  }
1918  NumberRemaining = --Calldown->NumberRemaining;
1919  SrvCall->Status = Context->Status;
1921 
1922  /* Still some to ask, keep going */
1923  if (NumberRemaining != 0)
1924  {
1925  return;
1926  }
1927 
1928  /* If that's not async, signal we're done */
1929  RxContext = Calldown->RxContext;
1931  {
1933  return;
1934  }
1935  /* If that's a mailslot, finish construction, no more to do */
1936  else if (BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_CREATE_MAILSLOT))
1937  {
1938  RxFinishSrvCallConstruction(Calldown);
1939  return;
1940  }
1941 
1942  /* Queue our finish call for delayed completion */
1943  DPRINT("Queuing RxFinishSrvCallConstruction() call\n");
1946  StartDispatcher = !RxSrvCallConstructionDispatcherActive;
1948 
1949  /* If we have to start dispatcher, go ahead */
1950  if (StartDispatcher)
1951  {
1952  NTSTATUS Status;
1953 
1956  if (!NT_SUCCESS(Status))
1957  {
1958  /* It failed - run it manually.... */
1960  }
1961  }
1962 }
struct _SRV_CALL * PSRV_CALL
NTSTATUS RxFinishSrvCallConstruction(PMRX_SRVCALLDOWN_STRUCTURE Calldown)
Definition: rxce.c:4089
PRX_CONTEXT RxContext
Definition: mrx.h:135
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI RxDispatchToWorkerThread(IN PRDBSS_DEVICE_OBJECT pMRxDeviceObject, IN WORK_QUEUE_TYPE WorkQueueType, IN PRX_WORKERTHREAD_ROUTINE Routine, IN PVOID pContext)
Definition: rxce.c:2401
#define InsertTailList(ListHead, Entry)
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
UCHAR KIRQL
Definition: env_spec_w32.h:591
PRDBSS_DEVICE_OBJECT RxFileSystemDeviceObject
Definition: rdbss.c:573
PRDBSS_DEVICE_OBJECT BestFinisher
Definition: mrx.h:142
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN RxSrvCallConstructionDispatcherActive
Definition: rxce.c:121
#define IO_NETWORK_INCREMENT
Definition: tcpip.h:43
Definition: fcb.h:9
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
LIST_ENTRY SrvCalldownList
Definition: mrx.h:134
VOID NTAPI RxFinishSrvCallConstructionDispatcher(IN PVOID Context)
Definition: rxce.c:4192
LIST_ENTRY RxSrvCalldownList
Definition: rxce.c:122
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
PMRX_SRV_CALL SrvCall
Definition: mrx.h:136
Status
Definition: gdiplustypes.h:24
ULONG Flags
Definition: rxcontx.h:124
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
unsigned int ULONG
Definition: retypes.h:1
RX_SPIN_LOCK RxStrucSupSpinLock
Definition: rxce.c:123
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by RxConstructSrvCall().

◆ RxCreateSrvOpen()

PSRV_OPEN RxCreateSrvOpen ( IN PV_NET_ROOT  VNetRoot,
IN OUT PFCB  Fcb 
)

Definition at line 1968 of file rxce.c.

1971 {
1972  ULONG Flags;
1973  PSRV_OPEN SrvOpen;
1975 
1976  PAGED_CODE();
1977 
1980 
1982 
1983  _SEH2_TRY
1984  {
1985  SrvOpen = Fcb->InternalSrvOpen;
1986  /* Check whethet we have to allocate a new SRV_OPEN */
1989  !IsListEmpty(&Fcb->InternalSrvOpen->SrvOpenQLinks))
1990  {
1991  /* Proceed */
1992  SrvOpen = RxAllocateFcbObject(Fcb->VNetRoot->NetRoot->pSrvCall->RxDeviceObject,
1994  Flags = 0;
1995  }
1996  else
1997  {
1998  /* Otherwise, just use internal one and initialize it */
1999  RxAllocateFcbObject(Fcb->VNetRoot->NetRoot->pSrvCall->RxDeviceObject,
2001  Fcb->InternalSrvOpen);
2004  }
2005 
2006  /* If SrvOpen was properly allocated, initialize it */
2007  if (SrvOpen != NULL)
2008  {
2009  SrvOpen->Flags = Flags;
2010  SrvOpen->pFcb = RX_GET_MRX_FCB(Fcb);
2011  SrvOpen->pAlreadyPrefixedName = &Fcb->PrivateAlreadyPrefixedName;
2012  SrvOpen->pVNetRoot = (PMRX_V_NET_ROOT)VNetRoot;
2013  SrvOpen->ulFileSizeVersion = Fcb->ulFileSizeVersion;
2014  SrvOpen->NodeReferenceCount = 1;
2015 
2016  RxReferenceVNetRoot(VNetRoot);
2018 
2019  InsertTailList(&Fcb->SrvOpenList, &SrvOpen->SrvOpenQLinks);
2020  ++Fcb->SrvOpenListVersion;
2021 
2024  InitializeListHead(&SrvOpen->FobxList);
2026  }
2027  }
2029  {
2031  {
2032  if (SrvOpen != NULL)
2033  {
2034  RxFinalizeSrvOpen(SrvOpen, TRUE, TRUE);
2035  SrvOpen = NULL;
2036  }
2037  }
2038  else
2039  {
2040  DPRINT("SrvOpen %p for FCB %p\n", SrvOpen, SrvOpen->pFcb);
2041  }
2042  }
2043  _SEH2_END;
2044 
2045  return SrvOpen;
2046 }
#define RxReferenceNetFcb(Fcb)
Definition: fcb.h:431
#define TRUE
Definition: types.h:120
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
LIST_ENTRY SrvOpenKeyList
Definition: fcb.h:283
#define NodeTypeIsFcb(FCB)
Definition: nodetype.h:68
ULONG ulFileSizeVersion
Definition: fcb.h:164
#define RDBSS_NTC_SRVOPEN
Definition: nodetype.h:52
struct _MRX_V_NET_ROOT_ * PMRX_V_NET_ROOT
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
#define SRVOPEN_FLAG_ENCLOSED_ALLOCATED
Definition: fcb.h:256
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
LIST_ENTRY ScavengerFinalizationList
Definition: fcb.h:277
#define FCB_STATE_PAGING_FILE
Definition: fatstruc.h:1191
#define RxReferenceVNetRoot(VNetRoot)
Definition: fcb.h:407
smooth NULL
Definition: ftsmooth.c:416
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:13
void DPRINT(...)
Definition: polytest.cpp:61
#define RX_GET_MRX_FCB(F)
Definition: rxprocs.h:157
INT POOL_TYPE
Definition: typedefs.h:76
PV_NET_ROOT VNetRoot
Definition: fcb.h:139
UNICODE_STRING PrivateAlreadyPrefixedName
Definition: fcb.h:145
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define SRVOPEN_FLAG_FOBX_USED
Definition: fcb.h:257
PSRV_OPEN InternalSrvOpen
Definition: fcb.h:152
LIST_ENTRY TransitionWaitList
Definition: fcb.h:278
PNET_ROOT NetRoot
Definition: fcb.h:65
Definition: fcb.h:260
#define RxIsFcbAcquiredExclusive(Fcb)
Definition: rxprocs.h:229
#define FCB_STATE_SRVOPEN_USED
Definition: fcb.h:230
_SEH2_END
Definition: create.c:4424
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
PVOID RxAllocateFcbObject(PRDBSS_DEVICE_OBJECT RxDeviceObject, NODE_TYPE_CODE NodeType, POOL_TYPE PoolType, ULONG NameSize, PVOID AlreadyAllocatedObject)
Definition: rxce.c:316
_SEH2_FINALLY
Definition: create.c:4395
#define RDBSS_NTC_INTERNAL_SRVOPEN
Definition: nodetype.h:53
BOOLEAN RxFinalizeSrvOpen(OUT PSRV_OPEN ThisSrvOpen, IN BOOLEAN RecursiveFinalize, IN BOOLEAN ForceFinalize)
Definition: rxce.c:3254
LIST_ENTRY FobxList
Definition: fcb.h:279
unsigned int ULONG
Definition: retypes.h:1
_In_ PFCB Fcb
Definition: cdprocs.h:151
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444
ULONG FcbState
Definition: cdstruc.h:977

◆ RxCreateVNetRoot()

PV_NET_ROOT RxCreateVNetRoot ( IN PRX_CONTEXT  RxContext,
IN PNET_ROOT  NetRoot,
IN PUNICODE_STRING  CanonicalName,
IN PUNICODE_STRING  LocalNetRootName,
IN PUNICODE_STRING  FilePath,
IN PRX_CONNECTION_ID  RxConnectionId 
)

Definition at line 2052 of file rxce.c.

2059 {
2060  NTSTATUS Status;
2061  PV_NET_ROOT VNetRoot;
2062  USHORT CaseInsensitiveLength;
2063 
2064  PAGED_CODE();
2065 
2066  DPRINT("RxCreateVNetRoot(%p, %p, %wZ, %wZ, %wZ, %p)\n", RxContext, NetRoot, CanonicalName,
2067  LocalNetRootName, FilePath, RxConnectionId);
2068 
2069  /* Lock must be held exclusively */
2070  ASSERT(RxIsPrefixTableLockExclusive(RxContext->RxDeviceObject->pRxNetNameTable));
2071 
2072  /* Check for overflow */
2073  if (LocalNetRootName->Length + NetRoot->PrefixEntry.Prefix.Length > MAXUSHORT)
2074  {
2075  return NULL;
2076  }
2077 
2078  /* Get name length and allocate VNetRoot */
2079  CaseInsensitiveLength = LocalNetRootName->Length + NetRoot->PrefixEntry.Prefix.Length;
2080  VNetRoot = RxAllocateObject(RDBSS_NTC_V_NETROOT, NetRoot->SrvCall->RxDeviceObject->Dispatch,
2081  CaseInsensitiveLength);
2082  if (VNetRoot == NULL)
2083  {
2084  return NULL;
2085  }
2086 
2087  /* Initialize its connection parameters */
2088  Status = RxInitializeVNetRootParameters(RxContext, &VNetRoot->LogonId, &VNetRoot->SessionId,
2089  &VNetRoot->pUserName, &VNetRoot->pUserDomainName,
2090  &VNetRoot->pPassword, &VNetRoot->Flags);
2091  if (!NT_SUCCESS(Status))
2092  {
2093  RxUninitializeVNetRootParameters(VNetRoot->pUserName, VNetRoot->pUserDomainName,
2094  VNetRoot->pPassword, &VNetRoot->Flags);
2095  RxFreeObject(VNetRoot);
2096 
2097  return NULL;
2098  }
2099 
2100  /* Set name */
2101  RtlMoveMemory(VNetRoot->PrefixEntry.Prefix.Buffer, CanonicalName->Buffer, VNetRoot->PrefixEntry.Prefix.Length);
2102 
2103  VNetRoot->PrefixOffsetInBytes = LocalNetRootName->Length + NetRoot->PrefixEntry.Prefix.Length;
2104  VNetRoot->NamePrefix.Buffer = Add2Ptr(VNetRoot->PrefixEntry.Prefix.Buffer, VNetRoot->PrefixOffsetInBytes);
2105  VNetRoot->NamePrefix.Length = VNetRoot->PrefixEntry.Prefix.Length - VNetRoot->PrefixOffsetInBytes;
2106  VNetRoot->NamePrefix.MaximumLength = VNetRoot->PrefixEntry.Prefix.Length - VNetRoot->PrefixOffsetInBytes;
2107 
2110 
2111  if (!BooleanFlagOn(NetRoot->SrvCall->Flags, SRVCALL_FLAG_CASE_INSENSITIVE_FILENAMES))
2112  {
2113  USHORT i;
2114 
2115  if (BooleanFlagOn(NetRoot->SrvCall->Flags, SRVCALL_FLAG_CASE_INSENSITIVE_NETROOTS))
2116  {
2117  CaseInsensitiveLength = NetRoot->PrefixEntry.CaseInsensitiveLength;
2118  }
2119  else
2120  {
2121  CaseInsensitiveLength = NetRoot->SrvCall->PrefixEntry.CaseInsensitiveLength;
2122  }
2123 
2124  for (i = 1; i < CanonicalName->Length / sizeof(WCHAR); ++i)
2125  {
2126  if (CanonicalName->Buffer[i] != OBJ_NAME_PATH_SEPARATOR)
2127  {
2128  break;
2129  }
2130  }
2131 
2132  CaseInsensitiveLength += (i * sizeof(WCHAR));
2133  }
2134 
2135  /* Insert in prefix table */
2136  RxPrefixTableInsertName(RxContext->RxDeviceObject->pRxNetNameTable, &VNetRoot->PrefixEntry,
2137  VNetRoot, (PULONG)&VNetRoot->NodeReferenceCount, CaseInsensitiveLength,
2138  RxConnectionId);
2139 
2140  RxReferenceNetRoot(NetRoot);
2141  RxAddVirtualNetRootToNetRoot(NetRoot, VNetRoot);
2142 
2143  /* Finish init */
2144  VNetRoot->SerialNumberForEnum = SerialNumber++;
2145  VNetRoot->UpperFinalizationDone = FALSE;
2146  VNetRoot->ConnectionFinalizationDone = FALSE;
2148 
2149  DPRINT("NamePrefix: %wZ\n", &VNetRoot->NamePrefix);
2150  DPRINT("PrefixEntry: %wZ\n", &VNetRoot->PrefixEntry.Prefix);
2151 
2152  return VNetRoot;
2153 }
#define Add2Ptr(PTR, INC)
USHORT MaximumLength
Definition: env_spec_w32.h:370
VOID RxAddVirtualNetRootToNetRoot(PNET_ROOT NetRoot, PV_NET_ROOT VNetRoot)
Definition: rxce.c:296
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define RxReferenceNetRoot(NetRoot)
Definition: fcb.h:399
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
PCWSTR FilePath
#define SRVCALL_FLAG_CASE_INSENSITIVE_NETROOTS
Definition: mrxfcb.h:11
ULONG SerialNumberForEnum
Definition: fcb.h:76
ULONG PrefixOffsetInBytes
Definition: fcb.h:74
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSTATUS RxInitializeVNetRootParameters(PRX_CONTEXT RxContext, OUT LUID *LogonId, OUT PULONG SessionId, OUT PUNICODE_STRING *UserNamePtr, OUT PUNICODE_STRING *UserDomainNamePtr, OUT PUNICODE_STRING *PasswordPtr, OUT PULONG Flags)
Definition: rxce.c:4963
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
PRX_PREFIX_ENTRY RxPrefixTableInsertName(IN OUT PRX_PREFIX_TABLE ThisTable, IN OUT PRX_PREFIX_ENTRY ThisEntry, IN PVOID Container, IN PULONG ContainerRefCount, IN USHORT CaseInsensitiveLength, IN PRX_CONNECTION_ID ConnectionId)
Definition: rxce.c:6428
LIST_ENTRY ScavengerFinalizationList
Definition: fcb.h:78
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN ConnectionFinalizationDone
Definition: fcb.h:69
#define RxIsPrefixTableLockExclusive(T)
Definition: prefix.h:112
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
RX_PREFIX_ENTRY PrefixEntry
Definition: fcb.h:72
#define SRVCALL_FLAG_CASE_INSENSITIVE_FILENAMES
Definition: mrxfcb.h:12
#define RDBSS_NTC_V_NETROOT
Definition: nodetype.h:50
volatile LONG AdditionalReferenceForDeleteFsctlTaken
Definition: fcb.h:71
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
UNICODE_STRING NamePrefix
Definition: fcb.h:73
ULONG SerialNumber
Definition: rxce.c:117
PVOID RxAllocateObject(NODE_TYPE_CODE NodeType, PMINIRDR_DISPATCH MRxDispatch, ULONG NameLength)
Definition: rxce.c:541
Status
Definition: gdiplustypes.h:24
unsigned short USHORT
Definition: pedump.c:61
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
unsigned int * PULONG
Definition: retypes.h:1
#define MAXUSHORT
Definition: typedefs.h:81
VOID RxUninitializeVNetRootParameters(IN PUNICODE_STRING UserName, IN PUNICODE_STRING UserDomainName, IN PUNICODE_STRING Password, OUT PULONG Flags)
Definition: rxce.c:8680
VOID RxFreeObject(PVOID pObject)
Definition: rxce.c:4319
LIST_ENTRY TransitionWaitList
Definition: fcb.h:77
BOOLEAN UpperFinalizationDone
Definition: fcb.h:68
UNICODE_STRING Prefix
Definition: prefix.h:53

Referenced by RxConstructVirtualNetRoot(), and RxFindOrCreateConnections().

◆ RxDereference()

VOID RxDereference ( IN OUT PVOID  Instance,
IN LOCK_HOLDING_STATE  LockHoldingState 
)

Definition at line 2159 of file rxce.c.

2162 {
2163  LONG RefCount;
2166 
2167  PAGED_CODE();
2168 
2170 
2171  /* Check we have a node we can handle */
2175  (NodeType == RDBSS_NTC_FOBX));
2176 
2178  RefCount = InterlockedDecrement((volatile long *)&Node->NodeReferenceCount);
2179  ASSERT(RefCount >= 0);
2180 
2181  /* Trace refcount */
2182  switch (NodeType)
2183  {
2184  case RDBSS_NTC_SRVCALL:
2185  PRINT_REF_COUNT(SRVCALL, Node->NodeReferenceCount);
2186  break;
2187 
2188  case RDBSS_NTC_NETROOT:
2189  PRINT_REF_COUNT(NETROOT, Node->NodeReferenceCount);
2190  break;
2191 
2192  case RDBSS_NTC_V_NETROOT:
2193  PRINT_REF_COUNT(VNETROOT, Node->NodeReferenceCount);
2194  break;
2195 
2196  case RDBSS_NTC_SRVOPEN:
2197  PRINT_REF_COUNT(SRVOPEN, Node->NodeReferenceCount);
2198  break;
2199 
2200  case RDBSS_NTC_FOBX:
2201  PRINT_REF_COUNT(NETFOBX, Node->NodeReferenceCount);
2202  break;
2203 
2204  default:
2205  ASSERT(FALSE);
2206  break;
2207  }
2208 
2209  /* No need to free - still in use */
2210  if (RefCount > 1)
2211  {
2213  return;
2214  }
2215 
2216  /* We have to be locked exclusively */
2217  if (LockHoldingState != LHS_ExclusiveLockHeld)
2218  {
2219  if ((NodeType == RDBSS_NTC_FOBX && RefCount == 0) ||
2221  {
2223  }
2224 
2226  return;
2227  }
2228  else
2229  {
2231  {
2233  }
2234  }
2235 
2237 
2238  /* Now, deallocate the memory */
2239  switch (NodeType)
2240  {
2241  case RDBSS_NTC_SRVCALL:
2242  {
2243  PSRV_CALL SrvCall;
2244 
2245  SrvCall = (PSRV_CALL)Instance;
2246 
2247  ASSERT(SrvCall->RxDeviceObject != NULL);
2248  ASSERT(RxIsPrefixTableLockAcquired(SrvCall->RxDeviceObject->pRxNetNameTable));
2249  RxFinalizeSrvCall(SrvCall, TRUE, TRUE);
2250  break;
2251  }
2252 
2253  case RDBSS_NTC_NETROOT:
2254  {
2255  PNET_ROOT NetRoot;
2256 
2257  NetRoot = (PNET_ROOT)Instance;
2258 
2259  ASSERT(NetRoot->pSrvCall->RxDeviceObject != NULL);
2260  ASSERT(RxIsPrefixTableLockAcquired(NetRoot->pSrvCall->RxDeviceObject->pRxNetNameTable));
2261  RxFinalizeNetRoot(NetRoot, TRUE, TRUE);
2262  break;
2263  }
2264 
2265  case RDBSS_NTC_V_NETROOT:
2266  {
2267  PV_NET_ROOT VNetRoot;
2268 
2269  VNetRoot = (PV_NET_ROOT)Instance;
2270 
2271  ASSERT(VNetRoot->pNetRoot->pSrvCall->RxDeviceObject != NULL);
2272  ASSERT(RxIsPrefixTableLockAcquired(VNetRoot->pNetRoot->pSrvCall->RxDeviceObject->pRxNetNameTable));
2273  RxFinalizeVNetRoot(VNetRoot, TRUE, TRUE);
2274  break;
2275  }
2276 
2277  case RDBSS_NTC_SRVOPEN:
2278  {
2279  PSRV_OPEN SrvOpen;
2280 
2281  SrvOpen = (PSRV_OPEN)Instance;
2282 
2283  ASSERT(RxIsFcbAcquired(SrvOpen->Fcb));
2284  if (SrvOpen->OpenCount == 0)
2285  {
2286  RxFinalizeSrvOpen(SrvOpen, FALSE, FALSE);
2287  }
2288  break;
2289  }
2290 
2291  case RDBSS_NTC_FOBX:
2292  {
2293  PFOBX Fobx;