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.

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