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.

112 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. ReadWrit.c
  5. Abstract:
  6. This module implements the File Read and Write routines called by the
  7. dispatch driver.
  8. Author:
  9. David Goebel [DavidGoe] 28-Feb-1991
  10. Revision History:
  11. --*/
  12. #include "RawProcs.h"
  13. #ifdef ALLOC_PRAGMA
  14. #pragma alloc_text(PAGE, RawReadWriteDeviceControl)
  15. #endif
  16. NTSTATUS
  17. RawReadWriteDeviceControl (
  18. IN PVCB Vcb,
  19. IN PIRP Irp,
  20. IN PIO_STACK_LOCATION IrpSp
  21. )
  22. /*++
  23. Routine Description:
  24. This is the a common routine for both reading and writing a volume.
  25. Arguments:
  26. Vcb - Supplies the volume being queried.
  27. Irp - Supplies the Irp to process
  28. IrpSp - Supplies parameters describing the read or write
  29. Return Value:
  30. NTSTATUS - The return status for the operation
  31. --*/
  32. {
  33. PIO_STACK_LOCATION NextIrpSp;
  34. NTSTATUS Status;
  35. PAGED_CODE();
  36. //
  37. // If this was for a zero byte read or write transfer, just complete
  38. // it with success.
  39. //
  40. if (((IrpSp->MajorFunction == IRP_MJ_READ) ||
  41. (IrpSp->MajorFunction == IRP_MJ_WRITE)) &&
  42. (IrpSp->Parameters.Read.Length == 0)) {
  43. RawCompleteRequest( Irp, STATUS_SUCCESS );
  44. return STATUS_SUCCESS;
  45. }
  46. //
  47. // This is a very simple operation. Simply forward the
  48. // request to the device driver since exact blocks are
  49. // being read and return whatever status was given.
  50. //
  51. // Get the next stack location, and copy over the stack location
  52. //
  53. NextIrpSp = IoGetNextIrpStackLocation( Irp );
  54. *NextIrpSp = *IrpSp;
  55. //
  56. // Prohibit verifies all together.
  57. //
  58. NextIrpSp->Flags |= SL_OVERRIDE_VERIFY_VOLUME;
  59. //
  60. // Set up the completion routine
  61. //
  62. IoSetCompletionRoutine( Irp,
  63. RawCompletionRoutine,
  64. NULL,
  65. TRUE,
  66. TRUE,
  67. TRUE );
  68. //
  69. // Send the request.
  70. //
  71. Status = IoCallDriver(Vcb->TargetDeviceObject, Irp);
  72. return Status;
  73. }