Source code of Windows XP (NT5)
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.

143 lines
3.3 KiB

  1. //+-----------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1992 - 1994
  6. //
  7. // File: sidcache.h
  8. //
  9. // Contents: types and prototypes for sid cache management
  10. //
  11. //
  12. // History: 15-May-1997 MikeSw Created
  13. //
  14. //------------------------------------------------------------------------------
  15. #ifndef __SIDCACHE_H__
  16. #define __SIDCACHE_H__
  17. ////////////////////////////////////////////////////////////////////////////////
  18. //
  19. // Sid Cache Data types exported for lsaexts
  20. //
  21. ////////////////////////////////////////////////////////////////////////////////
  22. typedef struct _LSAP_DB_SID_CACHE_ENTRY {
  23. struct _LSAP_DB_SID_CACHE_ENTRY * Next;
  24. //
  25. // Cache data
  26. //
  27. PSID Sid;
  28. UNICODE_STRING AccountName;
  29. SID_NAME_USE SidType;
  30. PSID DomainSid;
  31. UNICODE_STRING DomainName;
  32. //
  33. // These time values are only used for SID cache
  34. // entries that aren't associated with an actual logon session.
  35. //
  36. LARGE_INTEGER ExpirationTime;
  37. LARGE_INTEGER RefreshTime;
  38. LARGE_INTEGER CreateTime;
  39. LARGE_INTEGER LastUse;
  40. ULONG Flags;
  41. //
  42. // InUseCount is only used for SID cache entries that are
  43. // currently associated with an actual logon session. As long as
  44. // InUseCount is nonzero, ExpirationTime will not be checked.
  45. // Once InUseCount is zero, ExpirationTime will be set.
  46. //
  47. LONG InUseCount;
  48. } LSAP_DB_SID_CACHE_ENTRY, *PLSAP_DB_SID_CACHE_ENTRY;
  49. //
  50. // Flags to describe the cache entry
  51. //
  52. //
  53. // The name in the AccountName and DomainName fields represents
  54. // a SAM account name
  55. //
  56. #define LSAP_SID_CACHE_SAM_ACCOUNT_NAME 0x00000001
  57. //
  58. // The AccountName is a UPN
  59. //
  60. #define LSAP_SID_CACHE_UPN 0x00000002
  61. ////////////////////////////////////////////////////////////////////////////////
  62. //
  63. // Exported Sid Cache functions
  64. //
  65. ////////////////////////////////////////////////////////////////////////////////
  66. NTSTATUS
  67. LsapDbInitSidCache(
  68. VOID
  69. );
  70. VOID
  71. LsapSidCacheReadParameters(
  72. HKEY hKey
  73. );
  74. VOID
  75. LsapDbUpdateCacheWithSids(
  76. IN PSID *Sids,
  77. IN ULONG Count,
  78. IN OUT PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
  79. IN PLSA_TRANSLATED_NAME_EX TranslatedNames
  80. );
  81. VOID
  82. LsapDbUpdateCacheWithNames(
  83. IN PUNICODE_STRING AccountNames,
  84. IN PUNICODE_STRING DomainNames,
  85. IN ULONG Count,
  86. IN OUT PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
  87. IN PLSAPR_TRANSLATED_SID_EX2 TranslatedSids
  88. );
  89. NTSTATUS
  90. LsapDbMapCachedSids(
  91. IN PSID *Sids,
  92. IN ULONG Count,
  93. IN BOOLEAN UseOldEntries,
  94. IN OUT PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
  95. OUT PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
  96. OUT PULONG MappedCount
  97. );
  98. NTSTATUS
  99. LsapDbMapCachedNames(
  100. IN ULONG LookupOptions,
  101. IN PUNICODE_STRING AccountNames,
  102. IN PUNICODE_STRING DomainNames,
  103. IN ULONG Count,
  104. IN BOOLEAN UseOldEntries,
  105. IN OUT PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
  106. OUT PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids,
  107. OUT PULONG MappedCount
  108. );
  109. VOID
  110. LsapDbAddLogonNameToCache(
  111. IN PUNICODE_STRING AccountName,
  112. IN PUNICODE_STRING DomainName,
  113. IN PSID AccountSid
  114. );
  115. VOID
  116. LsapDbReleaseLogonNameFromCache(
  117. IN PSID Sid
  118. );
  119. #endif // __SIDCACHE_H__