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.

195 lines
4.5 KiB

  1. #ifndef __LNKLIST_H__
  2. #define __LNKLIST_H__
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include "pstypes.h"
  7. #include "listbase.h"
  8. #include <sha.h>
  9. //////////////////////
  10. // OpenItem list
  11. // item list element
  12. typedef struct _OPENITEM_LIST_ITEM
  13. {
  14. // internal to list
  15. struct _OPENITEM_LIST_ITEM * pNext;
  16. // Lookup devices: set by creator before adding to list
  17. PST_PROVIDER_HANDLE hPSTProv;
  18. PST_KEY Key;
  19. GUID guidType;
  20. GUID guidSubtype;
  21. LPWSTR szItemName;
  22. // item data
  23. BYTE rgbPwd[A_SHA_DIGEST_LEN];
  24. BYTE rgbPwdLowerCase[A_SHA_DIGEST_LEN];
  25. LPWSTR szMasterKey;
  26. PST_ACCESSMODE ModeFlags;
  27. } OPENITEM_LIST_ITEM, *POPENITEM_LIST_ITEM;
  28. class COpenItemList : public CLinkedList
  29. {
  30. // CLinkedList list;
  31. public:
  32. COpenItemList();
  33. BOOL AddToList(POPENITEM_LIST_ITEM pli)
  34. { return CLinkedList::AddToList((ELT*)pli); }
  35. BOOL DelFromList(POPENITEM_LIST_ITEM pli)
  36. { return CLinkedList::DelFromList((ELT*)pli); }
  37. POPENITEM_LIST_ITEM SearchList(POPENITEM_LIST_ITEM pli)
  38. { return (POPENITEM_LIST_ITEM) CLinkedList::SearchList((ELT*)pli); }
  39. };
  40. //////////////////////////
  41. // Associated functions
  42. void CreateOpenListItem(
  43. OPENITEM_LIST_ITEM* pli,
  44. PST_PROVIDER_HANDLE* phPSTProv,
  45. PST_KEY Key,
  46. const GUID* pguidType,
  47. const GUID* pguidSubtype,
  48. LPCWSTR szItemName);
  49. BOOL OpenItemIsMatch(
  50. ELT* pCandidate,
  51. ELT* pTemplate);
  52. void OpenItemFreeElt(
  53. ELT* pli);
  54. //////////////////////
  55. // User Authentication Cache list
  56. // item list element
  57. typedef struct _UACACHE_LIST_ITEM
  58. {
  59. // internal to list
  60. struct _UACACHE_LIST_ITEM * pNext;
  61. // Lookup devices: set by creator before adding to list
  62. LPWSTR szUserName;
  63. LPWSTR szMKName;
  64. LUID luidAuthID; // NT authentication ID
  65. // item data
  66. BYTE rgbPwd[A_SHA_DIGEST_LEN];
  67. BYTE rgbPwdLowerCase[A_SHA_DIGEST_LEN];
  68. } UACACHE_LIST_ITEM, *PUACACHE_LIST_ITEM;
  69. class CUAList : public CLinkedList
  70. {
  71. public:
  72. CUAList();
  73. BOOL AddToList(PUACACHE_LIST_ITEM pli)
  74. { return CLinkedList::AddToList((ELT*)pli); }
  75. BOOL DelFromList(PUACACHE_LIST_ITEM pli)
  76. { return CLinkedList::DelFromList((ELT*)pli); }
  77. PUACACHE_LIST_ITEM SearchList(PUACACHE_LIST_ITEM pli)
  78. { return (PUACACHE_LIST_ITEM) CLinkedList::SearchList((ELT*)pli); }
  79. };
  80. ///////////////////////////
  81. // Associated functions
  82. void CreateUACacheListItem(
  83. UACACHE_LIST_ITEM* pli,
  84. LPCWSTR szUserName,
  85. LPCWSTR szMKName,
  86. LUID *pluidAuthID);
  87. BOOL UACacheIsMatch(
  88. ELT* pCandidate,
  89. ELT* pTemplate);
  90. void UACacheFreeElt(
  91. ELT* pli);
  92. //////////////////////////////
  93. // CryptProv list
  94. // item list element
  95. typedef struct _CRYPTPROV_LIST_ITEM
  96. {
  97. // internal to list
  98. struct _CRYPTPROV_LIST_ITEM * pNext;
  99. // Lookup device
  100. // DWORD dwProvID;
  101. DWORD dwAlgId1;
  102. DWORD dwKeySize1;
  103. DWORD dwAlgId2;
  104. DWORD dwKeySize2;
  105. // item data
  106. HCRYPTPROV hProv;
  107. } CRYPTPROV_LIST_ITEM, *PCRYPTPROV_LIST_ITEM;
  108. class CCryptProvList : public CLinkedList
  109. {
  110. public:
  111. CCryptProvList();
  112. BOOL AddToList(PCRYPTPROV_LIST_ITEM pli)
  113. { return CLinkedList::AddToList((ELT*)pli); }
  114. BOOL DelFromList(PCRYPTPROV_LIST_ITEM pli)
  115. { return CLinkedList::DelFromList((ELT*)pli); }
  116. PCRYPTPROV_LIST_ITEM SearchList(PCRYPTPROV_LIST_ITEM pli)
  117. { return (PCRYPTPROV_LIST_ITEM) CLinkedList::SearchList((ELT*)pli); }
  118. };
  119. ///////////////////////////
  120. // Associated functions
  121. void CreateCryptProvListItem(CRYPTPROV_LIST_ITEM* pli,
  122. DWORD dwAlgId1,
  123. DWORD dwKeySize1,
  124. DWORD dwAlgId2,
  125. DWORD dwKeySize2,
  126. HCRYPTPROV hCryptProv);
  127. BOOL CryptProvIsMatch(
  128. ELT* pCandidate,
  129. ELT* pTemplate);
  130. void CryptProvFreeElt(
  131. ELT* p);
  132. #ifdef __cplusplus
  133. }
  134. #endif
  135. #endif // __LNKLIST_H__