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.

163 lines
3.3 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. serscan.c
  5. Abstract:
  6. This module contains the code for a serial imaging devices driver
  7. Open and Create routines
  8. Author:
  9. Vlad Sadovsky vlads 10-April-1998
  10. Environment:
  11. Kernel mode
  12. Revision History :
  13. vlads 04/10/1998 Created first draft
  14. --*/
  15. #include "serscan.h"
  16. #include "serlog.h"
  17. #if DBG
  18. extern ULONG SerScanDebugLevel;
  19. #endif
  20. NTSTATUS
  21. SerScanCreateOpen(
  22. IN PDEVICE_OBJECT DeviceObject,
  23. IN PIRP Irp
  24. )
  25. /*++
  26. Routine Description:
  27. This routine is the dispatch for a create requests.
  28. Arguments:
  29. DeviceObject - Supplies the device object.
  30. Irp - Supplies the I/O request packet.
  31. Return Value:
  32. STATUS_SUCCESS - Success.
  33. !STATUS_SUCCESS - Failure.
  34. --*/
  35. {
  36. NTSTATUS Status;
  37. PDEVICE_EXTENSION Extension;
  38. PIO_STACK_LOCATION IrpSp;
  39. PFILE_OBJECT FileObject;
  40. PAGED_CODE();
  41. Extension = DeviceObject->DeviceExtension;
  42. //
  43. // From the FileObject determine what mode we are running in.
  44. //
  45. // If FileObject->DeviceObject == DeviceObject, the user opened our device
  46. // and we will process each of the callbacks (Filter mode).
  47. //
  48. // If FileObject->DeviceObject != DeviceObject, the user opened PORTx
  49. // and we will get out of the way (PassThrough mode).
  50. //
  51. IrpSp = IoGetCurrentIrpStackLocation (Irp);
  52. FileObject = IrpSp->FileObject;
  53. // ASSERT (FileObject == NULL);
  54. //
  55. // Are the DeviceObjects equal...
  56. //
  57. Extension->PassThrough = !(FileObject->DeviceObject == DeviceObject);
  58. //
  59. // Call down to the parent and wait on the CreateOpen IRP to complete...
  60. //
  61. Status = SerScanCallParent(Extension,
  62. Irp,
  63. WAIT,
  64. NULL);
  65. DebugDump(SERIRPPATH,
  66. ("SerScan: [CreateOpen] After CallParent Status = %x\n",
  67. Status));
  68. //
  69. // WORKWORK: If we are in filter mode, we'll connect here...
  70. //
  71. IoCompleteRequest(Irp, IO_NO_INCREMENT);
  72. return Status;
  73. }
  74. NTSTATUS
  75. SerScanClose(
  76. IN PDEVICE_OBJECT DeviceObject,
  77. IN PIRP Irp
  78. )
  79. /*++
  80. Routine Description:
  81. This routine is the dispatch for a close requests.
  82. Arguments:
  83. DeviceObject - Supplies the device object.
  84. Irp - Supplies the I/O request packet.
  85. Return Value:
  86. STATUS_SUCCESS - Success.
  87. --*/
  88. {
  89. NTSTATUS Status;
  90. PDEVICE_EXTENSION Extension;
  91. PAGED_CODE();
  92. Extension = DeviceObject->DeviceExtension;
  93. //
  94. // Call down to the parent and wait on the Close IRP to complete...
  95. //
  96. Status = SerScanCallParent(Extension,
  97. Irp,
  98. WAIT,
  99. NULL);
  100. DebugDump(SERIRPPATH,
  101. ("SerScan: [Close] After CallParent Status = %x\n",
  102. Status));
  103. //
  104. // WORKWORK: If we are in filter mode we need to disconnect here...
  105. //
  106. IoCompleteRequest(Irp, IO_NO_INCREMENT);
  107. return Status;
  108. }