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.

100 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 1997-2000 Microsoft Corporation
  3. Module Name:
  4. common.c
  5. Abstract:
  6. This module provides the functions which are common to both the PDO and FDO.
  7. Author:
  8. Andy Thornton (andrewth) 20-Oct-97
  9. Revision History:
  10. --*/
  11. #include "mfp.h"
  12. /*++
  13. The majority of functions in this file are called based on their presence
  14. in Pnp and Po dispatch tables. In the interests of brevity the arguments
  15. to all those functions will be described below:
  16. NTSTATUS
  17. MfXxxCommon(
  18. IN PIRP Irp,
  19. IN PMF_COMMON_EXTENSION Common,
  20. IN PIO_STACK_LOCATION IrpStack
  21. )
  22. Routine Description:
  23. This function handles the Xxx requests for all multifunction devices
  24. Arguments:
  25. Irp - Points to the IRP associated with this request.
  26. Parent - Points to the common device extension.
  27. IrpStack - Points to the current stack location for this request.
  28. Return Value:
  29. Status code that indicates whether or not the function was successful.
  30. STATUS_NOT_SUPPORTED indicates that the IRP should be passed down without
  31. changing the Irp->IoStatus.Status field otherwise it is updated with this
  32. status.
  33. --*/
  34. NTSTATUS
  35. MfDeviceUsageNotificationCommon(
  36. IN PIRP Irp,
  37. IN PMF_COMMON_EXTENSION Common,
  38. IN PIO_STACK_LOCATION IrpStack
  39. )
  40. {
  41. PULONG counter;
  42. //
  43. // Select the appropriate counter
  44. //
  45. switch (IrpStack->Parameters.UsageNotification.Type) {
  46. case DeviceUsageTypePaging:
  47. counter = &Common->PagingCount;
  48. break;
  49. case DeviceUsageTypeHibernation:
  50. counter = &Common->HibernationCount;
  51. break;
  52. case DeviceUsageTypeDumpFile:
  53. counter = &Common->DumpCount;
  54. break;
  55. default:
  56. return STATUS_NOT_SUPPORTED;
  57. }
  58. //
  59. // Update it...
  60. //
  61. IoAdjustPagingPathCount(counter,
  62. IrpStack->Parameters.UsageNotification.InPath
  63. );
  64. return STATUS_SUCCESS;
  65. }