RX_CONTEXT structure

The RX_CONTEXT structure encapsulates an IRP for use by RDBSS, network mini-redirectors, and the file system. The RX_CONTEXT structure describes an IRP while it is being processed by a network mini-redirector and contains state information that allows global resources to be released as the IRP is completed.

Syntax

typedef struct _RX_CONTEXT {
  NODE_TYPE_CODE         NodeTypeCode;
  NODE_BYTE_SIZE         NodeByteSize;
  __volatile ULONG       ReferenceCount;
  LIST_ENTRY             ContextListEntry;
  UCHAR                  MajorFunction;
  UCHAR                  MinorFunction;
  BOOLEAN                PendingReturned;
  BOOLEAN                PostRequest;
  PDEVICE_OBJECT         RealDevice;
  PIRP                   CurrentIrp;
  PIO_STACK_LOCATION     CurrentIrpSp;
  PMRX_FCB               pFcb;
  PMRX_FOBX              pFobx;
  PMRX_SRV_OPEN          pRelevantSrvOpen;
  PNON_PAGED_FCB         NonPagedFcb;
  PRDBSS_DEVICE_OBJECT   RxDeviceObject;
  PETHREAD               OriginalThread;
  PETHREAD               LastExecutionThread;
  __volatile PVOID       LockManagerContext;
  PVOID                  RdbssDbgExtension;
  RX_SCAVENGER_ENTRY     ScavengerEntry;
  ULONG                  SerialNumber;
  ULONG                  FobxSerialNumber;
  ULONG                  Flags;
  BOOLEAN                FcbResourceAcquired;
  BOOLEAN                FcbPagingIoResourceAcquired;
  UCHAR                  MustSucceedDescriptorNumber;
  union {
    struct {
      union {
        NTSTATUS StoredStatus;
        PVOID    StoredStatusAlignment;
      };
      ULONG_PTR InformationToReturn;
    };
    IO_STATUS_BLOCK IoStatusBlock;
  };
  union {
    ULONGLONG ForceLonglongAligmentDummyField;
    PVOID     MRxContext[MRX_CONTEXT_FIELD_COUNT];
  };
  PVOID                  WriteOnlyOpenRetryContext;
  PMRX_CALLDOWN          MRxCancelRoutine;
  PRX_DISPATCH           ResumeRoutine;
  RX_WORK_QUEUE_ITEM     WorkQueueItem;
  LIST_ENTRY             OverflowListEntry;
  KEVENT                 SyncEvent;
  LIST_ENTRY             BlockedOperations;
  PFAST_MUTEX            BlockedOpsMutex;
  LIST_ENTRY             RxContextSerializationQLinks;
  union {
    struct {
      union {
        FS_INFORMATION_CLASS   FsInformationClass;
        FILE_INFORMATION_CLASS FileInformationClass;
      };
      PVOID   Buffer;
      union {
        LONG Length;
        LONG LengthRemaining;
      };
      BOOLEAN ReplaceIfExists;
      BOOLEAN AdvanceOnly;
    } Info;
    struct {
      UNICODE_STRING       SuppliedPathName;
      NET_ROOT_TYPE        NetRootType;
      PIO_SECURITY_CONTEXT pSecurityContext;
    } PrefixClaim;
  };
  union {
    struct {
      NT_CREATE_PARAMETERS NtCreateParameters;
      ULONG                ReturnedCreateInformation;
      PWCH                 CanonicalNameBuffer;
      PRX_PREFIX_ENTRY     NetNamePrefixEntry;
      PMRX_SRV_CALL        pSrvCall;
      PMRX_NET_ROOT        pNetRoot;
      PMRX_V_NET_ROOT      pVNetRoot;
      PVOID                EaBuffer;
      ULONG                EaLength;
      ULONG                SdLength;
      ULONG                PipeType;
      ULONG                PipeReadMode;
      ULONG                PipeCompletionMode;
      USHORT               Flags;
      NET_ROOT_TYPE        Type;
      UCHAR                RdrFlags;
      BOOLEAN              FcbAcquired;
      BOOLEAN              TryForScavengingOnSharingViolation;
      BOOLEAN              ScavengingAlreadyTried;
      BOOLEAN              ThisIsATreeConnectOpen;
      BOOLEAN              TreeConnectOpenDeferred;
      UNICODE_STRING       TransportName;
      UNICODE_STRING       UserName;
      UNICODE_STRING       Password;
      UNICODE_STRING       UserDomainName;
    } Create;
    struct {
      ULONG   FileIndex;
      BOOLEAN RestartScan;
      BOOLEAN ReturnSingleEntry;
      BOOLEAN IndexSpecified;
      BOOLEAN InitialQuery;
    } QueryDirectory;
    struct {
      PMRX_V_NET_ROOT pVNetRoot;
    } NotifyChangeDirectory;
    struct {
      PUCHAR  UserEaList;
      ULONG   UserEaListLength;
      ULONG   UserEaIndex;
      BOOLEAN RestartScan;
      BOOLEAN ReturnSingleEntry;
      BOOLEAN IndexSpecified;
    } QueryEa;
    struct {
      SECURITY_INFORMATION SecurityInformation;
      ULONG                Length;
    } QuerySecurity;
    struct {
      SECURITY_INFORMATION SecurityInformation;
      PSECURITY_DESCRIPTOR SecurityDescriptor;
    } SetSecurity;
    struct {
      ULONG                       Length;
      PSID                        StartSid;
      PFILE_GET_QUOTA_INFORMATION SidList;
      ULONG                       SidListLength;
      BOOLEAN                     RestartScan;
      BOOLEAN                     ReturnSingleEntry;
      BOOLEAN                     IndexSpecified;
    } QueryQuota;
    struct {
      ULONG Length;
    } SetQuota;
    struct {
      PV_NET_ROOT VNetRoot;
      PSRV_CALL   SrvCall;
      PNET_ROOT   NetRoot;
    } DosVolumeFunction;
    struct {
      ULONG         FlagsForLowIo;
      LOWIO_CONTEXT LowIoContext;
    };
  };
  PWCH                   AlsoCanonicalNameBuffer;
  PUNICODE_STRING        LoudCompletionString;
  __volatile LONG        AcquireReleaseFcbTrackerX;
  __volatile ULONG       TrackerHistoryPointer;
  RX_FCBTRACKER_CALLINFO TrackerHistory[RDBSS_TRACKER_HISTORY_SIZE];
  ULONG                  ShadowCritOwner;
} RX_CONTEXT, *PRX_CONTEXT;

