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.

231 lines
5.1 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. cpp.h
  5. Abstract:
  6. Private data structures and procedure prototypes for the
  7. Checkpoint Manager (CP) subcomponent of the NT Cluster Service
  8. Author:
  9. John Vert (jvert) 1/14/1997
  10. Revision History:
  11. --*/
  12. #define UNICODE 1
  13. #include "nt.h"
  14. #include "ntrtl.h"
  15. #include "nturtl.h"
  16. #include "service.h"
  17. #define LOG_CURRENT_MODULE LOG_MODULE_CP
  18. //global data relating to the quorum resource
  19. #if NO_SHARED_LOCKS
  20. extern CRITICAL_SECTION gQuoLock;
  21. #else
  22. extern RTL_RESOURCE gQuoLock;
  23. #endif
  24. //
  25. // This macro validates whether the passed in ID is NULL terminated. This is needed for
  26. // CP RPCs since all of those pass a string declared not as [string] but as an array of WCHARs whose
  27. // length is declared as CLUSTER_ID_SIZE. See CpDepositCheckpoint(...) definition in clusrpc.idl
  28. // for instance. Thus, there is no guarantee that the string will be NULL terminated by RPC runtime.
  29. // Thus, we need to make sure hackers can't blow us away with junk data directly targetting
  30. // the RPC endpoint (even though we make that hard with security callbacks.). Note that we
  31. // can't change the IDL definition since we will break mixed mode clusters.
  32. //
  33. #define CP_VALIDATE_ID_STRING( szId ) \
  34. { \
  35. if ( szId [ CLUSTER_ID_SIZE - 1 ] != UNICODE_NULL ) \
  36. return ( ERROR_INVALID_PARAMETER ); \
  37. }
  38. typedef struct _CP_CALLBACK_CONTEXT {
  39. PFM_RESOURCE Resource;
  40. LPCWSTR lpszPathName;
  41. BOOL IsChangeFileAttribute;
  42. } CP_CALLBACK_CONTEXT, *PCP_CALLBACK_CONTEXT;
  43. typedef struct _CP_RC2_W2k_KEYLEN_STRUCT
  44. {
  45. LPCWSTR lpszProviderName;
  46. DWORD dwDefaultKeyLength;
  47. DWORD dwDefaultEffectiveKeyLength;
  48. } CP_RC2_W2k_KEYLEN_STRUCT, *PCP_RC2_W2k_KEYLEN_STRUCT;
  49. //
  50. // Local function prototypes
  51. //
  52. DWORD
  53. CppReadCheckpoint(
  54. IN PFM_RESOURCE Resource,
  55. IN DWORD dwCheckpointId,
  56. IN LPCWSTR lpszFileName,
  57. IN BOOLEAN fCryptoCheckpoint
  58. );
  59. DWORD
  60. CppWriteCheckpoint(
  61. IN PFM_RESOURCE Resource,
  62. IN DWORD dwCheckpointId,
  63. IN LPCWSTR lpszFileName,
  64. IN BOOLEAN fCryptoCheckpoint
  65. );
  66. DWORD
  67. CppGetCheckpointFile(
  68. IN PFM_RESOURCE Resource,
  69. IN DWORD dwId,
  70. OUT OPTIONAL LPWSTR *pDirectoryName,
  71. OUT LPWSTR *pFileName,
  72. IN OPTIONAL LPCWSTR lpszQuorumDir,
  73. IN BOOLEAN fCryptoCheckpoint
  74. );
  75. DWORD
  76. CppCheckpoint(
  77. IN PFM_RESOURCE Resource,
  78. IN HKEY hKey,
  79. IN DWORD dwId,
  80. IN LPCWSTR KeyName
  81. );
  82. //
  83. // Crypto key checkpoint interfaces
  84. //
  85. DWORD
  86. CpckReplicateCryptoKeys(
  87. IN PFM_RESOURCE Resource
  88. );
  89. BOOL
  90. CpckRemoveCheckpointFileCallback(
  91. IN LPWSTR ValueName,
  92. IN LPVOID ValueData,
  93. IN DWORD ValueType,
  94. IN DWORD ValueSize,
  95. IN PCP_CALLBACK_CONTEXT Context
  96. );
  97. //
  98. // Registry watcher interfaces
  99. //
  100. DWORD
  101. CppWatchRegistry(
  102. IN PFM_RESOURCE Resource
  103. );
  104. DWORD
  105. CppUnWatchRegistry(
  106. IN PFM_RESOURCE Resource
  107. );
  108. DWORD
  109. CppRegisterNotify(
  110. IN PFM_RESOURCE Resource,
  111. IN LPCWSTR lpszKeyName,
  112. IN DWORD dwId
  113. );
  114. DWORD
  115. CppRundownCheckpoints(
  116. IN PFM_RESOURCE Resource
  117. );
  118. DWORD
  119. CppRundownCheckpointById(
  120. IN PFM_RESOURCE Resource,
  121. IN DWORD dwId
  122. );
  123. DWORD
  124. CppInstallDatabase(
  125. IN HKEY hKey,
  126. IN LPWSTR FileName
  127. );
  128. BOOL
  129. CppRemoveCheckpointFileCallback(
  130. IN LPWSTR ValueName,
  131. IN LPVOID ValueData,
  132. IN DWORD ValueType,
  133. IN DWORD ValueSize,
  134. IN PCP_CALLBACK_CONTEXT Context
  135. );
  136. DWORD CppDeleteCheckpointFile(
  137. IN PFM_RESOURCE Resource,
  138. IN DWORD dwCheckpointId,
  139. IN OPTIONAL LPCWSTR lpszQuorumPath
  140. );
  141. DWORD
  142. CpckDeleteCheckpointFile(
  143. IN PFM_RESOURCE Resource,
  144. IN DWORD dwCheckpointId,
  145. IN OPTIONAL LPCWSTR lpszQuorumPath
  146. );
  147. DWORD CppDeleteFile(
  148. IN PFM_RESOURCE Resource,
  149. IN DWORD dwCheckpointId,
  150. IN OPTIONAL LPCWSTR lpszQuorumPath
  151. );
  152. DWORD CpckDeleteFile(
  153. IN PFM_RESOURCE Resource,
  154. IN DWORD dwCheckpointId,
  155. IN OPTIONAL LPCWSTR lpszQuorumPath
  156. );
  157. DWORD
  158. CpckDeleteCryptoFile(
  159. IN PFM_RESOURCE Resource,
  160. IN DWORD dwCheckpointId,
  161. IN OPTIONAL LPCWSTR lpszQuorumPath
  162. );
  163. error_status_t
  164. CppDepositCheckpoint(
  165. handle_t IDL_handle,
  166. LPCWSTR ResourceId,
  167. DWORD dwCheckpointId,
  168. BYTE_PIPE CheckpointData,
  169. BOOLEAN fCryptoCheckpoint
  170. );
  171. error_status_t
  172. CppRetrieveCheckpoint(
  173. handle_t IDL_handle,
  174. LPCWSTR ResourceId,
  175. DWORD dwCheckpointId,
  176. BOOLEAN fCryptoCheckpoint,
  177. BYTE_PIPE CheckpointData
  178. );
  179. error_status_t
  180. CppDeleteCheckpoint(
  181. handle_t IDL_handle,
  182. LPCWSTR ResourceId,
  183. DWORD dwCheckpointId,
  184. LPCWSTR lpszQuorumPath,
  185. BOOL fCryptoCheckpoint
  186. );
  187. BOOL
  188. CppIsQuorumVolumeOffline(
  189. VOID
  190. );
  191. extern CRITICAL_SECTION CppNotifyLock;
  192. extern LIST_ENTRY CpNotifyListHead;