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.

186 lines
4.0 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. credp.h
  5. Abstract:
  6. This module contains the private data structures and API definitions
  7. needed for the Credential Manager.
  8. Author:
  9. Cliff Van Dyke (CliffV) 28-February-2000
  10. Revision History:
  11. --*/
  12. #ifndef _CREDP_H_
  13. #define _CREDP_H_
  14. #if !defined(_ADVAPI32_)
  15. #define WINADVAPI DECLSPEC_IMPORT
  16. #else
  17. #define WINADVAPI
  18. #endif
  19. #include <lmcons.h>
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. //
  24. // Describe direction of character conversion
  25. //
  26. typedef enum _WTOA_ENUM {
  27. DoWtoA = 1, // Convert unicode to ansi
  28. DoAtoW, // Convert ansi to unicode
  29. DoWtoW // Convert unicode to unicode
  30. } WTOA_ENUM, *PWTOA_ENUM;
  31. //
  32. // Describe whether encoding or decoding should be done
  33. //
  34. typedef enum _ENCODE_BLOB_ENUM {
  35. DoBlobEncode = 0, // Encode CredentialBlob
  36. DoBlobDecode, // Decode CredentialBlob
  37. DoBlobNeither // Leave Credential blob intact
  38. } ENCODE_BLOB_ENUM, *PENCODE_BLOB_ENUM;
  39. //
  40. // Define the valid target name types
  41. //
  42. typedef enum _TARGET_NAME_TYPE {
  43. IsUsernameTarget,
  44. IsNotUsernameTarget,
  45. MightBeUsernameTarget
  46. } TARGET_NAME_TYPE, *PTARGET_NAME_TYPE;
  47. //
  48. // enum describing different types of wildcarding in the TargetName field of a credential.
  49. //
  50. typedef enum _WILDCARD_TYPE {
  51. WcDfsShareName, // Target name of the form <DfsRoot>\<DfsShare>
  52. WcServerName, // Target name of the form <ServerName>
  53. WcServerWildcard, // Wildcard of the form *.<DnsName>
  54. WcDomainWildcard, // Wildcard of the form <Domain>\*
  55. WcUniversalSessionWildcard, // Wildcard of the form "*Session"
  56. WcUniversalWildcard, // Wildcard of the form *
  57. WcUserName // Target Name equals UserName
  58. } WILDCARD_TYPE, *PWILDCARD_TYPE;
  59. //
  60. // When passing a credential around, the CredentialBlob field is encrypted.
  61. // This structure describes this encrypted form.
  62. //
  63. //
  64. #ifndef _ENCRYPTED_CREDENTIAL_DEFINED
  65. #define _ENCRYPTED_CREDENTIAL_DEFINED
  66. typedef struct _ENCRYPTED_CREDENTIALW {
  67. //
  68. // The credential
  69. //
  70. // The CredentialBlob field points to the encrypted credential
  71. // The CredentialBlobSize field is the length (in bytes) of the encrypted credential
  72. //
  73. CREDENTIALW Cred;
  74. //
  75. // The size in bytes of the clear text credential blob
  76. //
  77. ULONG ClearCredentialBlobSize;
  78. } ENCRYPTED_CREDENTIALW, *PENCRYPTED_CREDENTIALW;
  79. #endif // _ENCRYPTED_CREDENTIAL_DEFINED
  80. //
  81. // Macro to determine the size of the credential blob buffer to allocate
  82. //
  83. // Round up for RTL_ENCRYPT_MEMORY_SIZE
  84. //
  85. #define AllocatedCredBlobSize( _Size ) \
  86. ROUND_UP_COUNT( (_Size), RTL_ENCRYPT_MEMORY_SIZE )
  87. //
  88. // Procedures
  89. //
  90. WINADVAPI
  91. DWORD
  92. WINAPI
  93. CredpConvertTargetInfo (
  94. IN WTOA_ENUM WtoA,
  95. IN PCREDENTIAL_TARGET_INFORMATIONW InTargetInfo,
  96. OUT PCREDENTIAL_TARGET_INFORMATIONW *OutTargetInfo,
  97. OUT PULONG OutTargetInfoSize
  98. );
  99. WINADVAPI
  100. DWORD
  101. WINAPI
  102. CredpConvertCredential (
  103. IN WTOA_ENUM WtoA,
  104. IN ENCODE_BLOB_ENUM DoDecode,
  105. IN PCREDENTIALW InCredential,
  106. OUT PCREDENTIALW *OutCredential
  107. );
  108. WINADVAPI
  109. BOOL
  110. WINAPI
  111. CredpEncodeCredential (
  112. IN OUT PENCRYPTED_CREDENTIALW Credential
  113. );
  114. WINADVAPI
  115. BOOL
  116. WINAPI
  117. CredpDecodeCredential (
  118. IN OUT PENCRYPTED_CREDENTIALW Credential
  119. );
  120. WINADVAPI
  121. BOOL
  122. WINAPI
  123. CredProfileLoaded (
  124. VOID
  125. );
  126. NTSTATUS
  127. NET_API_FUNCTION
  128. CredpValidateTargetName(
  129. IN OUT LPWSTR TargetName,
  130. IN ULONG Type,
  131. IN TARGET_NAME_TYPE TargetNameType,
  132. IN LPWSTR *UserNamePointer OPTIONAL,
  133. IN LPDWORD PersistPointer OPTIONAL,
  134. OUT PULONG TargetNameSize,
  135. OUT PWILDCARD_TYPE WildcardTypePointer OPTIONAL,
  136. OUT PUNICODE_STRING NonWildcardedTargetName OPTIONAL
  137. );
  138. #ifdef __cplusplus
  139. }
  140. #endif
  141. #endif // _CREDP_H_