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.

1210 lines
30 KiB

  1. //
  2. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  3. //
  4. // ***************************************************************************
  5. //
  6. // Original Author: Rajesh Rao
  7. //
  8. // $Author: rajeshr $
  9. // $Date: 6/11/98 4:43p $
  10. // $Workfile:adsiclas.cpp $
  11. //
  12. // $Modtime: 6/11/98 11:21a $
  13. // $Revision: 1 $
  14. // $Nokeywords: $
  15. //
  16. //
  17. // Description: Contains the implementation of the CADSIClass which encapsulates an ADSI class
  18. //
  19. //***************************************************************************
  20. #include "precomp.h"
  21. //***************************************************************************
  22. //
  23. // CADSIClass::CADSIClass
  24. //
  25. // Purpose : Constructor
  26. //
  27. // Parameters:
  28. // lpszWBEMClassName : The WBEM name of the Class being created. A copy of this is made
  29. // lpszADSIClassName : The ADSI name of the Class being created. A copy of this is made
  30. //***************************************************************************
  31. CADSIClass :: CADSIClass(LPCWSTR lpszWBEMClassName, LPCWSTR lpszADSIClassName)
  32. : CRefCountedObject(lpszADSIClassName)
  33. {
  34. if(lpszWBEMClassName)
  35. {
  36. m_lpszWBEMClassName = new WCHAR[wcslen(lpszWBEMClassName) + 1];
  37. wcscpy(m_lpszWBEMClassName, lpszWBEMClassName);
  38. }
  39. else
  40. {
  41. m_lpszWBEMClassName = NULL;
  42. }
  43. // Set the attributes to theri default values
  44. m_lpszCommonName = NULL;
  45. m_lpszSuperClassLDAPName = NULL;
  46. m_lpszGovernsID = NULL;
  47. m_pSchemaIDGUIDOctets = NULL;
  48. m_dwSchemaIDGUIDLength = 0;
  49. m_lpszRDNAttribute = NULL;
  50. m_lpszDefaultSecurityDescriptor = NULL;
  51. m_dwObjectClassCategory = 0;
  52. m_dwNTSecurityDescriptorLength = 0;
  53. m_pNTSecurityDescriptor = NULL;
  54. m_lpszDefaultObjectCategory = NULL;
  55. m_bSystemOnly = FALSE;
  56. // Initialize the property book keeping
  57. m_lppszAuxiliaryClasses = NULL;
  58. m_dwAuxiliaryClassesCount = 0;
  59. m_lppszSystemAuxiliaryClasses = NULL;
  60. m_dwSystemAuxiliaryClassesCount = 0;
  61. m_lppszPossibleSuperiors = NULL;
  62. m_dwPossibleSuperiorsCount = 0;
  63. m_lppszSystemPossibleSuperiors = NULL;
  64. m_dwSystemPossibleSuperiorsCount = 0;
  65. m_lppszMayContains = NULL;
  66. m_dwMayContainsCount = 0;
  67. m_lppszSystemMayContains = NULL;
  68. m_dwSystemMayContainsCount = 0;
  69. m_lppszMustContains = NULL;
  70. m_dwMustContainsCount = 0;
  71. m_lppszSystemMustContains = NULL;
  72. m_dwSystemMustContainsCount = 0;
  73. }
  74. //***************************************************************************
  75. //
  76. // CADSIClass :: ~CADSIClass
  77. //
  78. // Purpose : Destructor
  79. //***************************************************************************
  80. CADSIClass :: ~CADSIClass()
  81. {
  82. // Delete the WBEM Name. The ADSI Name is deleted in the base class destructor
  83. if ( m_lpszWBEMClassName )
  84. {
  85. delete [] m_lpszWBEMClassName;
  86. m_lpszWBEMClassName = NULL;
  87. }
  88. // Delete the attributes
  89. if ( m_lpszCommonName )
  90. {
  91. delete [] m_lpszCommonName;
  92. m_lpszCommonName = NULL;
  93. }
  94. if ( m_lpszSuperClassLDAPName )
  95. {
  96. delete [] m_lpszSuperClassLDAPName;
  97. m_lpszSuperClassLDAPName = NULL;
  98. }
  99. if ( m_lpszGovernsID )
  100. {
  101. delete [] m_lpszGovernsID;
  102. m_lpszGovernsID = NULL;
  103. }
  104. if ( m_pSchemaIDGUIDOctets )
  105. {
  106. delete [] m_pSchemaIDGUIDOctets;
  107. m_pSchemaIDGUIDOctets = NULL;
  108. }
  109. if ( m_lpszRDNAttribute )
  110. {
  111. delete [] m_lpszRDNAttribute;
  112. m_lpszRDNAttribute = NULL;
  113. }
  114. if ( m_lpszDefaultSecurityDescriptor )
  115. {
  116. delete [] m_lpszDefaultSecurityDescriptor;
  117. m_lpszDefaultSecurityDescriptor = NULL;
  118. }
  119. if ( m_pNTSecurityDescriptor )
  120. {
  121. delete [] m_pNTSecurityDescriptor;
  122. m_pNTSecurityDescriptor = NULL;
  123. }
  124. if ( m_lpszDefaultObjectCategory )
  125. {
  126. delete [] m_lpszDefaultObjectCategory;
  127. m_lpszDefaultObjectCategory = NULL;
  128. }
  129. DWORD i;
  130. // Delete the list of Auxiliary Classes
  131. if ( m_lppszAuxiliaryClasses )
  132. {
  133. for(i=0; i<m_dwAuxiliaryClassesCount; i++)
  134. {
  135. delete [] m_lppszAuxiliaryClasses[i];
  136. m_lppszAuxiliaryClasses[i] = NULL;
  137. }
  138. delete[] m_lppszAuxiliaryClasses;
  139. m_lppszAuxiliaryClasses = NULL;
  140. }
  141. // Delete the list of System Auxiliary Classes
  142. if ( m_lppszSystemAuxiliaryClasses )
  143. {
  144. for(i=0; i<m_dwSystemAuxiliaryClassesCount; i++)
  145. {
  146. delete [] m_lppszSystemAuxiliaryClasses[i];
  147. m_lppszSystemAuxiliaryClasses[i] = NULL;
  148. }
  149. delete[] m_lppszSystemAuxiliaryClasses;
  150. m_lppszSystemAuxiliaryClasses = NULL;
  151. }
  152. // Delete the list of possible superiors
  153. if ( m_lppszPossibleSuperiors )
  154. {
  155. for(i=0; i<m_dwPossibleSuperiorsCount; i++)
  156. {
  157. delete [] m_lppszPossibleSuperiors[i];
  158. m_lppszPossibleSuperiors[i] = NULL;
  159. }
  160. delete[] m_lppszPossibleSuperiors;
  161. m_lppszPossibleSuperiors = NULL;
  162. }
  163. // Delete the list of System possible superiors
  164. if ( m_lppszSystemPossibleSuperiors )
  165. {
  166. for(i=0; i<m_dwSystemPossibleSuperiorsCount; i++)
  167. {
  168. delete [] m_lppszSystemPossibleSuperiors[i];
  169. m_lppszSystemPossibleSuperiors[i] = NULL;
  170. }
  171. delete[] m_lppszSystemPossibleSuperiors;
  172. m_lppszSystemPossibleSuperiors = NULL;
  173. }
  174. // Delete the list of may contains
  175. if ( m_lppszMayContains )
  176. {
  177. for(i=0; i<m_dwMayContainsCount; i++)
  178. {
  179. delete [] m_lppszMayContains[i];
  180. m_lppszMayContains[i] = NULL;
  181. }
  182. delete[] m_lppszMayContains;
  183. m_lppszMayContains = NULL;
  184. }
  185. // Delete the list of System may contains
  186. if ( m_lppszSystemMayContains )
  187. {
  188. for(i=0; i<m_dwSystemMayContainsCount; i++)
  189. {
  190. delete [] m_lppszSystemMayContains[i];
  191. m_lppszSystemMayContains[i] = NULL;
  192. }
  193. delete[] m_lppszSystemMayContains;
  194. m_lppszSystemMayContains = NULL;
  195. }
  196. // Delete the list of Must Contains
  197. if ( m_lppszMustContains )
  198. {
  199. for(i=0; i<m_dwMustContainsCount; i++)
  200. {
  201. delete [] m_lppszMustContains[i];
  202. m_lppszMustContains[i] = NULL;
  203. }
  204. delete[] m_lppszMustContains;
  205. m_lppszMustContains = NULL;
  206. }
  207. // Delete the list of System Must Contains
  208. if ( m_lppszSystemMustContains )
  209. {
  210. for(i=0; i<m_dwSystemMustContainsCount; i++)
  211. {
  212. delete [] m_lppszSystemMustContains[i];
  213. m_lppszSystemMustContains[i] = NULL;
  214. }
  215. delete[] m_lppszSystemMustContains;
  216. m_lppszSystemMustContains = NULL;
  217. }
  218. }
  219. //***************************************************************************
  220. //
  221. // CADSIClass :: GetWBEMClassName
  222. //
  223. // Purpose : Returns the WBEM Class name of this Class
  224. //***************************************************************************
  225. LPCWSTR CADSIClass :: GetWBEMClassName()
  226. {
  227. return m_lpszWBEMClassName;
  228. }
  229. //***************************************************************************
  230. //
  231. // CADSIClass :: GetWBEMClassName
  232. //
  233. // Purpose : See Header
  234. //***************************************************************************
  235. void CADSIClass::SetWBEMClassName(LPCWSTR lpszName)
  236. {
  237. if ( m_lpszWBEMClassName )
  238. {
  239. delete[] m_lpszWBEMClassName;
  240. m_lpszWBEMClassName = NULL;
  241. }
  242. if(lpszName)
  243. {
  244. m_lpszWBEMClassName = new WCHAR[wcslen(lpszName) + 1];
  245. wcscpy(m_lpszWBEMClassName, lpszName);
  246. }
  247. }
  248. //***************************************************************************
  249. //
  250. // CADSIClass :: GetADSIClassName
  251. //
  252. // Purpose : See Header
  253. //***************************************************************************
  254. LPCWSTR CADSIClass :: GetADSIClassName()
  255. {
  256. return GetName();
  257. }
  258. //***************************************************************************
  259. //
  260. // CADSIClass :: GetADSIClassName
  261. //
  262. // Purpose : See Header
  263. //***************************************************************************
  264. void CADSIClass :: SetADSIClassName(LPCWSTR lpszName)
  265. {
  266. SetName(lpszName);
  267. }
  268. //***************************************************************************
  269. //
  270. // CADSIClass :: GetCommonName
  271. //
  272. // Purpose : See Header
  273. //
  274. //***************************************************************************
  275. LPCWSTR CADSIClass :: GetCommonName()
  276. {
  277. return m_lpszCommonName;
  278. }
  279. //***************************************************************************
  280. //
  281. // CADSIClass :: SetCommonName
  282. //
  283. // Purpose : See Header
  284. //***************************************************************************
  285. void CADSIClass :: SetCommonName(LPCWSTR lpszCommonName)
  286. {
  287. if ( m_lpszCommonName )
  288. {
  289. delete[] m_lpszCommonName;
  290. m_lpszCommonName = NULL;
  291. }
  292. if(lpszCommonName)
  293. {
  294. m_lpszCommonName = new WCHAR[wcslen(lpszCommonName) + 1];
  295. wcscpy(m_lpszCommonName, lpszCommonName);
  296. }
  297. }
  298. //***************************************************************************
  299. //
  300. // CADSIClass :: GetSuperClassLDAPName
  301. //
  302. // Purpose : See Header
  303. //
  304. //***************************************************************************
  305. LPCWSTR CADSIClass :: GetSuperClassLDAPName()
  306. {
  307. return m_lpszSuperClassLDAPName;
  308. }
  309. //***************************************************************************
  310. //
  311. // CADSIClass :: SetSuperClassLDAPName
  312. //
  313. // Purpose : See Header
  314. //***************************************************************************
  315. void CADSIClass :: SetSuperClassLDAPName(LPCWSTR lpszSuperClassLDAPName)
  316. {
  317. if ( m_lpszSuperClassLDAPName )
  318. {
  319. delete[] m_lpszSuperClassLDAPName;
  320. m_lpszSuperClassLDAPName = NULL;
  321. }
  322. if(lpszSuperClassLDAPName)
  323. {
  324. m_lpszSuperClassLDAPName = new WCHAR[wcslen(lpszSuperClassLDAPName) + 1];
  325. wcscpy(m_lpszSuperClassLDAPName, lpszSuperClassLDAPName);
  326. }
  327. }
  328. //***************************************************************************
  329. //
  330. // CADSIClass :: GetGovernsID
  331. //
  332. // Purpose : See Header
  333. //***************************************************************************
  334. LPCWSTR CADSIClass :: GetGovernsID()
  335. {
  336. return m_lpszGovernsID;
  337. }
  338. //***************************************************************************
  339. //
  340. // CADSIClass :: SetGovernsID
  341. //
  342. // Purpose : See Header
  343. //***************************************************************************
  344. void CADSIClass :: SetGovernsID(LPCWSTR lpszGovernsID)
  345. {
  346. if ( m_lpszGovernsID )
  347. {
  348. delete[] m_lpszGovernsID;
  349. m_lpszGovernsID = NULL;
  350. }
  351. if(lpszGovernsID)
  352. {
  353. m_lpszGovernsID = new WCHAR[wcslen(lpszGovernsID) + 1];
  354. wcscpy(m_lpszGovernsID, lpszGovernsID);
  355. }
  356. }
  357. //***************************************************************************
  358. //
  359. // CADSIClass :: GetSchemaIDGUID
  360. //
  361. // Purpose : See Header
  362. //***************************************************************************
  363. const LPBYTE CADSIClass :: GetSchemaIDGUID(DWORD *pdwLength)
  364. {
  365. *pdwLength = m_dwSchemaIDGUIDLength;
  366. return m_pSchemaIDGUIDOctets;
  367. }
  368. //***************************************************************************
  369. //
  370. // CADSIClass :: SetSchemaIDGUID
  371. //
  372. // Purpose : See Header
  373. //***************************************************************************
  374. void CADSIClass :: SetSchemaIDGUID(LPBYTE pOctets, DWORD dwLength)
  375. {
  376. if ( m_pSchemaIDGUIDOctets )
  377. {
  378. delete[] m_pSchemaIDGUIDOctets;
  379. m_pSchemaIDGUIDOctets = NULL;
  380. }
  381. m_dwSchemaIDGUIDLength = 0;
  382. if(pOctets)
  383. {
  384. m_dwSchemaIDGUIDLength = dwLength;
  385. if(m_pSchemaIDGUIDOctets = new BYTE[dwLength])
  386. {
  387. for(DWORD i=0; i<dwLength; i++)
  388. m_pSchemaIDGUIDOctets[i] = pOctets[i];
  389. }
  390. }
  391. }
  392. //***************************************************************************
  393. //
  394. // CADSIClass :: GetRDNAttribute
  395. //
  396. // Purpose : See Header
  397. //
  398. //***************************************************************************
  399. LPCWSTR CADSIClass :: GetRDNAttribute()
  400. {
  401. return m_lpszRDNAttribute;
  402. }
  403. //***************************************************************************
  404. //
  405. // CADSIClass :: SetRDNAttribute
  406. //
  407. // Purpose : See Header
  408. //***************************************************************************
  409. void CADSIClass :: SetRDNAttribute(LPCWSTR lpszRDNAttribute)
  410. {
  411. if ( m_lpszRDNAttribute )
  412. {
  413. delete[] m_lpszRDNAttribute;
  414. m_lpszRDNAttribute = NULL;
  415. }
  416. if(lpszRDNAttribute)
  417. {
  418. m_lpszRDNAttribute = new WCHAR[wcslen(lpszRDNAttribute) + 1];
  419. wcscpy(m_lpszRDNAttribute, lpszRDNAttribute);
  420. }
  421. }
  422. //***************************************************************************
  423. //
  424. // CADSIClass :: GetDefaultSecurityDescriptor
  425. //
  426. // Purpose : See Header
  427. //***************************************************************************
  428. LPCWSTR CADSIClass :: GetDefaultSecurityDescriptor()
  429. {
  430. return m_lpszDefaultSecurityDescriptor;
  431. }
  432. //***************************************************************************
  433. //
  434. // CADSIClass :: SetDefaultSecurityDescriptor
  435. //
  436. // Purpose : See Header
  437. //***************************************************************************
  438. void CADSIClass :: SetDefaultSecurityDescriptor(LPCWSTR lpszDefaultSecurityDescriptor)
  439. {
  440. if ( m_lpszDefaultSecurityDescriptor )
  441. {
  442. delete[] m_lpszDefaultSecurityDescriptor;
  443. m_lpszDefaultSecurityDescriptor = NULL;
  444. }
  445. if( lpszDefaultSecurityDescriptor)
  446. {
  447. m_lpszDefaultSecurityDescriptor = new WCHAR[wcslen(lpszDefaultSecurityDescriptor) + 1];
  448. wcscpy(m_lpszDefaultSecurityDescriptor, lpszDefaultSecurityDescriptor);
  449. }
  450. }
  451. //***************************************************************************
  452. //
  453. // CADSIClass :: GetObjectClassCategory
  454. //
  455. // Purpose : See Header
  456. //***************************************************************************
  457. DWORD CADSIClass :: GetObjectClassCategory()
  458. {
  459. return m_dwObjectClassCategory;
  460. }
  461. //***************************************************************************
  462. //
  463. // CADSIClass :: SetObjectClassCategory
  464. //
  465. // Purpose : See Header
  466. //***************************************************************************
  467. void CADSIClass :: SetObjectClassCategory(DWORD dwObjectClassCategory)
  468. {
  469. m_dwObjectClassCategory = dwObjectClassCategory;
  470. }
  471. //***************************************************************************
  472. //
  473. // CADSIClass :: GetNTSecurityDescriptor
  474. //
  475. // Purpose : See Header
  476. //***************************************************************************
  477. const LPBYTE CADSIClass :: GetNTSecurityDescriptor(DWORD *pdwLength)
  478. {
  479. *pdwLength = m_dwNTSecurityDescriptorLength;
  480. return m_pNTSecurityDescriptor;
  481. }
  482. //***************************************************************************
  483. //
  484. // CADSIClass :: SetNTSecurityDescriptor
  485. //
  486. // Purpose : See Header
  487. //***************************************************************************
  488. void CADSIClass :: SetNTSecurityDescriptor(LPBYTE pOctets, DWORD dwLength)
  489. {
  490. if ( m_pNTSecurityDescriptor )
  491. {
  492. delete[] m_pNTSecurityDescriptor;
  493. m_pNTSecurityDescriptor = NULL;
  494. }
  495. m_dwNTSecurityDescriptorLength = 0;
  496. if(pOctets)
  497. {
  498. m_dwNTSecurityDescriptorLength = dwLength;
  499. if(m_pNTSecurityDescriptor = new BYTE[dwLength])
  500. {
  501. for(DWORD i=0; i<dwLength; i++)
  502. m_pNTSecurityDescriptor[i] = pOctets[i];
  503. }
  504. }
  505. }
  506. //***************************************************************************
  507. //
  508. // CADSIClass :: GetDefaultObjectCategory
  509. //
  510. // Purpose : See Header
  511. //***************************************************************************
  512. LPCWSTR CADSIClass :: GetDefaultObjectCategory()
  513. {
  514. return m_lpszDefaultObjectCategory;
  515. }
  516. //***************************************************************************
  517. //
  518. // CADSIClass :: SetDefaultObjectCategory
  519. //
  520. // Purpose : See Header
  521. //***************************************************************************
  522. void CADSIClass :: SetDefaultObjectCategory(LPCWSTR lpszDefaultObjectCategory)
  523. {
  524. if ( m_lpszDefaultObjectCategory )
  525. {
  526. delete[] m_lpszDefaultObjectCategory;
  527. m_lpszDefaultObjectCategory = NULL;
  528. }
  529. if (lpszDefaultObjectCategory)
  530. {
  531. m_lpszDefaultObjectCategory = new WCHAR[wcslen(lpszDefaultObjectCategory) + 1];
  532. wcscpy(m_lpszDefaultObjectCategory, lpszDefaultObjectCategory);
  533. }
  534. }
  535. //***************************************************************************
  536. //
  537. // CADSIClass :: GetSystemOnly
  538. //
  539. // Purpose : See Header
  540. //***************************************************************************
  541. BOOLEAN CADSIClass :: GetSystemOnly()
  542. {
  543. return m_bSystemOnly;
  544. }
  545. //***************************************************************************
  546. //
  547. // CADSIClass :: SetSystemOnly
  548. //
  549. // Purpose : See Header
  550. //***************************************************************************
  551. void CADSIClass :: SetSystemOnly(BOOLEAN bSystemOnly)
  552. {
  553. m_bSystemOnly = bSystemOnly;
  554. }
  555. //***************************************************************************
  556. //
  557. // CADSIClass :: GetAuxiliaryClasses
  558. //
  559. // Purpose : See Header
  560. //***************************************************************************
  561. LPCWSTR *CADSIClass :: GetAuxiliaryClasses(DWORD *pdwCount)
  562. {
  563. *pdwCount = m_dwAuxiliaryClassesCount;
  564. return (LPCWSTR *)m_lppszAuxiliaryClasses;
  565. }
  566. //***************************************************************************
  567. //
  568. // CADSIClass :: SetAuxiliaryClasses
  569. //
  570. // Purpose : See Header
  571. //***************************************************************************
  572. void CADSIClass :: SetAuxiliaryClasses(PADSVALUE pValues, DWORD dwNumValues)
  573. {
  574. DWORD i = 0;
  575. // Delete the list of possible superiors
  576. if ( m_lppszAuxiliaryClasses )
  577. {
  578. for ( i = 0; i<m_dwAuxiliaryClassesCount; i++ )
  579. {
  580. if ( m_lppszAuxiliaryClasses [ i ] )
  581. {
  582. delete [] m_lppszAuxiliaryClasses [ i ];
  583. m_lppszAuxiliaryClasses [ i ] = NULL;
  584. }
  585. }
  586. delete [] m_lppszAuxiliaryClasses;
  587. m_lppszAuxiliaryClasses = NULL;
  588. m_dwAuxiliaryClassesCount = 0;
  589. }
  590. // Set the new list of values
  591. m_dwAuxiliaryClassesCount = dwNumValues;
  592. m_lppszAuxiliaryClasses = new LPWSTR[m_dwAuxiliaryClassesCount];
  593. for(i=0; i<m_dwAuxiliaryClassesCount; i++)
  594. {
  595. try
  596. {
  597. m_lppszAuxiliaryClasses[i] = new WCHAR[wcslen(pValues->CaseIgnoreString) + 1];
  598. wcscpy(m_lppszAuxiliaryClasses[i], pValues->CaseIgnoreString);
  599. }
  600. catch ( ... )
  601. {
  602. if ( m_lppszAuxiliaryClasses )
  603. {
  604. m_dwAuxiliaryClassesCount = 0;
  605. for ( DWORD dw = 0; dw < i; dw++ )
  606. {
  607. if ( m_lppszAuxiliaryClasses [ dw ] )
  608. {
  609. delete [] m_lppszAuxiliaryClasses [ dw ];
  610. m_lppszAuxiliaryClasses [ dw ] = NULL;
  611. }
  612. }
  613. delete [] m_lppszAuxiliaryClasses;
  614. m_lppszAuxiliaryClasses = NULL;
  615. }
  616. throw;
  617. }
  618. pValues ++;
  619. }
  620. }
  621. //***************************************************************************
  622. //
  623. // CADSIClass :: GetSystemAuxiliaryClasses
  624. //
  625. // Purpose : See Header
  626. //***************************************************************************
  627. LPCWSTR *CADSIClass :: GetSystemAuxiliaryClasses(DWORD *pdwCount)
  628. {
  629. *pdwCount = m_dwSystemAuxiliaryClassesCount;
  630. return (LPCWSTR *)m_lppszSystemAuxiliaryClasses;
  631. }
  632. //***************************************************************************
  633. //
  634. // CADSIClass :: SetSystemAuxiliaryClasses
  635. //
  636. // Purpose : See Header
  637. //***************************************************************************
  638. void CADSIClass :: SetSystemAuxiliaryClasses(PADSVALUE pValues, DWORD dwNumValues)
  639. {
  640. DWORD i = 0;
  641. // Delete the list of possible superiors
  642. if ( m_lppszSystemAuxiliaryClasses )
  643. {
  644. for ( i = 0; i<m_dwSystemAuxiliaryClassesCount; i++ )
  645. {
  646. if ( m_lppszSystemAuxiliaryClasses [ i ] )
  647. {
  648. delete [] m_lppszSystemAuxiliaryClasses [ i ];
  649. m_lppszSystemAuxiliaryClasses [ i ] = NULL;
  650. }
  651. }
  652. delete [] m_lppszSystemAuxiliaryClasses;
  653. m_lppszSystemAuxiliaryClasses = NULL;
  654. m_dwSystemAuxiliaryClassesCount = 0;
  655. }
  656. // Set the new list of values
  657. m_dwSystemAuxiliaryClassesCount = dwNumValues;
  658. m_lppszSystemAuxiliaryClasses = new LPWSTR[m_dwSystemAuxiliaryClassesCount];
  659. for(i=0; i<m_dwSystemAuxiliaryClassesCount; i++)
  660. {
  661. try
  662. {
  663. m_lppszSystemAuxiliaryClasses[i] = new WCHAR[wcslen(pValues->CaseIgnoreString) + 1];
  664. wcscpy(m_lppszSystemAuxiliaryClasses[i], pValues->CaseIgnoreString);
  665. }
  666. catch ( ... )
  667. {
  668. if ( m_lppszSystemAuxiliaryClasses )
  669. {
  670. m_dwSystemAuxiliaryClassesCount = 0;
  671. for ( DWORD dw = 0; dw < i; dw++ )
  672. {
  673. if ( m_lppszSystemAuxiliaryClasses [ dw ] )
  674. {
  675. delete [] m_lppszSystemAuxiliaryClasses [ dw ];
  676. m_lppszSystemAuxiliaryClasses [ dw ] = NULL;
  677. }
  678. }
  679. delete [] m_lppszSystemAuxiliaryClasses;
  680. m_lppszSystemAuxiliaryClasses = NULL;
  681. }
  682. throw;
  683. }
  684. pValues ++;
  685. }
  686. }
  687. //***************************************************************************
  688. //
  689. // CADSIClass :: GetPossibleSuperiors
  690. //
  691. // Purpose : See Header
  692. //***************************************************************************
  693. LPCWSTR *CADSIClass :: GetPossibleSuperiors(DWORD *pdwCount)
  694. {
  695. *pdwCount = m_dwPossibleSuperiorsCount;
  696. return (LPCWSTR *)m_lppszPossibleSuperiors;
  697. }
  698. //***************************************************************************
  699. //
  700. // CADSIClass :: SetPossibleSuperiors
  701. //
  702. // Purpose : See Header
  703. //***************************************************************************
  704. void CADSIClass :: SetPossibleSuperiors(PADSVALUE pValues, DWORD dwNumValues)
  705. {
  706. DWORD i = 0;
  707. // Delete the list of possible superiors
  708. if ( m_lppszPossibleSuperiors )
  709. {
  710. for ( i = 0; i<m_dwPossibleSuperiorsCount; i++ )
  711. {
  712. if ( m_lppszPossibleSuperiors [ i ] )
  713. {
  714. delete [] m_lppszPossibleSuperiors [ i ];
  715. m_lppszPossibleSuperiors [ i ] = NULL;
  716. }
  717. }
  718. delete [] m_lppszPossibleSuperiors;
  719. m_lppszPossibleSuperiors = NULL;
  720. m_dwPossibleSuperiorsCount = 0;
  721. }
  722. // Set the new list of values
  723. m_dwPossibleSuperiorsCount = dwNumValues;
  724. m_lppszPossibleSuperiors = new LPWSTR[m_dwPossibleSuperiorsCount];
  725. for(i=0; i<m_dwPossibleSuperiorsCount; i++)
  726. {
  727. try
  728. {
  729. m_lppszPossibleSuperiors[i] = new WCHAR[wcslen(pValues->CaseIgnoreString) + 1];
  730. wcscpy(m_lppszPossibleSuperiors[i], pValues->CaseIgnoreString);
  731. }
  732. catch ( ... )
  733. {
  734. if ( m_lppszPossibleSuperiors )
  735. {
  736. m_dwPossibleSuperiorsCount = 0;
  737. for ( DWORD dw = 0; dw < i; dw++ )
  738. {
  739. if ( m_lppszPossibleSuperiors [ dw ] )
  740. {
  741. delete [] m_lppszPossibleSuperiors [ dw ];
  742. m_lppszPossibleSuperiors [ dw ] = NULL;
  743. }
  744. }
  745. delete [] m_lppszPossibleSuperiors;
  746. m_lppszPossibleSuperiors = NULL;
  747. }
  748. throw;
  749. }
  750. pValues ++;
  751. }
  752. }
  753. //***************************************************************************
  754. //
  755. // CADSIClass :: GetSystemPossibleSuperiors
  756. //
  757. // Purpose : See Header
  758. //***************************************************************************
  759. LPCWSTR *CADSIClass :: GetSystemPossibleSuperiors(DWORD *pdwCount)
  760. {
  761. *pdwCount = m_dwSystemPossibleSuperiorsCount;
  762. return (LPCWSTR *)m_lppszSystemPossibleSuperiors;
  763. }
  764. //***************************************************************************
  765. //
  766. // CADSIClass :: SetSystemPossibleSuperiors
  767. //
  768. // Purpose : See Header
  769. //***************************************************************************
  770. void CADSIClass :: SetSystemPossibleSuperiors(PADSVALUE pValues, DWORD dwNumValues)
  771. {
  772. DWORD i = 0;
  773. // Delete the list of possible superiors
  774. if ( m_lppszSystemPossibleSuperiors )
  775. {
  776. for ( i = 0; i<m_dwSystemPossibleSuperiorsCount; i++ )
  777. {
  778. if ( m_lppszSystemPossibleSuperiors [ i ] )
  779. {
  780. delete [] m_lppszSystemPossibleSuperiors [ i ];
  781. m_lppszSystemPossibleSuperiors [ i ] = NULL;
  782. }
  783. }
  784. delete [] m_lppszSystemPossibleSuperiors;
  785. m_lppszSystemPossibleSuperiors = NULL;
  786. m_dwSystemPossibleSuperiorsCount = 0;
  787. }
  788. // Set the new list of values
  789. m_dwSystemPossibleSuperiorsCount = dwNumValues;
  790. m_lppszSystemPossibleSuperiors = new LPWSTR[m_dwSystemPossibleSuperiorsCount];
  791. for(i=0; i<m_dwSystemPossibleSuperiorsCount; i++)
  792. {
  793. try
  794. {
  795. m_lppszSystemPossibleSuperiors[i] = new WCHAR[wcslen(pValues->CaseIgnoreString) + 1];
  796. wcscpy(m_lppszSystemPossibleSuperiors[i], pValues->CaseIgnoreString);
  797. }
  798. catch ( ... )
  799. {
  800. if ( m_lppszSystemPossibleSuperiors )
  801. {
  802. m_dwSystemPossibleSuperiorsCount = 0;
  803. for ( DWORD dw = 0; dw < i; dw++ )
  804. {
  805. if ( m_lppszSystemPossibleSuperiors [ dw ] )
  806. {
  807. delete [] m_lppszSystemPossibleSuperiors [ dw ];
  808. m_lppszSystemPossibleSuperiors [ dw ] = NULL;
  809. }
  810. }
  811. delete [] m_lppszSystemPossibleSuperiors;
  812. m_lppszSystemPossibleSuperiors = NULL;
  813. }
  814. throw;
  815. }
  816. pValues ++;
  817. }
  818. }
  819. //***************************************************************************
  820. //
  821. // CADSIClass :: GetMayContains
  822. //
  823. // Purpose : See Header
  824. //***************************************************************************
  825. LPCWSTR *CADSIClass :: GetMayContains(DWORD *pdwCount)
  826. {
  827. *pdwCount = m_dwMayContainsCount;
  828. return (LPCWSTR *)m_lppszMayContains;
  829. }
  830. //***************************************************************************
  831. //
  832. // CADSIClass :: SetMayContains
  833. //
  834. // Purpose : See Header
  835. //***************************************************************************
  836. void CADSIClass :: SetMayContains(PADSVALUE pValues, DWORD dwNumValues)
  837. {
  838. DWORD i = 0;
  839. // Delete the list of possible superiors
  840. if ( m_lppszMayContains )
  841. {
  842. for ( i = 0; i<m_dwMayContainsCount; i++ )
  843. {
  844. if ( m_lppszMayContains [ i ] )
  845. {
  846. delete [] m_lppszMayContains [ i ];
  847. m_lppszMayContains [ i ] = NULL;
  848. }
  849. }
  850. delete [] m_lppszMayContains;
  851. m_lppszMayContains = NULL;
  852. m_dwMayContainsCount = 0;
  853. }
  854. // Set the new list of values
  855. m_dwMayContainsCount = dwNumValues;
  856. m_lppszMayContains = new LPWSTR[m_dwMayContainsCount];
  857. for(i=0; i<m_dwMayContainsCount; i++)
  858. {
  859. try
  860. {
  861. m_lppszMayContains[i] = new WCHAR[wcslen(pValues->CaseIgnoreString) + 1];
  862. wcscpy(m_lppszMayContains[i], pValues->CaseIgnoreString);
  863. }
  864. catch ( ... )
  865. {
  866. if ( m_lppszMayContains )
  867. {
  868. m_dwMayContainsCount = 0;
  869. for ( DWORD dw = 0; dw < i; dw++ )
  870. {
  871. if ( m_lppszMayContains [ dw ] )
  872. {
  873. delete [] m_lppszMayContains [ dw ];
  874. m_lppszMayContains [ dw ] = NULL;
  875. }
  876. }
  877. delete [] m_lppszMayContains;
  878. m_lppszMayContains = NULL;
  879. }
  880. throw;
  881. }
  882. pValues ++;
  883. }
  884. }
  885. //***************************************************************************
  886. //
  887. // CADSIClass :: GetSystemMayContains
  888. //
  889. // Purpose : See Header
  890. //***************************************************************************
  891. LPCWSTR *CADSIClass :: GetSystemMayContains(DWORD *pdwCount)
  892. {
  893. *pdwCount = m_dwSystemMayContainsCount;
  894. return (LPCWSTR *)m_lppszSystemMayContains;
  895. }
  896. //***************************************************************************
  897. //
  898. // CADSIClass :: SetSystemMayContains
  899. //
  900. // Purpose : See Header
  901. //***************************************************************************
  902. void CADSIClass :: SetSystemMayContains(PADSVALUE pValues, DWORD dwNumValues)
  903. {
  904. DWORD i = 0;
  905. // Delete the list of possible superiors
  906. if ( m_lppszSystemMayContains )
  907. {
  908. for ( i = 0; i<m_dwSystemMayContainsCount; i++ )
  909. {
  910. if ( m_lppszSystemMayContains [ i ] )
  911. {
  912. delete [] m_lppszSystemMayContains [ i ];
  913. m_lppszSystemMayContains [ i ] = NULL;
  914. }
  915. }
  916. delete [] m_lppszSystemMayContains;
  917. m_lppszSystemMayContains = NULL;
  918. m_dwSystemMayContainsCount = 0;
  919. }
  920. // Set the new list of values
  921. m_dwSystemMayContainsCount = dwNumValues;
  922. m_lppszSystemMayContains = new LPWSTR[m_dwSystemMayContainsCount];
  923. for(i=0; i<m_dwSystemMayContainsCount; i++)
  924. {
  925. try
  926. {
  927. m_lppszSystemMayContains[i] = new WCHAR[wcslen(pValues->CaseIgnoreString) + 1];
  928. wcscpy(m_lppszSystemMayContains[i], pValues->CaseIgnoreString);
  929. }
  930. catch ( ... )
  931. {
  932. if ( m_lppszSystemMayContains )
  933. {
  934. m_dwSystemMayContainsCount = 0;
  935. for ( DWORD dw = 0; dw < i; dw++ )
  936. {
  937. if ( m_lppszSystemMayContains [ dw ] )
  938. {
  939. delete [] m_lppszSystemMayContains [ dw ];
  940. m_lppszSystemMayContains [ dw ] = NULL;
  941. }
  942. }
  943. delete [] m_lppszSystemMayContains;
  944. m_lppszSystemMayContains = NULL;
  945. }
  946. throw;
  947. }
  948. pValues ++;
  949. }
  950. }
  951. //***************************************************************************
  952. //
  953. // CADSIClass :: GetMustContains
  954. //
  955. // Purpose : See Header
  956. //***************************************************************************
  957. LPCWSTR *CADSIClass :: GetMustContains(DWORD *pdwCount)
  958. {
  959. *pdwCount = m_dwMustContainsCount;
  960. return (LPCWSTR *)m_lppszMustContains;
  961. }
  962. //***************************************************************************
  963. //
  964. // CADSIClass :: SetMustContains
  965. //
  966. // Purpose : See Header
  967. //***************************************************************************
  968. void CADSIClass :: SetMustContains(PADSVALUE pValues, DWORD dwNumValues)
  969. {
  970. DWORD i = 0;
  971. // Delete the list of possible superiors
  972. if ( m_lppszMustContains )
  973. {
  974. for ( i = 0; i<m_dwMustContainsCount; i++ )
  975. {
  976. if ( m_lppszMustContains [ i ] )
  977. {
  978. delete [] m_lppszMustContains [ i ];
  979. m_lppszMustContains [ i ] = NULL;
  980. }
  981. }
  982. delete [] m_lppszMustContains;
  983. m_lppszMustContains = NULL;
  984. m_dwMustContainsCount = 0;
  985. }
  986. // Set the new list of values
  987. m_dwMustContainsCount = dwNumValues;
  988. m_lppszMustContains = new LPWSTR[m_dwMustContainsCount];
  989. for(i=0; i<m_dwMustContainsCount; i++)
  990. {
  991. try
  992. {
  993. m_lppszMustContains[i] = new WCHAR[wcslen(pValues->CaseIgnoreString) + 1];
  994. wcscpy(m_lppszMustContains[i], pValues->CaseIgnoreString);
  995. }
  996. catch ( ... )
  997. {
  998. if ( m_lppszMustContains )
  999. {
  1000. m_dwMustContainsCount = 0;
  1001. for ( DWORD dw = 0; dw < i; dw++ )
  1002. {
  1003. if ( m_lppszMustContains [ dw ] )
  1004. {
  1005. delete [] m_lppszMustContains [ dw ];
  1006. m_lppszMustContains [ dw ] = NULL;
  1007. }
  1008. }
  1009. delete [] m_lppszMustContains;
  1010. m_lppszMustContains = NULL;
  1011. }
  1012. throw;
  1013. }
  1014. pValues ++;
  1015. }
  1016. }
  1017. //***************************************************************************
  1018. //
  1019. // CADSIClass :: GetSystemMustContains
  1020. //
  1021. // Purpose : See Header
  1022. //***************************************************************************
  1023. LPCWSTR *CADSIClass :: GetSystemMustContains(DWORD *pdwCount)
  1024. {
  1025. *pdwCount = m_dwSystemMustContainsCount;
  1026. return (LPCWSTR *)m_lppszSystemMustContains;
  1027. }
  1028. //***************************************************************************
  1029. //
  1030. // CADSIClass :: SetSystemMustContains
  1031. //
  1032. // Purpose : See Header
  1033. //***************************************************************************
  1034. void CADSIClass :: SetSystemMustContains(PADSVALUE pValues, DWORD dwNumValues)
  1035. {
  1036. DWORD i = 0;
  1037. // Delete the list of possible superiors
  1038. if ( m_lppszSystemMustContains )
  1039. {
  1040. for ( i = 0; i<m_dwSystemMustContainsCount; i++ )
  1041. {
  1042. if ( m_lppszSystemMustContains [ i ] )
  1043. {
  1044. delete [] m_lppszSystemMustContains [ i ];
  1045. m_lppszSystemMustContains [ i ] = NULL;
  1046. }
  1047. }
  1048. delete [] m_lppszSystemMustContains;
  1049. m_lppszSystemMustContains = NULL;
  1050. m_dwSystemMustContainsCount = 0;
  1051. }
  1052. // Set the new list of values
  1053. m_dwSystemMustContainsCount = dwNumValues;
  1054. m_lppszSystemMustContains = new LPWSTR[m_dwSystemMustContainsCount];
  1055. for(i=0; i<m_dwSystemMustContainsCount; i++)
  1056. {
  1057. try
  1058. {
  1059. m_lppszSystemMustContains[i] = new WCHAR[wcslen(pValues->CaseIgnoreString) + 1];
  1060. wcscpy(m_lppszSystemMustContains[i], pValues->CaseIgnoreString);
  1061. }
  1062. catch ( ... )
  1063. {
  1064. if ( m_lppszSystemMustContains )
  1065. {
  1066. m_dwSystemMustContainsCount = 0;
  1067. for ( DWORD dw = 0; dw < i; dw++ )
  1068. {
  1069. if ( m_lppszSystemMustContains [ dw ] )
  1070. {
  1071. delete [] m_lppszSystemMustContains [ dw ];
  1072. m_lppszSystemMustContains [ dw ] = NULL;
  1073. }
  1074. }
  1075. delete [] m_lppszSystemMustContains;
  1076. m_lppszSystemMustContains = NULL;
  1077. }
  1078. throw;
  1079. }
  1080. pValues ++;
  1081. }
  1082. }