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.

871 lines
19 KiB

  1. #ifndef __WBEM_UTILITY__H_
  2. #define __WBEM_UTILITY__H_
  3. #include "iads.h"
  4. #undef _ASSERT
  5. #include <wbemcli.h>
  6. #include <wbemprov.h>
  7. #include <wbemcomn.h>
  8. #include <atlbase.h>
  9. #include <activeds.h>
  10. #include <WinNTSec.h>
  11. // **** default min, max and default
  12. #define SINT_MIN 0xffffffff
  13. #define SINT_MAX 0xefffffff
  14. #define SINT_DEFAULT 0x0
  15. #define UINT_MIN 0x0
  16. #define UINT_MAX 0xffffffff
  17. #define UINT_DEFAULT 0x0
  18. #define REAL_MIN (double)(0xffffffffffffffff)
  19. #define REAL_MAX (double)(0xefffffffffffffff)
  20. #define REAL_DEFAULT 0x0
  21. // retrieve namespace with given name
  22. HRESULT GetNamespace(BSTR namespaceName, IWbemServices*& pNamespace, bool bInProc);
  23. // make sure that the ID property of pObj has a value
  24. // will generate GUID if not
  25. // assumes property is a BSTR!
  26. // if pName == NULL, assumes property name is "ID"
  27. // returns WBEM_S_NO_ERROR if ID generated
  28. // WBEM_S_FALSE if no ID generated (already has a value)
  29. // WBEM_E_NOT_FOUND if ID property is not
  30. // some error if error of some sort
  31. HRESULT EnsureID(IWbemClassObject* pObj, WCHAR* pName);
  32. // init ADS_ATTR_INFO structure
  33. void Init_AdsAttrInfo(ADS_ATTR_INFO *pAdsAttrInfo,
  34. LPWSTR bstrName,
  35. DWORD control,
  36. ADSTYPE type,
  37. PADSVALUE pVals,
  38. DWORD nVals);
  39. template <class ElementType, VARTYPE vt> class SafeArray
  40. {
  41. private:
  42. long
  43. m_IndexMin,
  44. m_IndexMax,
  45. m_Size;
  46. ElementType
  47. *m_pElementType;
  48. SAFEARRAY
  49. *m_pSafeArray;
  50. void _EmptyInit(void)
  51. {
  52. m_IndexMin = -1;
  53. m_IndexMax = -1;
  54. m_Size = 0;
  55. m_pElementType = NULL;
  56. m_pSafeArray = NULL;
  57. }
  58. void _ArrayInit(void)
  59. {
  60. HRESULT hres;
  61. hres = SafeArrayGetUBound(m_pSafeArray, 1, &m_IndexMax);
  62. if(FAILED(hres))
  63. return;
  64. hres = SafeArrayGetLBound(m_pSafeArray, 1, &m_IndexMin);
  65. if(FAILED(hres))
  66. return;
  67. m_Size = m_IndexMax - m_IndexMin + 1;
  68. m_pElementType = NULL;
  69. hres = SafeArrayAccessData(m_pSafeArray, (void **)&m_pElementType);
  70. if(FAILED(hres))
  71. return;
  72. }
  73. public:
  74. SafeArray(void)
  75. {
  76. _EmptyInit();
  77. }
  78. // **** empty array creation
  79. SafeArray(long LowerBound, long ArgSize)
  80. {
  81. HRESULT hres;
  82. SAFEARRAYBOUND
  83. arrayBounds[1];
  84. // **** check for valid size
  85. if(LowerBound < 0)
  86. return;
  87. if(ArgSize < 0)
  88. return;
  89. // **** create empty array
  90. if(0 == ArgSize)
  91. {
  92. _EmptyInit();
  93. }
  94. else
  95. {
  96. arrayBounds[0].lLbound = LowerBound;
  97. arrayBounds[0].cElements = ArgSize;
  98. m_pSafeArray = SafeArrayCreate(vt, 1, arrayBounds);
  99. if(NULL == m_pSafeArray)
  100. return;
  101. _ArrayInit();
  102. }
  103. }
  104. // **** creation/init SafeArray from VARIANT
  105. SafeArray(VARIANT *v)
  106. {
  107. HRESULT hres;
  108. // **** first ensure that the contained object is valid
  109. if(NULL == v)
  110. return;
  111. if((V_VT(v) == VT_NULL) || (V_VT(v) == VT_EMPTY))
  112. {
  113. _EmptyInit();
  114. }
  115. else
  116. {
  117. if(V_VT(v) != (VT_ARRAY | vt))
  118. return;
  119. // **** copy to SafeArray contents of variant
  120. m_pSafeArray = NULL;
  121. hres = SafeArrayCopy(V_ARRAY(v), &m_pSafeArray);
  122. if(FAILED(hres))
  123. return;
  124. _ArrayInit();
  125. }
  126. }
  127. SafeArray &operator =(const VARIANT *Source)
  128. {
  129. HRESULT hres;
  130. // **** first ensure that the contained object is valid
  131. if((NULL == Source) || (V_VT(Source) != (VT_ARRAY | vt)))
  132. return *this;
  133. // **** get SAFEARRAY dimensions
  134. if(NULL != m_pSafeArray)
  135. {
  136. hres = SafeArrayUnaccessData(m_pSafeArray);
  137. hres = SafeArrayDestroy(m_pSafeArray);
  138. }
  139. hres = SafeArrayCopy(V_ARRAY(Source), &m_pSafeArray);
  140. if(FAILED(hres))
  141. {
  142. _EmptyInit();
  143. return *this;
  144. }
  145. _ArrayInit();
  146. return *this;
  147. }
  148. // **** creation/init SafeArray from SafeArray
  149. SafeArray(const SafeArray &Source)
  150. {
  151. HRESULT hres;
  152. if(NULL == Source.m_pSafeArray)
  153. {
  154. _EmptyInit();
  155. }
  156. else
  157. {
  158. // **** copy to SafeArray contents of variant
  159. m_pSafeArray = NULL;
  160. hres = SafeArrayCopy(Source.m_pSafeArray, &m_pSafeArray);
  161. if(FAILED(hres))
  162. return;
  163. _ArrayInit();
  164. }
  165. }
  166. SafeArray &operator = (const SafeArray &Source)
  167. {
  168. HRESULT hres;
  169. if(NULL == Source.m_pSafeArray)
  170. {
  171. _EmptyInit();
  172. }
  173. else
  174. {
  175. if(NULL != m_pSafeArray)
  176. {
  177. hres = SafeArrayUnaccessData(m_pSafeArray);
  178. }
  179. // **** copy to SafeArray contents of variant
  180. hres = SafeArrayCopy(Source.m_pSafeArray, &m_pSafeArray);
  181. if(FAILED(hres))
  182. return;
  183. _ArrayInit();
  184. }
  185. return *this;
  186. }
  187. ~SafeArray(void)
  188. {
  189. if(NULL != m_pSafeArray)
  190. {
  191. SafeArrayUnaccessData(m_pSafeArray);
  192. SafeArrayDestroy(m_pSafeArray);
  193. }
  194. _EmptyInit();
  195. }
  196. // **** Misc functions
  197. VARTYPE Type(void) { return vt; }
  198. long Size(void) { return m_Size; }
  199. long IndexMin(void) { return m_IndexMin; }
  200. long IndexMax(void) { return m_IndexMax; }
  201. SAFEARRAY *Data(void)
  202. {
  203. HRESULT hres;
  204. SAFEARRAY *pArrayCopy = NULL;
  205. if(NULL != m_pSafeArray)
  206. {
  207. hres = SafeArrayCopy(m_pSafeArray, &pArrayCopy);
  208. if(FAILED(hres))
  209. return NULL;
  210. }
  211. return pArrayCopy;
  212. }
  213. long ReDim(long LowerBound, long ArgSize)
  214. {
  215. HRESULT hres;
  216. SAFEARRAYBOUND arrayBounds[1];
  217. // **** check to see that Index is within range
  218. if((LowerBound != m_IndexMin) || ((LowerBound + ArgSize - 1) != m_IndexMax))
  219. {
  220. m_IndexMin = LowerBound;
  221. if(ArgSize < 1)
  222. {
  223. if(NULL != m_pSafeArray)
  224. {
  225. SafeArrayUnaccessData(m_pSafeArray);
  226. SafeArrayDestroy(m_pSafeArray);
  227. }
  228. _EmptyInit();
  229. }
  230. else
  231. {
  232. m_IndexMax = LowerBound + ArgSize - 1;
  233. m_Size = m_IndexMax - m_IndexMin + 1;
  234. arrayBounds[0].lLbound = LowerBound;
  235. arrayBounds[0].cElements = m_Size;
  236. if(NULL == m_pSafeArray)
  237. {
  238. m_pSafeArray = SafeArrayCreate(vt, 1, arrayBounds);
  239. }
  240. else
  241. {
  242. hres = SafeArrayUnaccessData(m_pSafeArray);
  243. hres = SafeArrayRedim(m_pSafeArray, arrayBounds);
  244. }
  245. m_pElementType = NULL;
  246. hres = SafeArrayAccessData(m_pSafeArray, (void **)&m_pElementType);
  247. }
  248. }
  249. // **** return reference to Index element
  250. return m_Size;
  251. }
  252. ElementType& operator[](long Index)
  253. {
  254. // **** return reference to Index element
  255. return m_pElementType[Index];
  256. }
  257. };
  258. class QString
  259. {
  260. BSTR m_data; // pointer to beginning of string
  261. UINT m_StringLength;
  262. UINT m_BufferLength;
  263. UINT m_ExtraLength;
  264. void _InitMembers(void)
  265. { m_data = NULL; m_StringLength = 0; m_BufferLength = 0; m_ExtraLength = 0; m_Status = OK; }
  266. public:
  267. enum
  268. {
  269. OK = 0,
  270. NOT_FOUND,
  271. OUT_OF_MEMORY,
  272. INVALID_PARAM,
  273. } m_Status;
  274. QString(void)
  275. { _InitMembers(); }
  276. QString(UINT size, UINT extra = 0)
  277. {
  278. _InitMembers();
  279. m_data = SysAllocStringLen(NULL, size + 1);
  280. if(NULL == m_data)
  281. {
  282. m_Status = OUT_OF_MEMORY;
  283. return;
  284. }
  285. m_data[0] = L'\0';
  286. m_BufferLength = SysStringLen(m_data);
  287. m_ExtraLength = extra;
  288. }
  289. QString(wchar_t *data, UINT extra = 0)
  290. {
  291. _InitMembers();
  292. m_StringLength = wcslen(data);
  293. m_ExtraLength = extra;
  294. if(m_StringLength > 0)
  295. {
  296. m_data = SysAllocStringLen(NULL, m_StringLength + m_ExtraLength + 1);
  297. if(NULL == m_data)
  298. {
  299. m_Status = OUT_OF_MEMORY;
  300. return;
  301. }
  302. wcscpy(m_data, data);
  303. m_BufferLength = SysStringLen(m_data);
  304. m_StringLength = wcslen(m_data);
  305. }
  306. }
  307. QString(QString &org)
  308. {
  309. _InitMembers();
  310. m_data = SysAllocString(org.m_data);
  311. if(NULL == m_data)
  312. {
  313. m_Status = OUT_OF_MEMORY;
  314. return;
  315. }
  316. m_StringLength = wcslen(m_data);
  317. m_BufferLength = SysStringLen(m_data);
  318. m_ExtraLength = org.m_ExtraLength;
  319. }
  320. ~QString(void)
  321. {
  322. if(NULL != m_data)
  323. SysFreeString(m_data);
  324. m_BufferLength = m_StringLength = m_ExtraLength = 0;
  325. }
  326. QString &Detach(void)
  327. {
  328. _InitMembers();
  329. return *this;
  330. }
  331. QString &operator=(wchar_t *data)
  332. {
  333. m_StringLength = wcslen(data);
  334. if((NULL == m_data) || (m_StringLength >= m_BufferLength))
  335. {
  336. if(NULL != m_data)
  337. {
  338. SysFreeString(m_data);
  339. m_BufferLength = 0;
  340. }
  341. m_data = SysAllocStringLen(NULL, m_StringLength + m_ExtraLength + 1);
  342. if(NULL == m_data)
  343. {
  344. m_Status = OUT_OF_MEMORY;
  345. return *this;
  346. }
  347. m_BufferLength = SysStringLen(m_data);
  348. }
  349. wcscpy(m_data, data);
  350. return *this;
  351. }
  352. QString &operator << (UINT data)
  353. {
  354. wchar_t buffer[20];
  355. if(OK != m_Status) return *this;
  356. return (*this << _ltow(data, buffer, 10));
  357. }
  358. QString &operator << (wchar_t *data)
  359. {
  360. BSTR
  361. NewData;
  362. if(OK != m_Status) return *this;
  363. UINT
  364. DataSize = wcslen(data);
  365. if((DataSize + m_StringLength + 1) < m_BufferLength)
  366. wcscat(m_data, data);
  367. else
  368. {
  369. NewData = SysAllocStringLen(NULL, DataSize + m_StringLength + m_ExtraLength + 1);
  370. if(NULL == NewData)
  371. {
  372. m_Status = OUT_OF_MEMORY;
  373. return *this;
  374. }
  375. if(0 != m_StringLength)
  376. {
  377. wcscpy(NewData, m_data);
  378. wcscat(NewData, data);
  379. }
  380. else
  381. wcscpy(NewData, data);
  382. if(NULL != m_data)
  383. SysFreeString(m_data);
  384. m_data = NewData;
  385. m_BufferLength = SysStringLen(m_data);
  386. }
  387. m_StringLength = wcslen(m_data);
  388. m_Status = OK;
  389. return *this;
  390. }
  391. UINT NextPattern(UINT offset, wchar_t *pattern, UINT &lIndex)
  392. {
  393. wchar_t *start;
  394. if(OK != m_Status) return m_Status;
  395. start = wcsstr(m_data + offset, pattern);
  396. if(NULL == start)
  397. return NOT_FOUND;
  398. else
  399. lIndex = (UINT)(start - m_data);
  400. return m_Status;
  401. }
  402. UINT PrevPattern(UINT offset, wchar_t *pattern, UINT &lIndex)
  403. {
  404. wchar_t
  405. *prev = NULL,
  406. *curr = NULL,
  407. *currOffset = m_data + offset;
  408. UINT
  409. patternLength;
  410. if((offset < 1) ||
  411. (NULL == pattern) ||
  412. (m_StringLength < (patternLength = wcslen(pattern))) ||
  413. (m_StringLength < offset))
  414. return INVALID_PARAM;
  415. if(OK != m_Status)
  416. return m_Status;
  417. curr = wcsstr(m_data, pattern);
  418. while(curr < currOffset)
  419. {
  420. prev = curr;
  421. curr = wcsstr(curr + patternLength, pattern);
  422. if(NULL == curr) curr = currOffset;
  423. }
  424. if(NULL == prev)
  425. return NOT_FOUND;
  426. else
  427. lIndex = (UINT)(prev - m_data);
  428. return m_Status;
  429. }
  430. UINT NextChar(UINT offset, wchar_t *charlist, UINT &lIndex)
  431. {
  432. wchar_t *start;
  433. if(OK != m_Status) return m_Status;
  434. start = wcspbrk(m_data + offset, charlist);
  435. if(NULL == start)
  436. return NOT_FOUND;
  437. else
  438. lIndex = (UINT)(start - m_data);
  439. return m_Status;
  440. }
  441. QString &SubStrCat(QString &SrcStr, UINT start, UINT end)
  442. {
  443. UINT
  444. SpliceLen = end - start + 1;
  445. BSTR
  446. NewData;
  447. if(OK != m_Status) return *this;
  448. if(end <= start)
  449. return *this;
  450. if((m_BufferLength - m_StringLength) > SpliceLen)
  451. wcsncat(m_data, SrcStr.m_data + start, SpliceLen);
  452. else
  453. {
  454. NewData = SysAllocStringLen(NULL, SpliceLen + m_StringLength + m_ExtraLength + 1);
  455. if(NULL == NewData)
  456. {
  457. m_Status = OUT_OF_MEMORY;
  458. return *this;
  459. }
  460. if(0 != m_StringLength)
  461. {
  462. wcscpy(NewData, m_data);
  463. wcsncat(NewData, SrcStr.m_data + start, SpliceLen);
  464. }
  465. else
  466. wcsncpy(NewData, SrcStr.m_data + start, SpliceLen);
  467. NewData[SpliceLen + m_StringLength] = L'\0';
  468. if(NULL != m_data)
  469. SysFreeString(m_data);
  470. m_data = NewData;
  471. m_BufferLength = SysStringLen(m_data);
  472. }
  473. m_StringLength = wcslen(m_data);
  474. return *this;
  475. }
  476. wchar_t & operator[] (UINT index) { return m_data[index]; }
  477. operator wchar_t* (void) { return m_data; }
  478. UINT StringLength(void) { return m_StringLength; }
  479. UINT BufferLength(void) { return m_BufferLength; }
  480. };
  481. template<class T> struct ADsStruct
  482. {
  483. T *m_pADsMem;
  484. ADsStruct(void)
  485. { m_pADsMem = NULL; }
  486. ~ADsStruct(void)
  487. { if(NULL != m_pADsMem) FreeADsMem(m_pADsMem); }
  488. operator T*(void) const { return m_pADsMem; }
  489. T** operator&(void) { return &m_pADsMem; }
  490. bool operator==(T *x) { return m_pADsMem == x; }
  491. bool operator!=(T *x) { return m_pADsMem != x; }
  492. T* & operator->(void) { return m_pADsMem; }
  493. // T* operator+(unsigned long x) { return m_pADsMem + x; }
  494. ADsStruct<T>& operator=(ADsStruct<T> &x)
  495. { return; }
  496. ADsStruct<T>& operator=(T* x)
  497. { if(NULL != m_pADsMem) FreeADsMem(m_pADsMem); m_pADsMem = x; return *this; }
  498. };
  499. template<class T> struct AutoDelete
  500. {
  501. T **m_pTheThingToDelete;
  502. AutoDelete(void)
  503. { m_pTheThingToDelete = NULL; }
  504. AutoDelete(T **x)
  505. { m_pTheThingToDelete = x; }
  506. ~AutoDelete(void)
  507. { if((NULL != m_pTheThingToDelete) && (NULL != *m_pTheThingToDelete)) delete *m_pTheThingToDelete;}
  508. };
  509. class ADsObjAutoDelete
  510. {
  511. CComPtr<IADsDeleteOps>
  512. m_pDelObj;
  513. public:
  514. HRESULT Attach(IDispatch *pDisp)
  515. { return pDisp->QueryInterface(IID_IADsDeleteOps, (void**)&m_pDelObj); }
  516. void Detach(void)
  517. { if(m_pDelObj != NULL) m_pDelObj = NULL; }
  518. ~ADsObjAutoDelete(void)
  519. { if(m_pDelObj != NULL) m_pDelObj->DeleteObject(0); }
  520. };
  521. extern BSTR
  522. // **** misc names
  523. g_bstrEmptyString,
  524. g_bstrEmptyDate,
  525. // **** AD schema names
  526. g_bstrADAuthor,
  527. g_bstrADChangeDate,
  528. g_bstrADClassDefinition,
  529. g_bstrADCreationDate,
  530. g_bstrADDescription,
  531. g_bstrADIntDefault,
  532. g_bstrADInt8Default,
  533. g_bstrADID,
  534. g_bstrADIntMax,
  535. g_bstrADInt8Max,
  536. g_bstrADIntMin,
  537. g_bstrADInt8Min,
  538. g_bstrADIntValidValues,
  539. g_bstrADName,
  540. g_bstrADNormalizedClass,
  541. g_bstrADObjectClass,
  542. g_bstrADParam2,
  543. g_bstrADPolicyType,
  544. g_bstrADPropertyName,
  545. g_bstrADQuery,
  546. g_bstrADQueryLanguage,
  547. g_bstrADStringDefault,
  548. g_bstrADStringValidValues,
  549. g_bstrADSourceOrganization,
  550. g_bstrADTargetClass,
  551. g_bstrADTargetNameSpace,
  552. g_bstrADTargetObject,
  553. g_bstrADTargetPath,
  554. g_bstrADTargetType,
  555. // **** AD class names
  556. g_bstrADClassMergeablePolicy,
  557. g_bstrADClassRangeParam,
  558. g_bstrADClassRangeSint32,
  559. g_bstrADClassRangeUint32,
  560. g_bstrADClassRangeReal,
  561. g_bstrADClassParamUnknown,
  562. g_bstrADClassSetSint32,
  563. g_bstrADClassSetUint32,
  564. g_bstrADClassSetString,
  565. g_bstrADClassSimplePolicy,
  566. g_bstrADClassRule,
  567. g_bstrADClassSom,
  568. g_bstrADClassPolicyType,
  569. g_bstrADClassWMIGPO,
  570. // **** CIM schema names
  571. g_bstrAuthor,
  572. g_bstrChangeDate,
  573. g_bstrClassDefinition,
  574. g_bstrCreationDate,
  575. g_bstrDefault,
  576. g_bstrDescription,
  577. g_bstrDsPath,
  578. g_bstrDomain,
  579. g_bstrID,
  580. g_bstrMax,
  581. g_bstrMin,
  582. g_bstrName,
  583. g_bstrPolicyType,
  584. g_bstrPropertyName,
  585. g_bstrQuery,
  586. g_bstrQueryLanguage,
  587. g_bstrRangeSettings,
  588. g_bstrRules,
  589. g_bstrSourceOrganization,
  590. g_bstrTargetClass,
  591. g_bstrTargetNameSpace,
  592. g_bstrTargetObject,
  593. g_bstrTargetPath,
  594. g_bstrTargetType,
  595. g_bstrValidValues,
  596. // **** CIM class names
  597. g_bstrClassMergeablePolicy,
  598. g_bstrClassRangeParam,
  599. g_bstrClassRangeSint32,
  600. g_bstrClassRangeUint32,
  601. g_bstrClassRangeReal,
  602. g_bstrClassSetSint32,
  603. g_bstrClassSetUint32,
  604. g_bstrClassSetString,
  605. g_bstrClassSimplePolicy,
  606. g_bstrClassRule,
  607. g_bstrClassSom,
  608. g_bstrClassPolicyType,
  609. g_bstrClassWMIGPO;
  610. void InitGlobalNames(void);
  611. void FreeGlobalNames(void);
  612. HRESULT DomainNameFromDistName(QString &DomainName, QString &DistName);
  613. HRESULT DistNameFromDomainName(QString &DomainName, QString &DistName);
  614. IADsContainer *CreateContainer(BSTR bstrPath, BSTR bstrName);
  615. IADsContainer *CreateContainers(QString &pDomain, QString &pPath);
  616. HRESULT ADSIToWMIErrorCodes(HRESULT hresAD);
  617. IsEmpty(VARIANT &);
  618. typedef HRESULT (*functTyp)(IWbemClassObject * *,
  619. IDirectoryObject*,
  620. IWbemServices*);
  621. HRESULT ExecuteWQLQuery(wchar_t *wcsPath,
  622. wchar_t *wcsWQLStmt,
  623. IWbemObjectSink *pResponseHandler,
  624. IWbemServices *pWbemServices,
  625. BSTR bstrADClassName,
  626. functTyp pf_ADToCIM);
  627. // **** PolicyTemplate
  628. HRESULT Policy_CIMToAD(long, IWbemClassObject *, IDirectoryObject *pDestContainer);
  629. HRESULT Policy_ADToCIM(IWbemClassObject **, IDirectoryObject *, IWbemServices *);
  630. HRESULT Policy_Merge(SafeArray<IUnknown*, VT_UNKNOWN> &PolicyArray,
  631. CComPtr<IWbemClassObject> &pMergedPolicy,
  632. IWbemServices *pDestCIM);
  633. // **** RangeSint32
  634. HRESULT Range_Sint32_Verify(IWbemClassObject*);
  635. HRESULT Range_Sint32_ADToCIM(IWbemClassObject * *, IDirectorySearch*, ADS_SEARCH_HANDLE, IWbemServices*);
  636. HRESULT Range_Sint32_Merge(SafeArray<IUnknown *, VT_UNKNOWN> &, CComPtr<IWbemClassObject> &, int &);
  637. // **** RangeUint32
  638. HRESULT Range_Uint32_Verify(IWbemClassObject*);
  639. HRESULT Range_Uint32_ADToCIM(IWbemClassObject * *, IDirectorySearch*, ADS_SEARCH_HANDLE, IWbemServices*);
  640. HRESULT Range_Uint32_Merge(SafeArray<IUnknown *, VT_UNKNOWN> &, CComPtr<IWbemClassObject> &, int &);
  641. // **** RangeReal
  642. HRESULT Range_Real_Verify(IWbemClassObject*);
  643. HRESULT Range_Real_ADToCIM(IWbemClassObject * *, IDirectorySearch*, ADS_SEARCH_HANDLE, IWbemServices*);
  644. HRESULT Range_Real_Merge(SafeArray<IUnknown *, VT_UNKNOWN> &, CComPtr<IWbemClassObject> &, int &);
  645. // **** SetSint32
  646. HRESULT Set_Sint32_Verify(IWbemClassObject*);
  647. HRESULT Set_Sint32_ADToCIM(IWbemClassObject * *, IDirectorySearch*, ADS_SEARCH_HANDLE, IWbemServices*);
  648. HRESULT Set_Sint32_Merge(SafeArray<IUnknown *, VT_UNKNOWN> &, CComPtr<IWbemClassObject> &, int &);
  649. // **** SetUint32
  650. HRESULT Set_Uint32_Verify(IWbemClassObject*);
  651. HRESULT Set_Uint32_ADToCIM(IWbemClassObject * *, IDirectorySearch*, ADS_SEARCH_HANDLE, IWbemServices*);
  652. HRESULT Set_Uint32_Merge(SafeArray<IUnknown *, VT_UNKNOWN> &, CComPtr<IWbemClassObject> &, int &);
  653. // **** SetString
  654. HRESULT Set_String_Verify(IWbemClassObject*);
  655. HRESULT Set_String_ADToCIM(IWbemClassObject * *, IDirectorySearch*, ADS_SEARCH_HANDLE, IWbemServices*);
  656. HRESULT Set_String_Merge(SafeArray<IUnknown *, VT_UNKNOWN> &, CComPtr<IWbemClassObject> &, int &);
  657. // **** ParamUnknown
  658. HRESULT Param_Unknown_Verify(IWbemClassObject*);
  659. HRESULT Param_Unknown_ADToCIM(IWbemClassObject * *, IDirectorySearch*, ADS_SEARCH_HANDLE*, IWbemServices*);
  660. // **** SOM
  661. HRESULT Som_CIMToAD(IWbemClassObject *pSrcPolicyObj, IDirectoryObject *pDestContainer, long lFlags);
  662. HRESULT Som_ADToCIM(IWbemClassObject **, IDirectoryObject *pSrcPolicyObj, IWbemServices *pDestCIM);
  663. // **** WMIGPO
  664. HRESULT WMIGPO_CIMToAD(IWbemClassObject *pSrcPolicyObj, IDirectoryObject *pDestContainer, long lFlags);
  665. HRESULT WMIGPO_ADToCIM(IWbemClassObject **, IDirectoryObject *pSrcPolicyObj, IWbemServices *pDestCIM);
  666. // **** PolicyType
  667. HRESULT PolicyType_CIMToAD(IWbemClassObject *pSrcPolicyObj, IDirectoryObject *pDestContainer);
  668. HRESULT PolicyType_ADToCIM(IWbemClassObject**, IDirectoryObject *pSrcPolicyObj, IWbemServices *pDestCIM);
  669. // **** Security Manipulation
  670. HRESULT CreateDefaultSecurityDescriptor(CNtSecurityDescriptor& cSD);
  671. HRESULT GetOwnerSecurityDescriptor(CNtSecurityDescriptor& SD);
  672. PSECURITY_DESCRIPTOR GetADSecurityDescriptor(IDirectoryObject *pIDirectoryObject);
  673. #endif __WBEM_UTILITY__H_