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.

185 lines
6.3 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // FILE : autoenrl.h //
  3. // DESCRIPTION : Auto Enrollment functions //
  4. // AUTHOR : //
  5. // HISTORY : //
  6. // //
  7. // Copyright (C) 1993-1999 Microsoft Corporation All Rights Reserved //
  8. /////////////////////////////////////////////////////////////////////////////
  9. #ifndef __AUTOENR_H__
  10. #define __AUTOENR_H__
  11. #if _MSC_VER > 1000
  12. #pragma once
  13. #endif
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /////////////////////////////////////////////////////////////////////////////////////////////////////
  18. //
  19. // CertAutoEnrollment
  20. //
  21. // Function to perform autoenrollment actions.
  22. //
  23. // Parameters:
  24. // IN hwndParent: The parent window
  25. // IN dwStatus: The status under which the function is called.
  26. // It can be one of the following:
  27. // CERT_AUTO_ENROLLMENT_START_UP
  28. // CERT_AUTO_ENROLLMENT_WAKE_UP
  29. //
  30. // Return Value:
  31. // HANDLE: The thread to wait on what does background autoenrollment
  32. // processing. NULL when there is no work to be done.
  33. //
  34. /////////////////////////////////////////////////////////////////////////////////////////////////////
  35. HANDLE
  36. WINAPI
  37. CertAutoEnrollment(IN HWND hwndParent,
  38. IN DWORD dwStatus);
  39. //the autoenrollment is called when the machine is booted or user first logs on
  40. #define CERT_AUTO_ENROLLMENT_START_UP 0x01
  41. //the autoenrollment is called when winlogon checks for policy changes
  42. #define CERT_AUTO_ENROLLMENT_WAKE_UP 0x02
  43. /////////////////////////////////////////////////////////////////////////////////////////////////////
  44. //
  45. // CertAutoRemove
  46. //
  47. // Function to remove enterprise specific public key trust upon domain disjoin.
  48. // Should be called under local admin's context.
  49. //
  50. // Parameters:
  51. // IN dwFlags: Should be one of the following flag:
  52. // CERT_AUTO_REMOVE_COMMIT
  53. // CERT_AUTO_REMOVE_ROLL_BACK
  54. //
  55. // Return Value:
  56. // BOOL: TURE is upon success
  57. //
  58. /////////////////////////////////////////////////////////////////////////////////////////////////////
  59. BOOL
  60. WINAPI
  61. CertAutoRemove(IN DWORD dwFlags);
  62. //remove enterprise specific public key trust upon domain disjoin
  63. #define CERT_AUTO_REMOVE_COMMIT 0x01
  64. //roll back all the publick key trust
  65. #define CERT_AUTO_REMOVE_ROLL_BACK 0x02
  66. /////////////////////////////////////////////////////////////////////////////////////////////////////
  67. //
  68. // Registry locations for userinit to check the autoenrollment requirements
  69. //
  70. /////////////////////////////////////////////////////////////////////////////////////////////////////
  71. //registry key for group policy settings
  72. #define AUTO_ENROLLMENT_KEY TEXT("SOFTWARE\\Policies\\Microsoft\\Cryptography\\AutoEnrollment")
  73. #define AUTO_ENROLLMENT_POLICY TEXT("AEPolicy")
  74. //registry key for user/machine wake up mode flags
  75. #define AUTO_ENROLLMENT_FLAG_KEY TEXT("SOFTWARE\\Microsoft\\Cryptography\\AutoEnrollment")
  76. #define AUTO_ENROLLMENT_FLAG TEXT("AEFlags")
  77. //possible flags for AUTO_ENROLLMENT_POLICY
  78. //the upper two bytes specify the behavior;
  79. //the lower two bytes enable/disable individual autoenrollment components
  80. #define AUTO_ENROLLMENT_ENABLE_TEMPLATE_CHECK 0x00000001
  81. #define AUTO_ENROLLMENT_ENABLE_MY_STORE_MANAGEMENT 0x00000002
  82. #define AUTO_ENROLLMENT_ENABLE_PENDING_FETCH 0x00000004
  83. //we will always check the user ds store.
  84. //#define AUTO_ENROLLMENT_ENABLE_USER_DS_STORE 0x00000008
  85. #define AUTO_ENROLLMENT_DISABLE_ALL 0x00008000
  86. #define AUTO_ENROLLMENT_BLOCK_USER_DS_STORE 0x00010000
  87. //possible flags for AUTO_ENROLLMENT_FLAG
  88. #define AUTO_ENROLLMENT_WAKE_UP_REQUIRED 0x01
  89. // 8 hour default autoenrollment rate
  90. #define AE_DEFAULT_REFRESH_RATE 8
  91. // policy location for autoenrollment rate
  92. #define SYSTEM_POLICIES_KEY L"Software\\Policies\\Microsoft\\Windows\\System"
  93. /////////////////////////////////////////////////////////////////////////////////////////////////////
  94. //
  95. // Timer/Event name for autoenrollment
  96. //
  97. /////////////////////////////////////////////////////////////////////////////////////////////////////
  98. #define MACHINE_AUTOENROLLMENT_TIMER_NAME L"AUTOENRL:MachineEnrollmentTimer"
  99. #define USER_AUTOENROLLMENT_TIMER_NAME L"AUTOENRL:UserEnrollmentTimer"
  100. #define MACHINE_AUTOENROLLMENT_TRIGGER_EVENT TEXT("AUTOENRL:TriggerMachineEnrollment")
  101. #define USER_AUTOENROLLMENT_TRIGGER_EVENT TEXT("AUTOENRL:TriggerUserEnrollment")
  102. /////////////////////////////////////////////////////////////////////////////////////////////////////
  103. //
  104. // W2K autoenrollment defines
  105. //
  106. /////////////////////////////////////////////////////////////////////////////////////////////////////
  107. typedef struct _AUTO_ENROLL_INFO_
  108. {
  109. LPSTR pszAutoEnrollProvider;
  110. LPWSTR pwszCertType;
  111. LPCWSTR pwszAutoEnrollmentID;
  112. HCERTSTORE hMYStore;
  113. BOOL fRenewal;
  114. PCCERT_CONTEXT pOldCert;
  115. DWORD dwProvType;
  116. DWORD dwKeySpec;
  117. DWORD dwGenKeyFlags;
  118. CERT_EXTENSIONS CertExtensions;
  119. LPWSTR pwszCAMachine;
  120. LPWSTR pwszCAAuthority;
  121. } AUTO_ENROLL_INFO, *PAUTO_ENROLL_INFO;
  122. DWORD
  123. AutoEnrollWrapper(
  124. PVOID CallbackState
  125. );
  126. BOOL ProvAutoEnrollment(
  127. IN BOOL fMachineEnrollment,
  128. IN PAUTO_ENROLL_INFO pInfo
  129. );
  130. typedef struct _CA_HASH_ENTRY_
  131. {
  132. DWORD cbHash;
  133. BYTE rgbHash[32];
  134. } CA_HASH_ENTRY, *PCA_HASH_ENTRY;
  135. #ifdef __cplusplus
  136. } // Balance extern "C" above
  137. #endif
  138. #endif // __AUTOENR_H__