Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. rxcontx.h
  5. Abstract:
  6. Notes:
  7. Author:
  8. Rohan Phillips [Rohanp] 18-Jan-2001
  9. --*/
  10. #ifndef _DFSRXCONTX_H_
  11. #define _DFSRXCONTX_H_
  12. typedef
  13. NTSTATUS
  14. (NTAPI *DFS_CALLDOWN_ROUTINE) (
  15. IN OUT PVOID pCalldownParameter);
  16. #define MRX_CONTEXT_FIELD_COUNT 4
  17. typedef struct _RX_CONTEXT {
  18. ULONG Signature;
  19. ULONG ReferenceCount;
  20. ULONG Flags;
  21. NTSTATUS Status;
  22. ULONG OutputBufferLength;
  23. ULONG InputBufferLength;
  24. ULONG ReturnedLength;
  25. PDEVICE_OBJECT RealDevice;
  26. PVOID OutputBuffer;
  27. PVOID InputBuffer;
  28. DFS_CALLDOWN_ROUTINE CancelRoutine;
  29. PVOID UMRScratchSpace[MRX_CONTEXT_FIELD_COUNT] ;
  30. // The original thread in which the request was initiated and the last
  31. // thread in which some processing associated with the context was done
  32. PETHREAD OriginalThread;
  33. PETHREAD LastExecutionThread;
  34. // ptr to the originating Irp
  35. PIRP CurrentIrp;
  36. //event
  37. KEVENT SyncEvent;
  38. // the list entry to wire the context to the list of active contexts
  39. LIST_ENTRY ContextListEntry;
  40. }RX_CONTEXT, *PRX_CONTEXT;
  41. #define ZeroAndInitializeNodeType(Ptr,TType,Size) {\
  42. RtlZeroMemory( Ptr, Size ); \
  43. }
  44. #define DFS_CONTEXT_FLAG_SYNC_EVENT_WAITERS 0x00000001
  45. #define DFS_CONTEXT_FLAG_CANCELLED 0x00000002
  46. #define DFS_CONTEXT_FLAG_ASYNC_OPERATION 0x00000004
  47. #define DFS_CONTEXT_FLAG_FILTER_INITIATED 0x00000008
  48. #define RxWaitSync(RxContext) \
  49. (RxContext)->Flags |= DFS_CONTEXT_FLAG_SYNC_EVENT_WAITERS; \
  50. KeWaitForSingleObject( &(RxContext)->SyncEvent, \
  51. Executive, KernelMode, FALSE, NULL );
  52. #define RxWaitSyncWithTimeout(RxContext,pliTimeout) \
  53. (RxContext)->Flags |= DFS_CONTEXT_FLAG_SYNC_EVENT_WAITERS; \
  54. Status = KeWaitForSingleObject( &(RxContext)->SyncEvent, \
  55. Executive, KernelMode, FALSE, pliTimeout );
  56. #define RxSignalSynchronousWaiter(RxContext) \
  57. (RxContext)->Flags &= ~DFS_CONTEXT_FLAG_SYNC_EVENT_WAITERS; \
  58. KeSetEvent( &(RxContext)->SyncEvent, 0, FALSE )
  59. NTSTATUS
  60. DfsInitializeContextResources(void);
  61. NTSTATUS
  62. DfsDeInitializeContextResources(void);
  63. VOID
  64. RxDereferenceAndDeleteRxContext_Real (
  65. IN PRX_CONTEXT RxContext
  66. );
  67. VOID
  68. RxInitializeContext(
  69. IN PIRP Irp,
  70. IN OUT PRX_CONTEXT RxContext);
  71. PRX_CONTEXT
  72. RxCreateRxContext (
  73. IN PIRP Irp,
  74. IN ULONG InitialContextFlags
  75. );
  76. NTSTATUS
  77. RxSetMinirdrCancelRoutine(
  78. IN OUT PRX_CONTEXT RxContext,
  79. IN DFS_CALLDOWN_ROUTINE MRxCancelRoutine);
  80. #define RxDereferenceAndDeleteRxContext(RXCONTEXT) { \
  81. RxDereferenceAndDeleteRxContext_Real((RXCONTEXT)); \
  82. }
  83. #endif