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.

395 lines
11 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:adsiprop.cpp $
  11. //
  12. // $Modtime: 6/11/98 11:21a $
  13. // $Revision: 1 $
  14. // $Nokeywords: $
  15. //
  16. //
  17. // Description: Contains the implementation of the CADSIProperty which encapsulates an ADSI property
  18. //
  19. //***************************************************************************
  20. #include "precomp.h"
  21. //***************************************************************************
  22. //
  23. // CADSIProperty::CADSIProperty
  24. //
  25. // Purpose : Constructor
  26. //
  27. // Parameters:
  28. // None
  29. //***************************************************************************
  30. CADSIProperty :: CADSIProperty()
  31. : CRefCountedObject()
  32. {
  33. m_lpszWBEMPropertyName = NULL;
  34. m_lpszSyntaxOID = NULL;
  35. m_bMultiValued = FALSE;
  36. m_lpszAttributeID = NULL;
  37. m_lpszCommonName = NULL;
  38. m_bSystemOnly = FALSE;
  39. m_pDirectoryObject = NULL;
  40. m_bORName = FALSE;
  41. }
  42. //***************************************************************************
  43. //
  44. // CADSIProperty::CADSIProperty
  45. //
  46. // Purpose : Constructor
  47. //
  48. // Parameters:
  49. // lpszWBEMPropertyName : The WBEM name of the property being created. A copy of this is made
  50. // lpszADSIPropertyName : The ADSI name of the property being created. A copy of this is made
  51. //***************************************************************************
  52. CADSIProperty :: CADSIProperty(LPCWSTR lpszWBEMPropertyName, LPCWSTR lpszADSIPropertyName)
  53. : CRefCountedObject(lpszADSIPropertyName)
  54. {
  55. m_lpszWBEMPropertyName = new WCHAR[wcslen(lpszWBEMPropertyName) + 1];
  56. wcscpy(m_lpszWBEMPropertyName, lpszWBEMPropertyName);
  57. m_lpszSyntaxOID = NULL;
  58. m_bMultiValued = FALSE;
  59. m_lpszAttributeID = NULL;
  60. m_lpszCommonName = NULL;
  61. m_bSystemOnly = FALSE;
  62. m_pDirectoryObject = NULL;
  63. m_bORName = FALSE;
  64. }
  65. //***************************************************************************
  66. //
  67. // CADSIProperty :: ~CADSIProperty
  68. //
  69. // Purpose : Destructor
  70. //***************************************************************************
  71. CADSIProperty :: ~CADSIProperty()
  72. {
  73. delete [] m_lpszWBEMPropertyName;
  74. delete [] m_lpszSyntaxOID;
  75. delete [] m_lpszAttributeID;
  76. delete [] m_lpszCommonName;
  77. if(m_pDirectoryObject)
  78. m_pDirectoryObject->Release();
  79. }
  80. //***************************************************************************
  81. //
  82. // CADSIProperty :: GetWBEMPropertyName
  83. //
  84. // Purpose : Returns the WBEM property name of this property
  85. //***************************************************************************
  86. LPCWSTR CADSIProperty :: GetWBEMPropertyName()
  87. {
  88. return m_lpszWBEMPropertyName;
  89. }
  90. //***************************************************************************
  91. //
  92. // CADSIProperty :: SetWBEMPropertyName
  93. //
  94. // Purpose : Sets the WBEM name of this property
  95. //***************************************************************************
  96. void CADSIProperty :: SetWBEMPropertyName(LPCWSTR lpszWBEMName)
  97. {
  98. delete [] m_lpszWBEMPropertyName;
  99. if(lpszWBEMName)
  100. {
  101. m_lpszWBEMPropertyName = new WCHAR[wcslen(lpszWBEMName) + 1];
  102. wcscpy(m_lpszWBEMPropertyName, lpszWBEMName);
  103. }
  104. else
  105. m_lpszWBEMPropertyName = NULL;
  106. }
  107. //***************************************************************************
  108. //
  109. // CADSIProperty :: GetADSIPropertyName
  110. //
  111. // Purpose : Returns the ADSI property name of this property
  112. //***************************************************************************
  113. LPCWSTR CADSIProperty :: GetADSIPropertyName()
  114. {
  115. return GetName();
  116. }
  117. //***************************************************************************
  118. //
  119. // CADSIProperty :: SetADSIPropertyName
  120. //
  121. // Purpose : Sets the ADSI name of this property
  122. //***************************************************************************
  123. void CADSIProperty :: SetADSIPropertyName(LPCWSTR lpszADSIName)
  124. {
  125. SetName(lpszADSIName);
  126. }
  127. //***************************************************************************
  128. //
  129. // CADSIProperty :: GetSyntaxOID
  130. //
  131. // Purpose : Returns the ADSI Syntax OID of this property
  132. //***************************************************************************
  133. LPCWSTR CADSIProperty :: GetSyntaxOID()
  134. {
  135. return m_lpszSyntaxOID;
  136. }
  137. //***************************************************************************
  138. //
  139. // CADSIProperty :: SetSyntaxOID
  140. //
  141. // Purpose : Sets the ADSI Syntax OID of this property
  142. //***************************************************************************
  143. void CADSIProperty :: SetSyntaxOID(LPCWSTR lpszSyntaxOID)
  144. {
  145. delete [] m_lpszSyntaxOID;
  146. if(lpszSyntaxOID)
  147. {
  148. m_lpszSyntaxOID = new WCHAR[wcslen(lpszSyntaxOID) + 1];
  149. wcscpy(m_lpszSyntaxOID, lpszSyntaxOID);
  150. }
  151. else
  152. m_lpszSyntaxOID = NULL;
  153. }
  154. //***************************************************************************
  155. //
  156. // CADSIProperty :: IsORName
  157. //
  158. // Purpose : Returns whether the property is m_bORName
  159. //***************************************************************************
  160. BOOLEAN CADSIProperty :: IsORName()
  161. {
  162. return m_bORName;
  163. }
  164. //***************************************************************************
  165. //
  166. // CADSIProperty :: SetORName
  167. //
  168. // Purpose : Sets the m_bORName property of this property
  169. //***************************************************************************
  170. void CADSIProperty :: SetORName(BOOLEAN bORName)
  171. {
  172. m_bORName = bORName;
  173. }
  174. //***************************************************************************
  175. //
  176. // CADSIProperty :: IsMultiValued
  177. //
  178. // Purpose : Returns whether the property is multi valued
  179. //***************************************************************************
  180. BOOLEAN CADSIProperty :: IsMultiValued()
  181. {
  182. return m_bMultiValued;
  183. }
  184. //***************************************************************************
  185. //
  186. // CADSIProperty :: SetMultiValued
  187. //
  188. // Purpose : Sets the multi-valued property of this property
  189. //***************************************************************************
  190. void CADSIProperty :: SetMultiValued(BOOLEAN bMultiValued)
  191. {
  192. m_bMultiValued = bMultiValued;
  193. }
  194. //***************************************************************************
  195. //
  196. // CADSIProperty :: IsSystemOnly
  197. //
  198. // Purpose : Returns whether the property is SystemOnly
  199. //***************************************************************************
  200. BOOLEAN CADSIProperty :: IsSystemOnly()
  201. {
  202. return m_bSystemOnly;
  203. }
  204. //***************************************************************************
  205. //
  206. // CADSIProperty :: SetSystemOnly
  207. //
  208. // Purpose : Sets the SystemOnly property of this property
  209. //***************************************************************************
  210. void CADSIProperty :: SetSystemOnly(BOOLEAN bSystemOnly)
  211. {
  212. m_bSystemOnly = bSystemOnly;
  213. }
  214. //***************************************************************************
  215. //
  216. // CADSIProperty :: GetSearchFlags
  217. //
  218. // Purpose : Returns the SearchFlags property of the property
  219. //***************************************************************************
  220. DWORD CADSIProperty :: GetSearchFlags()
  221. {
  222. return m_dwSearchFlags;
  223. }
  224. //***************************************************************************
  225. //
  226. // CADSIProperty :: SetSearchFlags
  227. //
  228. // Purpose : Sets the SearchFlags property of this property
  229. //***************************************************************************
  230. void CADSIProperty :: SetSearchFlags(DWORD dwSearchFlags)
  231. {
  232. m_dwSearchFlags = dwSearchFlags;
  233. }
  234. //***************************************************************************
  235. //
  236. // CADSIProperty :: GetOMSyntax
  237. //
  238. // Purpose : Returns the OMSyntax property of the property
  239. //***************************************************************************
  240. DWORD CADSIProperty :: GetOMSyntax()
  241. {
  242. return m_dwOMSyntax;
  243. }
  244. //***************************************************************************
  245. //
  246. // CADSIProperty :: SetOMSyntax
  247. //
  248. // Purpose : Sets the OMSyntax property of this property
  249. //***************************************************************************
  250. void CADSIProperty :: SetOMSyntax(DWORD dwOMSyntax)
  251. {
  252. m_dwOMSyntax = dwOMSyntax;
  253. }
  254. //***************************************************************************
  255. //
  256. // CADSIProperty :: GetMAPI_ID
  257. //
  258. // Purpose : Returns the MAPI_ID property of the property
  259. //***************************************************************************
  260. DWORD CADSIProperty :: GetMAPI_ID()
  261. {
  262. return m_dwMAPI_ID;
  263. }
  264. //***************************************************************************
  265. //
  266. // CADSIProperty :: SetMAPI_ID
  267. //
  268. // Purpose : Sets the MAPI_ID property of this property
  269. //***************************************************************************
  270. void CADSIProperty :: SetMAPI_ID(DWORD dwMAPI_ID)
  271. {
  272. m_dwMAPI_ID = dwMAPI_ID;
  273. }
  274. //***************************************************************************
  275. //
  276. // CADSIProperty :: GetAttributeID
  277. //
  278. // Purpose : Returns the Attribute ID of this property
  279. //***************************************************************************
  280. LPCWSTR CADSIProperty :: GetAttributeID()
  281. {
  282. return m_lpszAttributeID;
  283. }
  284. //***************************************************************************
  285. //
  286. // CADSIProperty :: SetAttributeID
  287. //
  288. // Purpose : Sets the Attribute ID of this property
  289. //***************************************************************************
  290. void CADSIProperty :: SetAttributeID(LPCWSTR lpszAttributeID)
  291. {
  292. delete [] m_lpszAttributeID;
  293. if(lpszAttributeID)
  294. {
  295. m_lpszAttributeID = new WCHAR[wcslen(lpszAttributeID) + 1];
  296. wcscpy(m_lpszAttributeID, lpszAttributeID);
  297. }
  298. else
  299. m_lpszAttributeID = NULL;
  300. }
  301. //***************************************************************************
  302. //
  303. // CADSIProperty :: GetCommonName
  304. //
  305. // Purpose : Returns the Common Name of this property
  306. //***************************************************************************
  307. LPCWSTR CADSIProperty :: GetCommonName()
  308. {
  309. return m_lpszCommonName;
  310. }
  311. //***************************************************************************
  312. //
  313. // CADSIProperty :: SetCommonName
  314. //
  315. // Purpose : Sets the CommonName of this property
  316. //***************************************************************************
  317. void CADSIProperty :: SetCommonName(LPCWSTR lpszCommonName)
  318. {
  319. delete [] m_lpszCommonName;
  320. if(lpszCommonName)
  321. {
  322. m_lpszCommonName = new WCHAR[wcslen(lpszCommonName) + 1];
  323. wcscpy(m_lpszCommonName, lpszCommonName);
  324. }
  325. else
  326. m_lpszCommonName = NULL;
  327. }
  328. //***************************************************************************
  329. //
  330. // CADSIProperty :: GetDirectoryObject
  331. //
  332. // Purpose : Returns the ADSI object pertaining to this property
  333. // It is the user's duty to release it when done
  334. //
  335. // Parameters:
  336. // None
  337. //
  338. // Return Value:
  339. // The ADSI object interface pertaining to this property
  340. //***************************************************************************
  341. IDirectoryObject *CADSIProperty :: GetDirectoryObject()
  342. {
  343. if(m_pDirectoryObject)
  344. m_pDirectoryObject->AddRef();
  345. return m_pDirectoryObject;
  346. }
  347. //***************************************************************************
  348. //
  349. // CADSIProperty :: SetDirectoryObject
  350. //
  351. // Purpose : Sets the ADSI object pertaining to this property
  352. //
  353. // Parameter : The directory object pertaining to this property
  354. //***************************************************************************
  355. void CADSIProperty :: SetDirectoryObject(IDirectoryObject * pDirectoryObject)
  356. {
  357. if(m_pDirectoryObject)
  358. m_pDirectoryObject->Release();
  359. m_pDirectoryObject = pDirectoryObject;
  360. m_pDirectoryObject->AddRef();
  361. }