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.

151 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( RXCOMMON_SIGNATURE );
  21. #ifdef ALLOC_PRAGMA
  22. #pragma alloc_text(PAGE, RxCommonDeviceControl)
  23. #pragma alloc_text(PAGE, RxLowIoIoCtlShellCompletion)
  24. #endif
  25. NTSTATUS
  26. RxCommonDeviceControl ( RXCOMMON_SIGNATURE )
  27. /*++
  28. Routine Description:
  29. This is the common routine for doing Device control operations called
  30. by both the fsd and fsp threads
  31. Arguments:
  32. Irp - Supplies the Irp to process
  33. InFsp - Indicates if this is the fsp thread or someother thread
  34. Return Value:
  35. RXSTATUS - The return status for the operation
  36. --*/
  37. {
  38. NTSTATUS Status;
  39. RxCaptureRequestPacket;
  40. RxCaptureParamBlock;
  41. BOOLEAN SubmitLowIoRequest = TRUE;
  42. ULONG IoControlCode = capPARAMS->Parameters.DeviceIoControl.IoControlCode;
  43. PAGED_CODE();
  44. RxDbgTrace(+1, Dbg, ("RxCommonDeviceControl\n", 0));
  45. RxDbgTrace( 0, Dbg, ("Irp = %08lx\n", capReqPacket));
  46. RxDbgTrace( 0, Dbg, ("MinorFunction = %08lx\n", capPARAMS->MinorFunction));
  47. //
  48. //
  49. if (IoControlCode == IOCTL_REDIR_QUERY_PATH) {
  50. Status = (STATUS_INVALID_DEVICE_REQUEST);
  51. SubmitLowIoRequest = FALSE;
  52. }
  53. if (SubmitLowIoRequest) {
  54. RxInitializeLowIoContext(&RxContext->LowIoContext,LOWIO_OP_IOCTL);
  55. Status = RxLowIoSubmit(RxContext,RxLowIoIoCtlShellCompletion);
  56. if( Status == STATUS_PENDING )
  57. {
  58. // Another thread will complete the request, but we must remove our reference count.
  59. RxDereferenceAndDeleteRxContext( RxContext );
  60. }
  61. }
  62. RxDbgTrace(-1, Dbg, ("RxCommonDeviceControl -> %08lx\n", Status));
  63. return Status;
  64. }
  65. NTSTATUS
  66. RxLowIoIoCtlShellCompletion( RXCOMMON_SIGNATURE )
  67. /*++
  68. Routine Description:
  69. This is the completion routine for IoCtl requests passed down to the mini rdr
  70. Arguments:
  71. Irp - Supplies the Irp being processed
  72. Return Value:
  73. RXSTATUS - The return status for the operation
  74. --*/
  75. {
  76. RxCaptureRequestPacket;
  77. //RxCaptureFcb;
  78. //RxCaptureFobx;
  79. //RxCaptureParamBlock;
  80. //RxCaptureFileObject;
  81. NTSTATUS Status = STATUS_SUCCESS;
  82. //NODE_TYPE_CODE TypeOfOpen = NodeType(capFcb);
  83. PLOWIO_CONTEXT pLowIoContext = &RxContext->LowIoContext;
  84. //ULONG FsControlCode = capPARAMS->Parameters.FileSystemControl.FsControlCode;
  85. PAGED_CODE();
  86. Status = RxContext->StoredStatus;
  87. RxDbgTrace(+1, Dbg, ("RxLowIoIoCtlShellCompletion entry Status = %08lx\n", Status));
  88. switch (Status) { //maybe success vs warning vs error
  89. case STATUS_SUCCESS:
  90. case STATUS_BUFFER_OVERFLOW:
  91. //capReqPacket->IoStatus.Information = pLowIoContext->ParamsFor.IoCtl.OutputBufferLength;
  92. capReqPacket->IoStatus.Information = RxContext->InformationToReturn;
  93. break;
  94. //case STATUS(CONNECTION_INVALID:
  95. default:
  96. break;
  97. }
  98. capReqPacket->IoStatus.Status = Status;
  99. RxDbgTrace(-1, Dbg, ("RxLowIoIoCtlShellCompletion exit Status = %08lx\n", Status));
  100. return Status;
  101. }