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.

1052 lines
24 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. resapi.h
  5. Abstract:
  6. This module defines the interface exported by Windows Clusters resources.
  7. Revision History:
  8. --*/
  9. #ifndef _RESAPI_DEFINES_
  10. #define _RESAPI_DEFINES_
  11. #if _MSC_VER > 1000
  12. #pragma once
  13. #endif
  14. #include <windows.h>
  15. #include <winsvc.h>
  16. #include <clusapi.h>
  17. #include <stdio.h>
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #define IN
  22. #define OUT
  23. //
  24. // Definitions for entrypoints exported by a resource DLL.
  25. //
  26. #define STARTUP_ROUTINE "Startup"
  27. #define CLRES_V1_FUNCTION_SIZE sizeof(CLRES_V1_FUNCTIONS)
  28. #define CLRES_VERSION_V1_00 0x100
  29. #define CLRES_V1_FUNCTION_TABLE( _Name, \
  30. _Version, \
  31. _Prefix, \
  32. _Arbitrate, \
  33. _Release, \
  34. _ResControl, \
  35. _ResTypeControl \
  36. ) \
  37. CLRES_FUNCTION_TABLE _Name = { CLRES_V1_FUNCTION_SIZE, \
  38. _Version, \
  39. _Prefix##Open, \
  40. _Prefix##Close, \
  41. _Prefix##Online, \
  42. _Prefix##Offline, \
  43. _Prefix##Terminate, \
  44. _Prefix##LooksAlive, \
  45. _Prefix##IsAlive, \
  46. _Arbitrate, \
  47. _Release, \
  48. _ResControl, \
  49. _ResTypeControl }
  50. #endif // ifndef _RESAPI_DEFINES_
  51. #ifndef _RESAPI_
  52. #define _RESAPI_
  53. //
  54. // Define a RESID
  55. //
  56. typedef PVOID RESID;
  57. //
  58. // Define a RESOURCE_HANDLE
  59. //
  60. typedef HANDLE RESOURCE_HANDLE;
  61. //
  62. // Define the Resource Status structure.
  63. //
  64. typedef struct RESOURCE_STATUS {
  65. CLUSTER_RESOURCE_STATE ResourceState;
  66. DWORD CheckPoint;
  67. DWORD WaitHint;
  68. HANDLE EventHandle;
  69. } RESOURCE_STATUS, *PRESOURCE_STATUS;
  70. #define ResUtilInitializeResourceStatus( _resource_status_ ) \
  71. ZeroMemory( _resource_status_, sizeof(RESOURCE_STATUS) )
  72. //
  73. // Define Resource DLL callback method for updating the state of a resource.
  74. //
  75. typedef
  76. DWORD
  77. (_stdcall *PSET_RESOURCE_STATUS_ROUTINE) (
  78. IN RESOURCE_HANDLE ResourceHandle,
  79. IN PRESOURCE_STATUS ResourceStatus
  80. );
  81. //
  82. // Define Resource DLL callback method for notifying that a quorum
  83. // resource DLL failed to hold the quorum resource.
  84. //
  85. typedef
  86. VOID
  87. (_stdcall *PQUORUM_RESOURCE_LOST) (
  88. IN RESOURCE_HANDLE Resource
  89. );
  90. //
  91. // Define Resource DLL callback method for logging events.
  92. //
  93. typedef enum LOG_LEVEL {
  94. LOG_INFORMATION,
  95. LOG_WARNING,
  96. LOG_ERROR,
  97. LOG_SEVERE
  98. } LOG_LEVEL, *PLOG_LEVEL;
  99. typedef
  100. VOID
  101. (_stdcall *PLOG_EVENT_ROUTINE) (
  102. IN RESOURCE_HANDLE ResourceHandle,
  103. IN LOG_LEVEL LogLevel,
  104. IN LPCWSTR FormatString,
  105. ...
  106. );
  107. typedef
  108. RESID
  109. (_stdcall *POPEN_ROUTINE) (
  110. IN LPCWSTR ResourceName,
  111. IN HKEY ResourceKey,
  112. IN RESOURCE_HANDLE ResourceHandle
  113. );
  114. typedef
  115. VOID
  116. (_stdcall *PCLOSE_ROUTINE) (
  117. IN RESID Resource
  118. );
  119. typedef
  120. DWORD
  121. (_stdcall *PONLINE_ROUTINE) (
  122. IN RESID Resource,
  123. IN OUT LPHANDLE EventHandle
  124. );
  125. typedef
  126. DWORD
  127. (_stdcall *POFFLINE_ROUTINE) (
  128. IN RESID Resource
  129. );
  130. typedef
  131. VOID
  132. (_stdcall *PTERMINATE_ROUTINE) (
  133. IN RESID Resource
  134. );
  135. typedef
  136. BOOL
  137. (_stdcall *PIS_ALIVE_ROUTINE) (
  138. IN RESID Resource
  139. );
  140. typedef
  141. BOOL
  142. (_stdcall *PLOOKS_ALIVE_ROUTINE) (
  143. IN RESID Resource
  144. );
  145. typedef
  146. DWORD
  147. (_stdcall *PARBITRATE_ROUTINE) (
  148. IN RESID Resource,
  149. IN PQUORUM_RESOURCE_LOST LostQuorumResource
  150. );
  151. typedef
  152. DWORD
  153. (_stdcall *PRELEASE_ROUTINE) (
  154. IN RESID Resource
  155. );
  156. typedef
  157. DWORD
  158. (_stdcall *PRESOURCE_CONTROL_ROUTINE) (
  159. IN RESID Resource,
  160. IN DWORD ControlCode,
  161. IN PVOID InBuffer,
  162. IN DWORD InBufferSize,
  163. OUT PVOID OutBuffer,
  164. IN DWORD OutBufferSize,
  165. OUT LPDWORD BytesReturned
  166. );
  167. typedef
  168. DWORD
  169. (_stdcall *PRESOURCE_TYPE_CONTROL_ROUTINE) (
  170. IN LPCWSTR ResourceTypeName,
  171. IN DWORD ControlCode,
  172. IN PVOID InBuffer,
  173. IN DWORD InBufferSize,
  174. OUT PVOID OutBuffer,
  175. IN DWORD OutBufferSize,
  176. OUT LPDWORD BytesReturned
  177. );
  178. typedef enum _RESOURCE_EXIT_STATE {
  179. ResourceExitStateContinue,
  180. ResourceExitStateTerminate,
  181. ResourceExitStateMax
  182. } RESOURCE_EXIT_STATE;
  183. //***************************************************************
  184. //
  185. // Define the Function Table Format
  186. //
  187. //***************************************************************
  188. //
  189. // Version 1 Resource DLL Interface definition
  190. //
  191. typedef struct CLRES_V1_FUNCTIONS {
  192. POPEN_ROUTINE Open;
  193. PCLOSE_ROUTINE Close;
  194. PONLINE_ROUTINE Online;
  195. POFFLINE_ROUTINE Offline;
  196. PTERMINATE_ROUTINE Terminate;
  197. PLOOKS_ALIVE_ROUTINE LooksAlive;
  198. PIS_ALIVE_ROUTINE IsAlive;
  199. PARBITRATE_ROUTINE Arbitrate;
  200. PRELEASE_ROUTINE Release;
  201. PRESOURCE_CONTROL_ROUTINE ResourceControl;
  202. PRESOURCE_TYPE_CONTROL_ROUTINE ResourceTypeControl;
  203. } CLRES_V1_FUNCTIONS, *PCLRES_V1_FUNCTIONS;
  204. //
  205. // Resource DLL Function Table definition
  206. //
  207. #if _MSC_VER >= 1200
  208. #pragma warning(push)
  209. #endif
  210. #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union
  211. typedef struct CLRES_FUNCTION_TABLE {
  212. DWORD TableSize;
  213. DWORD Version;
  214. union {
  215. CLRES_V1_FUNCTIONS V1Functions;
  216. };
  217. } CLRES_FUNCTION_TABLE, *PCLRES_FUNCTION_TABLE;
  218. #if _MSC_VER >= 1200
  219. #pragma warning(pop)
  220. #else
  221. #pragma warning( default : 4201 ) // nonstandard extension used : nameless struct/union
  222. #endif
  223. //
  224. // Define the Resource DLL Startup routine. This is the only routine
  225. // that should be exported from a resource DLL.
  226. //
  227. //
  228. // Calculate the byte offset of a field in a structure of type type.
  229. //
  230. #ifndef FIELD_OFFSET
  231. #define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field))
  232. #endif
  233. //
  234. // large ints need more space than what was originally allocated.
  235. //
  236. typedef struct RESUTIL_LARGEINT_DATA {
  237. LARGE_INTEGER Default;
  238. LARGE_INTEGER Minimum;
  239. LARGE_INTEGER Maximum;
  240. } RESUTIL_LARGEINT_DATA, *PRESUTIL_LARGEINT_DATA;
  241. typedef struct RESUTIL_ULARGEINT_DATA {
  242. ULARGE_INTEGER Default;
  243. ULARGE_INTEGER Minimum;
  244. ULARGE_INTEGER Maximum;
  245. } RESUTIL_ULARGEINT_DATA, *PRESUTIL_ULARGEINT_DATA;
  246. //
  247. // Property list structures and functions
  248. //
  249. typedef struct RESUTIL_PROPERTY_ITEM {
  250. LPWSTR Name; // Property name
  251. LPWSTR KeyName; // Name of value in cluster database
  252. DWORD Format; // Format: REG_SZ, REG_DWORD, etc.
  253. union {
  254. DWORD_PTR DefaultPtr;
  255. DWORD Default; // Default value
  256. LPVOID lpDefault;
  257. PRESUTIL_LARGEINT_DATA LargeIntData;
  258. PRESUTIL_ULARGEINT_DATA ULargeIntData;
  259. };
  260. DWORD Minimum; // Minimum value
  261. DWORD Maximum; // Maximum value
  262. DWORD Flags; // Flags for this item
  263. #define RESUTIL_PROPITEM_READ_ONLY 0x00000001 // Property is read-only
  264. #define RESUTIL_PROPITEM_REQUIRED 0x00000002 // Property is required
  265. #define RESUTIL_PROPITEM_SIGNED 0x00000004 // Numeric property is signed (defaults to unsigned)
  266. DWORD Offset; // Byte offset to value in parameter block
  267. // Assumes MULTI_SZ and BINARY parameters
  268. // are LPWSTRs followed by DWORDs for length
  269. } RESUTIL_PROPERTY_ITEM, *PRESUTIL_PROPERTY_ITEM;
  270. typedef
  271. DWORD
  272. (_stdcall *PSTARTUP_ROUTINE) (
  273. IN LPCWSTR ResourceType,
  274. IN DWORD MinVersionSupported,
  275. IN DWORD MaxVersionSupported,
  276. IN PSET_RESOURCE_STATUS_ROUTINE SetResourceStatus,
  277. IN PLOG_EVENT_ROUTINE LogEvent,
  278. OUT PCLRES_FUNCTION_TABLE *FunctionTable
  279. );
  280. //
  281. // Define layout of shared memory used for tracking Resource Monitor state.
  282. //
  283. typedef enum RESOURCE_MONITOR_STATE {
  284. RmonInitializing,
  285. RmonIdle,
  286. RmonStartingResource,
  287. RmonInitializingResource,
  288. RmonOnlineResource,
  289. RmonOfflineResource,
  290. RmonShutdownResource,
  291. RmonDeletingResource,
  292. RmonIsAlivePoll,
  293. RmonLooksAlivePoll,
  294. RmonArbitrateResource,
  295. RmonReleaseResource,
  296. RmonResourceControl,
  297. RmonResourceTypeControl,
  298. RmonTerminateResource,
  299. RmonDeadlocked
  300. } RESOURCE_MONITOR_STATE;
  301. typedef struct MONITOR_STATE {
  302. LARGE_INTEGER LastUpdate;
  303. RESOURCE_MONITOR_STATE State;
  304. HANDLE ActiveResource;
  305. BOOL ResmonStop;
  306. } MONITOR_STATE, *PMONITOR_STATE;
  307. //
  308. // Resource Utility Routines
  309. //
  310. DWORD
  311. WINAPI
  312. ResUtilStartResourceService(
  313. IN LPCWSTR pszServiceName,
  314. OUT LPSC_HANDLE phServiceHandle
  315. );
  316. DWORD
  317. WINAPI
  318. ResUtilVerifyResourceService(
  319. IN LPCWSTR pszServiceName
  320. );
  321. DWORD
  322. WINAPI
  323. ResUtilStopResourceService(
  324. IN LPCWSTR pszServiceName
  325. );
  326. DWORD
  327. WINAPI
  328. ResUtilVerifyService(
  329. IN SC_HANDLE hServiceHandle
  330. );
  331. DWORD
  332. WINAPI
  333. ResUtilStopService(
  334. IN SC_HANDLE hServiceHandle
  335. );
  336. DWORD
  337. WINAPI
  338. ResUtilCreateDirectoryTree(
  339. IN LPCWSTR pszPath
  340. );
  341. BOOL
  342. WINAPI
  343. ResUtilIsPathValid(
  344. IN LPCWSTR pszPath
  345. );
  346. DWORD
  347. WINAPI
  348. ResUtilEnumProperties(
  349. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  350. OUT LPWSTR pszOutProperties,
  351. IN DWORD cbOutPropertiesSize,
  352. OUT LPDWORD pcbBytesReturned,
  353. OUT LPDWORD pcbRequired
  354. );
  355. DWORD
  356. WINAPI
  357. ResUtilEnumPrivateProperties(
  358. IN HKEY hkeyClusterKey,
  359. OUT LPWSTR pszOutProperties,
  360. IN DWORD cbOutPropertiesSize,
  361. OUT LPDWORD pcbBytesReturned,
  362. OUT LPDWORD pcbRequired
  363. );
  364. DWORD
  365. WINAPI
  366. ResUtilGetProperties(
  367. IN HKEY hkeyClusterKey,
  368. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  369. OUT PVOID pOutPropertyList,
  370. IN DWORD cbOutPropertyListSize,
  371. OUT LPDWORD pcbBytesReturned,
  372. OUT LPDWORD pcbRequired
  373. );
  374. DWORD
  375. WINAPI
  376. ResUtilGetAllProperties(
  377. IN HKEY hkeyClusterKey,
  378. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  379. OUT PVOID pOutPropertyList,
  380. IN DWORD cbOutPropertyListSize,
  381. OUT LPDWORD pcbBytesReturned,
  382. OUT LPDWORD pcbRequired
  383. );
  384. DWORD
  385. WINAPI
  386. ResUtilGetPrivateProperties(
  387. IN HKEY hkeyClusterKey,
  388. OUT PVOID pOutPropertyList,
  389. IN DWORD cbOutPropertyListSize,
  390. OUT LPDWORD pcbBytesReturned,
  391. OUT LPDWORD pcbRequired
  392. );
  393. DWORD
  394. WINAPI
  395. ResUtilGetPropertySize(
  396. IN HKEY hkeyClusterKey,
  397. IN const PRESUTIL_PROPERTY_ITEM pPropertyTableItem,
  398. IN OUT LPDWORD pcbOutPropertyListSize,
  399. IN OUT LPDWORD pnPropertyCount
  400. );
  401. DWORD
  402. WINAPI
  403. ResUtilGetProperty(
  404. IN HKEY hkeyClusterKey,
  405. IN const PRESUTIL_PROPERTY_ITEM pPropertyTableItem,
  406. OUT PVOID * pOutPropertyItem,
  407. IN OUT LPDWORD pcbOutPropertyItemSize
  408. );
  409. DWORD
  410. WINAPI
  411. ResUtilVerifyPropertyTable(
  412. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  413. IN PVOID Reserved,
  414. IN BOOL bAllowUnknownProperties,
  415. IN const PVOID pInPropertyList,
  416. IN DWORD cbInPropertyListSize,
  417. OUT OPTIONAL LPBYTE pOutParams
  418. );
  419. DWORD
  420. WINAPI
  421. ResUtilSetPropertyTable(
  422. IN HKEY hkeyClusterKey,
  423. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  424. IN PVOID Reserved,
  425. IN BOOL bAllowUnknownProperties,
  426. IN const PVOID pInPropertyList,
  427. IN DWORD cbInPropertyListSize,
  428. OUT OPTIONAL LPBYTE pOutParams
  429. );
  430. DWORD
  431. WINAPI
  432. ResUtilSetPropertyTableEx(
  433. IN HKEY hkeyClusterKey,
  434. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  435. IN PVOID Reserved,
  436. IN BOOL bAllowUnknownProperties,
  437. IN const PVOID pInPropertyList,
  438. IN DWORD cbInPropertyListSize,
  439. IN BOOL bForceWrite,
  440. OUT OPTIONAL LPBYTE pOutParams
  441. );
  442. DWORD
  443. WINAPI
  444. ResUtilSetPropertyParameterBlock(
  445. IN HKEY hkeyClusterKey,
  446. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  447. IN PVOID Reserved,
  448. IN const LPBYTE pInParams,
  449. IN const PVOID pInPropertyList,
  450. IN DWORD cbInPropertyListSize,
  451. OUT OPTIONAL LPBYTE pOutParams
  452. );
  453. DWORD
  454. WINAPI
  455. ResUtilSetPropertyParameterBlockEx(
  456. IN HKEY hkeyClusterKey,
  457. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  458. IN PVOID Reserved,
  459. IN const LPBYTE pInParams,
  460. IN const PVOID pInPropertyList,
  461. IN DWORD cbInPropertyListSize,
  462. IN BOOL bForceWrite,
  463. OUT OPTIONAL LPBYTE pOutParams
  464. );
  465. DWORD
  466. WINAPI
  467. ResUtilSetUnknownProperties(
  468. IN HKEY hkeyClusterKey,
  469. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  470. IN const PVOID pInPropertyList,
  471. IN DWORD cbInPropertyListSize
  472. );
  473. DWORD
  474. WINAPI
  475. ResUtilGetPropertiesToParameterBlock(
  476. IN HKEY hkeyClusterKey,
  477. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  478. OUT LPBYTE pOutParams,
  479. IN BOOL bCheckForRequiredProperties,
  480. OUT OPTIONAL LPWSTR * pszNameOfPropInError
  481. );
  482. DWORD
  483. WINAPI
  484. ResUtilPropertyListFromParameterBlock(
  485. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  486. OUT PVOID pOutPropertyList,
  487. IN OUT LPDWORD pcbOutPropertyListSize,
  488. IN const LPBYTE pInParams,
  489. OUT LPDWORD pcbBytesReturned,
  490. OUT LPDWORD pcbRequired
  491. );
  492. DWORD
  493. WINAPI
  494. ResUtilDupParameterBlock(
  495. OUT LPBYTE pOutParams,
  496. IN const LPBYTE pInParams,
  497. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable
  498. );
  499. void
  500. WINAPI
  501. ResUtilFreeParameterBlock(
  502. IN OUT LPBYTE pOutParams,
  503. IN const LPBYTE pInParams,
  504. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable
  505. );
  506. DWORD
  507. WINAPI
  508. ResUtilAddUnknownProperties(
  509. IN HKEY hkeyClusterKey,
  510. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  511. IN OUT PVOID pOutPropertyList,
  512. IN DWORD pcbOutPropertyListSize,
  513. IN OUT LPDWORD pcbBytesReturned,
  514. IN OUT LPDWORD pcbRequired
  515. );
  516. DWORD
  517. WINAPI
  518. ResUtilSetPrivatePropertyList(
  519. IN HKEY hkeyClusterKey,
  520. IN const PVOID pInPropertyList,
  521. IN DWORD cbInPropertyListSize
  522. );
  523. DWORD
  524. WINAPI
  525. ResUtilVerifyPrivatePropertyList(
  526. IN const PVOID pInPropertyList,
  527. IN DWORD cbInPropertyListSize
  528. );
  529. PWSTR
  530. WINAPI
  531. ResUtilDupString(
  532. IN LPCWSTR pszInString
  533. );
  534. DWORD
  535. WINAPI
  536. ResUtilGetBinaryValue(
  537. IN HKEY hkeyClusterKey,
  538. IN LPCWSTR pszValueName,
  539. OUT LPBYTE * ppbOutValue,
  540. OUT DWORD * pcbOutValueSize
  541. );
  542. LPWSTR
  543. WINAPI
  544. ResUtilGetSzValue(
  545. IN HKEY hkeyClusterKey,
  546. IN LPCWSTR pszValueName
  547. );
  548. LPWSTR
  549. WINAPI
  550. ResUtilGetExpandSzValue(
  551. IN HKEY hkeyClusterKey,
  552. IN LPCWSTR pszValueName,
  553. IN BOOL bExpand
  554. );
  555. FORCEINLINE
  556. DWORD
  557. WINAPI
  558. ResUtilGetMultiSzValue(
  559. IN HKEY hkeyClusterKey,
  560. IN LPCWSTR pszValueName,
  561. OUT LPWSTR * ppszOutValue,
  562. OUT LPDWORD pcbOutValueSize
  563. )
  564. {
  565. return ResUtilGetBinaryValue( hkeyClusterKey, pszValueName, (LPBYTE *) ppszOutValue, pcbOutValueSize );
  566. }
  567. DWORD
  568. WINAPI
  569. ResUtilGetDwordValue(
  570. IN HKEY hkeyClusterKey,
  571. IN LPCWSTR pszValueName,
  572. OUT LPDWORD pdwOutValue,
  573. IN DWORD dwDefaultValue OPTIONAL
  574. );
  575. DWORD
  576. WINAPI
  577. ResUtilSetBinaryValue(
  578. IN HKEY hkeyClusterKey,
  579. IN LPCWSTR pszValueName,
  580. IN const LPBYTE pbNewValue,
  581. IN DWORD cbNewValueSize,
  582. IN OUT LPBYTE * ppbOutValue,
  583. IN OUT LPDWORD pcbOutValueSize
  584. );
  585. DWORD
  586. WINAPI
  587. ResUtilSetSzValue(
  588. IN HKEY hkeyClusterKey,
  589. IN LPCWSTR pszValueName,
  590. IN LPCWSTR pszNewValue,
  591. IN OUT LPWSTR * ppszOutString
  592. );
  593. DWORD
  594. WINAPI
  595. ResUtilSetExpandSzValue(
  596. IN HKEY hkeyClusterKey,
  597. IN LPCWSTR pszValueName,
  598. IN LPCWSTR pszNewValue,
  599. IN OUT LPWSTR * ppszOutString
  600. );
  601. DWORD
  602. WINAPI
  603. ResUtilSetMultiSzValue(
  604. IN HKEY hkeyClusterKey,
  605. IN LPCWSTR pszValueName,
  606. IN LPCWSTR pszNewValue,
  607. IN DWORD cbNewValueSize,
  608. IN OUT LPWSTR * ppszOutValue,
  609. IN OUT LPDWORD pcbOutValueSize
  610. );
  611. DWORD
  612. WINAPI
  613. ResUtilSetDwordValue(
  614. IN HKEY hkeyClusterKey,
  615. IN LPCWSTR pszValueName,
  616. IN DWORD dwNewValue,
  617. IN OUT LPDWORD pdwOutValue
  618. );
  619. DWORD
  620. WINAPI
  621. ResUtilGetBinaryProperty(
  622. OUT LPBYTE * ppbOutValue,
  623. OUT LPDWORD pcbOutValueSize,
  624. IN const PCLUSPROP_BINARY pValueStruct,
  625. IN const LPBYTE pbOldValue,
  626. IN DWORD cbOldValueSize,
  627. OUT LPBYTE * ppPropertyList,
  628. OUT LPDWORD pcbPropertyListSize
  629. );
  630. DWORD
  631. WINAPI
  632. ResUtilGetSzProperty(
  633. OUT LPWSTR * ppszOutValue,
  634. IN const PCLUSPROP_SZ pValueStruct,
  635. IN LPCWSTR pszOldValue,
  636. OUT LPBYTE * ppPropertyList,
  637. OUT LPDWORD pcbPropertyListSize
  638. );
  639. DWORD
  640. WINAPI
  641. ResUtilGetMultiSzProperty(
  642. OUT LPWSTR * ppszOutValue,
  643. OUT LPDWORD pcbOutValueSize,
  644. IN const PCLUSPROP_SZ pValueStruct,
  645. IN LPCWSTR pszOldValue,
  646. IN DWORD cbOldValueSize,
  647. OUT LPBYTE * ppPropertyList,
  648. OUT LPDWORD pcbPropertyListSize
  649. );
  650. DWORD
  651. WINAPI
  652. ResUtilGetDwordProperty(
  653. OUT LPDWORD pdwOutValue,
  654. IN const PCLUSPROP_DWORD pValueStruct,
  655. IN DWORD dwOldValue,
  656. IN DWORD dwMinimum,
  657. IN DWORD dwMaximum,
  658. OUT LPBYTE * ppPropertyList,
  659. OUT LPDWORD pcbPropertyListSize
  660. );
  661. LPVOID
  662. WINAPI
  663. ResUtilGetEnvironmentWithNetName(
  664. IN HRESOURCE hResource
  665. );
  666. DWORD
  667. WINAPI
  668. ResUtilFreeEnvironment(
  669. IN LPVOID lpEnvironment
  670. );
  671. LPWSTR
  672. WINAPI
  673. ResUtilExpandEnvironmentStrings(
  674. IN LPCWSTR pszSrc
  675. );
  676. DWORD
  677. WINAPI
  678. ResUtilSetResourceServiceEnvironment(
  679. IN LPCWSTR pszServiceName,
  680. IN HRESOURCE hResource,
  681. IN PLOG_EVENT_ROUTINE pfnLogEvent,
  682. IN RESOURCE_HANDLE hResourceHandle
  683. );
  684. DWORD
  685. WINAPI
  686. ResUtilRemoveResourceServiceEnvironment(
  687. IN LPCWSTR pszServiceName,
  688. IN PLOG_EVENT_ROUTINE pfnLogEvent,
  689. IN RESOURCE_HANDLE hResourceHandle
  690. );
  691. DWORD
  692. WINAPI
  693. ResUtilSetResourceServiceStartParameters(
  694. IN LPCWSTR pszServiceName,
  695. IN SC_HANDLE schSCMHandle,
  696. IN OUT LPSC_HANDLE phService,
  697. IN PLOG_EVENT_ROUTINE pfnLogEvent,
  698. IN RESOURCE_HANDLE hResourceHandle
  699. );
  700. DWORD
  701. WINAPI
  702. ResUtilFindSzProperty(
  703. IN const PVOID pPropertyList,
  704. IN DWORD cbPropertyListSize,
  705. IN LPCWSTR pszPropertyName,
  706. OUT LPWSTR * pszPropertyValue
  707. );
  708. DWORD
  709. WINAPI
  710. ResUtilFindExpandSzProperty(
  711. IN const PVOID pPropertyList,
  712. IN DWORD cbPropertyListSize,
  713. IN LPCWSTR pszPropertyName,
  714. OUT LPWSTR * pszPropertyValue
  715. );
  716. DWORD
  717. WINAPI
  718. ResUtilFindExpandedSzProperty(
  719. IN const PVOID pPropertyList,
  720. IN DWORD cbPropertyListSize,
  721. IN LPCWSTR pszPropertyName,
  722. OUT LPWSTR * pszPropertyValue
  723. );
  724. DWORD
  725. WINAPI
  726. ResUtilFindDwordProperty(
  727. IN const PVOID pPropertyList,
  728. IN DWORD cbPropertyListSize,
  729. IN LPCWSTR pszPropertyName,
  730. OUT LPDWORD pdwPropertyValue
  731. );
  732. DWORD
  733. WINAPI
  734. ResUtilFindBinaryProperty(
  735. IN const PVOID pPropertyList,
  736. IN DWORD cbPropertyListSize,
  737. IN LPCWSTR pszPropertyName,
  738. OUT LPBYTE * pbPropertyValue,
  739. OUT LPDWORD pcbPropertyValueSize
  740. );
  741. DWORD
  742. WINAPI
  743. ResUtilFindMultiSzProperty(
  744. IN const PVOID pPropertyList,
  745. IN DWORD cbPropertyListSize,
  746. IN LPCWSTR pszPropertyName,
  747. OUT LPWSTR * pszPropertyValue,
  748. OUT LPDWORD pcbPropertyValueSize
  749. );
  750. DWORD
  751. WINAPI
  752. ResUtilFindLongProperty(
  753. IN const PVOID pPropertyList,
  754. IN DWORD cbPropertyListSize,
  755. IN LPCWSTR pszPropertyName,
  756. OUT LPLONG plPropertyValueSize
  757. );
  758. //
  759. // Common worker thread routines that allow a pending operation to
  760. // be cancelled with CORRECT synchronization.
  761. //
  762. typedef struct CLUS_WORKER {
  763. HANDLE hThread;
  764. BOOL Terminate;
  765. } CLUS_WORKER, *PCLUS_WORKER;
  766. typedef DWORD (WINAPI *PWORKER_START_ROUTINE)(
  767. PCLUS_WORKER pWorker,
  768. LPVOID lpThreadParameter
  769. );
  770. DWORD
  771. WINAPI
  772. ClusWorkerCreate(
  773. OUT PCLUS_WORKER lpWorker,
  774. IN PWORKER_START_ROUTINE lpStartAddress,
  775. IN PVOID lpParameter
  776. );
  777. BOOL
  778. WINAPI
  779. ClusWorkerCheckTerminate(
  780. IN PCLUS_WORKER lpWorker
  781. );
  782. VOID
  783. WINAPI
  784. ClusWorkerTerminate(
  785. IN PCLUS_WORKER lpWorker
  786. );
  787. //Define enumerate resource callback function. This gets called for each resource enumerated
  788. //by ResUtilEnumResources
  789. typedef DWORD (*LPRESOURCE_CALLBACK)( HRESOURCE, HRESOURCE , PVOID );
  790. typedef DWORD (*LPRESOURCE_CALLBACK_EX)( HCLUSTER, HRESOURCE, HRESOURCE , PVOID );
  791. BOOL
  792. WINAPI
  793. ResUtilResourcesEqual(
  794. IN HRESOURCE hSelf,
  795. IN HRESOURCE hResource
  796. );
  797. BOOL
  798. WINAPI
  799. ResUtilResourceTypesEqual(
  800. IN LPCWSTR lpszResourceTypeName,
  801. IN HRESOURCE hResource
  802. );
  803. BOOL
  804. WINAPI
  805. ResUtilIsResourceClassEqual(
  806. IN PCLUS_RESOURCE_CLASS_INFO prci,
  807. IN HRESOURCE hResource
  808. );
  809. DWORD
  810. WINAPI
  811. ResUtilEnumResources(
  812. IN HRESOURCE hSelf,
  813. IN LPCWSTR lpszResTypeName,
  814. IN LPRESOURCE_CALLBACK pResCallBack,
  815. IN PVOID pParameter
  816. );
  817. DWORD
  818. WINAPI
  819. ResUtilEnumResourcesEx(
  820. IN HCLUSTER hCluster,
  821. IN HRESOURCE hSelf,
  822. IN LPCWSTR lpszResTypeName,
  823. IN LPRESOURCE_CALLBACK_EX pResCallBack,
  824. IN PVOID pParameter
  825. );
  826. HRESOURCE
  827. WINAPI
  828. ResUtilGetResourceDependency(
  829. IN HANDLE hSelf,
  830. IN LPCWSTR lpszResourceType
  831. );
  832. HRESOURCE
  833. WINAPI
  834. ResUtilGetResourceDependencyByName(
  835. IN HCLUSTER hCluster,
  836. IN HANDLE hSelf,
  837. IN LPCWSTR lpszResourceType,
  838. IN BOOL bRecurse
  839. );
  840. HRESOURCE
  841. WINAPI
  842. ResUtilGetResourceDependencyByClass(
  843. IN HCLUSTER hCluster,
  844. IN HANDLE hSelf,
  845. IN PCLUS_RESOURCE_CLASS_INFO prci,
  846. IN BOOL bRecurse
  847. );
  848. HRESOURCE
  849. WINAPI
  850. ResUtilGetResourceNameDependency(
  851. IN LPCWSTR lpszResourceName,
  852. IN LPCWSTR lpszResourceType
  853. );
  854. DWORD
  855. WINAPI
  856. ResUtilGetResourceDependentIPAddressProps(
  857. IN HRESOURCE hResource,
  858. OUT LPWSTR pszAddress,
  859. IN OUT DWORD * pcchAddress,
  860. OUT LPWSTR pszSubnetMask,
  861. IN OUT DWORD * pcchSubnetMask,
  862. OUT LPWSTR pszNetwork,
  863. IN OUT DWORD * pcchNetwork
  864. );
  865. DWORD
  866. WINAPI
  867. ResUtilFindDependentDiskResourceDriveLetter(
  868. IN HCLUSTER hCluster, // handle to cluster
  869. IN HRESOURCE hResource, // handle to resource to query for dependencies
  870. IN LPWSTR pszDriveLetter, // buffer to store drive letter (ex. "X:\0")
  871. IN OUT DWORD * pcchDriveLetter // IN size of the pszDriveLetter buffer, OUT size of buffer required
  872. );
  873. DWORD
  874. WINAPI
  875. ResUtilTerminateServiceProcessFromResDll(
  876. IN DWORD dwServicePid,
  877. IN BOOL bOffline,
  878. OUT PDWORD pdwResourceState,
  879. IN PLOG_EVENT_ROUTINE pfnLogEvent,
  880. IN RESOURCE_HANDLE hResourceHandle
  881. );
  882. DWORD
  883. WINAPI
  884. ResUtilGetPropertyFormats(
  885. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  886. OUT PVOID pOutPropertyFormatList,
  887. IN DWORD cbPropertyFormatListSize,
  888. OUT LPDWORD pcbBytesReturned,
  889. OUT LPDWORD pcbRequired
  890. );
  891. DWORD
  892. WINAPI
  893. ResUtilGetCoreClusterResources(
  894. IN HCLUSTER hCluster
  895. , OUT HRESOURCE * phClusterNameResource
  896. , OUT HRESOURCE * phClusterIPAddressResource
  897. , OUT HRESOURCE * phClusterQuorumResource
  898. );
  899. DWORD
  900. WINAPI
  901. ResUtilGetResourceName(
  902. IN HRESOURCE hResource
  903. , OUT WCHAR * pszResourceName
  904. , IN OUT DWORD * pcchResourceName
  905. );
  906. #ifdef __cplusplus
  907. }
  908. #endif
  909. #endif // ifdef _RESAPI_DEFINES_