RX_CONTEXT数据结构

//留着以备查询之用 来自WinDDK\6000\inc\ddk\rxcontx.h

typedef struct _RX_CONTEXT {
    
    //
    //  the node type, size and reference count, aka standard header
    // 

    NODE_TYPE_CODE NodeTypeCode;
    NODE_BYTE_SIZE NodeByteSize;
    __volatile ULONG ReferenceCount;

    //
    //  the list entry to wire the context to the list of active contexts
    //

    LIST_ENTRY ContextListEntry;

    //
    //  Major and minor function of the IRP associated with the context
    //

    UCHAR MajorFunction;
    UCHAR MinorFunction;

    //
    //  this is similar to the same field in Irps; it
    //  allows callback routines for async operations
    //  to know whether to do asynchronous work or not
    //

    BOOLEAN PendingReturned;

    //
    //  indicates if the associated request is to be posted to a RDBSS worker thread.
    //

    BOOLEAN PostRequest;

    //
    //  Originating Device (required for workque algorithms)
    //  not currently used but could be used for local minis
    //

    PDEVICE_OBJECT RealDevice;

    //
    //  ptr to the originating Irp
    //

    PIRP CurrentIrp;

    //
    //  ptr to the IRP stack location
    //

    PIO_STACK_LOCATION CurrentIrpSp;

    //
    //  ptr to the FCB and FOBX, derived from the context pointers in the
    //  file object associated with the IRP
    //

    PMRX_FCB pFcb;
    PMRX_FOBX pFobx;
    PMRX_SRV_OPEN pRelevantSrvOpen;
    PNON_PAGED_FCB NonPagedFcb;

    //
    //  device object calldown (not irpsp.....)
    //

    PRDBSS_DEVICE_OBJECT RxDeviceObject;

    //
    //  The original thread in which the request was initiated and the last
    //  thread in which some processing associated with the context was done
    //

    PETHREAD OriginalThread;
    PETHREAD LastExecutionThread;

    __volatile PVOID LockManagerContext;

    //
    //  One word of the context is given to rdbss for dbg information
    //

    PVOID RdbssDbgExtension;

    RX_SCAVENGER_ENTRY ScavengerEntry;

    //
    //  global serial number for this operation
    //

    ULONG SerialNumber;

    //
    //  used by minirdrs to see if multiple calls are part
    //  of the same larger operation and (therefore) more cacheable
    //

    ULONG FobxSerialNumber;

    ULONG Flags;

    BOOLEAN FcbResourceAcquired;
    BOOLEAN FcbPagingIoResourceAcquired;
    UCHAR MustSucceedDescriptorNumber;

    //
    //  mostly you want the individual components...sometimes it's nice as a pair
    //  used to record the status when you can't just return it; e.g., when
    //  RXSTATUS is not an appropriate return type or if the consumer of the
    //  status didn't call directly (lowiocompletions). minirdrs will not need
    //  to set the information directly
    //

    union {
        struct {
            union {
                NTSTATUS StoredStatus;
                PVOID StoredStatusAlignment;
            };
            ULONG_PTR InformationToReturn;
        };
        IO_STATUS_BLOCK IoStatusBlock;
    };

    //
    //  the context fields provided for use by the mini redirectors
    //  this is defined as a union to force longlong alignment
    //

    union {
        ULONGLONG ForceLonglongAligmentDummyField;
        PVOID MRxContext[MRX_CONTEXT_FIELD_COUNT];
    };

    //
    //  The following field is included to fix the problem related to write only
    //  opens. This introduces a new field for the mini redirector to squirrel
    //  some state. This is redundant and should be removed after Windows 2000.
    //  Having a unique field reduces the impact of the change that we are making
    //  to the specific code path. It will be ideal to use one of the MRXContext
    //  fields defined above
    //

    PVOID WriteOnlyOpenRetryContext;

    //
    //  the cancellation routine to be invoked, set by the mini redirector
    //

    PMRX_CALLDOWN MRxCancelRoutine;

    //
    //  private dispatch, if any. used in fspdisp
    //

    PRX_DISPATCH ResumeRoutine;

    //
    //  for posting to worker threads
    //  the minirdr can use this for posting within the minirdr
    //  a potential problem can arise if the minirdr relies on this both
    //  for queueing async stuff and for queueing cancel stuff
    //

    //
    //  The OverflowListEntry is used for queueing items to the overflow queue.
    //  This is seperate now to allow us to distinguish between an item in the overflow
    //  queue and one in the active work queue (for cancellation logic)
    //

    RX_WORK_QUEUE_ITEM WorkQueueItem;
    LIST_ENTRY OverflowListEntry;

    //
    //  this event is used for synchronous operations
    //  that have to i/f with an underlying async service. it can be used
    //  by the minirdr with the following provisions:
    //      1) on entering the minirdr through lowio, it is set to the
    //         nonsignaled state (but a wise user will reset it before using
    //         it....particularly if it's used multiple times.
    //      2) if you are returning STATUS_PENDING on a sync operation, you must
    //         return with it set to the nonsignaled state; that is, either
    //         you don't use it or you reset it in this case
    //

    KEVENT SyncEvent;

    //
    //  this is a list head of operations that are to be released on completion
    //

    LIST_ENTRY BlockedOperations;

    //
    //  this is the mutex that controls serialization of the blocked operations
    //

    PFAST_MUTEX BlockedOpsMutex;

    //
    //  these links are used to serialize pipe operations on a
    //  per-file-object basis AND FOR LOTS OF OTHER STUFF
    //

    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;
    };

    //
    //  THIS UNION MUST BE LAST....AT SOME POINT, WE MAY START ALLOCATING
    //  SMALLER PER OPERATION!
    //

    union{
        struct {
            NT_CREATE_PARAMETERS NtCreateParameters; //  a copy of the createparameters
            ULONG ReturnedCreateInformation;
            PWCH CanonicalNameBuffer;  // if the canonical name is larger than available buffer
            PRX_PREFIX_ENTRY NetNamePrefixEntry;   // the entry returned by the lookup....for dereferencing

            PMRX_SRV_CALL pSrvCall;              // Server Call being used
            PMRX_NET_ROOT pNetRoot;              // Net Root being used
            PMRX_V_NET_ROOT pVNetRoot;             // Virtual Net Root
            //PMRX_SRV_OPEN        pSrvOpen;              // Server Open

            PVOID EaBuffer;
            ULONG EaLength;

            ULONG SdLength;

            ULONG PipeType;
            ULONG PipeReadMode;
            ULONG PipeCompletionMode;

            USHORT Flags;
            NET_ROOT_TYPE Type;                 // Type of Net Root(Pipe/File/Mailslot..)
            UCHAR         RdrFlags;             // Flags for use by the RDR while processing the request.

            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;        //  the LOWIO parameters
        }; //  no name here....
        LUID FsdUid;
    } ;

    //
    //  CODE.IMPROVEMENT remove this to wrapperdbgprivates
    //

    PWCH AlsoCanonicalNameBuffer;  //  if the canonical name is larger than available buffer
    PUNICODE_STRING LoudCompletionString;

