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.

346 lines
6.2 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. credp.hxx
  5. Abstract:
  6. Credential Manager private interfaces
  7. Author:
  8. Cliff Van Dyke (CliffV)
  9. Environment:
  10. Revision History:
  11. --*/
  12. #ifndef _CREDP_HXX_
  13. #define _CREDP_HXX_
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. //
  18. // Structure describing a set of credentials.
  19. //
  20. typedef struct _CREDENTIAL_SET {
  21. //
  22. // Number of references to the credential set.
  23. // Access serialized by CredentialSetListLock
  24. //
  25. LONG ReferenceCount;
  26. //
  27. // List of credentials for this credential set.
  28. // Access serialized by UserCredentialSets->CritSect
  29. //
  30. LIST_ENTRY Credentials;
  31. //
  32. // Flag indicating the credential set has been read from disk
  33. // Access serialized by UserCredentialSets->CritSect
  34. //
  35. BOOLEAN FileRead;
  36. //
  37. // Flag indicating if the credential set is dirty
  38. // Access serialized by UserCredentialSets->CritSect
  39. //
  40. BOOLEAN Dirty;
  41. //
  42. // Flag indicating a thread is already writing the credential set.
  43. // Access serialized by UserCredentialSets->CritSect
  44. //
  45. BOOLEAN BeingWritten;
  46. //
  47. // Count of times cred set has been marked dirty.
  48. // Access serialized by UserCredentialSets->CritSect
  49. //
  50. ULONG WriteCount;
  51. } CREDENTIAL_SET, *PCREDENTIAL_SET;
  52. //
  53. // Structure describing a set of credential sets specific to a particular user
  54. //
  55. typedef struct _USER_CREDENTIAL_SETS {
  56. //
  57. // Link to next entry in the global list of all user credential sets (CredentialSetList).
  58. // Access serialized by CredentialSetListLock
  59. //
  60. LIST_ENTRY Next;
  61. //
  62. // Number of references to the credential set.
  63. // Access serialized by CredentialSetListLock
  64. //
  65. LONG ReferenceCount;
  66. //
  67. // The credential set replicated enterprise wide.
  68. //
  69. PCREDENTIAL_SET EnterpriseCredSet;
  70. //
  71. // The credential set specific to this machine
  72. //
  73. PCREDENTIAL_SET LocalMachineCredSet;
  74. //
  75. // Sid of the user owning this credential set.
  76. // Access not serialized. This field is constant.
  77. //
  78. PSID UserSid;
  79. //
  80. // Critical Section to serialize access to credentials
  81. //
  82. RTL_CRITICAL_SECTION CritSect;
  83. } USER_CREDENTIAL_SETS, *PUSER_CREDENTIAL_SETS;
  84. //
  85. // Structure describing a set of credential sets specific to a particular session
  86. //
  87. typedef struct _SESSION_CREDENTIAL_SETS {
  88. //
  89. // Number of references to the session credential sets.
  90. // Access serialized by CredentialSetListLock
  91. //
  92. LONG ReferenceCount;
  93. //
  94. // The credential set specific to this session.
  95. //
  96. PCREDENTIAL_SET SessionCredSet;
  97. //
  98. // List of the PROMPT_DATA for session specific and non-session specific credentials
  99. //
  100. LIST_ENTRY PromptData;
  101. //
  102. // Cache of target infos
  103. //
  104. #define CRED_TARGET_INFO_HASH_TABLE_SIZE 16
  105. LIST_ENTRY TargetInfoHashTable[ CRED_TARGET_INFO_HASH_TABLE_SIZE ];
  106. LIST_ENTRY TargetInfoLruList;
  107. // Number of entries in TargetInfoHashTable and TargetInfoLruList
  108. ULONG TargetInfoCount;
  109. //
  110. // Flag indicating that the profile containing the credential set
  111. // has been loaded.
  112. //
  113. BOOLEAN ProfileLoaded;
  114. } SESSION_CREDENTIAL_SETS, *PSESSION_CREDENTIAL_SETS;
  115. //
  116. // Structure describing all of the credential sets for a logon session
  117. //
  118. typedef struct _CREDENTIAL_SETS {
  119. //
  120. // Credential sets shared by all logon sessions for this user.
  121. //
  122. PUSER_CREDENTIAL_SETS UserCredentialSets;
  123. //
  124. // Credential sets specific to this logon session
  125. //
  126. PSESSION_CREDENTIAL_SETS SessionCredSets;
  127. //
  128. // Attributes of the credential set
  129. //
  130. ULONG Flags;
  131. #define CREDSETS_FLAGS_LOCAL_ACCOUNT 0x01 // User is logged onto a local account
  132. } CREDENTIAL_SETS, *PCREDENTIAL_SETS;
  133. //
  134. // Functions
  135. //
  136. NTSTATUS
  137. CrediWrite(
  138. IN PLUID LogonId,
  139. IN ULONG CredFlags,
  140. IN PENCRYPTED_CREDENTIALW Credential,
  141. IN ULONG Flags
  142. );
  143. NTSTATUS
  144. CrediRead (
  145. IN PLUID LogonId,
  146. IN ULONG CredFlags,
  147. IN LPWSTR TargetName,
  148. IN ULONG Type,
  149. IN ULONG Flags,
  150. OUT PENCRYPTED_CREDENTIALW *Credential
  151. );
  152. NTSTATUS
  153. CrediEnumerate (
  154. IN PLUID LogonId,
  155. IN ULONG CredFlags,
  156. IN LPWSTR Filter,
  157. IN ULONG Flags,
  158. OUT PULONG Count,
  159. OUT PENCRYPTED_CREDENTIALW **Credential
  160. );
  161. NTSTATUS
  162. CrediWriteDomainCredentials (
  163. IN PLUID LogonId,
  164. IN ULONG CredFlags,
  165. IN PCREDENTIAL_TARGET_INFORMATIONW TargetInfo,
  166. IN PENCRYPTED_CREDENTIALW Credential,
  167. IN ULONG Flags
  168. );
  169. NTSTATUS
  170. CrediReadDomainCredentials (
  171. IN PLUID LogonId,
  172. IN ULONG CredFlags,
  173. IN PCREDENTIAL_TARGET_INFORMATIONW TargetInfo,
  174. IN ULONG Flags,
  175. OUT PULONG Count,
  176. OUT PENCRYPTED_CREDENTIALW **Credential
  177. );
  178. VOID
  179. CrediFreeCredentials (
  180. IN ULONG Count,
  181. IN PENCRYPTED_CREDENTIALW *Credentials OPTIONAL
  182. );
  183. NTSTATUS
  184. CrediDelete (
  185. IN PLUID LogonId,
  186. IN ULONG CredFlags,
  187. IN LPWSTR TargetName,
  188. IN ULONG Type,
  189. IN ULONG Flags
  190. );
  191. NTSTATUS
  192. CrediRename (
  193. IN PLUID LogonId,
  194. IN LPWSTR OldTargetName,
  195. IN LPWSTR NewTargetName,
  196. IN ULONG Type,
  197. IN ULONG Flags
  198. );
  199. NTSTATUS
  200. CrediGetTargetInfo (
  201. IN PLUID LogonId,
  202. IN LPWSTR TargetServerName,
  203. IN ULONG Flags,
  204. OUT PCREDENTIAL_TARGET_INFORMATIONW *TargetInfo
  205. );
  206. NTSTATUS
  207. CrediGetSessionTypes (
  208. IN PLUID LogonId,
  209. IN DWORD MaximumPersistCount,
  210. OUT LPDWORD MaximumPersist
  211. );
  212. NTSTATUS
  213. CrediProfileLoaded (
  214. IN PLUID LogonId
  215. );
  216. NTSTATUS
  217. CredpInitialize(
  218. VOID
  219. );
  220. NTSTATUS
  221. CredpCreateCredSets(
  222. IN PSID UserSid,
  223. IN PUNICODE_STRING NetbiosDomainName,
  224. OUT PCREDENTIAL_SETS CredentialSets
  225. );
  226. VOID
  227. CredpDereferenceCredSets(
  228. IN PCREDENTIAL_SETS CredentialSets
  229. );
  230. VOID
  231. CredpNotifyPasswordChange(
  232. IN PUNICODE_STRING NetbiosDomainName,
  233. IN PUNICODE_STRING UserName,
  234. IN PUNICODE_STRING DnsDomainName OPTIONAL,
  235. IN PUNICODE_STRING Upn OPTIONAL,
  236. IN PUNICODE_STRING NewPassword
  237. );
  238. VOID
  239. LsaProtectMemory(
  240. VOID *pData,
  241. ULONG cbData
  242. );
  243. VOID
  244. LsaUnprotectMemory(
  245. VOID *pData,
  246. ULONG cbData
  247. );
  248. #ifdef __cplusplus
  249. } // extern C
  250. #endif
  251. #endif // _CREDP_HXX_