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.

1042 lines
23 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. } RESOURCE_MONITOR_STATE;
  299. typedef struct MONITOR_STATE {
  300. LARGE_INTEGER LastUpdate;
  301. RESOURCE_MONITOR_STATE State;
  302. HANDLE ActiveResource;
  303. BOOL ResmonStop;
  304. } MONITOR_STATE, *PMONITOR_STATE;
  305. //
  306. // Resource Utility Routines
  307. //
  308. DWORD
  309. WINAPI
  310. ResUtilStartResourceService(
  311. IN LPCWSTR pszServiceName,
  312. OUT LPSC_HANDLE phServiceHandle
  313. );
  314. DWORD
  315. WINAPI
  316. ResUtilVerifyResourceService(
  317. IN LPCWSTR pszServiceName
  318. );
  319. DWORD
  320. WINAPI
  321. ResUtilStopResourceService(
  322. IN LPCWSTR pszServiceName
  323. );
  324. DWORD
  325. WINAPI
  326. ResUtilVerifyService(
  327. IN SC_HANDLE hServiceHandle
  328. );
  329. DWORD
  330. WINAPI
  331. ResUtilStopService(
  332. IN SC_HANDLE hServiceHandle
  333. );
  334. DWORD
  335. WINAPI
  336. ResUtilCreateDirectoryTree(
  337. IN LPCWSTR pszPath
  338. );
  339. BOOL
  340. WINAPI
  341. ResUtilIsPathValid(
  342. IN LPCWSTR pszPath
  343. );
  344. DWORD
  345. WINAPI
  346. ResUtilEnumProperties(
  347. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  348. OUT LPWSTR pszOutProperties,
  349. IN DWORD cbOutPropertiesSize,
  350. OUT LPDWORD pcbBytesReturned,
  351. OUT LPDWORD pcbRequired
  352. );
  353. DWORD
  354. WINAPI
  355. ResUtilEnumPrivateProperties(
  356. IN HKEY hkeyClusterKey,
  357. OUT LPWSTR pszOutProperties,
  358. IN DWORD cbOutPropertiesSize,
  359. OUT LPDWORD pcbBytesReturned,
  360. OUT LPDWORD pcbRequired
  361. );
  362. DWORD
  363. WINAPI
  364. ResUtilGetProperties(
  365. IN HKEY hkeyClusterKey,
  366. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  367. OUT PVOID pOutPropertyList,
  368. IN DWORD cbOutPropertyListSize,
  369. OUT LPDWORD pcbBytesReturned,
  370. OUT LPDWORD pcbRequired
  371. );
  372. DWORD
  373. WINAPI
  374. ResUtilGetAllProperties(
  375. IN HKEY hkeyClusterKey,
  376. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  377. OUT PVOID pOutPropertyList,
  378. IN DWORD cbOutPropertyListSize,
  379. OUT LPDWORD pcbBytesReturned,
  380. OUT LPDWORD pcbRequired
  381. );
  382. DWORD
  383. WINAPI
  384. ResUtilGetPrivateProperties(
  385. IN HKEY hkeyClusterKey,
  386. OUT PVOID pOutPropertyList,
  387. IN DWORD cbOutPropertyListSize,
  388. OUT LPDWORD pcbBytesReturned,
  389. OUT LPDWORD pcbRequired
  390. );
  391. DWORD
  392. WINAPI
  393. ResUtilGetPropertySize(
  394. IN HKEY hkeyClusterKey,
  395. IN const PRESUTIL_PROPERTY_ITEM pPropertyTableItem,
  396. IN OUT LPDWORD pcbOutPropertyListSize,
  397. IN OUT LPDWORD pnPropertyCount
  398. );
  399. DWORD
  400. WINAPI
  401. ResUtilGetProperty(
  402. IN HKEY hkeyClusterKey,
  403. IN const PRESUTIL_PROPERTY_ITEM pPropertyTableItem,
  404. OUT PVOID * pOutPropertyItem,
  405. IN OUT LPDWORD pcbOutPropertyItemSize
  406. );
  407. DWORD
  408. WINAPI
  409. ResUtilVerifyPropertyTable(
  410. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  411. IN PVOID Reserved,
  412. IN BOOL bAllowUnknownProperties,
  413. IN const PVOID pInPropertyList,
  414. IN DWORD cbInPropertyListSize,
  415. OUT OPTIONAL LPBYTE pOutParams
  416. );
  417. DWORD
  418. WINAPI
  419. ResUtilSetPropertyTable(
  420. IN HKEY hkeyClusterKey,
  421. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  422. IN PVOID Reserved,
  423. IN BOOL bAllowUnknownProperties,
  424. IN const PVOID pInPropertyList,
  425. IN DWORD cbInPropertyListSize,
  426. OUT OPTIONAL LPBYTE pOutParams
  427. );
  428. DWORD
  429. WINAPI
  430. ResUtilSetPropertyTableEx(
  431. IN HKEY hkeyClusterKey,
  432. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  433. IN PVOID Reserved,
  434. IN BOOL bAllowUnknownProperties,
  435. IN const PVOID pInPropertyList,
  436. IN DWORD cbInPropertyListSize,
  437. IN BOOL bForceWrite,
  438. OUT OPTIONAL LPBYTE pOutParams
  439. );
  440. DWORD
  441. WINAPI
  442. ResUtilSetPropertyParameterBlock(
  443. IN HKEY hkeyClusterKey,
  444. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  445. IN PVOID Reserved,
  446. IN const LPBYTE pInParams,
  447. IN const PVOID pInPropertyList,
  448. IN DWORD cbInPropertyListSize,
  449. OUT OPTIONAL LPBYTE pOutParams
  450. );
  451. DWORD
  452. WINAPI
  453. ResUtilSetPropertyParameterBlockEx(
  454. IN HKEY hkeyClusterKey,
  455. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  456. IN PVOID Reserved,
  457. IN const LPBYTE pInParams,
  458. IN const PVOID pInPropertyList,
  459. IN DWORD cbInPropertyListSize,
  460. IN BOOL bForceWrite,
  461. OUT OPTIONAL LPBYTE pOutParams
  462. );
  463. DWORD
  464. WINAPI
  465. ResUtilSetUnknownProperties(
  466. IN HKEY hkeyClusterKey,
  467. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  468. IN const PVOID pInPropertyList,
  469. IN DWORD cbInPropertyListSize
  470. );
  471. DWORD
  472. WINAPI
  473. ResUtilGetPropertiesToParameterBlock(
  474. IN HKEY hkeyClusterKey,
  475. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  476. OUT LPBYTE pOutParams,
  477. IN BOOL bCheckForRequiredProperties,
  478. OUT OPTIONAL LPWSTR * pszNameOfPropInError
  479. );
  480. DWORD
  481. WINAPI
  482. ResUtilPropertyListFromParameterBlock(
  483. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  484. OUT PVOID pOutPropertyList,
  485. IN OUT LPDWORD pcbOutPropertyListSize,
  486. IN const LPBYTE pInParams,
  487. OUT LPDWORD pcbBytesReturned,
  488. OUT LPDWORD pcbRequired
  489. );
  490. DWORD
  491. WINAPI
  492. ResUtilDupParameterBlock(
  493. OUT LPBYTE pOutParams,
  494. IN const LPBYTE pInParams,
  495. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable
  496. );
  497. void
  498. WINAPI
  499. ResUtilFreeParameterBlock(
  500. IN OUT LPBYTE pOutParams,
  501. IN const LPBYTE pInParams,
  502. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable
  503. );
  504. DWORD
  505. WINAPI
  506. ResUtilAddUnknownProperties(
  507. IN HKEY hkeyClusterKey,
  508. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  509. IN OUT PVOID pOutPropertyList,
  510. IN DWORD pcbOutPropertyListSize,
  511. IN OUT LPDWORD pcbBytesReturned,
  512. IN OUT LPDWORD pcbRequired
  513. );
  514. DWORD
  515. WINAPI
  516. ResUtilSetPrivatePropertyList(
  517. IN HKEY hkeyClusterKey,
  518. IN const PVOID pInPropertyList,
  519. IN DWORD cbInPropertyListSize
  520. );
  521. DWORD
  522. WINAPI
  523. ResUtilVerifyPrivatePropertyList(
  524. IN const PVOID pInPropertyList,
  525. IN DWORD cbInPropertyListSize
  526. );
  527. PWSTR
  528. WINAPI
  529. ResUtilDupString(
  530. IN LPCWSTR pszInString
  531. );
  532. DWORD
  533. WINAPI
  534. ResUtilGetBinaryValue(
  535. IN HKEY hkeyClusterKey,
  536. IN LPCWSTR pszValueName,
  537. OUT LPBYTE * ppbOutValue,
  538. OUT DWORD * pcbOutValueSize
  539. );
  540. LPWSTR
  541. WINAPI
  542. ResUtilGetSzValue(
  543. IN HKEY hkeyClusterKey,
  544. IN LPCWSTR pszValueName
  545. );
  546. LPWSTR
  547. WINAPI
  548. ResUtilGetExpandSzValue(
  549. IN HKEY hkeyClusterKey,
  550. IN LPCWSTR pszValueName,
  551. IN BOOL bExpand
  552. );
  553. FORCEINLINE
  554. DWORD
  555. WINAPI
  556. ResUtilGetMultiSzValue(
  557. IN HKEY hkeyClusterKey,
  558. IN LPCWSTR pszValueName,
  559. OUT LPWSTR * ppszOutValue,
  560. OUT LPDWORD pcbOutValueSize
  561. )
  562. {
  563. return ResUtilGetBinaryValue( hkeyClusterKey, pszValueName, (LPBYTE *) ppszOutValue, pcbOutValueSize );
  564. }
  565. DWORD
  566. WINAPI
  567. ResUtilGetDwordValue(
  568. IN HKEY hkeyClusterKey,
  569. IN LPCWSTR pszValueName,
  570. OUT LPDWORD pdwOutValue,
  571. IN DWORD dwDefaultValue OPTIONAL
  572. );
  573. DWORD
  574. WINAPI
  575. ResUtilSetBinaryValue(
  576. IN HKEY hkeyClusterKey,
  577. IN LPCWSTR pszValueName,
  578. IN const LPBYTE pbNewValue,
  579. IN DWORD cbNewValueSize,
  580. IN OUT LPBYTE * ppbOutValue,
  581. IN OUT LPDWORD pcbOutValueSize
  582. );
  583. DWORD
  584. WINAPI
  585. ResUtilSetSzValue(
  586. IN HKEY hkeyClusterKey,
  587. IN LPCWSTR pszValueName,
  588. IN LPCWSTR pszNewValue,
  589. IN OUT LPWSTR * ppszOutString
  590. );
  591. DWORD
  592. WINAPI
  593. ResUtilSetExpandSzValue(
  594. IN HKEY hkeyClusterKey,
  595. IN LPCWSTR pszValueName,
  596. IN LPCWSTR pszNewValue,
  597. IN OUT LPWSTR * ppszOutString
  598. );
  599. DWORD
  600. WINAPI
  601. ResUtilSetMultiSzValue(
  602. IN HKEY hkeyClusterKey,
  603. IN LPCWSTR pszValueName,
  604. IN LPCWSTR pszNewValue,
  605. IN DWORD cbNewValueSize,
  606. IN OUT LPWSTR * ppszOutValue,
  607. IN OUT LPDWORD pcbOutValueSize
  608. );
  609. DWORD
  610. WINAPI
  611. ResUtilSetDwordValue(
  612. IN HKEY hkeyClusterKey,
  613. IN LPCWSTR pszValueName,
  614. IN DWORD dwNewValue,
  615. IN OUT LPDWORD pdwOutValue
  616. );
  617. DWORD
  618. WINAPI
  619. ResUtilGetBinaryProperty(
  620. OUT LPBYTE * ppbOutValue,
  621. OUT LPDWORD pcbOutValueSize,
  622. IN const PCLUSPROP_BINARY pValueStruct,
  623. IN const LPBYTE pbOldValue,
  624. IN DWORD cbOldValueSize,
  625. OUT LPBYTE * ppPropertyList,
  626. OUT LPDWORD pcbPropertyListSize
  627. );
  628. DWORD
  629. WINAPI
  630. ResUtilGetSzProperty(
  631. OUT LPWSTR * ppszOutValue,
  632. IN const PCLUSPROP_SZ pValueStruct,
  633. IN LPCWSTR pszOldValue,
  634. OUT LPBYTE * ppPropertyList,
  635. OUT LPDWORD pcbPropertyListSize
  636. );
  637. DWORD
  638. WINAPI
  639. ResUtilGetMultiSzProperty(
  640. OUT LPWSTR * ppszOutValue,
  641. OUT LPDWORD pcbOutValueSize,
  642. IN const PCLUSPROP_SZ pValueStruct,
  643. IN LPCWSTR pszOldValue,
  644. IN DWORD cbOldValueSize,
  645. OUT LPBYTE * ppPropertyList,
  646. OUT LPDWORD pcbPropertyListSize
  647. );
  648. DWORD
  649. WINAPI
  650. ResUtilGetDwordProperty(
  651. OUT LPDWORD pdwOutValue,
  652. IN const PCLUSPROP_DWORD pValueStruct,
  653. IN DWORD dwOldValue,
  654. IN DWORD dwMinimum,
  655. IN DWORD dwMaximum,
  656. OUT LPBYTE * ppPropertyList,
  657. OUT LPDWORD pcbPropertyListSize
  658. );
  659. LPVOID
  660. WINAPI
  661. ResUtilGetEnvironmentWithNetName(
  662. IN HRESOURCE hResource
  663. );
  664. DWORD
  665. WINAPI
  666. ResUtilFreeEnvironment(
  667. IN LPVOID lpEnvironment
  668. );
  669. LPWSTR
  670. WINAPI
  671. ResUtilExpandEnvironmentStrings(
  672. IN LPCWSTR pszSrc
  673. );
  674. DWORD
  675. WINAPI
  676. ResUtilSetResourceServiceEnvironment(
  677. IN LPCWSTR pszServiceName,
  678. IN HRESOURCE hResource,
  679. IN PLOG_EVENT_ROUTINE pfnLogEvent,
  680. IN RESOURCE_HANDLE hResourceHandle
  681. );
  682. DWORD
  683. WINAPI
  684. ResUtilSetResourceServiceStartParameters(
  685. IN LPCWSTR pszServiceName,
  686. IN SC_HANDLE schSCMHandle,
  687. IN OUT LPSC_HANDLE phService,
  688. IN PLOG_EVENT_ROUTINE pfnLogEvent,
  689. IN RESOURCE_HANDLE hResourceHandle
  690. );
  691. DWORD
  692. WINAPI
  693. ResUtilFindSzProperty(
  694. IN const PVOID pPropertyList,
  695. IN DWORD cbPropertyListSize,
  696. IN LPCWSTR pszPropertyName,
  697. OUT LPWSTR * pszPropertyValue
  698. );
  699. DWORD
  700. WINAPI
  701. ResUtilFindExpandSzProperty(
  702. IN const PVOID pPropertyList,
  703. IN DWORD cbPropertyListSize,
  704. IN LPCWSTR pszPropertyName,
  705. OUT LPWSTR * pszPropertyValue
  706. );
  707. DWORD
  708. WINAPI
  709. ResUtilFindExpandedSzProperty(
  710. IN const PVOID pPropertyList,
  711. IN DWORD cbPropertyListSize,
  712. IN LPCWSTR pszPropertyName,
  713. OUT LPWSTR * pszPropertyValue
  714. );
  715. DWORD
  716. WINAPI
  717. ResUtilFindDwordProperty(
  718. IN const PVOID pPropertyList,
  719. IN DWORD cbPropertyListSize,
  720. IN LPCWSTR pszPropertyName,
  721. OUT LPDWORD pdwPropertyValue
  722. );
  723. DWORD
  724. WINAPI
  725. ResUtilFindBinaryProperty(
  726. IN const PVOID pPropertyList,
  727. IN DWORD cbPropertyListSize,
  728. IN LPCWSTR pszPropertyName,
  729. OUT LPBYTE * pbPropertyValue,
  730. OUT LPDWORD pcbPropertyValueSize
  731. );
  732. DWORD
  733. WINAPI
  734. ResUtilFindMultiSzProperty(
  735. IN const PVOID pPropertyList,
  736. IN DWORD cbPropertyListSize,
  737. IN LPCWSTR pszPropertyName,
  738. OUT LPWSTR * pszPropertyValue,
  739. OUT LPDWORD pcbPropertyValueSize
  740. );
  741. DWORD
  742. WINAPI
  743. ResUtilFindLongProperty(
  744. IN const PVOID pPropertyList,
  745. IN DWORD cbPropertyListSize,
  746. IN LPCWSTR pszPropertyName,
  747. OUT LPLONG plPropertyValueSize
  748. );
  749. //
  750. // Common worker thread routines that allow a pending operation to
  751. // be cancelled with CORRECT synchronization.
  752. //
  753. typedef struct CLUS_WORKER {
  754. HANDLE hThread;
  755. BOOL Terminate;
  756. } CLUS_WORKER, *PCLUS_WORKER;
  757. typedef DWORD (WINAPI *PWORKER_START_ROUTINE)(
  758. PCLUS_WORKER pWorker,
  759. LPVOID lpThreadParameter
  760. );
  761. DWORD
  762. WINAPI
  763. ClusWorkerCreate(
  764. OUT PCLUS_WORKER lpWorker,
  765. IN PWORKER_START_ROUTINE lpStartAddress,
  766. IN PVOID lpParameter
  767. );
  768. BOOL
  769. WINAPI
  770. ClusWorkerCheckTerminate(
  771. IN PCLUS_WORKER lpWorker
  772. );
  773. VOID
  774. WINAPI
  775. ClusWorkerTerminate(
  776. IN PCLUS_WORKER lpWorker
  777. );
  778. //Define enumerate resource callback function. This gets called for each resource enumerated
  779. //by ResUtilEnumResources
  780. typedef DWORD (*LPRESOURCE_CALLBACK)( HRESOURCE, HRESOURCE , PVOID );
  781. typedef DWORD (*LPRESOURCE_CALLBACK_EX)( HCLUSTER, HRESOURCE, HRESOURCE , PVOID );
  782. BOOL
  783. WINAPI
  784. ResUtilResourcesEqual(
  785. IN HRESOURCE hSelf,
  786. IN HRESOURCE hResource
  787. );
  788. BOOL
  789. WINAPI
  790. ResUtilResourceTypesEqual(
  791. IN LPCWSTR lpszResourceTypeName,
  792. IN HRESOURCE hResource
  793. );
  794. BOOL
  795. WINAPI
  796. ResUtilIsResourceClassEqual(
  797. IN PCLUS_RESOURCE_CLASS_INFO prci,
  798. IN HRESOURCE hResource
  799. );
  800. DWORD
  801. WINAPI
  802. ResUtilEnumResources(
  803. IN HRESOURCE hSelf,
  804. IN LPCWSTR lpszResTypeName,
  805. IN LPRESOURCE_CALLBACK pResCallBack,
  806. IN PVOID pParameter
  807. );
  808. DWORD
  809. WINAPI
  810. ResUtilEnumResourcesEx(
  811. IN HCLUSTER hCluster,
  812. IN HRESOURCE hSelf,
  813. IN LPCWSTR lpszResTypeName,
  814. IN LPRESOURCE_CALLBACK_EX pResCallBack,
  815. IN PVOID pParameter
  816. );
  817. HRESOURCE
  818. WINAPI
  819. ResUtilGetResourceDependency(
  820. IN HANDLE hSelf,
  821. IN LPCWSTR lpszResourceType
  822. );
  823. HRESOURCE
  824. WINAPI
  825. ResUtilGetResourceDependencyByName(
  826. IN HCLUSTER hCluster,
  827. IN HANDLE hSelf,
  828. IN LPCWSTR lpszResourceType,
  829. IN BOOL bRecurse
  830. );
  831. HRESOURCE
  832. WINAPI
  833. ResUtilGetResourceDependencyByClass(
  834. IN HCLUSTER hCluster,
  835. IN HANDLE hSelf,
  836. IN PCLUS_RESOURCE_CLASS_INFO prci,
  837. IN BOOL bRecurse
  838. );
  839. HRESOURCE
  840. WINAPI
  841. ResUtilGetResourceNameDependency(
  842. IN LPCWSTR lpszResourceName,
  843. IN LPCWSTR lpszResourceType
  844. );
  845. DWORD
  846. WINAPI
  847. ResUtilGetResourceDependentIPAddressProps(
  848. IN HRESOURCE hResource,
  849. OUT LPWSTR pszAddress,
  850. IN OUT DWORD * pcchAddress,
  851. OUT LPWSTR pszSubnetMask,
  852. IN OUT DWORD * pcchSubnetMask,
  853. OUT LPWSTR pszNetwork,
  854. IN OUT DWORD * pcchNetwork
  855. );
  856. DWORD
  857. WINAPI
  858. ResUtilFindDependentDiskResourceDriveLetter(
  859. IN HCLUSTER hCluster, // handle to cluster
  860. IN HRESOURCE hResource, // handle to resource to query for dependencies
  861. IN LPWSTR pszDriveLetter, // buffer to store drive letter (ex. "X:\0")
  862. IN OUT DWORD * pcchDriveLetter // IN size of the pszDriveLetter buffer, OUT size of buffer required
  863. );
  864. DWORD
  865. WINAPI
  866. ResUtilTerminateServiceProcessFromResDll(
  867. IN DWORD dwServicePid,
  868. IN BOOL bOffline,
  869. OUT PDWORD pdwResourceState,
  870. IN PLOG_EVENT_ROUTINE pfnLogEvent,
  871. IN RESOURCE_HANDLE hResourceHandle
  872. );
  873. DWORD
  874. WINAPI
  875. ResUtilGetPropertyFormats(
  876. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  877. OUT PVOID pOutPropertyFormatList,
  878. IN DWORD cbPropertyFormatListSize,
  879. OUT LPDWORD pcbBytesReturned,
  880. OUT LPDWORD pcbRequired
  881. );
  882. DWORD
  883. WINAPI
  884. ResUtilGetCoreClusterResources(
  885. IN HCLUSTER hCluster
  886. , OUT HRESOURCE * phClusterNameResource
  887. , OUT HRESOURCE * phClusterIPAddressResource
  888. , OUT HRESOURCE * phClusterQuorumResource
  889. );
  890. DWORD
  891. WINAPI
  892. ResUtilGetResourceName(
  893. IN HRESOURCE hResource
  894. , OUT WCHAR * pszResourceName
  895. , IN OUT DWORD * pcchResourceName
  896. );
  897. #ifdef __cplusplus
  898. }
  899. #endif
  900. #endif // ifdef _RESAPI_DEFINES_