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.

118 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. notify.c
  5. Abstract:
  6. User-mode interface to UL.SYS.
  7. Author:
  8. Paul McDaniel (paulmcd) 07-Mar-2000
  9. Revision History:
  10. --*/
  11. #include "precomp.h"
  12. //
  13. // Private macros.
  14. //
  15. //
  16. // Private prototypes.
  17. //
  18. //
  19. // Public functions.
  20. //
  21. /***************************************************************************++
  22. Routine Description:
  23. SrWaitForNotificaiton is used to receive volume activity notifications
  24. from the driver. This includes new volume, delete volume, and out of disk
  25. space for a volume.
  26. Arguments:
  27. ControlHandle - the HANDLE from SrCreateControlHandle.
  28. pNotification - the buffer to hold the NOTIFICATION_RECORD.
  29. NotificationLength - the length in bytes of pNotification
  30. pOverlapped - an OVERLAPPED structure if async io is enabled on the
  31. HANDLE.
  32. Return Value:
  33. ULONG - Completion status.
  34. --***************************************************************************/
  35. ULONG
  36. WINAPI
  37. SrWaitForNotification(
  38. IN HANDLE ControlHandle,
  39. OUT PSR_NOTIFICATION_RECORD pNotification,
  40. IN ULONG NotificationLength,
  41. IN LPOVERLAPPED pOverlapped OPTIONAL
  42. )
  43. {
  44. NTSTATUS Status;
  45. #if DBG
  46. RtlFillMemory( pNotification, NotificationLength, '\xcc' );
  47. #endif
  48. //
  49. // Make the request.
  50. //
  51. if (pOverlapped == NULL)
  52. {
  53. Status = SrpSynchronousDeviceControl(
  54. ControlHandle, // FileHandle
  55. IOCTL_SR_WAIT_FOR_NOTIFICATION, // IoControlCode
  56. NULL, // pInputBuffer
  57. 0, // InputBufferLength
  58. pNotification, // pOutputBuffer
  59. NotificationLength, // OutputBufferLength
  60. NULL // pBytesTransferred
  61. );
  62. }
  63. else
  64. {
  65. Status = SrpOverlappedDeviceControl(
  66. ControlHandle, // FileHandle
  67. pOverlapped, // pOverlapped
  68. IOCTL_SR_WAIT_FOR_NOTIFICATION, // IoControlCode
  69. NULL, // pInputBuffer
  70. 0, // InputBufferLength
  71. pNotification, // pOutputBuffer
  72. NotificationLength, // OutputBufferLength
  73. NULL // pBytesTransferred
  74. );
  75. }
  76. return SrpNtStatusToWin32Status( Status );
  77. } // SrWaitForNotification
  78. //
  79. // Private functions.
  80. //