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.

107 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. remlock.h
  5. Abstract:
  6. Common RemoveLock
  7. Authors:
  8. Jeff Midkiff
  9. Environment:
  10. kernel mode only
  11. Notes:
  12. Simple binary compatible RemoveLock definitions for Win9x & Win2k
  13. made to mimic the new Win2k ONLY IoXxxRemoveLock functions.
  14. See the Win2k DDK for descriptions.
  15. Revision History:
  16. --*/
  17. #include <ntverp.h>
  18. #include <wdm.h>
  19. #if !defined (_REMLOCK_)
  20. #define _REMLOCK_
  21. #if (DBG && WIN2K_LOCKS)
  22. #include "debug.h"
  23. typedef IO_REMOVE_LOCK REMOVE_LOCK;
  24. typedef PIO_REMOVE_LOCK PREMOVE_LOCK;
  25. __inline VOID InitializeRemoveLock(IN PREMOVE_LOCK Lock) {
  26. IoInitializeRemoveLock(Lock, 'HECW', 1, 100);
  27. DbgDump(DBG_LOCKS, ("InitializeRemoveLock: %p, %d\n", Lock, Lock->Common.IoCount));
  28. }
  29. __inline NTSTATUS AcquireRemoveLock(PIO_REMOVE_LOCK Lock, PVOID Tag) {
  30. NTSTATUS status = IoAcquireRemoveLock(Lock, Tag);
  31. DbgDump(DBG_LOCKS, ("AcquireRemoveLock: %d, %p\n", Lock->Common.IoCount, Tag));
  32. return status;
  33. }
  34. __inline VOID ReleaseRemoveLock(PIO_REMOVE_LOCK Lock, PVOID Tag) {
  35. IoReleaseRemoveLock(Lock, Tag);
  36. DbgDump(DBG_LOCKS, ("ReleaseRemoveLock: %d, %p\n", Lock->Common.IoCount, Tag));
  37. }
  38. __inline VOID ReleaseRemoveLockAndWait(PIO_REMOVE_LOCK Lock, PVOID Tag) {
  39. DbgDump(DBG_LOCKS, ("ReleaseRemoveLockAndWait: %d, %p\n", Lock->Common.IoCount, Tag));
  40. IoReleaseRemoveLockAndWait(Lock, Tag);
  41. }
  42. #else
  43. typedef struct _REMOVE_LOCK {
  44. BOOLEAN Removed;
  45. BOOLEAN Reserved[3];
  46. LONG IoCount;
  47. KEVENT RemoveEvent;
  48. } REMOVE_LOCK, *PREMOVE_LOCK;
  49. VOID
  50. InitializeRemoveLock(
  51. IN PREMOVE_LOCK Lock
  52. );
  53. NTSTATUS
  54. AcquireRemoveLock(
  55. IN PREMOVE_LOCK Lock,
  56. IN OPTIONAL PVOID Tag
  57. );
  58. VOID
  59. ReleaseRemoveLock(
  60. IN PREMOVE_LOCK Lock,
  61. IN OPTIONAL PVOID Tag
  62. );
  63. VOID
  64. ReleaseRemoveLockAndWait(
  65. IN PREMOVE_LOCK Lock,
  66. IN OPTIONAL PVOID Tag
  67. );
  68. #endif
  69. #endif // _REMLOCK_
  70. //EOF