Members

NodeTypeCode

The unique node type used for an RX_CONTEXT structure. All of the major structure types (RX_CONTEXT, SRV_CALL, NET_ROOT, V_NET_ROOT, SRV_OPEN, FCB, and FOBX, for example) used by RDBSS have a unique two-byte node type code defined in the nodetype.h include file which can be used for debugging. RDBSS sets this member to RDBSS_NTC_RX_CONTEXT when an RX_CONTEXT is initialized in the RxInitializeContext routine. If a network mini-redirector driver initializes an RX_CONTEXT structure using some other method, this member must be set.

RDBSS defines this member as part of a standard header for all structures used by RDBSS.

NodeByteSize

The size, in bytes, of this structure. RDBSS sets this member to sizeof( RX_CONTEXT) when an RX_CONTEXT is initialized in the RxInitializeContext routine. If a network mini-redirector driver initializes an RX_CONTEXT structure using some other method, this member must be set.

RDBSS defines this member as part of a standard header for all structures used by RDBSS.

ReferenceCount

The reference count for this structure after it is allocated. RDBSS sets this member to 1 when an RX_CONTEXT is allocated and initialized in the RxInitializeContext routine. If a network mini-redirector driver initializes an RX_CONTEXT structure using some other method, this member must be set.

RDBSS defines this member as part of a standard header for all structures used by RDBSS.

ContextListEntry

The list entry to connect this RX_CONTEXT to the list of active RX_CONTEXTS.

MajorFunction

The major function for the IRP encapsulated by this RX_CONTEXT.

MinorFunction

The minor function for the IRP encapsulated by this RX_CONTEXT.

PendingReturned

If set to TRUE, this specifies that RDBSS or a driver has marked the IRP pending. Each IoCompletion routine should check the value of this flag. If the flag is TRUE, and if the IoCompletion routine will not return STATUS_MORE_PROCESSING_REQUIRED, the routine should call IoMarkIrpPending to propagate the pending status to drivers above it in the device stack. This member is similar to the same field in the IRP.

RDBSS always sets this member to TRUE before calling the network mini-redirector driver.

PostRequest

If set to TRUE, this indicates if the associated request is to be posted to a RDBSS worker thread. A network mini-redirector can set this member to TRUE to indicate that it wants to post this request to the file system process (FSP).

RealDevice

