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.

209 lines
5.7 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. VolInfo.c
  5. Abstract:
  6. This module implements the volume information routines for Rx called by
  7. the dispatch driver.
  8. Author:
  9. Joe Linn [JoeLinn] 5-oct-94
  10. Revision History:
  11. --*/
  12. #include "precomp.h"
  13. #pragma hdrstop
  14. //
  15. // The local debug trace level
  16. //
  17. #define Dbg (DEBUG_TRACE_VOLINFO)
  18. #ifdef ALLOC_PRAGMA
  19. #pragma alloc_text(PAGE, RxCommonQueryVolumeInformation)
  20. #pragma alloc_text(PAGE, RxCommonSetVolumeInformation)
  21. #endif
  22. NTSTATUS
  23. RxCommonQueryVolumeInformation (
  24. IN PRX_CONTEXT RxContext,
  25. IN PIRP Irp
  26. )
  27. /*++
  28. Routine Description:
  29. This is the common routine for querying volume information called by both
  30. the fsd and fsp threads.
  31. Arguments:
  32. Irp - Supplies the Irp being processed
  33. Return Value:
  34. NTSTATUS - The return status for the operation
  35. --*/
  36. {
  37. NTSTATUS Status;
  38. PFCB Fcb;
  39. PFOBX Fobx;
  40. PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
  41. ULONG OriginalLength = IrpSp->Parameters.QueryVolume.Length;
  42. FS_INFORMATION_CLASS FsInformationClass = IrpSp->Parameters.QueryVolume.FsInformationClass;
  43. PVOID OriginalBuffer = Irp->AssociatedIrp.SystemBuffer;
  44. PAGED_CODE();
  45. RxDecodeFileObject( IrpSp->FileObject, &Fcb, &Fobx );
  46. RxDbgTrace( +1, Dbg, ("RxCommonQueryVolumeInformation...IrpC %08lx, Fobx %08lx, Fcb %08lx\n",
  47. RxContext, Fobx, Fcb) );
  48. RxDbgTrace( 0, Dbg, ("->Length = %08lx\n", OriginalLength) );
  49. RxDbgTrace( 0, Dbg, ("->FsInformationClass = %08lx\n", FsInformationClass) );
  50. RxDbgTrace( 0, Dbg, ("->Buffer = %08lx\n", OriginalBuffer) );
  51. RxLog(( "QueryVolInfo %lx %lx %lx\n", RxContext, Fcb, Fobx ));
  52. RxWmiLog( LOG,
  53. RxCommonQueryVolumeInformation_1,
  54. LOGPTR(RxContext )
  55. LOGPTR(Fcb )
  56. LOGPTR(Fobx ) );
  57. RxLog(( " alsoqvi %lx %lx %lx\n", OriginalLength, FsInformationClass, OriginalBuffer ));
  58. RxWmiLog( LOG,
  59. RxCommonQueryVolumeInformation_2,
  60. LOGULONG( OriginalLength )
  61. LOGULONG( FsInformationClass )
  62. LOGPTR( OriginalBuffer ) );
  63. try {
  64. RxContext->Info.FsInformationClass = FsInformationClass;
  65. RxContext->Info.Buffer = OriginalBuffer;
  66. RxContext->Info.LengthRemaining = OriginalLength;
  67. MINIRDR_CALL( Status,
  68. RxContext,
  69. Fcb->MRxDispatch,
  70. MRxQueryVolumeInfo,
  71. (RxContext) );
  72. if (RxContext->PostRequest) {
  73. Status = RxFsdPostRequest( RxContext );
  74. } else {
  75. Irp->IoStatus.Information = OriginalLength - RxContext->Info.LengthRemaining;
  76. }
  77. } finally {
  78. DebugUnwind( RxCommonQueryVolumeInformation );
  79. }
  80. RxDbgTrace( -1, Dbg, ("RxCommonQueryVolumeInformation -> %08lx,%08lx\n", Status, Irp->IoStatus.Information) );
  81. return Status;
  82. }
  83. NTSTATUS
  84. RxCommonSetVolumeInformation (
  85. IN PRX_CONTEXT RxContext,
  86. IN PIRP Irp
  87. )
  88. /*++
  89. Routine Description:
  90. This is the common routine for setting Volume Information called by both
  91. the fsd and fsp threads.
  92. Arguments:
  93. Irp - Supplies the Irp being processed
  94. Return Value:
  95. RXSTATUS - The return status for the operation
  96. --*/
  97. {
  98. NTSTATUS Status = STATUS_NOT_IMPLEMENTED;
  99. PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
  100. PFCB Fcb;
  101. PFOBX Fobx;
  102. TYPE_OF_OPEN TypeOfOpen;
  103. ULONG Length;
  104. FS_INFORMATION_CLASS FsInformationClass;
  105. PVOID Buffer;
  106. PAGED_CODE();
  107. TypeOfOpen = RxDecodeFileObject( IrpSp->FileObject, &Fcb, &Fobx );
  108. RxDbgTrace( +1, Dbg, ("RxCommonSetVolumeInformation...IrpC %08lx, Fobx %08lx, Fcb %08lx\n",
  109. RxContext, Fobx, Fcb) );
  110. Length = IrpSp->Parameters.SetVolume.Length;
  111. FsInformationClass = IrpSp->Parameters.SetVolume.FsInformationClass;
  112. Buffer = Irp->AssociatedIrp.SystemBuffer;
  113. RxDbgTrace( 0, Dbg, ("->Length = %08lx\n", Length) );
  114. RxDbgTrace( 0, Dbg, ("->FsInformationClass = %08lx\n", FsInformationClass) );
  115. RxDbgTrace( 0, Dbg, ("->Buffer = %08lx\n", Buffer) );
  116. RxLog(( "SetVolInfo %lx %lx %lx\n", RxContext, Fcb, Fobx ));
  117. RxWmiLog( LOG,
  118. RxCommonSetVolumeInformation_1,
  119. LOGPTR( RxContext )
  120. LOGPTR( Fcb )
  121. LOGPTR( Fobx ) );
  122. RxLog(( " alsosvi %lx %lx %lx\n", Length, FsInformationClass, Buffer ));
  123. RxWmiLog( LOG,
  124. RxCommonSetVolumeInformation_2,
  125. LOGULONG( Length )
  126. LOGULONG( FsInformationClass )
  127. LOGPTR( Buffer ) );
  128. try {
  129. //
  130. // Based on the information class we'll do different actions. Each
  131. // of the procedures that we're calling performs the action if
  132. // possible and returns true if it successful and false if it couldn't
  133. // wait for any I/O to complete.
  134. //
  135. RxContext->Info.FsInformationClass = FsInformationClass;
  136. RxContext->Info.Buffer = Buffer;
  137. RxContext->Info.LengthRemaining = Length;
  138. MINIRDR_CALL( Status,
  139. RxContext,
  140. Fcb->MRxDispatch,
  141. MRxSetVolumeInfo,
  142. (RxContext) );
  143. } finally {
  144. DebugUnwind( RxCommonSetVolumeInformation );
  145. RxDbgTrace( -1, Dbg, ("RxCommonSetVolumeInformation -> %08lx\n", Status) );
  146. }
  147. return Status;
  148. }
  149.