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.

154 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. DevCtrl.c
  5. Abstract:
  6. This module implements the File System Device Control routines for Rx
  7. called by the dispatch driver.
  8. Author:
  9. Revision History:
  10. Balan Sethu Raman [19-July-95] -- Hook it up to the mini rdr call down.
  11. --*/
  12. #include "precomp.h"
  13. #pragma hdrstop
  14. #include "ntddmup.h"
  15. //
  16. // The local debug trace level
  17. //
  18. #define Dbg (DEBUG_TRACE_DEVCTRL)
  19. NTSTATUS
  20. RxLowIoIoCtlShellCompletion (
  21. IN PRX_CONTEXT RxContext
  22. );
  23. #ifdef ALLOC_PRAGMA
  24. #pragma alloc_text(PAGE, RxCommonDeviceControl)
  25. #pragma alloc_text(PAGE, RxLowIoIoCtlShellCompletion)
  26. #endif
  27. NTSTATUS
  28. RxCommonDeviceControl (
  29. IN PRX_CONTEXT RxContext,
  30. IN PIRP Irp
  31. )
  32. /*++
  33. Routine Description:
  34. This is the common routine for doing Device control operations called
  35. by both the fsd and fsp threads
  36. Arguments:
  37. Irp - Supplies the Irp to process
  38. InFsp - Indicates if this is the fsp thread or someother thread
  39. Return Value:
  40. RXSTATUS - The return status for the operation
  41. --*/
  42. {
  43. NTSTATUS Status;
  44. PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
  45. PFCB Fcb;
  46. PFOBX Fobx;
  47. BOOLEAN SubmitLowIoRequest = TRUE;
  48. ULONG IoControlCode = IrpSp->Parameters.DeviceIoControl.IoControlCode;
  49. PAGED_CODE();
  50. RxDbgTrace( +1, Dbg, ("RxCommonDeviceControl\n", 0 ));
  51. RxDbgTrace( 0, Dbg, ("Irp = %08lx\n", Irp ));
  52. RxDbgTrace( 0, Dbg, ("MinorFunction = %08lx\n", IrpSp->MinorFunction));
  53. RxDecodeFileObject( IrpSp->FileObject, &Fcb, &Fobx );
  54. if (IoControlCode == IOCTL_REDIR_QUERY_PATH) {
  55. Status = STATUS_INVALID_DEVICE_REQUEST;
  56. SubmitLowIoRequest = FALSE;
  57. }
  58. if (SubmitLowIoRequest) {
  59. RxInitializeLowIoContext( RxContext, LOWIO_OP_IOCTL, &RxContext->LowIoContext );
  60. Status = RxLowIoSubmit( RxContext, Irp, Fcb, RxLowIoIoCtlShellCompletion );
  61. if (Status == STATUS_PENDING) {
  62. //
  63. // Another thread will complete the request, but we must remove our reference count.
  64. //
  65. RxDereferenceAndDeleteRxContext( RxContext );
  66. }
  67. }
  68. RxDbgTrace(-1, Dbg, ("RxCommonDeviceControl -> %08lx\n", Status));
  69. return Status;
  70. }
  71. NTSTATUS
  72. RxLowIoIoCtlShellCompletion (
  73. IN PRX_CONTEXT RxContext
  74. )
  75. /*++
  76. Routine Description:
  77. This is the completion routine for IoCtl requests passed down to the mini rdr
  78. Arguments:
  79. Irp - Supplies the Irp being processed
  80. Return Value:
  81. NTSTATUS - The return status for the operation
  82. --*/
  83. {
  84. PIRP Irp = RxContext->CurrentIrp;
  85. NTSTATUS Status;
  86. PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
  87. PAGED_CODE();
  88. Status = RxContext->StoredStatus;
  89. RxDbgTrace( +1, Dbg, ("RxLowIoIoCtlShellCompletion entry Status = %08lx\n", Status) );
  90. switch (Status) { // may be success vs warning vs error
  91. case STATUS_SUCCESS:
  92. case STATUS_BUFFER_OVERFLOW:
  93. Irp->IoStatus.Information = RxContext->InformationToReturn;
  94. break;
  95. default:
  96. break;
  97. }
  98. Irp->IoStatus.Status = Status;
  99. RxDbgTrace( -1, Dbg, ("RxLowIoIoCtlShellCompletion exit Status = %08lx\n", Status) );
  100. return Status;
  101. }