#ifdef RDBSS_TRACKER
    __volatile LONG AcquireReleaseFcbTrackerX;
    __volatile ULONG TrackerHistoryPointer;
    RX_FCBTRACKER_CALLINFO TrackerHistory[RDBSS_TRACKER_HISTORY_SIZE];
#endif

#if DBG
    ULONG ShadowCritOwner;
#endif

} RX_CONTEXT, *PRX_CONTEXT;




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要打印 `rx_buffer[rx_index]` 中的数据,你可以使用 UART 发送来将数据发送到串口,然后通过串口连接到计算机,从而在计算机上查看打印的数据。以下是一个示例代码,演示如何将接收到的数据发送到串口: ```c #include <reg52.h> #include <stdio.h> #define BAUDRATE 9600 // Serial baud rate void UART_Init(); void UART_SendChar(unsigned char data); void UART_PrintString(char* str); void UART_PrintBuffer(); unsigned char rx_buffer[128]; // Receive buffer unsigned int rx_index = 0; // Receive buffer index void main() { UART_Init(); // Initialize UART while (1) { UART_PrintBuffer(); // Print the data in rx_buffer } } void UART_Init() { TMOD = 0x20; // Set Timer1 in mode 2 (8-bit auto-reload) TH1 = 256 - (11059200UL / 12UL / 32UL / BAUDRATE); // Calculate baud rate value TL1 = TH1; // Set Timer1 initial value TR1 = 1; // Start Timer1 SM0 = 0; // Set UART in mode 1 (8-bit UART, variable baud rate) SM1 = 1; REN = 1; // Enable UART receiver EA = 1; // Enable global interrupts ES = 1; // Enable UART interrupts } void UART_SendChar(unsigned char data) { SBUF = data; // Load data into the UART data register while (!TI); // Wait until transmission is complete TI = 0; // Clear transmit interrupt flag } void UART_PrintString(char* str) { while (*str) { UART_SendChar(*str); // Send each character of the string str++; } } void UART_PrintBuffer() { char buffer[16]; // Temporary buffer to convert data to string sprintf(buffer, "%d", rx_buffer[rx_index]); // Convert data to string UART_PrintString(buffer); // Send the string via UART rx_index++; // Increment buffer index if (rx_index >= sizeof(rx_buffer)) { rx_index = 0; // Reset buffer index if it exceeds buffer size } } ``` 在这个示例代码中,通过调用 `UART_PrintBuffer()` 函数,将 `rx_buffer[rx_index]` 中的数据转换为字符串,并通过 UART 发送到串口。你可以使用串口调试助手等工具来查看串口输出的数据。 请注意,这段代码假设你使用的是 Keil C51 编译器和 STC32G 系列微控制器。如果你使用的是不同的开发环境或微控制器,请相应地进行修改。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值