Leaked source code of windows server 2003
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.

624 lines
18 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:classpro.cpp $
  11. //
  12. // $Modtime: 6/11/98 11:21a $
  13. // $Revision: 1 $
  14. // $Nokeywords: $
  15. //
  16. //
  17. // Description: Contains implementation of the DS Class Provider class. THis is the
  18. // base class for all DS class providers
  19. //
  20. //***************************************************************************
  21. #include "precomp.h"
  22. // Initialize the static members
  23. BSTR CDSClassProvider :: CLASS_STR = NULL;
  24. CWbemCache *CDSClassProvider :: s_pWbemCache = NULL;
  25. //***************************************************************************
  26. //
  27. // CDSClassProvider::CDSClassProvider
  28. // CDSClassProvider::~CDSClassProvider
  29. //
  30. // Constructor Parameters:
  31. // lpLogFileName : The name of the file used for logging. The log file
  32. // name will be used in creating the log file path. The log file path
  33. // will be <SystemDirectory>\logFileName. Hence the logFileName may be relative
  34. // path. For exaple if this argument is specified as wbem\logs\dsprov.txt, then
  35. // the actual log file would be c:\winnt\system32\wbem\logs\dsprov.txt on a system
  36. // where the system directory is c:\winnt\system32
  37. //
  38. //
  39. //***************************************************************************
  40. CDSClassProvider :: CDSClassProvider ()
  41. {
  42. InterlockedIncrement(&g_lComponents);
  43. m_lReferenceCount = 0 ;
  44. m_IWbemServices = NULL;
  45. m_bInitializedSuccessfully = FALSE;
  46. }
  47. CDSClassProvider::~CDSClassProvider ()
  48. {
  49. g_pLogObject->WriteW( L"CDSClassProvider :: DESTRUCTOR\r\n");
  50. if(m_IWbemServices)
  51. {
  52. m_IWbemServices->Release();
  53. m_IWbemServices = NULL;
  54. }
  55. InterlockedDecrement(&g_lComponents);
  56. }
  57. //***************************************************************************
  58. //
  59. // CDSClassProvider::QueryInterface
  60. // CDSClassProvider::AddRef
  61. // CDSClassProvider::Release
  62. //
  63. // Purpose: Standard COM routines needed for all COM objects
  64. //
  65. //***************************************************************************
  66. STDMETHODIMP CDSClassProvider :: QueryInterface (
  67. REFIID iid ,
  68. LPVOID FAR *iplpv
  69. )
  70. {
  71. *iplpv = NULL ;
  72. if ( iid == IID_IUnknown )
  73. {
  74. *iplpv = ( LPVOID ) (IUnknown *)(IWbemProviderInit *)this ;
  75. }
  76. else if ( iid == IID_IWbemServices )
  77. {
  78. *iplpv = ( LPVOID ) (IWbemServices *)this ;
  79. }
  80. else if ( iid == IID_IWbemProviderInit )
  81. {
  82. *iplpv = ( LPVOID ) (IWbemProviderInit *)this ;
  83. }
  84. else
  85. {
  86. return E_NOINTERFACE;
  87. }
  88. ( ( LPUNKNOWN ) *iplpv )->AddRef () ;
  89. return S_OK;
  90. }
  91. STDMETHODIMP_( ULONG ) CDSClassProvider :: AddRef ()
  92. {
  93. return InterlockedIncrement ( & m_lReferenceCount ) ;
  94. }
  95. STDMETHODIMP_(ULONG) CDSClassProvider :: Release ()
  96. {
  97. LONG ref ;
  98. if ( ( ref = InterlockedDecrement ( & m_lReferenceCount ) ) == 0 )
  99. {
  100. delete this ;
  101. return 0 ;
  102. }
  103. else
  104. {
  105. return ref ;
  106. }
  107. }
  108. HRESULT CDSClassProvider :: Initialize(
  109. LPWSTR wszUser,
  110. LONG lFlags,
  111. LPWSTR wszNamespace,
  112. LPWSTR wszLocale,
  113. IWbemServices __RPC_FAR *pNamespace,
  114. IWbemContext __RPC_FAR *pCtx,
  115. IWbemProviderInitSink __RPC_FAR *pInitSink)
  116. {
  117. // Validate the arguments
  118. if( pNamespace == NULL || lFlags != 0 )
  119. {
  120. g_pLogObject->WriteW( L"CDSClassProvider :: Argument validation FAILED\r\n");
  121. pInitSink->SetStatus(WBEM_E_FAILED, 0);
  122. return WBEM_S_NO_ERROR;
  123. }
  124. // Store the IWbemServices pointer for future use
  125. m_IWbemServices = pNamespace;
  126. m_IWbemServices->AddRef();
  127. m_bInitializedSuccessfully = TRUE;
  128. pInitSink->SetStatus(WBEM_S_INITIALIZED, 0);
  129. return WBEM_S_NO_ERROR;
  130. }
  131. HRESULT CDSClassProvider :: OpenNamespace(
  132. /* [in] */ const BSTR strNamespace,
  133. /* [in] */ long lFlags,
  134. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  135. /* [unique][in][out] */ IWbemServices __RPC_FAR *__RPC_FAR *ppWorkingNamespace,
  136. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppResult)
  137. {
  138. return WBEM_E_NOT_SUPPORTED;
  139. }
  140. HRESULT CDSClassProvider :: CancelAsyncCall(
  141. /* [in] */ IWbemObjectSink __RPC_FAR *pSink)
  142. {
  143. return WBEM_E_NOT_SUPPORTED;
  144. }
  145. HRESULT CDSClassProvider :: QueryObjectSink(
  146. /* [in] */ long lFlags,
  147. /* [out] */ IWbemObjectSink __RPC_FAR *__RPC_FAR *ppResponseHandler)
  148. {
  149. return WBEM_E_NOT_SUPPORTED;
  150. }
  151. HRESULT CDSClassProvider :: GetObject(
  152. /* [in] */ const BSTR strObjectPath,
  153. /* [in] */ long lFlags,
  154. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  155. /* [unique][in][out] */ IWbemClassObject __RPC_FAR *__RPC_FAR *ppObject,
  156. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  157. {
  158. return WBEM_E_NOT_SUPPORTED;
  159. }
  160. HRESULT CDSClassProvider :: GetObjectAsync(
  161. /* [in] */ const BSTR strObjectPath,
  162. /* [in] */ long lFlags,
  163. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  164. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  165. {
  166. if(!m_bInitializedSuccessfully)
  167. {
  168. g_pLogObject->WriteW( L"CDSClassProvider :: Initialization status is FAILED, hence returning failure\r\n");
  169. return WBEM_E_FAILED;
  170. }
  171. // For exception handling
  172. //========================
  173. SetStructuredExceptionHandler seh;
  174. try
  175. {
  176. if(!m_bInitializedSuccessfully)
  177. {
  178. g_pLogObject->WriteW( L"CDSClassProvider :: Initialization status is FAILED, hence returning failure\r\n");
  179. return WBEM_E_FAILED;
  180. }
  181. g_pLogObject->WriteW( L"CDSClassProvider :: GetObjectAsync() called for %s \r\n", strObjectPath);
  182. // Impersonate the client
  183. //=======================
  184. HRESULT result;
  185. if(!SUCCEEDED(result = WbemCoImpersonateClient()))
  186. {
  187. g_pLogObject->WriteW( L"CDSClassProvider :: GetObjectAsync() CoImpersonate FAILED for %s with %x\r\n", strObjectPath, result);
  188. return WBEM_E_FAILED;
  189. }
  190. // Validate the arguments
  191. //========================
  192. if(strObjectPath == NULL )
  193. {
  194. g_pLogObject->WriteW( L"CDSClassProvider :: GetObjectAsync() argument validation FAILED\r\n");
  195. return WBEM_E_INVALID_PARAMETER;
  196. }
  197. // Parse the object path
  198. //========================
  199. CObjectPathParser theParser;
  200. ParsedObjectPath *theParsedObjectPath = NULL;
  201. switch(theParser.Parse(strObjectPath, &theParsedObjectPath))
  202. {
  203. case CObjectPathParser::NoError:
  204. break;
  205. default:
  206. g_pLogObject->WriteW( L"CDSClassProvider :: GetObjectAsync() object path parsing FAILED\r\n");
  207. return WBEM_E_INVALID_PARAMETER;
  208. }
  209. try
  210. {
  211. // Check to see if it one of those classes that we know that dont provide
  212. //=======================================================================
  213. if(IsUnProvidedClass(theParsedObjectPath->m_pClass))
  214. {
  215. pResponseHandler->SetStatus(WBEM_STATUS_COMPLETE , WBEM_E_NOT_FOUND, NULL, NULL);
  216. }
  217. else
  218. {
  219. IWbemClassObject *pReturnObject = NULL;
  220. if(SUCCEEDED(result = GetClassFromCacheOrADSI(theParsedObjectPath->m_pClass, &pReturnObject, pCtx)))
  221. {
  222. result = pResponseHandler->Indicate(1, &pReturnObject);
  223. pReturnObject->Release();
  224. pResponseHandler->SetStatus(WBEM_STATUS_COMPLETE , WBEM_S_NO_ERROR, NULL, NULL);
  225. }
  226. else
  227. {
  228. g_pLogObject->WriteW( L"CDSClassProvider :: GetObjectAsync() GetClassFromCacheOrADSI FAILED for %s with %x\r\n", strObjectPath, result);
  229. pResponseHandler->SetStatus(WBEM_STATUS_COMPLETE , WBEM_E_NOT_FOUND, NULL, NULL);
  230. }
  231. }
  232. }
  233. catch ( ... )
  234. {
  235. theParser.Free(theParsedObjectPath);
  236. throw;
  237. }
  238. // Delete the parser allocated structures
  239. //=======================================
  240. theParser.Free(theParsedObjectPath);
  241. }
  242. catch(Heap_Exception e_HE)
  243. {
  244. pResponseHandler->SetStatus(WBEM_STATUS_COMPLETE , WBEM_E_OUT_OF_MEMORY, NULL, NULL);
  245. }
  246. return WBEM_S_NO_ERROR;
  247. }
  248. HRESULT CDSClassProvider :: PutClass(
  249. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  250. /* [in] */ long lFlags,
  251. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  252. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  253. {
  254. return WBEM_E_NOT_SUPPORTED;
  255. }
  256. HRESULT CDSClassProvider :: PutClassAsync(
  257. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  258. /* [in] */ long lFlags,
  259. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  260. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  261. {
  262. return WBEM_E_NOT_SUPPORTED;
  263. }
  264. HRESULT CDSClassProvider :: DeleteClass(
  265. /* [in] */ const BSTR strClass,
  266. /* [in] */ long lFlags,
  267. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  268. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  269. {
  270. return WBEM_E_NOT_SUPPORTED;
  271. }
  272. HRESULT CDSClassProvider :: DeleteClassAsync(
  273. /* [in] */ const BSTR strClass,
  274. /* [in] */ long lFlags,
  275. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  276. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  277. {
  278. return WBEM_E_NOT_SUPPORTED;
  279. }
  280. HRESULT CDSClassProvider :: CreateClassEnum(
  281. /* [in] */ const BSTR strSuperclass,
  282. /* [in] */ long lFlags,
  283. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  284. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  285. {
  286. return WBEM_E_NOT_SUPPORTED;
  287. }
  288. HRESULT CDSClassProvider :: CreateClassEnumAsync(
  289. /* [in] */ const BSTR strSuperclass,
  290. /* [in] */ long lFlags,
  291. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  292. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  293. {
  294. return WBEM_E_NOT_SUPPORTED;
  295. }
  296. HRESULT CDSClassProvider :: PutInstance(
  297. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  298. /* [in] */ long lFlags,
  299. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  300. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  301. {
  302. return WBEM_E_NOT_SUPPORTED;
  303. }
  304. HRESULT CDSClassProvider :: PutInstanceAsync(
  305. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  306. /* [in] */ long lFlags,
  307. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  308. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  309. {
  310. return WBEM_E_NOT_SUPPORTED;
  311. }
  312. HRESULT CDSClassProvider :: DeleteInstance(
  313. /* [in] */ const BSTR strObjectPath,
  314. /* [in] */ long lFlags,
  315. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  316. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  317. {
  318. return WBEM_E_NOT_SUPPORTED;
  319. }
  320. HRESULT CDSClassProvider :: DeleteInstanceAsync(
  321. /* [in] */ const BSTR strObjectPath,
  322. /* [in] */ long lFlags,
  323. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  324. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  325. {
  326. return WBEM_E_NOT_SUPPORTED;
  327. }
  328. HRESULT CDSClassProvider :: CreateInstanceEnum(
  329. /* [in] */ const BSTR strClass,
  330. /* [in] */ long lFlags,
  331. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  332. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  333. {
  334. return WBEM_E_NOT_SUPPORTED;
  335. }
  336. HRESULT CDSClassProvider :: CreateInstanceEnumAsync(
  337. /* [in] */ const BSTR strClass,
  338. /* [in] */ long lFlags,
  339. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  340. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  341. {
  342. return WBEM_E_NOT_SUPPORTED;
  343. }
  344. HRESULT CDSClassProvider :: ExecQuery(
  345. /* [in] */ const BSTR strQueryLanguage,
  346. /* [in] */ const BSTR strQuery,
  347. /* [in] */ long lFlags,
  348. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  349. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  350. {
  351. return WBEM_E_NOT_SUPPORTED;
  352. }
  353. HRESULT CDSClassProvider :: ExecQueryAsync(
  354. /* [in] */ const BSTR strQueryLanguage,
  355. /* [in] */ const BSTR strQuery,
  356. /* [in] */ long lFlags,
  357. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  358. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  359. {
  360. return WBEM_E_NOT_SUPPORTED;
  361. }
  362. HRESULT CDSClassProvider :: ExecNotificationQuery(
  363. /* [in] */ const BSTR strQueryLanguage,
  364. /* [in] */ const BSTR strQuery,
  365. /* [in] */ long lFlags,
  366. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  367. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  368. {
  369. return WBEM_E_NOT_SUPPORTED;
  370. }
  371. HRESULT CDSClassProvider :: ExecNotificationQueryAsync(
  372. /* [in] */ const BSTR strQueryLanguage,
  373. /* [in] */ const BSTR strQuery,
  374. /* [in] */ long lFlags,
  375. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  376. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  377. {
  378. return WBEM_E_NOT_SUPPORTED;
  379. }
  380. HRESULT CDSClassProvider :: ExecMethod(
  381. /* [in] */ const BSTR strObjectPath,
  382. /* [in] */ const BSTR strMethodName,
  383. /* [in] */ long lFlags,
  384. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  385. /* [in] */ IWbemClassObject __RPC_FAR *pInParams,
  386. /* [unique][in][out] */ IWbemClassObject __RPC_FAR *__RPC_FAR *ppOutParams,
  387. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  388. {
  389. return WBEM_E_NOT_SUPPORTED;
  390. }
  391. HRESULT CDSClassProvider :: ExecMethodAsync(
  392. /* [in] */ const BSTR strObjectPath,
  393. /* [in] */ const BSTR strMethodName,
  394. /* [in] */ long lFlags,
  395. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  396. /* [in] */ IWbemClassObject __RPC_FAR *pInParams,
  397. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  398. {
  399. return WBEM_E_NOT_SUPPORTED;
  400. }
  401. HRESULT CDSClassProvider :: GetClassFromCacheOrADSI(LPCWSTR pszWBEMClassName,
  402. IWbemClassObject **ppWbemClassObject,
  403. IWbemContext *pCtx)
  404. {
  405. HRESULT result = E_FAIL;
  406. // The algorithm is as follows:
  407. // Check whether the classname is present in the list of classes to which this user is granted access
  408. // If so
  409. // See if is present in the WBEM Cache.
  410. // If so return it.
  411. // If not, get it from ADSI.
  412. // If successful Map it to WBEM class and add the WBEM class to the WBEM cache and return
  413. // If not, if the return value is ACCESS_DENIED, remove it from the user's list
  414. // If not
  415. // Get it from ADSI.
  416. // if successful
  417. // if it is not present in the cache map it to WBEM and add the WBEM class to the cache
  418. // else discard it and return the WBEM class in the cache to the user
  419. // else
  420. // return error
  421. if(m_AccessAllowedClasses.IsNamePresent(pszWBEMClassName))
  422. {
  423. g_pLogObject->WriteW( L"CDSClassProvider :: GetClassFromCacheOrADSI() Found class in Authenticated list for %s\r\n", pszWBEMClassName);
  424. // Check the WBEM Cache to see if it there
  425. //=========================================
  426. CWbemClass *pWbemClass = NULL;
  427. try
  428. {
  429. if(SUCCEEDED(result = s_pWbemCache->GetClass(pszWBEMClassName, &pWbemClass)))
  430. {
  431. g_pLogObject->WriteW( L"CDSClassProvider :: GetClassFromCacheOrADSI() Found class in cache for %s\r\n", pszWBEMClassName);
  432. // Get the IWbemClassObject of the cache object
  433. IWbemClassObject *pCacheObject = pWbemClass->GetWbemClass();
  434. pWbemClass->Release();
  435. pWbemClass = NULL;
  436. // Clone it
  437. if(!SUCCEEDED(result = pCacheObject->Clone(ppWbemClassObject)))
  438. g_pLogObject->WriteW( L"CDSClassProvider :: GetClassFromCacheOrADSI() Clone() FAILED : %x for %s\r\n", result, pszWBEMClassName);
  439. pCacheObject->Release();
  440. }
  441. else // Could not be found in cache. Go to ADSI
  442. //=========================================
  443. {
  444. g_pLogObject->WriteW( L"CDSClassProvider :: GetClassFromCacheOrADSI() Could not find class in cache for %s. Going to ADSI\r\n", pszWBEMClassName);
  445. IWbemClassObject *pNewObject = NULL;
  446. if(SUCCEEDED(result = GetClassFromADSI(pszWBEMClassName, pCtx, &pNewObject)))
  447. {
  448. try
  449. {
  450. // Add it to the cache
  451. pWbemClass = NULL;
  452. if(pWbemClass = new CWbemClass(pszWBEMClassName, pNewObject))
  453. {
  454. s_pWbemCache->AddClass(pWbemClass);
  455. pWbemClass->Release();
  456. pWbemClass = NULL;
  457. g_pLogObject->WriteW( L"CDSClassProvider :: GetClassFromCacheOrADSI() Added %s to cache\r\n", pszWBEMClassName);
  458. // Clone it
  459. if(!SUCCEEDED(result = pNewObject->Clone(ppWbemClassObject)))
  460. g_pLogObject->WriteW( L"CDSClassProvider :: GetClassFromCacheOrADSI() Clone() FAILED : %x for %s\r\n", result, pszWBEMClassName);
  461. pNewObject->Release();
  462. pNewObject = NULL;
  463. }
  464. else
  465. result = E_OUTOFMEMORY;
  466. }
  467. catch ( ... )
  468. {
  469. if ( pNewObject )
  470. {
  471. pNewObject->Release ();
  472. pNewObject = NULL;
  473. }
  474. throw;
  475. }
  476. }
  477. else
  478. {
  479. m_AccessAllowedClasses.RemoveName(pszWBEMClassName);
  480. g_pLogObject->WriteW( L"CDSClassProvider :: GetClassFromCacheOrADSI() GetClassFromADSI() FAILED : %x. Removing %s from user list\r\n", result, pszWBEMClassName);
  481. }
  482. }
  483. }
  484. catch ( ... )
  485. {
  486. if ( pWbemClass )
  487. {
  488. pWbemClass->Release ();
  489. pWbemClass = NULL;
  490. }
  491. throw;
  492. }
  493. }
  494. else // Get it from ADSI
  495. //=========================================
  496. {
  497. g_pLogObject->WriteW( L"CDSClassProvider :: GetClassFromCacheOrADSI() Could not find class in Authenticated list for %s. Going to ADSI\r\n", pszWBEMClassName);
  498. CWbemClass *pWbemClass = NULL;
  499. IWbemClassObject *pNewObject = NULL;
  500. try
  501. {
  502. if(SUCCEEDED(result = GetClassFromADSI(pszWBEMClassName, pCtx, &pNewObject)))
  503. {
  504. // Add it to the cache
  505. pWbemClass = NULL;
  506. if(pWbemClass = new CWbemClass(pszWBEMClassName, pNewObject))
  507. {
  508. s_pWbemCache->AddClass(pWbemClass);
  509. pWbemClass->Release();
  510. pWbemClass = NULL;
  511. g_pLogObject->WriteW( L"CDSClassProvider :: GetClassFromCacheOrADSI() GetClassFromADSI succeeded for %s Added it to cache\r\n", pszWBEMClassName);
  512. // Clone it
  513. if(!SUCCEEDED(result = pNewObject->Clone(ppWbemClassObject)))
  514. g_pLogObject->WriteW( L"CDSClassProvider :: GetClassFromCacheOrADSI() Clone() FAILED : %x for %s\r\n", result, pszWBEMClassName);
  515. pNewObject->Release();
  516. pNewObject = NULL;
  517. // Add it to the list of classnames for this user
  518. m_AccessAllowedClasses.AddName(pszWBEMClassName);
  519. g_pLogObject->WriteW( L"CDSClassProvider :: GetClassFromCacheOrADSI() Also added to Authenticated list : %s \r\n", pszWBEMClassName);
  520. }
  521. else
  522. result = E_OUTOFMEMORY;
  523. }
  524. else
  525. g_pLogObject->WriteW( L"CDSClassProvider :: GetClassFromCacheOrADSI() GetClassFromADSI FAILED : %x for %s\r\n", result, pszWBEMClassName);
  526. }
  527. catch ( ... )
  528. {
  529. if ( pNewObject )
  530. {
  531. pNewObject->Release ();
  532. pNewObject = NULL;
  533. }
  534. if ( pWbemClass )
  535. {
  536. pWbemClass->Release ();
  537. pWbemClass = NULL;
  538. }
  539. throw;
  540. }
  541. }
  542. return result;
  543. }