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.

90 lines
1.3 KiB

  1. /*++
  2. *
  3. * Component: hidserv.dll
  4. * File: list.c
  5. * Purpose: Generic singly linked list.
  6. *
  7. * Copyright (C) Microsoft Corporation 1997,1998. All rights reserved.
  8. *
  9. * WGJ
  10. --*/
  11. #include "hidserv.h"
  12. void
  13. InsertTailList(
  14. PLIST_NODE head,
  15. PLIST_NODE entry
  16. )
  17. /*++
  18. Routine Description:
  19. --*/
  20. {
  21. PLIST_NODE pCurrent = head;
  22. entry->pNext = 0;
  23. while(pCurrent->pNext)
  24. pCurrent = pCurrent->pNext;
  25. pCurrent->pNext = entry;
  26. }
  27. BOOL
  28. RemoveEntryList(
  29. PLIST_NODE head,
  30. PLIST_NODE entry
  31. )
  32. /*++
  33. Routine Description:
  34. --*/
  35. {
  36. PLIST_NODE pCurrent = head;
  37. while(pCurrent->pNext != entry){
  38. pCurrent = pCurrent->pNext;
  39. if(pCurrent == 0) return FALSE;
  40. }
  41. pCurrent->pNext = entry->pNext;
  42. return TRUE;
  43. }
  44. void
  45. InsertHeadList(
  46. PLIST_NODE head,
  47. PLIST_NODE entry
  48. )
  49. /*++
  50. Routine Description:
  51. --*/
  52. {
  53. entry->pNext = head->pNext;
  54. head->pNext = entry;
  55. }
  56. BOOL
  57. IsNodeOnList(
  58. PLIST_NODE head,
  59. PLIST_NODE entry
  60. )
  61. /*++
  62. Routine Description:
  63. --*/
  64. {
  65. PLIST_NODE pCurrent = head;
  66. while(pCurrent->pNext != entry){
  67. pCurrent = pCurrent->pNext;
  68. if(pCurrent == 0) return FALSE;
  69. }
  70. return TRUE;
  71. }