A pointer to the device object for the target network mini-redirector driver. RDBSS sets this member to the device object for the network mini-redirector driver when an RX_CONTEXT is allocated in the RxInitializeContext routine. This member is copied from the FileObject->DeviceObject member from the IRP stack. The device object for the network mini-redirector is also stored in the RxDeviceObject structure member.

The RealDevice member is not currently used by RDBSS, but can be used by network mini-redirectors.

CurrentIrp

A pointer to the originating IRP. This member should not be used by a network mini-redirector driver.

CurrentIrpSp

A pointer to the IRP stack location.

pFcb

A pointer to the associated file control block (FCB) for this IRP.

pFobx

A pointer to the associated file object extension (FOBX) for this IRP.

pRelevantSrvOpen

A pointer to the associated server open(SRV_OPEN) for this IRP.

NonPagedFcb

A pointer to the associated non-paged file control block (FCB) for this IRP.

RxDeviceObject

A pointer to the RDBSS_DEVICE_OBJECT for the target network mini-redirector driver which is required for worker queue algorithms. RDBSS sets this member to the RDBSS_DEVICE_OBJECT for the network mini-redirector when an RX_CONTEXT is initialized in the RxInitializeContext routine. The RxDeviceObject structure includes a DeviceObject member that contains the device object for the network mini-redirector driver which is the same as the RealDevice member of the RX_CONTEXT.

OriginalThread

A pointer to the original thread in which the request was initiated.

LastExecutionThread

A pointer to the last thread in which some processing associated with the RX_CONTEXT was done if the thread was posted to the file system process.

LockManagerContext

A pointer to the lock manager context. This member is reserved for internal use.

RdbssDbgExtension

A pointer to the context given to RDBSS for debugging information. This member is reserved for internal use.

ScavengerEntry

A pointer to the list of items to be scavenged. This member is reserved for internal use.

SerialNumber

The serial number for this RX_CONTEXT structure. Every structure initialized by RDBSS has a serial number assigned when the structure is first initialized. This serial number is a number that is incremented by one before the value is set. RDBSS sets this member when an RX_CONTEXT is initialized in the RxInitializeContext routine. RDBSS

FobxSerialNumber

The serial number for the associated FOBX structure. Every structure initialized by RDBSS has a serial number assigned when the structure is first initialized. This member can be used by network mini-redirectors to see if multiple calls are part of the same larger operation and are therefore more cacheable.

Flags

A bitmask of flags for this RX_CONTEXT structure.

FcbResourceAcquired

If set to TRUE, this member specifies that the FCB resource has been acquired for this operation. The FCB resource is one of the locking mechanisms associated with an operation on an FCB.

FcbPagingIoResourceAcquired

If set to TRUE, this member specifies that the FCB paging I/O resource has been acquired for this operation. The FCB paging I/O resource is one of the locking mechanisms associated with a paging I/O operation on an FCB.

MustSucceedDescriptorNumber

A member initially set to zero in the RxCreateRxContext routine. This member is not otherwise used by RDBSS, but it may be used by network mini-redirectors.

__unnamed_union_0d60_2

__unnamed_union_0d60_2.__unnamed_struct_0

__unnamed_union_0d60_2.__unnamed_struct_0.__unnamed_union_0d60_4

__unnamed_union_0d60_2.__unnamed_struct_0.__unnamed_union_0d60_4.StoredStatus

__unnamed_union_0d60_2.__unnamed_struct_0.__unnamed_union_0d60_4.StoredStatusAlignment

__unnamed_union_0d60_2.__unnamed_struct_0.InformationToReturn

__unnamed_union_0d60_2.IoStatusBlock

__unnamed_union_0d60_5

__unnamed_union_0d60_5.ForceLonglongAligmentDummyField

__unnamed_union_0d60_5.MRxContext

WriteOnlyOpenRetryContext

A pointer that can be used to store some state for the network mini-redirector. This member is not used by RDBSS, but it can be used by a network mini-redirector driver to indicate that a file is cached on a write-only handle.

MRxCancelRoutine

A pointer to the cancellation routine that can be set by a network mini-redirector driver.

ResumeRoutine

This member is reserved for internal use.

WorkQueueItem

A pointer to a work queue item that can be used by a network mini-redirector driver while processing the RX_CONTEXT.

OverflowListEntry

A pointer to the list head of operations that are to be released on completion. This member is reserved for internal use.

SyncEvent

A pointer to a kernel EVENT that can be used by a network mini-redirector driver to wait while processing the RX_CONTEXT.

BlockedOperations

