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.

144 lines
2.9 KiB

  1. /*++
  2. Copyright (c) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. OCRW.C
  5. Abstract:
  6. This source file contains the dispatch routines which handle
  7. opening, closing, reading, and writing to the device, i.e.:
  8. IRP_MJ_CREATE
  9. IRP_MJ_CLOSE
  10. IRP_MJ_READ
  11. IRP_MJ_WRITE
  12. Environment:
  13. kernel mode
  14. Revision History:
  15. 06-01-98 : started rewrite
  16. --*/
  17. //*****************************************************************************
  18. // I N C L U D E S
  19. //*****************************************************************************
  20. #include <ntddk.h>
  21. #include <usbdi.h>
  22. #include <usbdlib.h>
  23. #include "usbmass.h"
  24. #ifdef ALLOC_PRAGMA
  25. #pragma alloc_text(PAGE, USBSTOR_Create)
  26. #pragma alloc_text(PAGE, USBSTOR_Close)
  27. #pragma alloc_text(PAGE, USBSTOR_ReadWrite)
  28. #endif
  29. //******************************************************************************
  30. //
  31. // USBSTOR_Create()
  32. //
  33. // Dispatch routine which handles IRP_MJ_CREATE
  34. //
  35. //******************************************************************************
  36. NTSTATUS
  37. USBSTOR_Create (
  38. IN PDEVICE_OBJECT DeviceObject,
  39. IN PIRP Irp
  40. )
  41. {
  42. DBGPRINT(2, ("enter: USBSTOR_Create\n"));
  43. LOGENTRY('CREA', DeviceObject, Irp, 0);
  44. DBGFBRK(DBGF_BRK_CREATE);
  45. Irp->IoStatus.Status = STATUS_SUCCESS;
  46. Irp->IoStatus.Information = 0;
  47. IoCompleteRequest(Irp, IO_NO_INCREMENT);
  48. DBGPRINT(2, ("exit: USBSTOR_Create\n"));
  49. LOGENTRY('crea', 0, 0, 0);
  50. return STATUS_SUCCESS;
  51. }
  52. //******************************************************************************
  53. //
  54. // USBSTOR_Close()
  55. //
  56. // Dispatch routine which handles IRP_MJ_CLOSE
  57. //
  58. //******************************************************************************
  59. NTSTATUS
  60. USBSTOR_Close (
  61. IN PDEVICE_OBJECT DeviceObject,
  62. IN PIRP Irp
  63. )
  64. {
  65. DBGPRINT(2, ("enter: USBSTOR_Close\n"));
  66. LOGENTRY('CLOS', DeviceObject, Irp, 0);
  67. DBGFBRK(DBGF_BRK_CLOSE);
  68. Irp->IoStatus.Status = STATUS_SUCCESS;
  69. Irp->IoStatus.Information = 0;
  70. IoCompleteRequest(Irp, IO_NO_INCREMENT);
  71. DBGPRINT(2, ("exit: USBSTOR_Close\n"));
  72. LOGENTRY('clos', 0, 0, 0);
  73. return STATUS_SUCCESS;
  74. }
  75. //******************************************************************************
  76. //
  77. // USBSTOR_ReadWrite()
  78. //
  79. // Dispatch routine which handles IRP_MJ_READ and IRP_MJ_WRITE
  80. //
  81. //******************************************************************************
  82. NTSTATUS
  83. USBSTOR_ReadWrite (
  84. IN PDEVICE_OBJECT DeviceObject,
  85. IN PIRP Irp
  86. )
  87. {
  88. NTSTATUS ntStatus;
  89. DBGPRINT(2, ("enter: USBSTOR_ReadWrite\n"));
  90. LOGENTRY('RW ', DeviceObject, Irp, 0);
  91. DBGFBRK(DBGF_BRK_READWRITE);
  92. ntStatus = STATUS_INVALID_PARAMETER;
  93. Irp->IoStatus.Status = ntStatus;
  94. Irp->IoStatus.Information = 0;
  95. IoCompleteRequest(Irp, IO_NO_INCREMENT);
  96. DBGPRINT(2, ("exit: USBSTOR_ReadWrite %08X\n", ntStatus));
  97. LOGENTRY('rw ', ntStatus, 0, 0);
  98. return ntStatus;
  99. }