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.

66 lines
1.1 KiB

  1. /*++
  2. Copyright (c) 1989-2001 Microsoft Corporation
  3. Module Name:
  4. debug.c
  5. Abstract:
  6. Platform independent utility functions
  7. Author:
  8. Jiandong Ruan
  9. Revision History:
  10. --*/
  11. #include "precomp.h"
  12. #include "debug.tmh"
  13. #if DBG
  14. BOOL
  15. EntryIsInList(PLIST_ENTRY ListHead, PLIST_ENTRY SearchEntry)
  16. /*++
  17. Routine Description:
  18. This routine search SearchEntry in the list ListHead.
  19. NOTE: proper lock should be held before calling this function.
  20. Arguments:
  21. ListHead the head of the list
  22. SearchEntry the entry to be searched
  23. Return Value:
  24. TRUE if the entry is in the list
  25. FALSE otherwise
  26. --*/
  27. {
  28. PLIST_ENTRY Entry;
  29. KIRQL Irql;
  30. Irql = KeGetCurrentIrql();
  31. if (Irql < DISPATCH_LEVEL) {
  32. KdPrint (("Spin lock should be held before calling IsEntryList\n"));
  33. DbgBreakPoint();
  34. return FALSE;
  35. }
  36. Entry = ListHead->Flink;
  37. while(Entry != ListHead) {
  38. if (Entry == SearchEntry) {
  39. return TRUE;
  40. }
  41. Entry = Entry->Flink;
  42. }
  43. return FALSE;
  44. }
  45. #endif