A pointer to the list head of blocked operations that are to be released on completion. This member is reserved for internal use.

BlockedOpsMutex

A pointer to a mutex that controls serialization of the blocked operations. This member is reserved for internal use.

RxContextSerializationQLinks

A pointer to the list entry used to serialize pipe operations on a per-file-object basis. This member is reserved for internal use.

__unnamed_union_0d60_6

__unnamed_union_0d60_6.Info

__unnamed_union_0d60_6.Info.__unnamed_union_0d60_8

__unnamed_union_0d60_6.Info.__unnamed_union_0d60_8.FsInformationClass

__unnamed_union_0d60_6.Info.__unnamed_union_0d60_8.FileInformationClass

__unnamed_union_0d60_6.Info.Buffer

__unnamed_union_0d60_6.Info.__unnamed_union_0d60_9

__unnamed_union_0d60_6.Info.__unnamed_union_0d60_9.Length

__unnamed_union_0d60_6.Info.__unnamed_union_0d60_9.LengthRemaining

__unnamed_union_0d60_6.Info.ReplaceIfExists

__unnamed_union_0d60_6.Info.AdvanceOnly

__unnamed_union_0d60_6.PrefixClaim

__unnamed_union_0d60_6.PrefixClaim.SuppliedPathName

__unnamed_union_0d60_6.PrefixClaim.NetRootType

__unnamed_union_0d60_6.PrefixClaim.pSecurityContext

__unnamed_union_0d60_11

__unnamed_union_0d60_11.Create

__unnamed_union_0d60_11.Create.NtCreateParameters

__unnamed_union_0d60_11.Create.ReturnedCreateInformation

__unnamed_union_0d60_11.Create.CanonicalNameBuffer

__unnamed_union_0d60_11.Create.NetNamePrefixEntry

__unnamed_union_0d60_11.Create.pSrvCall

__unnamed_union_0d60_11.Create.pNetRoot

__unnamed_union_0d60_11.Create.pVNetRoot

__unnamed_union_0d60_11.Create.EaBuffer

__unnamed_union_0d60_11.Create.EaLength

__unnamed_union_0d60_11.Create.SdLength

__unnamed_union_0d60_11.Create.PipeType

__unnamed_union_0d60_11.Create.PipeReadMode

__unnamed_union_0d60_11.Create.PipeCompletionMode

__unnamed_union_0d60_11.Create.Flags

__unnamed_union_0d60_11.Create.Type

__unnamed_union_0d60_11.Create.RdrFlags

__unnamed_union_0d60_11.Create.FcbAcquired

__unnamed_union_0d60_11.Create.TryForScavengingOnSharingViolation

__unnamed_union_0d60_11.Create.ScavengingAlreadyTried

__unnamed_union_0d60_11.Create.ThisIsATreeConnectOpen

__unnamed_union_0d60_11.Create.TreeConnectOpenDeferred

__unnamed_union_0d60_11.Create.TransportName

__unnamed_union_0d60_11.Create.UserName

__unnamed_union_0d60_11.Create.Password

__unnamed_union_0d60_11.Create.UserDomainName

__unnamed_union_0d60_11.QueryDirectory

__unnamed_union_0d60_11.QueryDirectory.FileIndex

__unnamed_union_0d60_11.QueryDirectory.RestartScan

__unnamed_union_0d60_11.QueryDirectory.ReturnSingleEntry

__unnamed_union_0d60_11.QueryDirectory.IndexSpecified

__unnamed_union_0d60_11.QueryDirectory.InitialQuery

__unnamed_union_0d60_11.NotifyChangeDirectory

__unnamed_union_0d60_11.NotifyChangeDirectory.pVNetRoot

__unnamed_union_0d60_11.QueryEa

__unnamed_union_0d60_11.QueryEa.UserEaList

__unnamed_union_0d60_11.QueryEa.UserEaListLength

__unnamed_union_0d60_11.QueryEa.UserEaIndex

__unnamed_union_0d60_11.QueryEa.RestartScan

__unnamed_union_0d60_11.QueryEa.ReturnSingleEntry

__unnamed_union_0d60_11.QueryEa.IndexSpecified

__unnamed_union_0d60_11.QuerySecurity

__unnamed_union_0d60_11.QuerySecurity.SecurityInformation

__unnamed_union_0d60_11.QuerySecurity.Length

__unnamed_union_0d60_11.SetSecurity

__unnamed_union_0d60_11.SetSecurity.SecurityInformation

