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.

179 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. omlist.c
  5. Abstract:
  6. Object Manager list processing routines for the NT Cluster Service
  7. Author:
  8. John Vert (jvert) 27-Feb-1996
  9. Revision History:
  10. --*/
  11. #include "omp.h"
  12. POM_HEADER
  13. OmpFindIdInList(
  14. IN PLIST_ENTRY ListHead,
  15. IN LPCWSTR Id
  16. )
  17. /*++
  18. Routine Description:
  19. Searches the specified list of objects for the given name.
  20. Arguments:
  21. ListHead - Supplies the head of the object list.
  22. Id - Supplies the Id string of the object.
  23. Return Value:
  24. A pointer to the specified object's OM_HEADER if it is found
  25. NULL if the given Id string was not found
  26. Notes:
  27. This routine assumes the the critical section for the object type
  28. is held on entry.
  29. --*/
  30. {
  31. PLIST_ENTRY ListEntry;
  32. POM_HEADER Header;
  33. POM_HEADER FoundHeader = NULL;
  34. ListEntry = ListHead->Flink;
  35. while (ListEntry != ListHead) {
  36. Header = CONTAINING_RECORD(ListEntry, OM_HEADER, ListEntry);
  37. if (lstrcmpiW(Header->Id, Id) == 0) {
  38. FoundHeader = Header;
  39. break;
  40. }
  41. ListEntry = ListEntry->Flink;
  42. }
  43. return(FoundHeader);
  44. } // OmpFindIdInList
  45. POM_HEADER
  46. OmpFindNameInList(
  47. IN PLIST_ENTRY ListHead,
  48. IN LPCWSTR Name
  49. )
  50. /*++
  51. Routine Description:
  52. Searches the specified list of objects for the given name.
  53. Arguments:
  54. ListHead - Supplies the head of the object list.
  55. Name - Supplies the name of the object.
  56. Return Value:
  57. A pointer to the specified object's OM_HEADER if it is found
  58. NULL if the given name was not found
  59. Notes:
  60. This routine assumes the the critical section for the object type
  61. is held on entry.
  62. --*/
  63. {
  64. PLIST_ENTRY ListEntry;
  65. POM_HEADER Header;
  66. POM_HEADER FoundHeader = NULL;
  67. ListEntry = ListHead->Flink;
  68. while (ListEntry != ListHead) {
  69. Header = CONTAINING_RECORD(ListEntry, OM_HEADER, ListEntry);
  70. if (lstrcmpiW(Header->Name, Name) == 0) {
  71. FoundHeader = Header;
  72. break;
  73. }
  74. ListEntry = ListEntry->Flink;
  75. }
  76. return(FoundHeader);
  77. } // OmpFindNameInList
  78. POM_NOTIFY_RECORD
  79. OmpFindNotifyCbInList(
  80. IN PLIST_ENTRY ListHead,
  81. IN OM_OBJECT_NOTIFYCB pfnObjNotifyCb
  82. )
  83. /*++
  84. Routine Description:
  85. Searches the specified list of objects for the given name.
  86. Arguments:
  87. ListHead - Supplies the head of the object list.
  88. pfnObjNotifyCb - Supplies the callback fn that we are looking
  89. for.
  90. Return Value:
  91. A pointer to the specified object's OM_NOTIFY_RECORD if it is found
  92. NULL if the given Id string was not found
  93. Notes:
  94. This routine assumes the the critical section for the object type
  95. is held on entry.
  96. --*/
  97. {
  98. PLIST_ENTRY ListEntry;
  99. POM_NOTIFY_RECORD pNotifyRec;
  100. POM_NOTIFY_RECORD pFoundNotifyRec = NULL;
  101. ListEntry = ListHead->Flink;
  102. while (ListEntry != ListHead) {
  103. pNotifyRec = CONTAINING_RECORD(ListEntry, OM_NOTIFY_RECORD, ListEntry);
  104. if (pNotifyRec->pfnObjNotifyCb == pfnObjNotifyCb)
  105. {
  106. pFoundNotifyRec = pNotifyRec;
  107. break;
  108. }
  109. ListEntry = ListEntry->Flink;
  110. }
  111. return(pFoundNotifyRec);
  112. } // OmpFindNotifyCbInList