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.

2111 lines
45 KiB

  1. /*++
  2. Copyright (c) 1995-1998 Microsoft Corporation
  3. Module Name:
  4. clusrtl.h
  5. Abstract:
  6. Header file for definitions and structures for the NT Cluster
  7. Run Time Library
  8. Author:
  9. John Vert (jvert) 30-Nov-1995
  10. Revision History:
  11. --*/
  12. #ifndef _CLUSRTL_INCLUDED_
  13. #define _CLUSRTL_INCLUDED_
  14. //
  15. // Service Message IDs
  16. //
  17. #include "clusvmsg.h"
  18. #include "resapi.h"
  19. #include <aclapi.h>
  20. #include <netcon.h>
  21. #include <winioctl.h>
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. //
  26. // Routine Description:
  27. //
  28. // Initializes the cluster run time library.
  29. //
  30. // Arguments:
  31. //
  32. // DbgOutputToConsole - TRUE if the debug output should be written to a
  33. // console window
  34. //
  35. // DbgLogLevel - pointer to a DWORD that contains the current msg filter
  36. // level. checked by ClRtlDbgPrint.
  37. //
  38. // Return Value:
  39. //
  40. // ERROR_SUCCESS if the function succeeds.
  41. // A Win32 error code otherwise.
  42. //
  43. DWORD
  44. ClRtlInitialize(
  45. IN BOOL DbgOutputToConsole,
  46. IN PDWORD DbgLogLevel
  47. );
  48. //
  49. // Routine Description:
  50. //
  51. // Cleans up the cluster run time library.
  52. //
  53. // Arguments:
  54. //
  55. // None.
  56. //
  57. // Return Value:
  58. //
  59. // None.
  60. //
  61. VOID
  62. ClRtlCleanup(
  63. VOID
  64. );
  65. //
  66. // Routine Description:
  67. //
  68. // Checks to see if Services for MacIntosh is installed.
  69. //
  70. // Arguments:
  71. //
  72. // Pointer to boolean that tells if SFM is installed.
  73. //
  74. // Return Value:
  75. //
  76. // Status of request.
  77. //
  78. DWORD
  79. ClRtlIsServicesForMacintoshInstalled(
  80. OUT BOOL * pfInstalled
  81. );
  82. //////////////////////////////////////////////////////////////////////////
  83. //
  84. // Event logging interfaces
  85. //
  86. //
  87. // There are three currently defined logging levels:
  88. // LOG_CRITICAL - fatal error, chaos and destruction will ensue
  89. // LOG_UNUSUAL - unexpected event, but will be handled
  90. // LOG_NOISE - normal occurence
  91. //
  92. //////////////////////////////////////////////////////////////////////////
  93. #define LOG_CRITICAL 1
  94. #define LOG_UNUSUAL 2
  95. #define LOG_NOISE 3
  96. //
  97. // A few interfaces for reporting of errors.
  98. //
  99. VOID
  100. ClRtlEventLogInit(
  101. VOID
  102. );
  103. VOID
  104. ClRtlEventLogCleanup(
  105. VOID
  106. );
  107. VOID
  108. ClusterLogFatalError(
  109. IN ULONG LogModule,
  110. IN ULONG Line,
  111. IN LPSTR File,
  112. IN ULONG ErrCode
  113. );
  114. VOID
  115. ClusterLogNonFatalError(
  116. IN ULONG LogModule,
  117. IN ULONG Line,
  118. IN LPSTR File,
  119. IN ULONG ErrCode
  120. );
  121. VOID
  122. ClusterLogAssertionFailure(
  123. IN ULONG LogModule,
  124. IN ULONG Line,
  125. IN LPSTR File,
  126. IN LPSTR Expression
  127. );
  128. VOID
  129. ClusterLogEvent0(
  130. IN DWORD LogLevel,
  131. IN DWORD LogModule,
  132. IN LPSTR FileName,
  133. IN DWORD LineNumber,
  134. IN DWORD MessageId,
  135. IN DWORD dwByteCount,
  136. IN PVOID lpBytes
  137. );
  138. VOID
  139. ClusterLogEvent1(
  140. IN DWORD LogLevel,
  141. IN DWORD LogModule,
  142. IN LPSTR FileName,
  143. IN DWORD LineNumber,
  144. IN DWORD MessageId,
  145. IN DWORD dwByteCount,
  146. IN PVOID lpBytes,
  147. IN LPCWSTR Arg1
  148. );
  149. VOID
  150. ClusterLogEvent2(
  151. IN DWORD LogLevel,
  152. IN DWORD LogModule,
  153. IN LPSTR FileName,
  154. IN DWORD LineNumber,
  155. IN DWORD MessageId,
  156. IN DWORD dwByteCount,
  157. IN PVOID lpBytes,
  158. IN LPCWSTR Arg1,
  159. IN LPCWSTR Arg2
  160. );
  161. VOID
  162. ClusterLogEvent3(
  163. IN DWORD LogLevel,
  164. IN DWORD LogModule,
  165. IN LPSTR FileName,
  166. IN DWORD LineNumber,
  167. IN DWORD MessageId,
  168. IN DWORD dwByteCount,
  169. IN PVOID lpBytes,
  170. IN LPCWSTR Arg1,
  171. IN LPCWSTR Arg2,
  172. IN LPCWSTR Arg3
  173. );
  174. VOID
  175. ClusterLogEvent4(
  176. IN DWORD LogLevel,
  177. IN DWORD LogModule,
  178. IN LPSTR FileName,
  179. IN DWORD LineNumber,
  180. IN DWORD MessageId,
  181. IN DWORD dwByteCount,
  182. IN PVOID lpBytes,
  183. IN LPCWSTR Arg1,
  184. IN LPCWSTR Arg2,
  185. IN LPCWSTR Arg3,
  186. IN LPCWSTR Arg4
  187. );
  188. //
  189. // Routine Description:
  190. //
  191. // Prints a message to the debugger if running as a service
  192. // or the console window if running as a console app.
  193. //
  194. // Arguments:
  195. //
  196. // LogLevel - Supplies the logging level, one of
  197. // LOG_CRITICAL 1
  198. // LOG_UNUSUAL 2
  199. // LOG_NOISE 3
  200. //
  201. // FormatString - Message string.
  202. //
  203. // Any FormatMessage-compatible arguments to be inserted in the
  204. // ErrorMessage before it is logged.
  205. //
  206. // Return Value:
  207. //
  208. // None.
  209. //
  210. VOID
  211. __cdecl
  212. ClRtlDbgPrint(
  213. DWORD LogLevel,
  214. PCHAR FormatString,
  215. ...
  216. );
  217. //
  218. // Same as ClRtlDbgPrint, only uses a message ID instead of a string.
  219. //
  220. VOID
  221. __cdecl
  222. ClRtlMsgPrint(
  223. IN DWORD MessageId,
  224. ...
  225. );
  226. //
  227. // Same as ClRtlDbgPrint, only logs to a file instead of screen.
  228. //
  229. VOID
  230. __cdecl
  231. ClRtlLogPrint(
  232. DWORD LogLevel,
  233. PCHAR FormatString,
  234. ...
  235. );
  236. //
  237. // Macros/prototypes for unexpected error handling.
  238. //
  239. #define ARGUMENT_PRESENT( ArgumentPointer ) (\
  240. (CHAR *)(ArgumentPointer) != (CHAR *)(NULL) )
  241. WINBASEAPI
  242. BOOL
  243. APIENTRY
  244. IsDebuggerPresent(
  245. VOID
  246. );
  247. #define CL_UNEXPECTED_ERROR(_errcode_) \
  248. ClusterLogFatalError(LOG_CURRENT_MODULE, \
  249. __LINE__, \
  250. __FILE__, \
  251. (_errcode_))
  252. #if DBG
  253. #define CL_ASSERT( exp ) \
  254. if (!(exp)) { \
  255. ClusterLogAssertionFailure(LOG_CURRENT_MODULE, \
  256. __LINE__, \
  257. __FILE__, \
  258. #exp); \
  259. }
  260. #define CL_LOGFAILURE( _errcode_ ) \
  261. ClusterLogNonFatalError(LOG_CURRENT_MODULE, \
  262. __LINE__, \
  263. __FILE__, \
  264. (_errcode_))
  265. #else
  266. #define CL_ASSERT( exp )
  267. #define CL_LOGFAILURE( _errorcode_ )
  268. #endif
  269. // Use the following to put cluster specific errors in the event log
  270. #define CL_LOGCLUSINFO( _errcode_ ) \
  271. ClusterLogEvent0(LOG_NOISE, \
  272. LOG_CURRENT_MODULE, \
  273. __FILE__, \
  274. __LINE__, \
  275. (_errcode_), \
  276. 0, \
  277. NULL)
  278. #define CL_LOGCLUSWARNING( _errcode_ ) \
  279. ClusterLogEvent0(LOG_UNUSUAL, \
  280. LOG_CURRENT_MODULE, \
  281. __FILE__, \
  282. __LINE__, \
  283. (_errcode_), \
  284. 0, \
  285. NULL)
  286. #define CL_LOGCLUSWARNING1(_msgid_,_arg1_) \
  287. ClusterLogEvent1(LOG_UNUSUAL, \
  288. LOG_CURRENT_MODULE, \
  289. __FILE__, \
  290. __LINE__, \
  291. (_msgid_), \
  292. 0, \
  293. NULL, \
  294. (_arg1_))
  295. #define CL_LOGCLUSERROR( _errcode_ ) \
  296. ClusterLogEvent0(LOG_CRITICAL, \
  297. LOG_CURRENT_MODULE, \
  298. __FILE__, \
  299. __LINE__, \
  300. (_errcode_), \
  301. 0, \
  302. NULL)
  303. #define CL_LOGCLUSERROR1(_msgid_,_arg1_) \
  304. ClusterLogEvent1(LOG_CRITICAL, \
  305. LOG_CURRENT_MODULE, \
  306. __FILE__, \
  307. __LINE__, \
  308. (_msgid_), \
  309. 0, \
  310. NULL, \
  311. (_arg1_))
  312. #define CL_LOGCLUSERROR2(_msgid_,_arg1_, _arg2_) \
  313. ClusterLogEvent2(LOG_CRITICAL, \
  314. LOG_CURRENT_MODULE, \
  315. __FILE__, \
  316. __LINE__, \
  317. (_msgid_), \
  318. 0, \
  319. NULL, \
  320. (_arg1_), \
  321. (_arg2_))
  322. //////////////////////////////////////////////////////////////////////////
  323. //
  324. // General-purpose hash table package
  325. //
  326. //////////////////////////////////////////////////////////////////////////
  327. #define MAX_CL_HASH 16 // the size of the table
  328. typedef struct _CL_HASH_ITEM {
  329. LIST_ENTRY ListHead;
  330. DWORD Id;
  331. PVOID pData;
  332. } CL_HASH_ITEM, *PCL_HASH_ITEM;
  333. typedef struct _CL_HASH {
  334. CRITICAL_SECTION Lock;
  335. BOOL bRollover; // flag to handle rollover
  336. DWORD LastId; // last id used
  337. DWORD CacheFreeId[MAX_CL_HASH]; // a cache of available id's
  338. CL_HASH_ITEM Head[MAX_CL_HASH];
  339. } CL_HASH, *PCL_HASH;
  340. VOID
  341. ClRtlInitializeHash(
  342. IN PCL_HASH pTable
  343. );
  344. DWORD
  345. ClRtlInsertTailHash(
  346. IN PCL_HASH pTable,
  347. IN PVOID pData,
  348. OUT LPDWORD pId
  349. );
  350. PVOID
  351. ClRtlGetEntryHash(
  352. IN PCL_HASH pTable,
  353. IN DWORD Id
  354. );
  355. PVOID
  356. ClRtlRemoveEntryHash(
  357. IN PCL_HASH pTable,
  358. IN DWORD Id
  359. );
  360. VOID
  361. ClRtlDeleteHash(
  362. IN PCL_HASH pTable
  363. );
  364. //////////////////////////////////////////////////////////////////////////
  365. //
  366. // General-purpose queue package.
  367. //
  368. //////////////////////////////////////////////////////////////////////////
  369. typedef struct _CL_QUEUE {
  370. LIST_ENTRY ListHead;
  371. CRITICAL_SECTION Lock;
  372. HANDLE Event;
  373. DWORD Count;
  374. HANDLE Abort;
  375. } CL_QUEUE, *PCL_QUEUE;
  376. DWORD
  377. ClRtlInitializeQueue(
  378. IN PCL_QUEUE Queue
  379. );
  380. VOID
  381. ClRtlDeleteQueue(
  382. IN PCL_QUEUE Queue
  383. );
  384. PLIST_ENTRY
  385. ClRtlRemoveHeadQueue(
  386. IN PCL_QUEUE Queue
  387. );
  388. typedef
  389. DWORD
  390. (*CLRTL_CHECK_HEAD_QUEUE_CALLBACK)(
  391. IN PLIST_ENTRY ListEntry,
  392. IN PVOID Context
  393. );
  394. /*++
  395. Routine Description:
  396. Called by ClRtlRemoveHeadQueueTimeout to determine
  397. whether or not an entry at the head of the queue is
  398. appropriate to dequeue and return or not.
  399. Arguments:
  400. ListEntry - value of the PLIST_ENTRY we're examining
  401. Context - caller-defined data
  402. Return Value:
  403. ERROR_SUCCESS if it's appropriate to return the event.
  404. A Win32 error code if the initialization failed. This value
  405. can be retrieved by calling GetLastError().
  406. --*/
  407. PLIST_ENTRY
  408. ClRtlRemoveHeadQueueTimeout(
  409. IN PCL_QUEUE Queue,
  410. IN DWORD dwMilliseconds,
  411. IN CLRTL_CHECK_HEAD_QUEUE_CALLBACK pfnCallback,
  412. IN PVOID pvContext
  413. );
  414. VOID
  415. ClRtlInsertTailQueue(
  416. IN PCL_QUEUE Queue,
  417. IN PLIST_ENTRY Item
  418. );
  419. VOID
  420. ClRtlRundownQueue(
  421. IN PCL_QUEUE Queue,
  422. OUT PLIST_ENTRY ListHead
  423. );
  424. //////////////////////////////////////////////////////////////////////////
  425. //
  426. // General-purpose buffer pool package.
  427. //
  428. //////////////////////////////////////////////////////////////////////////
  429. //
  430. // Buffer pool definition.
  431. //
  432. typedef struct _CLRTL_BUFFER_POOL *PCLRTL_BUFFER_POOL;
  433. //
  434. // Maximum number of buffers that can be allocated from a pool.
  435. //
  436. #define CLRTL_MAX_POOL_BUFFERS 0xFFFFFFFE
  437. //
  438. // Routines for utilizing buffer pools.
  439. //
  440. typedef
  441. DWORD
  442. (*CLRTL_BUFFER_CONSTRUCTOR)(
  443. PVOID Buffer
  444. );
  445. /*++
  446. Routine Description:
  447. Called to initialize a buffer which has been newly allocated
  448. from system memory.
  449. Arguments:
  450. Buffer - A pointer to the buffer to initialize.
  451. Return Value:
  452. ERROR_SUCCESS if the initialization succeeded.
  453. A Win32 error code if the initialization failed.
  454. --*/
  455. typedef
  456. VOID
  457. (*CLRTL_BUFFER_DESTRUCTOR)(
  458. PVOID Buffer
  459. );
  460. /*++
  461. Routine Description:
  462. Called to cleanup a buffer which is about to be returned to
  463. system memory.
  464. Arguments:
  465. Buffer - A pointer to the buffer to cleanup.
  466. Return Value:
  467. None.
  468. --*/
  469. PCLRTL_BUFFER_POOL
  470. ClRtlCreateBufferPool(
  471. IN DWORD BufferSize,
  472. IN DWORD MaximumCached,
  473. IN DWORD MaximumAllocated,
  474. IN CLRTL_BUFFER_CONSTRUCTOR Constructor, OPTIONAL
  475. IN CLRTL_BUFFER_DESTRUCTOR Destructor OPTIONAL
  476. );
  477. /*++
  478. Routine Description:
  479. Creates a pool from which fixed-size buffers may be allocated.
  480. Arguments:
  481. BufferSize - Size of the buffers managed by the pool.
  482. MaximumCached - The maximum number of buffers to cache in the pool.
  483. Must be less than or equal to MaximumAllocated.
  484. MaximumAllocated - The maximum number of buffers to allocate from
  485. system memory. Must be less than or equal to
  486. CLRTL_MAX_POOL_BUFFERS.
  487. Constructor - An optional routine to be called when a new buffer
  488. is allocated from system memory. May be NULL
  489. Destructor - An optional routine to be called when a buffer
  490. is returned to system memory. May be NULL.
  491. Return Value:
  492. A pointer to the created buffer pool or NULL on error.
  493. Extended error information is available from GetLastError().
  494. --*/
  495. VOID
  496. ClRtlDestroyBufferPool(
  497. IN PCLRTL_BUFFER_POOL Pool
  498. );
  499. /*++
  500. Routine Description:
  501. Destroys a previously created buffer pool.
  502. Arguments:
  503. Pool - A pointer to the pool to destroy.
  504. Return Value:
  505. None.
  506. Notes:
  507. The pool will not actually be destroyed until all outstanding
  508. buffers have been returned. Each outstanding buffer is effectively
  509. a reference on the pool.
  510. --*/
  511. PVOID
  512. ClRtlAllocateBuffer(
  513. IN PCLRTL_BUFFER_POOL Pool
  514. );
  515. /*++
  516. Routine Description:
  517. Allocates a buffer from a previously created buffer pool.
  518. Arguments:
  519. Pool - A pointer to the pool from which to allocate the buffer.
  520. Return Value:
  521. A pointer to the allocated buffer if the routine was successfull.
  522. NULL if the routine failed. Extended error information is available
  523. by calling GetLastError().
  524. --*/
  525. VOID
  526. ClRtlFreeBuffer(
  527. PVOID Buffer
  528. );
  529. /*++
  530. Routine Description:
  531. Frees a buffer back to its owning pool.
  532. Arguments:
  533. Buffer - The buffer to free.
  534. Return Value:
  535. None.
  536. --*/
  537. //////////////////////////////////////////////////////////////////////////
  538. //
  539. // General-purpose worker thread queue package.
  540. //
  541. //////////////////////////////////////////////////////////////////////////
  542. typedef struct _CLRTL_WORK_ITEM *PCLRTL_WORK_ITEM;
  543. typedef
  544. VOID
  545. (*PCLRTL_WORK_ROUTINE)(
  546. IN PCLRTL_WORK_ITEM WorkItem,
  547. IN DWORD Status,
  548. IN DWORD BytesTransferred,
  549. IN ULONG_PTR IoContext
  550. );
  551. /*++
  552. Routine Description:
  553. Called to process an item posted to a work queue.
  554. Arguments:
  555. WorkItem - The work item to process.
  556. Status - If the work item represents a completed I/O operation,
  557. this parameter contains the completion status of the
  558. operation.
  559. BytesTransferred - If the work item represents a completed I/O operation,
  560. this parameter contains the number of bytes tranferred
  561. during the operation. For other work items, the
  562. semantics of this parameter are defined by the caller
  563. of ClRtlPostItemWorkQueue.
  564. IoContext - If the work item represents a completed I/O operation,
  565. this parameter contains the context value associated
  566. with the handle on which the I/O was submitted. For
  567. other work items, the semantics of this parameter are
  568. defined by the caller of ClRtlPostItemWorkQueue.
  569. Return Value:
  570. None.
  571. --*/
  572. //
  573. // Work Item Structure.
  574. //
  575. typedef struct _CLRTL_WORK_ITEM {
  576. OVERLAPPED Overlapped;
  577. PCLRTL_WORK_ROUTINE WorkRoutine;
  578. PVOID Context;
  579. } CLRTL_WORK_ITEM;
  580. //
  581. // Work queue definition.
  582. //
  583. typedef struct _CLRTL_WORK_QUEUE *PCLRTL_WORK_QUEUE;
  584. //
  585. // Routines For Utilizing Work Queues
  586. //
  587. #define ClRtlInitializeWorkItem(Item, Routine, Ctx) \
  588. ZeroMemory(&((Item)->Overlapped), sizeof(OVERLAPPED)); \
  589. (Item)->WorkRoutine = (Routine); \
  590. (Item)->Context = (Ctx);
  591. PCLRTL_WORK_QUEUE
  592. ClRtlCreateWorkQueue(
  593. IN DWORD MaximumThreads,
  594. IN int ThreadPriority
  595. );
  596. /*++
  597. Routine Description:
  598. Creates a work queue and a dynamic pool of threads to service it.
  599. Arguments:
  600. MaximumThreads - The maximum number of threads to create to service
  601. the queue.
  602. ThreadPriority - The priority level at which the queue worker threads
  603. should run.
  604. Return Value:
  605. A pointer to the created queue if the routine is successful.
  606. NULL if the routine fails. Call GetLastError for extended
  607. error information.
  608. --*/
  609. VOID
  610. ClRtlDestroyWorkQueue(
  611. IN PCLRTL_WORK_QUEUE WorkQueue
  612. );
  613. /*++
  614. Routine Description:
  615. Destroys a work queue and its thread pool.
  616. Arguments:
  617. WorkQueue - The queue to destroy.
  618. Return Value:
  619. None.
  620. Notes:
  621. The following rules must be observed in order to safely destroy a
  622. work queue:
  623. 1) No new work items may be posted to the queue once all previously
  624. posted items have been processed by this routine.
  625. 2) WorkRoutines must be able to process items until this
  626. call returns. After the call returns, no more items will
  627. be delivered from the specified queue.
  628. One workable cleanup procedure is as follows: First, direct the
  629. WorkRoutines to silently discard completed items. Next, eliminate
  630. all sources of new work. Finally, destroy the work queue. Note that
  631. when in discard mode, the WorkRoutines may not access any structures
  632. which will be destroyed by eliminating the sources of new work.
  633. --*/
  634. DWORD
  635. ClRtlPostItemWorkQueue(
  636. IN PCLRTL_WORK_QUEUE WorkQueue,
  637. IN PCLRTL_WORK_ITEM WorkItem,
  638. IN DWORD BytesTransferred, OPTIONAL
  639. IN ULONG_PTR IoContext OPTIONAL
  640. );
  641. /*++
  642. Routine Description:
  643. Posts a specified work item to a specified work queue.
  644. Arguments:
  645. WorkQueue - A pointer to the work queue to which to post the item.
  646. WorkItem - A pointer to the item to post.
  647. BytesTransferred - If the work item represents a completed I/O operation,
  648. this parameter contains the number of bytes
  649. transferred during the operation. For other work items,
  650. the semantics of this parameter may be defined by
  651. the caller.
  652. IoContext - If the work item represents a completed I/O operation,
  653. this parameter contains the context value associated
  654. with the handle on which the operation was submitted.
  655. Of other work items, the semantics of this parameter
  656. may be defined by the caller.
  657. Return Value:
  658. ERROR_SUCCESS if the item was posted successfully.
  659. A Win32 error code if the post operation fails.
  660. --*/
  661. DWORD
  662. ClRtlAssociateIoHandleWorkQueue(
  663. IN PCLRTL_WORK_QUEUE WorkQueue,
  664. IN HANDLE IoHandle,
  665. IN ULONG_PTR IoContext
  666. );
  667. /*++
  668. Routine Description:
  669. Associates a specified I/O handle, opened for overlapped I/O
  670. completion, with a work queue. All pending I/O operations on
  671. the specified handle will be posted to the work queue when
  672. completed. An initialized CLRTL_WORK_ITEM must be used to supply
  673. the OVERLAPPED structure whenever an I/O operation is submitted on
  674. the specified handle.
  675. Arguments:
  676. WorkQueue - The work queue with which to associate the I/O handle.
  677. IoHandle - The I/O handle to associate.
  678. IoContext - A context value to associate with the specified handle.
  679. This value will be supplied as a parameter to the
  680. WorkRoutine which processes completions for this
  681. handle.
  682. Return Value:
  683. ERROR_SUCCESS if the association completes successfully.
  684. A Win32 error code if the association fails.
  685. --*/
  686. //////////////////////////////////////////////////////////////////////////
  687. //
  688. // Utilities for accessing the NT system registry.
  689. //
  690. //////////////////////////////////////////////////////////////////////////
  691. DWORD
  692. ClRtlRegQueryDword(
  693. IN HKEY hKey,
  694. IN LPWSTR lpValueName,
  695. OUT LPDWORD lpValue,
  696. IN LPDWORD lpDefaultValue OPTIONAL
  697. );
  698. DWORD
  699. ClRtlRegQueryString(
  700. IN HKEY Key,
  701. IN LPWSTR ValueName,
  702. IN DWORD ValueType,
  703. IN LPWSTR *StringBuffer,
  704. IN OUT LPDWORD StringBufferSize,
  705. OUT LPDWORD StringSize
  706. );
  707. //////////////////////////////////////////////////////////////////////////
  708. //
  709. // Routines for groveling and managing network configuration.
  710. // Currently, these are specific to TCP/IP.
  711. //
  712. //////////////////////////////////////////////////////////////////////////
  713. //
  714. // Transport interface information structure
  715. //
  716. // The "Ignore" field is intitialized to FALSE. If it is set to
  717. // TRUE by an application, the enum search functions will ignore
  718. // the entry.
  719. //
  720. typedef struct _CLRTL_NET_INTERFACE_INFO {
  721. struct _CLRTL_NET_INTERFACE_INFO * Next;
  722. ULONG Context;
  723. ULONG Flags;
  724. ULONG InterfaceAddress;
  725. LPWSTR InterfaceAddressString;
  726. ULONG NetworkAddress;
  727. LPWSTR NetworkAddressString;
  728. ULONG NetworkMask;
  729. LPWSTR NetworkMaskString;
  730. BOOLEAN Ignore;
  731. } CLRTL_NET_INTERFACE_INFO, *PCLRTL_NET_INTERFACE_INFO;
  732. #define CLRTL_NET_INTERFACE_PRIMARY 0x00000001
  733. #define CLRTL_NET_INTERFACE_DYNAMIC 0x00000002
  734. //
  735. // Adapter information structure
  736. //
  737. // The "Ignore" field is intitialized to FALSE. If it is set to
  738. // TRUE by an application, the enum search functions will ignore
  739. // the entry.
  740. //
  741. typedef struct _CLRTL_NET_ADAPTER_INFO {
  742. struct _CLRTL_NET_ADAPTER_INFO * Next;
  743. LPWSTR ConnectoidName; // INetConnection::get_Name
  744. LPWSTR DeviceGuid; // GUID for INetConnection
  745. BSTR DeviceName; // INetConnection::get_DeviceName
  746. LPWSTR AdapterDomainName; // adapter specific domain
  747. ULONG Index;
  748. ULONG Flags;
  749. NETCON_STATUS NCStatus; // INetConnection::GetProperties->Status
  750. ULONG InterfaceCount;
  751. PCLRTL_NET_INTERFACE_INFO InterfaceList;
  752. BOOLEAN Ignore;
  753. DWORD DnsServerCount;
  754. PDWORD DnsServerList;
  755. } CLRTL_NET_ADAPTER_INFO, *PCLRTL_NET_ADAPTER_INFO;
  756. #define CLRTL_NET_ADAPTER_HIDDEN 0x00000001
  757. typedef struct {
  758. ULONG AdapterCount;
  759. PCLRTL_NET_ADAPTER_INFO AdapterList;
  760. } CLRTL_NET_ADAPTER_ENUM, *PCLRTL_NET_ADAPTER_ENUM;
  761. PCLRTL_NET_ADAPTER_ENUM
  762. ClRtlEnumNetAdapters(
  763. VOID
  764. );
  765. VOID
  766. ClRtlFreeNetAdapterEnum(
  767. IN PCLRTL_NET_ADAPTER_ENUM AdapterEnum
  768. );
  769. PCLRTL_NET_ADAPTER_INFO
  770. ClRtlFindNetAdapterById(
  771. PCLRTL_NET_ADAPTER_ENUM AdapterEnum,
  772. LPWSTR AdapterId
  773. );
  774. PCLRTL_NET_INTERFACE_INFO
  775. ClRtlFindNetInterfaceByNetworkAddress(
  776. IN PCLRTL_NET_ADAPTER_INFO AdapterInfo,
  777. IN LPWSTR NetworkAddress
  778. );
  779. PCLRTL_NET_ADAPTER_INFO
  780. ClRtlFindNetAdapterByNetworkAddress(
  781. IN PCLRTL_NET_ADAPTER_ENUM AdapterEnum,
  782. IN LPWSTR NetworkAddress,
  783. OUT PCLRTL_NET_INTERFACE_INFO * InterfaceInfo
  784. );
  785. PCLRTL_NET_ADAPTER_INFO
  786. ClRtlFindNetAdapterByInterfaceAddress(
  787. IN PCLRTL_NET_ADAPTER_ENUM AdapterEnum,
  788. IN LPWSTR InterfaceAddressString,
  789. OUT PCLRTL_NET_INTERFACE_INFO * InterfaceInfo
  790. );
  791. PCLRTL_NET_INTERFACE_INFO
  792. ClRtlGetPrimaryNetInterface(
  793. IN PCLRTL_NET_ADAPTER_INFO AdapterInfo
  794. );
  795. VOID
  796. ClRtlQueryTcpipInformation(
  797. OUT LPDWORD MaxAddressStringLength,
  798. OUT LPDWORD MaxEndpointStringLength,
  799. OUT LPDWORD TdiAddressInfoLength
  800. );
  801. DWORD
  802. ClRtlTcpipAddressToString(
  803. ULONG AddressValue,
  804. LPWSTR * AddressString
  805. );
  806. DWORD
  807. ClRtlTcpipStringToAddress(
  808. LPCWSTR AddressString,
  809. PULONG AddressValue
  810. );
  811. DWORD
  812. ClRtlTcpipEndpointToString(
  813. USHORT EndpointValue,
  814. LPWSTR * EndpointString
  815. );
  816. DWORD
  817. ClRtlTcpipStringToEndpoint(
  818. LPCWSTR EndpointString,
  819. PUSHORT EndpointValue
  820. );
  821. BOOL
  822. ClRtlIsValidTcpipAddress(
  823. IN ULONG Address
  824. );
  825. BOOL
  826. ClRtlIsDuplicateTcpipAddress(
  827. IN ULONG Address
  828. );
  829. BOOL
  830. ClRtlIsValidTcpipSubnetMask(
  831. IN ULONG SubnetMask
  832. );
  833. BOOL
  834. ClRtlIsValidTcpipAddressAndSubnetMask(
  835. IN ULONG Address,
  836. IN ULONG SubnetMask
  837. );
  838. __inline
  839. BOOL
  840. ClRtlAreTcpipAddressesOnSameSubnet(
  841. ULONG Address1,
  842. ULONG Address2,
  843. ULONG SubnetMask
  844. )
  845. {
  846. BOOL fReturn;
  847. if ( ( Address1 & SubnetMask ) == ( Address2 & SubnetMask ) )
  848. {
  849. fReturn = TRUE;
  850. }
  851. else
  852. {
  853. fReturn = FALSE;
  854. }
  855. return fReturn;
  856. }
  857. //#define ClRtlAreTcpipAddressesOnSameSubnet(_Addr1, _Addr2, _Mask) \
  858. // ( ((_Addr1 & _Mask) == (_Addr2 & _Mask)) ? TRUE : FALSE )
  859. DWORD
  860. ClRtlBuildTcpipTdiAddress(
  861. IN LPWSTR NetworkAddress,
  862. IN LPWSTR TransportEndpoint,
  863. OUT LPVOID * TdiAddress,
  864. OUT LPDWORD TdiAddressLength
  865. );
  866. DWORD
  867. ClRtlBuildLocalTcpipTdiAddress(
  868. IN LPWSTR NetworkAddress,
  869. OUT LPVOID TdiAddress,
  870. OUT LPDWORD TdiAddressLength
  871. );
  872. DWORD
  873. ClRtlParseTcpipTdiAddress(
  874. IN LPVOID TdiAddress,
  875. OUT LPWSTR * NetworkAddress,
  876. OUT LPWSTR * TransportEndpoint
  877. );
  878. DWORD
  879. ClRtlParseTcpipTdiAddressInfo(
  880. IN LPVOID TdiAddressInfo,
  881. OUT LPWSTR * NetworkAddress,
  882. OUT LPWSTR * TransportEndpoint
  883. );
  884. //
  885. // Validate network name
  886. //
  887. typedef enum CLRTL_NAME_STATUS {
  888. NetNameOk,
  889. NetNameEmpty,
  890. NetNameTooLong,
  891. NetNameInvalidChars,
  892. NetNameInUse,
  893. NetNameSystemError,
  894. NetNameDNSNonRFCChars
  895. } CLRTL_NAME_STATUS;
  896. BOOL
  897. ClRtlIsNetNameValid(
  898. IN LPCWSTR NetName,
  899. OUT OPTIONAL CLRTL_NAME_STATUS *Result,
  900. IN BOOL CheckIfExists
  901. );
  902. //
  903. // Security related routines
  904. //
  905. LONG
  906. MapSAToRpcSA(
  907. IN LPSECURITY_ATTRIBUTES lpSA,
  908. IN OUT struct _RPC_SECURITY_ATTRIBUTES *pRpcSA
  909. );
  910. LONG
  911. MapSDToRpcSD(
  912. IN PSECURITY_DESCRIPTOR lpSD,
  913. IN OUT struct _RPC_SECURITY_DESCRIPTOR *pRpcSD
  914. );
  915. DWORD
  916. ClRtlSetObjSecurityInfo(
  917. IN HANDLE hObject,
  918. IN SE_OBJECT_TYPE SeObjType,
  919. IN DWORD dwAdminMask,
  920. IN DWORD dwOwnerMask,
  921. IN DWORD dwEveryOneMask
  922. );
  923. DWORD
  924. ClRtlFreeClusterServiceSecurityDescriptor( void );
  925. DWORD
  926. ClRtlBuildClusterServiceSecurityDescriptor(
  927. PSECURITY_DESCRIPTOR * poutSD
  928. );
  929. DWORD
  930. ClRtlEnableThreadPrivilege(
  931. IN ULONG Privilege,
  932. OUT BOOLEAN *pWasEnabled
  933. );
  934. DWORD
  935. ClRtlRestoreThreadPrivilege(
  936. IN ULONG Privilege,
  937. IN BOOLEAN WasEnabled
  938. );
  939. PSECURITY_DESCRIPTOR
  940. ClRtlCopySecurityDescriptor(
  941. IN PSECURITY_DESCRIPTOR psd
  942. );
  943. PSECURITY_DESCRIPTOR
  944. ClRtlConvertClusterSDToNT4Format(
  945. IN PSECURITY_DESCRIPTOR psd
  946. );
  947. PSECURITY_DESCRIPTOR
  948. ClRtlConvertClusterSDToNT5Format(
  949. IN PSECURITY_DESCRIPTOR psd
  950. );
  951. PSECURITY_DESCRIPTOR
  952. ClRtlConvertFileShareSDToNT4Format(
  953. IN PSECURITY_DESCRIPTOR psd
  954. );
  955. BOOL
  956. ClRtlExamineSD(
  957. PSECURITY_DESCRIPTOR psdSD,
  958. LPSTR pszPrefix
  959. );
  960. VOID
  961. ClRtlExamineMask(
  962. ACCESS_MASK amMask,
  963. LPSTR lpszOldIndent
  964. );
  965. DWORD
  966. ClRtlBuildDefaultClusterSD(
  967. IN PSID pOwnerSid,
  968. OUT PSECURITY_DESCRIPTOR * SD,
  969. OUT ULONG * SizeSD
  970. );
  971. BOOL
  972. ClRtlExamineClientToken(
  973. HANDLE hClientToken,
  974. LPSTR pszPrefix
  975. );
  976. DWORD
  977. ClRtlIsCallerAccountLocalSystemAccount(
  978. OUT PBOOL pbIsLocalSystemAccount
  979. );
  980. //
  981. // OS checker
  982. //
  983. DWORD
  984. GetServicePack(
  985. VOID
  986. );
  987. BOOL
  988. ClRtlIsOSValid(
  989. VOID
  990. );
  991. DWORD
  992. ClRtlGetSuiteType(
  993. VOID
  994. );
  995. BOOL
  996. ClRtlIsOSTypeValid(
  997. VOID
  998. );
  999. //
  1000. // A few MULTI_SZ string manipulation routines
  1001. //
  1002. DWORD
  1003. ClRtlMultiSzAppend(
  1004. IN OUT LPWSTR *MultiSz,
  1005. IN OUT LPDWORD StringLength,
  1006. IN LPCWSTR lpString
  1007. );
  1008. DWORD
  1009. ClRtlMultiSzRemove(
  1010. IN LPWSTR lpszMultiSz,
  1011. IN OUT LPDWORD StringLength,
  1012. IN LPCWSTR lpString
  1013. );
  1014. LPCWSTR
  1015. ClRtlMultiSzEnum(
  1016. IN LPCWSTR MszString,
  1017. IN DWORD MszStringLength,
  1018. IN DWORD StringIndex
  1019. );
  1020. DWORD
  1021. ClRtlMultiSzLength(
  1022. IN LPCWSTR lpszMultiSz
  1023. );
  1024. LPCWSTR
  1025. ClRtlMultiSzScan(
  1026. IN LPCWSTR lpszMultiSz,
  1027. IN LPCWSTR lpszString
  1028. );
  1029. DWORD
  1030. ClRtlCreateDirectory(
  1031. IN LPCWSTR lpszPath
  1032. );
  1033. BOOL
  1034. WINAPI
  1035. ClRtlIsPathValid(
  1036. IN LPCWSTR lpszPath
  1037. );
  1038. DWORD
  1039. ClRtlGetClusterDirectory(
  1040. IN LPWSTR lpBuffer,
  1041. IN DWORD dwBufSize
  1042. );
  1043. typedef LONG (*PFNCLRTLCREATEKEY)(
  1044. IN PVOID ClusterKey,
  1045. IN LPCWSTR lpszSubKey,
  1046. IN DWORD dwOptions,
  1047. IN REGSAM samDesired,
  1048. IN LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  1049. OUT PVOID * phkResult,
  1050. OUT OPTIONAL LPDWORD lpdwDisposition
  1051. );
  1052. typedef LONG (*PFNCLRTLOPENKEY)(
  1053. IN PVOID ClusterKey,
  1054. IN LPCWSTR lpszSubKey,
  1055. IN REGSAM samDesired,
  1056. OUT PVOID * phkResult
  1057. );
  1058. typedef LONG (*PFNCLRTLCLOSEKEY)(
  1059. IN PVOID ClusterKey
  1060. );
  1061. typedef LONG (*PFNCLRTLENUMVALUE)(
  1062. IN PVOID ClusterKey,
  1063. IN DWORD dwIndex,
  1064. OUT LPWSTR lpszValueName,
  1065. IN OUT LPDWORD lpcbValueName,
  1066. OUT LPDWORD lpType,
  1067. OUT LPBYTE lpData,
  1068. IN OUT LPDWORD lpcbData
  1069. );
  1070. typedef LONG (*PFNCLRTLSETVALUE)(
  1071. IN PVOID ClusterKey,
  1072. IN LPCWSTR lpszValueName,
  1073. IN DWORD dwType,
  1074. IN CONST BYTE* lpData,
  1075. IN DWORD cbData
  1076. );
  1077. typedef LONG (*PFNCLRTLQUERYVALUE)(
  1078. IN PVOID ClusterKey,
  1079. IN LPCWSTR lpszValueName,
  1080. OUT LPDWORD lpValueType,
  1081. OUT LPBYTE lpData,
  1082. IN OUT LPDWORD lpcbData
  1083. );
  1084. typedef DWORD (*PFNCLRTLDELETEVALUE)(
  1085. IN PVOID ClusterKey,
  1086. IN LPCWSTR lpszValueName
  1087. );
  1088. typedef LONG (*PFNCLRTLLOCALCREATEKEY)(
  1089. IN HANDLE hXsaction,
  1090. IN PVOID ClusterKey,
  1091. IN LPCWSTR lpszSubKey,
  1092. IN DWORD dwOptions,
  1093. IN REGSAM samDesired,
  1094. IN LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  1095. OUT PVOID * phkResult,
  1096. OUT OPTIONAL LPDWORD lpdwDisposition
  1097. );
  1098. typedef LONG (*PFNCLRTLLOCALSETVALUE)(
  1099. IN HANDLE hXsaction,
  1100. IN PVOID ClusterKey,
  1101. IN LPCWSTR lpszValueName,
  1102. IN DWORD dwType,
  1103. IN CONST BYTE* lpData,
  1104. IN DWORD cbData
  1105. );
  1106. typedef LONG (*PFNCLRTLLOCALDELETEVALUE)(
  1107. IN HANDLE hXsaction,
  1108. IN PVOID ClusterKey,
  1109. IN LPCWSTR lpszValueName
  1110. );
  1111. typedef struct _CLUSTER_REG_APIS {
  1112. PFNCLRTLCREATEKEY pfnCreateKey;
  1113. PFNCLRTLOPENKEY pfnOpenKey;
  1114. PFNCLRTLCLOSEKEY pfnCloseKey;
  1115. PFNCLRTLSETVALUE pfnSetValue;
  1116. PFNCLRTLQUERYVALUE pfnQueryValue;
  1117. PFNCLRTLENUMVALUE pfnEnumValue;
  1118. PFNCLRTLDELETEVALUE pfnDeleteValue;
  1119. PFNCLRTLLOCALCREATEKEY pfnLocalCreateKey;
  1120. PFNCLRTLLOCALSETVALUE pfnLocalSetValue;
  1121. PFNCLRTLLOCALDELETEVALUE pfnLocalDeleteValue;
  1122. } CLUSTER_REG_APIS, *PCLUSTER_REG_APIS;
  1123. DWORD
  1124. WINAPI
  1125. ClRtlEnumProperties(
  1126. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1127. OUT LPWSTR pszOutProperties,
  1128. IN DWORD cbOutPropertiesSize,
  1129. OUT LPDWORD pcbBytesReturned,
  1130. OUT LPDWORD pcbRequired
  1131. );
  1132. DWORD
  1133. WINAPI
  1134. ClRtlEnumPrivateProperties(
  1135. IN PVOID hkeyClusterKey,
  1136. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1137. OUT LPWSTR pszOutProperties,
  1138. IN DWORD cbOutPropertiesSize,
  1139. OUT LPDWORD pcbBytesReturned,
  1140. OUT LPDWORD pcbRequired
  1141. );
  1142. DWORD
  1143. WINAPI
  1144. ClRtlGetProperties(
  1145. IN PVOID hkeyClusterKey,
  1146. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1147. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1148. OUT PVOID pOutPropertyList,
  1149. IN DWORD cbOutPropertyListSize,
  1150. OUT LPDWORD pcbBytesReturned,
  1151. OUT LPDWORD pcbRequired
  1152. );
  1153. DWORD
  1154. WINAPI
  1155. ClRtlGetPrivateProperties(
  1156. IN PVOID hkeyClusterKey,
  1157. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1158. OUT PVOID pOutPropertyList,
  1159. IN DWORD cbOutPropertyListSize,
  1160. OUT LPDWORD pcbBytesReturned,
  1161. OUT LPDWORD pcbRequired
  1162. );
  1163. DWORD
  1164. WINAPI
  1165. ClRtlGetPropertySize(
  1166. IN PVOID hkeyClusterKey,
  1167. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1168. IN const PRESUTIL_PROPERTY_ITEM pPropertyTableItem,
  1169. IN OUT LPDWORD pcbOutPropertyListSize,
  1170. IN OUT LPDWORD pnPropertyCount
  1171. );
  1172. DWORD
  1173. WINAPI
  1174. ClRtlGetProperty(
  1175. IN PVOID ClusterKey,
  1176. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1177. IN const PRESUTIL_PROPERTY_ITEM pPropertyTableItem,
  1178. OUT PVOID * pOutPropertyItem,
  1179. IN OUT LPDWORD pcbOutPropertyItemSize
  1180. );
  1181. DWORD
  1182. WINAPI
  1183. ClRtlpSetPropertyTable(
  1184. IN HANDLE hXsaction,
  1185. IN PVOID hkeyClusterKey,
  1186. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1187. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1188. IN PVOID Reserved,
  1189. IN BOOL bAllowUnknownProperties,
  1190. IN const PVOID pInPropertyList,
  1191. IN DWORD cbInPropertyListSize,
  1192. IN BOOL bForceWrite,
  1193. OUT OPTIONAL LPBYTE pOutParams
  1194. );
  1195. DWORD
  1196. WINAPI
  1197. ClRtlpSetNonPropertyTable(
  1198. IN HANDLE hXsaction,
  1199. IN PVOID hkeyClusterKey,
  1200. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1201. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1202. IN PVOID Reserved,
  1203. IN const PVOID pInPropertyList,
  1204. IN DWORD cbInPropertyListSize
  1205. );
  1206. DWORD
  1207. WINAPI
  1208. ClRtlSetPropertyParameterBlock(
  1209. IN HANDLE hXsaction,
  1210. IN PVOID hkeyClusterKey,
  1211. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1212. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1213. IN PVOID Reserved,
  1214. IN const LPBYTE pInParams,
  1215. IN const PVOID pInPropertyList,
  1216. IN DWORD cbInPropertyListSize,
  1217. IN BOOL bForceWrite,
  1218. OUT OPTIONAL LPBYTE pOutParams
  1219. );
  1220. DWORD
  1221. WINAPI
  1222. ClRtlGetAllProperties(
  1223. IN PVOID hkeyClusterKey,
  1224. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1225. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1226. OUT PVOID pPropertyList,
  1227. IN DWORD cbPropertyListSize,
  1228. OUT LPDWORD pcbBytesReturned,
  1229. OUT LPDWORD pcbRequired
  1230. );
  1231. DWORD
  1232. WINAPI
  1233. ClRtlGetPropertiesToParameterBlock(
  1234. IN HKEY hkeyClusterKey,
  1235. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1236. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1237. IN OUT LPBYTE pOutParams,
  1238. IN BOOL bCheckForRequiredProperties,
  1239. OUT OPTIONAL LPWSTR * ppszNameOfPropInError
  1240. );
  1241. DWORD
  1242. WINAPI
  1243. ClRtlPropertyListFromParameterBlock(
  1244. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1245. OUT PVOID pOutPropertyList,
  1246. IN OUT LPDWORD pcbOutPropertyListSize,
  1247. IN const LPBYTE pInParams,
  1248. OUT LPDWORD pcbBytesReturned,
  1249. OUT LPDWORD pcbRequired
  1250. );
  1251. DWORD
  1252. WINAPI
  1253. ClRtlGetUnknownProperties(
  1254. IN PVOID hkeyClusterKey,
  1255. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1256. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1257. OUT PVOID pOutPropertyList,
  1258. IN DWORD cbOutPropertyListSize,
  1259. OUT LPDWORD pcbBytesReturned,
  1260. OUT LPDWORD pcbRequired
  1261. );
  1262. DWORD
  1263. WINAPI
  1264. ClRtlAddUnknownProperties(
  1265. IN PVOID hkeyClusterKey,
  1266. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1267. IN const PRESUTIL_PROPERTY_ITEM ppPropertyTable,
  1268. IN OUT PVOID pOutPropertyList,
  1269. IN DWORD cbOutPropertyListSize,
  1270. IN OUT LPDWORD pcbBytesReturned,
  1271. IN OUT LPDWORD pcbRequired
  1272. );
  1273. DWORD
  1274. WINAPI
  1275. ClRtlpFindSzProperty(
  1276. IN const PVOID pPropertyList,
  1277. IN DWORD cbPropertyListSize,
  1278. IN LPCWSTR pszPropertyName,
  1279. OUT LPWSTR * pszPropertyValue,
  1280. IN BOOL bReturnExpandedValue
  1281. );
  1282. __inline
  1283. DWORD
  1284. WINAPI
  1285. ClRtlFindSzProperty(
  1286. IN const PVOID pPropertyList,
  1287. IN DWORD cbPropertyListSize,
  1288. IN LPCWSTR pszPropertyName,
  1289. OUT LPWSTR * pszPropertyValue
  1290. )
  1291. {
  1292. return ClRtlpFindSzProperty(
  1293. pPropertyList,
  1294. cbPropertyListSize,
  1295. pszPropertyName,
  1296. pszPropertyValue,
  1297. FALSE /* bReturnExpandedValue */
  1298. );
  1299. } //*** ClRtlFindSzProperty()
  1300. __inline
  1301. DWORD
  1302. WINAPI
  1303. ClRtlFindExpandSzProperty(
  1304. IN const PVOID pPropertyList,
  1305. IN DWORD cbPropertyListSize,
  1306. IN LPCWSTR pszPropertyName,
  1307. OUT LPWSTR * pszPropertyValue
  1308. )
  1309. {
  1310. return ClRtlpFindSzProperty(
  1311. pPropertyList,
  1312. cbPropertyListSize,
  1313. pszPropertyName,
  1314. pszPropertyValue,
  1315. FALSE /* bReturnExpandedValue */
  1316. );
  1317. } //*** ClRtlFindExpandSzProperty()
  1318. __inline
  1319. DWORD
  1320. WINAPI
  1321. ClRtlFindExpandedSzProperty(
  1322. IN const PVOID pPropertyList,
  1323. IN DWORD cbPropertyListSize,
  1324. IN LPCWSTR pszPropertyName,
  1325. OUT LPWSTR * pszPropertyValue
  1326. )
  1327. {
  1328. return ClRtlpFindSzProperty(
  1329. pPropertyList,
  1330. cbPropertyListSize,
  1331. pszPropertyName,
  1332. pszPropertyValue,
  1333. TRUE /* bReturnExpandedValue */
  1334. );
  1335. } //*** ClRtlFindExpandedSzProperty()
  1336. DWORD
  1337. WINAPI
  1338. ClRtlFindDwordProperty(
  1339. IN const PVOID pPropertyList,
  1340. IN DWORD cbPropertyListSize,
  1341. IN LPCWSTR pszPropertyName,
  1342. OUT LPDWORD pdwPropertyValue
  1343. );
  1344. DWORD
  1345. WINAPI
  1346. ClRtlFindLongProperty(
  1347. IN const PVOID pPropertyList,
  1348. IN DWORD cbPropertyListSize,
  1349. IN LPCWSTR pszPropertyName,
  1350. OUT LPLONG plPropertyValue
  1351. );
  1352. DWORD
  1353. WINAPI
  1354. ClRtlFindBinaryProperty(
  1355. IN const PVOID pPropertyList,
  1356. IN DWORD cbPropertyListSize,
  1357. IN LPCWSTR pszPropertyName,
  1358. OUT LPBYTE * pbPropertyValue,
  1359. OUT LPDWORD pcbPropertyValueSize
  1360. );
  1361. DWORD
  1362. WINAPI
  1363. ClRtlFindMultiSzProperty(
  1364. IN const PVOID pPropertyList,
  1365. IN DWORD cbPropertyListSize,
  1366. IN LPCWSTR pszPropertyName,
  1367. OUT LPWSTR * pszPropertyValue,
  1368. OUT LPDWORD pcbPropertyValueSize
  1369. );
  1370. __inline
  1371. DWORD
  1372. WINAPI
  1373. ClRtlVerifyPropertyTable(
  1374. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1375. IN PVOID Reserved,
  1376. IN BOOL bAllowUnknownProperties,
  1377. IN const PVOID pInPropertyList,
  1378. IN DWORD cbInPropertyListSize,
  1379. OUT OPTIONAL LPBYTE pOutParams
  1380. )
  1381. {
  1382. return ClRtlpSetPropertyTable(
  1383. NULL,
  1384. NULL,
  1385. NULL,
  1386. pPropertyTable,
  1387. Reserved,
  1388. bAllowUnknownProperties,
  1389. pInPropertyList,
  1390. cbInPropertyListSize,
  1391. FALSE, // bForceWrite
  1392. pOutParams);
  1393. }
  1394. __inline
  1395. DWORD
  1396. WINAPI
  1397. ClRtlSetPropertyTable(
  1398. IN HANDLE hXsaction,
  1399. IN PVOID hkeyClusterKey,
  1400. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1401. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1402. IN PVOID Reserved,
  1403. IN BOOL bAllowUnknownProperties,
  1404. IN const PVOID pInPropertyList,
  1405. IN DWORD cbInPropertyListSize,
  1406. IN BOOL bForceWrite,
  1407. OUT OPTIONAL LPBYTE pOutParams
  1408. )
  1409. {
  1410. if ( (hkeyClusterKey == NULL) ||
  1411. (pClusterRegApis == NULL) ){
  1412. return(ERROR_BAD_ARGUMENTS);
  1413. }
  1414. return ClRtlpSetPropertyTable(
  1415. hXsaction,
  1416. hkeyClusterKey,
  1417. pClusterRegApis,
  1418. pPropertyTable,
  1419. Reserved,
  1420. bAllowUnknownProperties,
  1421. pInPropertyList,
  1422. cbInPropertyListSize,
  1423. bForceWrite,
  1424. pOutParams);
  1425. }
  1426. DWORD
  1427. WINAPI
  1428. ClRtlpSetPrivatePropertyList(
  1429. IN HANDLE hXsaction,
  1430. IN PVOID hkeyClusterKey,
  1431. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1432. IN const PVOID pInPropertyList,
  1433. IN DWORD cbInPropertyListSize
  1434. );
  1435. __inline
  1436. DWORD
  1437. WINAPI
  1438. ClRtlVerifyPrivatePropertyList(
  1439. IN const PVOID pInPropertyList,
  1440. IN DWORD cbInPropertyListSize
  1441. )
  1442. {
  1443. return ClRtlpSetPrivatePropertyList( NULL, NULL, NULL, pInPropertyList, cbInPropertyListSize );
  1444. }
  1445. __inline
  1446. DWORD
  1447. WINAPI
  1448. ClRtlSetPrivatePropertyList(
  1449. IN HANDLE hXsaction,
  1450. IN PVOID hkeyClusterKey,
  1451. IN const PCLUSTER_REG_APIS pClusterRegApis,
  1452. IN const PVOID pInPropertyList,
  1453. IN DWORD cbInPropertyListSize
  1454. )
  1455. {
  1456. if ( (hkeyClusterKey == NULL) ||
  1457. (pClusterRegApis == NULL) ){
  1458. return(ERROR_BAD_ARGUMENTS);
  1459. }
  1460. return ClRtlpSetPrivatePropertyList(
  1461. hXsaction,
  1462. hkeyClusterKey,
  1463. pClusterRegApis,
  1464. pInPropertyList,
  1465. cbInPropertyListSize
  1466. );
  1467. }
  1468. DWORD
  1469. WINAPI
  1470. ClRtlGetBinaryValue(
  1471. IN HKEY ClusterKey,
  1472. IN LPCWSTR ValueName,
  1473. OUT LPBYTE * OutValue,
  1474. OUT LPDWORD OutValueSize,
  1475. IN const PCLUSTER_REG_APIS pClusterRegApis
  1476. );
  1477. LPWSTR
  1478. WINAPI
  1479. ClRtlGetSzValue(
  1480. IN HKEY ClusterKey,
  1481. IN LPCWSTR ValueName,
  1482. IN const PCLUSTER_REG_APIS pClusterRegApis
  1483. );
  1484. DWORD
  1485. WINAPI
  1486. ClRtlDupParameterBlock(
  1487. OUT LPBYTE pOutParams,
  1488. IN const LPBYTE pInParams,
  1489. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable
  1490. );
  1491. void
  1492. WINAPI
  1493. ClRtlFreeParameterBlock(
  1494. IN OUT LPBYTE pOutParams,
  1495. IN const LPBYTE pInParams,
  1496. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable
  1497. );
  1498. DWORD
  1499. WINAPI
  1500. ClRtlMarshallPropertyTable(
  1501. IN PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1502. IN OUT DWORD dwSize,
  1503. IN OUT LPBYTE pBuffer,
  1504. OUT DWORD *Required
  1505. );
  1506. DWORD
  1507. WINAPI
  1508. ClRtlUnmarshallPropertyTable(
  1509. IN OUT PRESUTIL_PROPERTY_ITEM *ppPropertyTable,
  1510. IN LPBYTE pBuffer
  1511. );
  1512. LPWSTR
  1513. WINAPI
  1514. ClRtlExpandEnvironmentStrings(
  1515. IN LPCWSTR pszSrc
  1516. );
  1517. DWORD
  1518. WINAPI
  1519. ClRtlGetPropertyFormats(
  1520. IN const PRESUTIL_PROPERTY_ITEM pPropertyTable,
  1521. OUT PVOID pOutPropertyFormatList,
  1522. IN DWORD cbOutPropertyFormatListSize,
  1523. OUT LPDWORD pcbReturned,
  1524. OUT LPDWORD pcbRequired
  1525. );
  1526. DWORD
  1527. WINAPI
  1528. ClRtlGetPropertyFormat(
  1529. IN const PRESUTIL_PROPERTY_ITEM pPropertyTableItem,
  1530. OUT PVOID * pOutPropertyItem,
  1531. IN OUT LPDWORD pcbOutPropertyItemSize
  1532. );
  1533. DWORD
  1534. WINAPI
  1535. ClRtlGetPropertyFormatSize(
  1536. IN const PRESUTIL_PROPERTY_ITEM pPropertyTableItem,
  1537. IN OUT LPDWORD pcbOutPropertyListSize,
  1538. IN OUT LPDWORD pnPropertyCount
  1539. );
  1540. //
  1541. // Miscellaneous Routines
  1542. //
  1543. LPWSTR
  1544. ClRtlMakeGuid(
  1545. VOID
  1546. );
  1547. LPWSTR
  1548. ClRtlGetConnectoidName(
  1549. INetConnection * NetConnection
  1550. );
  1551. INetConnection *
  1552. ClRtlFindConnectoidByGuid(
  1553. LPWSTR ConnectoidGuid
  1554. );
  1555. INetConnection *
  1556. ClRtlFindConnectoidByName(
  1557. LPCWSTR ConnectoidName
  1558. );
  1559. DWORD
  1560. ClRtlSetConnectoidName(
  1561. INetConnection * NetConnection,
  1562. LPWSTR NewConnectoidName
  1563. );
  1564. DWORD
  1565. ClRtlFindConnectoidByGuidAndSetName(
  1566. LPWSTR ConnectoidGuid,
  1567. LPWSTR NewConnectoidName
  1568. );
  1569. DWORD
  1570. ClRtlFindConnectoidByNameAndSetName(
  1571. LPWSTR ConnectoidName,
  1572. LPWSTR NewConnectoidName
  1573. );
  1574. ///////////////////////////////////////////////////////////////////////////
  1575. //
  1576. // General purpose Watchdog timer.
  1577. //
  1578. ///////////////////////////////////////////////////////////////////////////
  1579. PVOID
  1580. ClRtlSetWatchdogTimer(
  1581. DWORD timeout,
  1582. LPWSTR par
  1583. );
  1584. VOID
  1585. ClRtlCancelWatchdogTimer(
  1586. PVOID wTimer
  1587. );
  1588. /* commented out 16 Nov 1998 by GalenB because the DS work has been postponed
  1589. //
  1590. // Active Directory Services (DS) Publication Routines
  1591. //
  1592. HRESULT
  1593. HrClRtlAddClusterNameToDS(
  1594. const TCHAR *pClusterName,
  1595. const HCLUSTER hCluster
  1596. );
  1597. HRESULT
  1598. HrClRtlMoveClusterNodeDS(
  1599. const TCHAR *pClusterName,
  1600. const HCLUSTER hCluster,
  1601. const TCHAR *pNodeName
  1602. );
  1603. end of commented out code */
  1604. // Apis and defines for cluster installation state
  1605. // This enum is used to indicate the state of the Cluster Server installation.
  1606. // The registry key that indicates the state of the Cluster Server installation
  1607. // will be a DWORD representation of one of the following values.
  1608. typedef enum
  1609. {
  1610. eClusterInstallStateUnknown,
  1611. eClusterInstallStateFilesCopied,
  1612. eClusterInstallStateConfigured,
  1613. eClusterInstallStateUpgraded
  1614. } eClusterInstallState;
  1615. DWORD
  1616. ClRtlGetClusterInstallState(
  1617. IN LPCWSTR pszNodeName,
  1618. OUT eClusterInstallState * peState
  1619. );
  1620. BOOL
  1621. ClRtlSetClusterInstallState(
  1622. IN eClusterInstallState InstallState
  1623. );
  1624. //
  1625. // Registry utilities routines
  1626. //
  1627. BOOL RegDelnode( HKEY hKeyRoot, const LPTSTR lpSubKey );
  1628. //
  1629. // Routine to get drive layout table
  1630. //
  1631. BOOL
  1632. ClRtlGetDriveLayoutTable(
  1633. IN HANDLE hDisk,
  1634. OUT PDRIVE_LAYOUT_INFORMATION * DriveLayout,
  1635. OUT PDWORD InfoSize OPTIONAL
  1636. );
  1637. DWORD ClRtlGetDefaultNodeLimit(
  1638. IN DWORD SuiteType);
  1639. //
  1640. // If async event reporting is required,
  1641. // use the following function to set
  1642. // a work queue
  1643. //
  1644. VOID
  1645. ClRtlEventLogSetWorkQueue(
  1646. PCLRTL_WORK_QUEUE WorkQueue
  1647. );
  1648. //
  1649. // Fast check to see if a file or directory exists.
  1650. //
  1651. BOOL
  1652. ClRtlPathFileExists(
  1653. LPWSTR pwszPath
  1654. );
  1655. //
  1656. // set default failure actions in service controller
  1657. //
  1658. DWORD
  1659. ClRtlSetSCMFailureActions(
  1660. LPWSTR NodeName OPTIONAL
  1661. );
  1662. //
  1663. // Initialize Wmi tracing (noop if wmi is disabled)
  1664. //
  1665. DWORD
  1666. ClRtlInitWmi(
  1667. LPCWSTR ComponentName
  1668. );
  1669. //
  1670. // Get the cluster service domain account info
  1671. //
  1672. DWORD
  1673. ClRtlGetServiceAccountInfo(
  1674. LPWSTR * AccountBuffer
  1675. );
  1676. //
  1677. // set the DACL for Winsta0 and its desktop such that any genapp process can
  1678. // access it
  1679. //
  1680. DWORD
  1681. ClRtlAddClusterServiceAccountToWinsta0DACL(
  1682. VOID
  1683. );
  1684. //
  1685. // Cleanup a node that has been evicted (requires cleanup COM component to be registered locally).
  1686. //
  1687. HRESULT ClRtlCleanupNode(
  1688. const WCHAR * pcszEvictedNodeNameIn,
  1689. DWORD dwDelayIn,
  1690. DWORD dwTimeoutIn
  1691. );
  1692. //
  1693. // Asynchronously cleanup a node that has been evicted.
  1694. //
  1695. HRESULT ClRtlAsyncCleanupNode(
  1696. const WCHAR * pcszEvictedNodeNameIn
  1697. , DWORD dwDelayIn
  1698. , DWORD dwTimeoutIn
  1699. );
  1700. //
  1701. // Find out if a registry value indicating that this node has been evicted, is set or not
  1702. //
  1703. DWORD
  1704. ClRtlHasNodeBeenEvicted(
  1705. BOOL * pfNodeEvictedOut
  1706. );
  1707. //
  1708. // Initiate operations that inform interested parties that the cluster
  1709. // service is starting up
  1710. //
  1711. HRESULT
  1712. ClRtlInitiateStartupNotification(
  1713. void
  1714. );
  1715. //
  1716. // get the domain account in the form of 'user\domain'
  1717. //
  1718. DWORD
  1719. ClRtlGetRunningAccountInfo(
  1720. LPWSTR * AccountBuffer
  1721. );
  1722. //
  1723. // Checks if cluster version checking has been disabled on a particular computer.
  1724. //
  1725. DWORD
  1726. ClRtlIsVersionCheckingDisabled(
  1727. const WCHAR * pcszNodeNameIn
  1728. , BOOL * pfVerCheckDisabledOut
  1729. );
  1730. #ifdef __cplusplus
  1731. }
  1732. #endif
  1733. #endif // ifndef _CLUSRTL_INCLUDED_