__unnamed_union_0d60_11.SetSecurity.SecurityDescriptor

__unnamed_union_0d60_11.QueryQuota

__unnamed_union_0d60_11.QueryQuota.Length

__unnamed_union_0d60_11.QueryQuota.StartSid

__unnamed_union_0d60_11.QueryQuota.SidList

__unnamed_union_0d60_11.QueryQuota.SidListLength

__unnamed_union_0d60_11.QueryQuota.RestartScan

__unnamed_union_0d60_11.QueryQuota.ReturnSingleEntry

__unnamed_union_0d60_11.QueryQuota.IndexSpecified

__unnamed_union_0d60_11.SetQuota

__unnamed_union_0d60_11.SetQuota.Length

__unnamed_union_0d60_11.DosVolumeFunction

__unnamed_union_0d60_11.DosVolumeFunction.VNetRoot

__unnamed_union_0d60_11.DosVolumeFunction.SrvCall

__unnamed_union_0d60_11.DosVolumeFunction.NetRoot

__unnamed_union_0d60_11.__unnamed_struct_1

__unnamed_union_0d60_11.__unnamed_struct_1.FlagsForLowIo

__unnamed_union_0d60_11.__unnamed_struct_1.LowIoContext

AlsoCanonicalNameBuffer

LoudCompletionString

An unused member of the RX_CONTEXT structure.

AcquireReleaseFcbTrackerX

TrackerHistoryPointer

TrackerHistory

ShadowCritOwner

Remarks

The RX_CONTEXT structure is one of the fundamental data structures used by RDBSS and network mini-redirectors to manage an I/O request packet (IRP). The RX_CONTEXT data structure encapsulates an IRP for use by RDBSS, network mini-redirectors, and the file system. An RX_CONTEXT structure includes a pointer to a single IRP and all of the context required to process the IRP.

An RX_CONTEXT structure is sometimes referred to as an IRP Context or RxContext in the Window Driver Kit (WDK) or IFS Kit header files and other resources used for developing network mini-redirector drivers.

The RX_CONTEXT is a data structure to which additional information provided by the various network mini redirectors is attached. The RX_CONTEXT includes fields for over allocating the size of each RX_CONTEXT structure by a pre-specified amount for each network mini redirector, which is then reserved for use by the mini redirector. This approach consists of allocating a pre-specified area, which is the same for all network mini redirectors as part of each RX_CONTEXT. This is an unformatted area on top of which any desired structure can be imposed by the various network mini redirectors. Developers of network mini-redirector drivers should try and define the associated private context to fit into this pre-specified area defined in the RX_CONTEXT data structure. Network mini-redirector drivers that violate this rule will incur a significant performance penalty.

Many RDBSS routines and routines exported by a network mini-redirector make reference to RX_CONTEXT structures in either the initiating thread or in some other thread used by the routine. Thus, allocated RX_CONTEXT structures are reference counted to manage their use for asynchronous operations. When the reference count goes to zero, the allocated RX_CONTEXT structure can be finalized and released on the last dereference operation.

RDBSS provides a number of routines that are used to manipulate an RX_CONTEXT and the associated IRP. These routines are used to allocate, initialize, and delete an RX_CONTEXT. These routines are also used to complete the IRP associated with an RX_CONTEXT and set up a cancel routine for an RX_CONTEXT.

Requirements

   
Header rxcontx.h (include Rx.h, Rxcontx.h)

See Also

FILE_GET_EA_INFORMATION

IOCTL_REDIR_QUERY_PATH

IOCTL_REDIR_QUERY_PATH_EX

IRP_MJ_CREATE

IRP_MJ_DEVICE_CONTROL

IRP_MJ_DIRECTORY_CONTROL

IRP_MJ_QUERY_EA

IRP_MJ_QUERY_QUOTA

IRP_MJ_QUERY_SECURITY

IRP_MJ_SET_QUOTA

IRP_MJ_SET_SECURITY

IoCompletion

IoMarkIrpPending

MRxCreate

MRxLowIOSubmit[LOWIO_OP_NOTIFY_CHANGE_DIRECTORY]

MRxQueryDirectory

MRxQueryEaInfo

MRxQueryFileInfo

MRxQueryQuotaInfo

MRxQuerySdInfo

MRxQueryVolumeInfo

MRxSetFileInfo

MRxSetFileInfoAtCleanup

MRxSetSdInfo

MRxSetVolumeInfo

RxCreateRxContext

RxInitializeContext

RxStartMinirdr