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.

576 lines
10 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. dm.h
  5. Abstract:
  6. Public data structures and procedure prototypes for the
  7. Config Database Manager (DM) subcomponent of the NT Cluster Service
  8. Author:
  9. John Vert (jvert) 24-Apr-1996
  10. Revision History:
  11. --*/
  12. #ifndef _DM_H
  13. #define _DM_H
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. //
  18. // Define public structures and types
  19. //
  20. typedef struct _HDMKEY *HDMKEY;
  21. extern HDMKEY DmClusterParametersKey;
  22. extern HDMKEY DmResourcesKey;
  23. extern HDMKEY DmResourceTypesKey;
  24. extern HDMKEY DmQuorumKey;
  25. extern HDMKEY DmGroupsKey;
  26. extern HDMKEY DmNodesKey;
  27. extern HDMKEY DmNetworksKey;
  28. extern HDMKEY DmNetInterfacesKey;
  29. extern WCHAR DmpResourceListKeyName[];
  30. extern WCHAR DmpResourceTypeListKeyName[];
  31. extern WCHAR DmpGroupListKeyName[];
  32. extern WCHAR DmpNodeListKeyName[];
  33. extern WCHAR DmpTransportListKeyName[];
  34. extern WCHAR DmpInterconnectListKeyName[];
  35. extern const WCHAR DmpClusterParametersKeyName[];
  36. extern DWORD gbIsQuoResEnoughSpace;
  37. //define public cluster key value names
  38. extern const WCHAR cszPath[];
  39. extern const WCHAR cszMaxQuorumLogSize[];
  40. extern const WCHAR cszParameters[];
  41. //other const strings
  42. extern const WCHAR cszClusFilePath[];
  43. extern const WCHAR cszQuoFileName[];
  44. extern const WCHAR cszQuoTombStoneFile[];
  45. extern const WCHAR cszTmpQuoTombStoneFile[];
  46. //local transaction handle
  47. typedef HANDLE HLOCALXSACTION;
  48. //
  49. // Define Macros
  50. //
  51. #define DmQuerySz(Key, ValueName, StringBuffer, StringBufferSize, StringSize) \
  52. DmQueryString( Key, \
  53. ValueName, \
  54. REG_SZ, \
  55. StringBuffer, \
  56. StringBufferSize, \
  57. StringSize )
  58. #define DmQueryMultiSz(Key,ValueName,StringBuffer,StringBufferSize,StringSize) \
  59. DmQueryString( Key, \
  60. ValueName, \
  61. REG_MULTI_SZ, \
  62. StringBuffer, \
  63. StringBufferSize, \
  64. StringSize )
  65. //
  66. // Define public interfaces
  67. //
  68. DWORD
  69. DmInitialize(
  70. VOID
  71. );
  72. DWORD
  73. DmShutdown(
  74. VOID
  75. );
  76. VOID DmShutdownUpdates(
  77. VOID
  78. );
  79. DWORD
  80. DmFormNewCluster(
  81. VOID
  82. );
  83. DWORD
  84. DmJoin(
  85. IN RPC_BINDING_HANDLE RpcBinding,
  86. OUT DWORD *StartSequence
  87. );
  88. DWORD
  89. DmUpdateFormNewCluster(
  90. VOID
  91. );
  92. DWORD
  93. DmCompleteFormNewCluster(
  94. VOID
  95. );
  96. DWORD
  97. DmUpdateJoinCluster(
  98. VOID
  99. );
  100. DWORD
  101. DmWaitQuorumResOnline(
  102. VOID
  103. );
  104. DWORD DmRollChanges(VOID);
  105. DWORD DmPauseDiskManTimer(VOID);
  106. DWORD DmRestartDiskManTimer(VOID);
  107. DWORD DmPrepareQuorumResChange(
  108. IN PVOID pResource,
  109. IN LPCWSTR lpszQuorumLogPath,
  110. IN DWORD dwMaxQuoLogSize
  111. );
  112. DWORD DmCompleteQuorumResChange(
  113. IN LPCWSTR lpszOldQuoResId,
  114. IN LPCWSTR lpszOldQuoLogPath
  115. );
  116. void DmSwitchToNewQuorumLog(
  117. IN LPCWSTR lpszQuorumLogPath
  118. );
  119. DWORD DmReinstallTombStone(
  120. IN LPCWSTR lpszQuoLogPath
  121. );
  122. DWORD DmGetQuorumLogPath(
  123. IN LPWSTR lpszQuorumLogPath,
  124. IN DWORD dwSize
  125. );
  126. DWORD DmGetQuorumLogMaxSize(
  127. OUT LPDWORD pdwLogSize
  128. );
  129. DWORD DmBackupClusterDatabase(
  130. IN LPCWSTR lpszPathName
  131. );
  132. HDMKEY
  133. DmGetRootKey(
  134. IN DWORD samDesired
  135. );
  136. HDMKEY
  137. DmCreateKey(
  138. IN HDMKEY hKey,
  139. IN LPCWSTR lpSubKey,
  140. IN DWORD dwOptions,
  141. IN DWORD samDesired,
  142. IN OPTIONAL LPVOID lpSecurityDescriptor,
  143. OUT LPDWORD lpDisposition
  144. );
  145. HDMKEY
  146. DmOpenKey(
  147. IN HDMKEY hKey,
  148. IN LPCWSTR lpSubKey,
  149. IN DWORD samDesired
  150. );
  151. DWORD
  152. DmCloseKey(
  153. IN HDMKEY hKey
  154. );
  155. DWORD
  156. DmEnumKey(
  157. IN HDMKEY hKey,
  158. IN DWORD dwIndex,
  159. OUT LPWSTR lpName,
  160. IN OUT LPDWORD lpcbName,
  161. OUT OPTIONAL PFILETIME lpLastWriteTime
  162. );
  163. DWORD
  164. DmSetValue(
  165. IN HDMKEY hKey,
  166. IN LPCWSTR lpValueName,
  167. IN DWORD dwType,
  168. IN CONST BYTE *lpData,
  169. IN DWORD cbData
  170. );
  171. DWORD
  172. DmDeleteValue(
  173. IN HDMKEY hKey,
  174. IN LPCWSTR lpValueName
  175. );
  176. DWORD
  177. DmQueryValue(
  178. IN HDMKEY hKey,
  179. IN LPCWSTR lpValueName,
  180. OUT LPDWORD lpType,
  181. OUT LPBYTE lpData,
  182. IN OUT LPDWORD lpcbData
  183. );
  184. DWORD
  185. DmDeleteKey(
  186. IN HDMKEY hKey,
  187. IN LPCWSTR lpSubKey
  188. );
  189. DWORD
  190. DmGetKeySecurity(
  191. IN HDMKEY hKey,
  192. IN SECURITY_INFORMATION RequestedInformation,
  193. OUT PSECURITY_DESCRIPTOR pSecurityDescriptor,
  194. IN LPDWORD lpcbSecurityDescriptor
  195. );
  196. DWORD
  197. DmSetKeySecurity(
  198. IN HDMKEY hKey,
  199. IN SECURITY_INFORMATION SecurityInformation,
  200. IN PSECURITY_DESCRIPTOR pSecurityDescriptor
  201. );
  202. DWORD
  203. DmDeleteTree(
  204. IN HDMKEY hKey,
  205. IN LPCWSTR lpSubKey
  206. );
  207. DWORD
  208. DmEnumValue(
  209. IN HDMKEY hKey,
  210. IN DWORD dwIndex,
  211. OUT LPWSTR lpValueName,
  212. IN OUT LPDWORD lpcbValueName,
  213. OUT LPDWORD lpType,
  214. OUT LPBYTE lpData,
  215. IN OUT LPDWORD lpcbData
  216. );
  217. DWORD
  218. DmQueryDword(
  219. IN HDMKEY hKey,
  220. IN LPCWSTR lpValueName,
  221. OUT LPDWORD lpValue,
  222. IN LPDWORD lpDefaultValue OPTIONAL
  223. );
  224. DWORD
  225. DmQueryString(
  226. IN HDMKEY Key,
  227. IN LPCWSTR ValueName,
  228. IN DWORD ValueType,
  229. IN LPWSTR *StringBuffer,
  230. IN OUT LPDWORD StringBufferSize,
  231. OUT LPDWORD StringSize
  232. );
  233. LPWSTR
  234. DmEnumMultiSz(
  235. IN LPWSTR MszString,
  236. IN DWORD MszStringLength,
  237. IN DWORD StringIndex
  238. );
  239. typedef
  240. VOID
  241. (WINAPI *PENUM_KEY_CALLBACK) (
  242. IN HDMKEY Key,
  243. IN PWSTR KeyName,
  244. IN PVOID Context
  245. );
  246. VOID
  247. DmEnumKeys(
  248. IN HDMKEY RootKey,
  249. IN PENUM_KEY_CALLBACK Callback,
  250. IN PVOID Context
  251. );
  252. typedef
  253. BOOL
  254. (WINAPI *PENUM_VALUE_CALLBACK) (
  255. IN LPWSTR ValueName,
  256. IN LPVOID ValueData,
  257. IN DWORD ValueType,
  258. IN DWORD ValueSize,
  259. IN PVOID Context
  260. );
  261. VOID
  262. DmEnumValues(
  263. IN HDMKEY RootKey,
  264. IN PENUM_VALUE_CALLBACK Callback,
  265. IN PVOID Context
  266. );
  267. DWORD
  268. DmQueryInfoKey(
  269. IN HDMKEY hKey,
  270. OUT LPDWORD SubKeys,
  271. OUT LPDWORD MaxSubKeyLen,
  272. OUT LPDWORD Values,
  273. OUT LPDWORD MaxValueNameLen,
  274. OUT LPDWORD MaxValueLen,
  275. OUT LPDWORD lpcbSecurityDescriptor,
  276. OUT PFILETIME FileTime
  277. );
  278. //
  279. // Local registry modification routines for use in a GUM update handler.
  280. //
  281. HDMKEY
  282. DmLocalCreateKey(
  283. IN HLOCALXSACTION hLocalXsaction,
  284. IN HDMKEY hKey,
  285. IN LPCWSTR lpSubKey,
  286. IN DWORD dwOptions,
  287. IN DWORD samDesired,
  288. IN OPTIONAL LPVOID lpSecurityDescriptor,
  289. OUT LPDWORD lpDisposition
  290. );
  291. DWORD
  292. DmLocalSetValue(
  293. IN HLOCALXSACTION hLocalXsaction,
  294. IN HDMKEY hKey,
  295. IN LPCWSTR lpValueName,
  296. IN DWORD dwType,
  297. IN CONST BYTE *lpData,
  298. IN DWORD cbData
  299. );
  300. DWORD
  301. DmLocalDeleteValue(
  302. IN HLOCALXSACTION hLocalXsaction,
  303. IN HDMKEY hKey,
  304. IN LPCWSTR lpValueName
  305. );
  306. DWORD
  307. DmLocalDeleteKey(
  308. IN HLOCALXSACTION hLocalXsaction,
  309. IN HDMKEY hKey,
  310. IN LPCWSTR lpSubKey
  311. );
  312. DWORD
  313. DmLocalRemoveFromMultiSz(
  314. IN HLOCALXSACTION hLocalXsaction,
  315. IN HDMKEY hKey,
  316. IN LPCWSTR lpValueName,
  317. IN LPCWSTR lpString
  318. );
  319. DWORD
  320. DmLocalAppendToMultiSz(
  321. IN HLOCALXSACTION hLocalXsaction,
  322. IN HDMKEY hKey,
  323. IN LPCWSTR lpValueName,
  324. IN LPCWSTR lpString
  325. );
  326. DWORD
  327. DmLocalDeleteTree(
  328. IN HLOCALXSACTION hLocalXsaction,
  329. IN HDMKEY hKey,
  330. IN LPCWSTR lpSubKey
  331. );
  332. HLOCALXSACTION
  333. DmBeginLocalUpdate();
  334. DWORD
  335. DmCommitLocalUpdate(
  336. IN HLOCALXSACTION hLocalXsaction
  337. );
  338. DWORD
  339. DmAbortLocalUpdate(
  340. IN HLOCALXSACTION hLocalXsaction);
  341. //
  342. // Notification support.
  343. //
  344. // Supported completion filters are
  345. //
  346. // CLUSTER_CHANGE_REGISTRY_NAME - applies to changes in the namespace. (key creation and deletion).
  347. // CLUSTER_CHANGE_REGISTRY_ATTRIBUTES - applies to key attributes. The only key attribute is the
  348. // security descriptor.
  349. // CLUSTER_CHANGE_REGISTRY_VALUE - applies to creation, modification, or deletion of values.
  350. //
  351. //
  352. // Notification callback routine
  353. //
  354. typedef VOID (*DM_NOTIFY_CALLBACK)(
  355. IN DWORD_PTR Context1,
  356. IN DWORD_PTR Context2,
  357. IN DWORD CompletionFilter,
  358. IN LPCWSTR RelativeName
  359. );
  360. DWORD
  361. DmNotifyChangeKey(
  362. IN HDMKEY hKey,
  363. IN ULONG CompletionFilter,
  364. IN BOOL WatchTree,
  365. IN OPTIONAL PLIST_ENTRY ListHead,
  366. IN DM_NOTIFY_CALLBACK NotifyCallback,
  367. IN DWORD_PTR Context1,
  368. IN DWORD_PTR Context2
  369. );
  370. VOID
  371. DmRundownList(
  372. IN PLIST_ENTRY ListHead
  373. );
  374. //
  375. // A few helper routines.
  376. //
  377. DWORD
  378. DmAppendToMultiSz(
  379. IN HDMKEY hKey,
  380. IN LPCWSTR lpValueName,
  381. IN LPCWSTR lpString
  382. );
  383. DWORD
  384. DmRemoveFromMultiSz(
  385. IN HDMKEY hKey,
  386. IN LPCWSTR lpValueName,
  387. IN LPCWSTR lpString
  388. );
  389. //
  390. // Some routines for saving and restoring registry trees
  391. //
  392. DWORD
  393. DmInstallDatabase(
  394. IN LPWSTR FileName,
  395. IN OPTIONAL LPCWSTR Directory,
  396. IN BOOL bDeleteSrcFile
  397. );
  398. DWORD
  399. DmGetDatabase(
  400. IN HKEY hKey,
  401. IN LPWSTR FileName
  402. );
  403. DWORD
  404. DmCreateTempFileName(
  405. OUT LPWSTR FileName
  406. );
  407. typedef struct _FILE_PIPE_STATE {
  408. unsigned long BufferSize;
  409. char __RPC_FAR *pBuffer;
  410. HANDLE hFile;
  411. } FILE_PIPE_STATE;
  412. typedef struct _FILE_PIPE {
  413. BYTE_PIPE Pipe;
  414. FILE_PIPE_STATE State;
  415. } FILE_PIPE, *PFILE_PIPE;
  416. VOID
  417. DmInitFilePipe(
  418. IN PFILE_PIPE FilePipe,
  419. IN HANDLE hFile
  420. );
  421. VOID
  422. DmFreeFilePipe(
  423. IN PFILE_PIPE FilePipe
  424. );
  425. DWORD
  426. DmPushFile(
  427. IN LPCWSTR FileName,
  428. IN BYTE_PIPE Pipe
  429. );
  430. DWORD
  431. DmPullFile(
  432. IN LPCWSTR FileName,
  433. IN BYTE_PIPE Pipe
  434. );
  435. DWORD
  436. DmCommitRegistry(
  437. VOID
  438. );
  439. DWORD
  440. DmRollbackRegistry(
  441. VOID
  442. );
  443. DWORD
  444. DmRtlCreateKey(
  445. IN HDMKEY hKey,
  446. IN LPCWSTR lpSubKey,
  447. IN DWORD dwOptions,
  448. IN DWORD samDesired,
  449. IN OPTIONAL LPVOID lpSecurityDescriptor,
  450. OUT HDMKEY * phkResult,
  451. OUT LPDWORD lpDisposition
  452. );
  453. DWORD
  454. DmRtlOpenKey(
  455. IN HDMKEY hKey,
  456. IN LPCWSTR lpSubKey,
  457. IN DWORD samDesired,
  458. OUT HDMKEY * phkResult
  459. );
  460. DWORD
  461. DmRtlLocalCreateKey(
  462. IN HLOCALXSACTION hLocalXsaction,
  463. IN HDMKEY hKey,
  464. IN LPCWSTR lpSubKey,
  465. IN DWORD dwOptions,
  466. IN DWORD samDesired,
  467. IN OPTIONAL LPVOID lpSecurityDescriptor,
  468. OUT HDMKEY * phkResult,
  469. OUT LPDWORD lpDisposition
  470. );
  471. #ifdef __cplusplus
  472. }
  473. #endif
  474. #endif //_DM_H