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.

159 lines
3.2 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: cainfop.h
  7. //
  8. // Contents: Private definitions for CA Info
  9. //
  10. // History: 12-dec-97 petesk created
  11. //
  12. //---------------------------------------------------------------------------
  13. #ifndef __CAINFOP_H__
  14. #define __CAINFOP_H__
  15. #include <winldap.h>
  16. #define SYSTEM_CN TEXT("System")
  17. #define PUBLIC_KEY_SERVICES_CN TEXT("Public Key Services")
  18. #define CAS_CN TEXT("CAs")
  19. VOID CACleanup();
  20. DWORD
  21. DNStoRFC1779Name(
  22. WCHAR *rfcDomain,
  23. ULONG *rfcDomainLength,
  24. LPCWSTR dnsDomain);
  25. DWORD
  26. myGetSidFromDomain(
  27. IN LPWSTR wszDomain,
  28. OUT PSID *ppDomainSid);
  29. DWORD
  30. myGetEnterpriseDnsName(
  31. OUT LPWSTR *pwszDomain);
  32. BOOL
  33. myNetLogonUser(
  34. LPTSTR UserName,
  35. LPTSTR DomainName,
  36. LPTSTR Password,
  37. PHANDLE phToken);
  38. #ifndef DNS_MAX_NAME_LENGTH
  39. #define DNS_MAX_NAME_LENGTH 255
  40. #endif
  41. typedef WCHAR *CERTSTR;
  42. //
  43. // CAGetAuthoritativeDomainDn - retrieve the Domain root DN for this
  44. // domain. This retrieves config info from the DS for the default domain.
  45. //
  46. HRESULT
  47. CAGetAuthoritativeDomainDn(
  48. IN LDAP* LdapHandle,
  49. OUT CERTSTR *DomainDn,
  50. OUT CERTSTR *ConfigDN);
  51. //
  52. // CASCreateCADSEntry - This creates a CA entry in the DS for this CA,
  53. // and sets the appropriate entries for name, DN, certificate, dnsname.
  54. // It is for use by setup.
  55. // It creates the CA entry at the location
  56. // CN=bstrCAName,CN=CAs,CN=PublicKeyServices,CN=System,DC....root dc path...
  57. //
  58. HRESULT
  59. CASCreateCADSEntry(
  60. IN CERTSTR bstrCAName, // Name of the CA
  61. IN PCCERT_CONTEXT pCertificate); // Certificate of the CA
  62. HRESULT
  63. GetCertAuthorityDSLocation(
  64. IN LDAP *LdapHandle,
  65. CERTSTR bstrCAName,
  66. CERTSTR bstrDomainDN,
  67. CERTSTR *bstrDSLocation);
  68. class CCAProperty
  69. {
  70. public:
  71. CCAProperty(LPCWSTR wszName);
  72. HRESULT Find(LPCWSTR wszName, CCAProperty **ppCAProp);
  73. static HRESULT Append(CCAProperty **ppCAPropChain, CCAProperty *pNewProp);
  74. static HRESULT DeleteChain(CCAProperty **ppCAProp);
  75. HRESULT SetValue(LPWSTR * awszProperties);
  76. HRESULT GetValue(LPWSTR ** pawszProperties);
  77. HRESULT LoadFromRegValue(HKEY hkReg, LPCWSTR wszValue);
  78. HRESULT UpdateToRegValue(HKEY hkReg, LPCWSTR wszValue);
  79. protected:
  80. // Only call via DeleteChain
  81. ~CCAProperty();
  82. HRESULT _Cleanup();
  83. WCHAR ** m_awszValues;
  84. CERTSTR m_wszName;
  85. CCAProperty *m_pNext;
  86. private:
  87. };
  88. HRESULT CertFreeString(CERTSTR cstrString);
  89. CERTSTR CertAllocString(LPCWSTR wszString);
  90. CERTSTR CertAllocStringLen(LPCWSTR wszString, UINT len);
  91. CERTSTR CertAllocStringByteLen(LPCSTR szString, UINT len);
  92. UINT CertStringLen(CERTSTR cstrString);
  93. UINT CertStringByteLen(CERTSTR cstrString);
  94. HRESULT
  95. myRobustLdapBind(
  96. OUT LDAP **ppldap,
  97. IN BOOL fGC);
  98. HRESULT
  99. myRobustLdapBindEx(
  100. IN BOOL fGC,
  101. IN BOOL fRediscover,
  102. IN ULONG uVersion,
  103. OPTIONAL IN WCHAR const *pwszDomainName,
  104. OUT LDAP **ppldap,
  105. OPTIONAL OUT WCHAR **ppwszForestDNSName);
  106. HRESULT
  107. CAAccessCheckp(
  108. HANDLE ClientToken,
  109. PSECURITY_DESCRIPTOR pSD);
  110. HRESULT
  111. CAAccessCheckpEx(
  112. IN HANDLE ClientToken,
  113. IN PSECURITY_DESCRIPTOR pSD,
  114. IN DWORD dwOption);
  115. #endif // __CAINFOP_H__