Source code of Windows XP (NT5)
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.

218 lines
5.5 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. vfirp.h
  5. Abstract:
  6. This module contains prototypes for functions used to manage IRPs used in
  7. the verification process.
  8. Author:
  9. Adrian J. Oney (adriao) 20-Apr-1998
  10. Environment:
  11. Kernel mode
  12. Revision History:
  13. AdriaO 05/02/2000 - Seperated out from ntos\io\hashirp.h
  14. --*/
  15. struct _IOV_STACK_LOCATION;
  16. struct _IOV_REQUEST_PACKET;
  17. struct _IOFCALLDRIVER_STACKDATA;
  18. typedef struct _IOV_STACK_LOCATION *PIOV_STACK_LOCATION;
  19. typedef struct _IOV_REQUEST_PACKET *PIOV_REQUEST_PACKET;
  20. typedef struct _IOV_SESSION_DATA *PIOV_SESSION_DATA;
  21. typedef struct _IOFCALLDRIVER_STACKDATA *PIOFCALLDRIVER_STACKDATA;
  22. typedef struct _IRP_SNAPSHOT {
  23. PIRP Irp;
  24. IO_STACK_LOCATION IoStackLocation;
  25. } IRP_SNAPSHOT, *PIRP_SNAPSHOT;
  26. typedef struct _IOV_STACK_LOCATION {
  27. BOOLEAN InUse;
  28. ULONG Flags;
  29. PIOV_STACK_LOCATION RequestsFirstStackLocation;
  30. LIST_ENTRY CallStackData;
  31. PIO_STACK_LOCATION IrpSp;
  32. PVOID LastDispatch;
  33. LARGE_INTEGER PerfDispatchStart;
  34. LARGE_INTEGER PerfStackLocationStart;
  35. PDEVICE_OBJECT ReferencingObject;
  36. LONG ReferencingCount;
  37. IO_STATUS_BLOCK InitialStatusBlock;
  38. IO_STATUS_BLOCK LastStatusBlock;
  39. PETHREAD ThreadDispatchedTo;
  40. } IOV_STACK_LOCATION;
  41. typedef struct _IOV_SESSION_DATA {
  42. PIOV_REQUEST_PACKET IovRequestPacket;
  43. LONG SessionRefCount;
  44. LIST_ENTRY SessionLink;
  45. ULONG SessionFlags;
  46. PETHREAD OriginatorThread;
  47. PDEVICE_OBJECT DeviceLastCalled; // Last device called
  48. ULONG ForwardMethod;
  49. PIRP BestVisibleIrp;
  50. PVERIFIER_SETTINGS_SNAPSHOT VerifierSettings;
  51. IOV_STACK_LOCATION StackData[ANYSIZE_ARRAY];
  52. } IOV_SESSION_DATA;
  53. typedef struct _IOFCALLDRIVER_STACKDATA {
  54. PIOV_SESSION_DATA IovSessionData;
  55. PIOV_STACK_LOCATION IovStackLocation;
  56. PIOV_REQUEST_PACKET IovPacket;
  57. ULONG Flags;
  58. LIST_ENTRY SharedLocationList;
  59. PDRIVER_DISPATCH DispatchRoutine;
  60. NTSTATUS ExpectedStatus;
  61. NTSTATUS NewStatus;
  62. PDEVICE_OBJECT RemovePdo;
  63. IRP_SNAPSHOT IrpSnapshot;
  64. } IOFCALLDRIVER_STACKDATA;
  65. typedef struct _IOFCOMPLETEREQUEST_STACKDATA {
  66. PIOV_SESSION_DATA IovSessionData;
  67. PIOV_REQUEST_PACKET IovRequestPacket;
  68. BOOLEAN IsRemoveIrp;
  69. LONG LocationsAdvanced;
  70. ULONG RaisedCount;
  71. KIRQL PreviousIrql;
  72. PVOID CompletionRoutine;
  73. } IOFCOMPLETEREQUEST_STACKDATA, *PIOFCOMPLETEREQUEST_STACKDATA;
  74. VOID
  75. FASTCALL
  76. VfIrpInit(
  77. VOID
  78. );
  79. PIRP
  80. FASTCALL
  81. VfIrpAllocate(
  82. IN CCHAR StackSize
  83. );
  84. VOID
  85. FASTCALL
  86. VfIrpMakeTouchable(
  87. IN PIRP Irp
  88. );
  89. VOID
  90. FASTCALL
  91. VfIrpMakeUntouchable(
  92. IN PIRP Irp OPTIONAL
  93. );
  94. VOID
  95. FASTCALL
  96. VfIrpFree(
  97. IN PIRP Irp OPTIONAL
  98. );
  99. VOID
  100. FASTCALL
  101. VerifierIoAllocateIrp1(
  102. IN CCHAR StackSize,
  103. IN BOOLEAN ChargeQuota,
  104. IN OUT PIRP *IrpPointer
  105. );
  106. VOID
  107. FASTCALL
  108. VerifierIoAllocateIrp2(
  109. IN PIRP Irp
  110. );
  111. VOID
  112. FASTCALL
  113. VerifierIoFreeIrp(
  114. IN PIRP Irp,
  115. IN OUT PBOOLEAN FreeHandled
  116. );
  117. VOID
  118. FASTCALL
  119. VerifierIoInitializeIrp(
  120. IN OUT PIRP Irp,
  121. IN USHORT PacketSize,
  122. IN CCHAR StackSize,
  123. IN OUT PBOOLEAN InitializeHandled
  124. );
  125. BOOLEAN
  126. FASTCALL
  127. VfIrpReserveCallStackData(
  128. IN PIRP Irp,
  129. OUT PIOFCALLDRIVER_STACKDATA *IofCallDriverStackData
  130. );
  131. VOID
  132. FASTCALL
  133. VfIrpPrepareAllocaCallStackData(
  134. OUT PIOFCALLDRIVER_STACKDATA IofCallDriverStackData
  135. );
  136. VOID
  137. FASTCALL
  138. VfIrpReleaseCallStackData(
  139. IN PIOFCALLDRIVER_STACKDATA IofCallDriverStackData OPTIONAL
  140. );
  141. //
  142. // VfIrpCallDriverPreprocess is a macro function that may do an alloca as
  143. // part of it's operation. As such callers must be careful not to use
  144. // variable lengthed arrays in a scope that encompasses
  145. // VfIrpCallDriverPreProcess but not VfIrpCallDriverPostProcess.
  146. //
  147. #define VfIrpCallDriverPreProcess(DeviceObject, IrpPointer, CallStackData) \
  148. if (!VfIrpReserveCallStackData(*(IrpPointer), (CallStackData))) { \
  149. *(CallStackData) = alloca(sizeof(IOFCALLDRIVER_STACKDATA)); \
  150. VfIrpPrepareAllocaCallStackData(*(CallStackData)); \
  151. } \
  152. IovpCallDriver1((DeviceObject), (IrpPointer), *(CallStackData))
  153. #define VfIrpCallDriverPostProcess(DeviceObject, FinalStatus, CallStackData) \
  154. IovpCallDriver2(DeviceObject, FinalStatus, CallStackData); \
  155. VfIrpReleaseCallStackData(CallStackData)
  156. BOOLEAN
  157. VfIrpSendSynchronousIrp(
  158. IN PDEVICE_OBJECT DeviceObject,
  159. IN PIO_STACK_LOCATION TopStackLocation,
  160. IN BOOLEAN Untouchable,
  161. IN NTSTATUS InitialStatus,
  162. IN ULONG_PTR InitialInformation OPTIONAL,
  163. OUT ULONG_PTR *FinalInformation OPTIONAL,
  164. OUT NTSTATUS *FinalStatus OPTIONAL
  165. );
  166. VOID
  167. FASTCALL
  168. VfIrpWatermark(
  169. IN PIRP Irp,
  170. IN ULONG Flags
  171. );