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.

790 lines
24 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995.
  5. //
  6. // File:
  7. // dscmif.cxx
  8. //
  9. // Contents:
  10. // Entry points for remote activation SCM interface.
  11. //
  12. // Functions:
  13. // SCMActivatorGetClassObject
  14. // SCMActivatorCreateInstance
  15. //
  16. // History: SatishT 2/10/98 Rewrote for use with ISCMActivator
  17. // History: Vinaykr 3/1/98 Modified To Add Activation Properties,
  18. // SCM Stage handling and Remote handling
  19. //
  20. //--------------------------------------------------------------------------
  21. #include "act.hxx"
  22. // forward defn
  23. HRESULT GetClassInfoFromClsid(REFCLSID rclsid, IComClassInfo **ppClassInfo);
  24. /*********************************************************************/
  25. /** Entry point for local GetClassObject activation requests **/
  26. /*********************************************************************/
  27. HRESULT SCMActivatorGetClassObject(
  28. IN handle_t hRpc,
  29. IN ORPCTHIS * ORPCthis,
  30. IN LOCALTHIS * LOCALthis,
  31. OUT ORPCTHAT * ORPCthat,
  32. IN MInterfacePointer * pInActProperties,
  33. OUT MInterfacePointer ** ppOutActProperties
  34. )
  35. {
  36. ACTIVATION_PARAMS ActParams;
  37. if (ORPCthis == NULL || LOCALthis == NULL || ORPCthat == NULL)
  38. return E_INVALIDARG;
  39. memset(&ActParams, 0, sizeof(ActParams));
  40. ActParams.MsgType = GETCLASSOBJECT;
  41. ActParams.hRpc = hRpc;
  42. ActParams.ORPCthis = ORPCthis;
  43. ActParams.Localthis = LOCALthis;
  44. ActParams.ORPCthat = ORPCthat;
  45. ActParams.oldActivationCall = FALSE;
  46. return PerformScmStage(CLIENT_MACHINE_STAGE,
  47. &ActParams,
  48. pInActProperties,
  49. ppOutActProperties);
  50. }
  51. /*********************************************************************/
  52. /** Entry point for local CreateInstance activation requests **/
  53. /*********************************************************************/
  54. HRESULT SCMActivatorCreateInstance(
  55. IN handle_t hRpc,
  56. IN ORPCTHIS * ORPCthis,
  57. IN LOCALTHIS * LOCALthis,
  58. OUT ORPCTHAT * ORPCthat,
  59. IN MInterfacePointer * pUnkOuter,
  60. IN MInterfacePointer * pInActProperties,
  61. OUT MInterfacePointer ** ppOutActProperties
  62. )
  63. {
  64. ACTIVATION_PARAMS ActParams;
  65. if (ORPCthis == NULL || LOCALthis == NULL || ORPCthat == NULL)
  66. return E_INVALIDARG;
  67. memset(&ActParams, 0, sizeof(ActParams));
  68. ActParams.MsgType = CREATEINSTANCE;
  69. ActParams.hRpc = hRpc;
  70. ActParams.ORPCthis = ORPCthis;
  71. ActParams.Localthis = LOCALthis;
  72. ActParams.ORPCthat = ORPCthat;
  73. ActParams.oldActivationCall = FALSE;
  74. return PerformScmStage(CLIENT_MACHINE_STAGE,
  75. &ActParams,
  76. pInActProperties,
  77. ppOutActProperties);
  78. }
  79. /*********************************************************************/
  80. /** Dummy IUnknown functions **/
  81. /*********************************************************************/
  82. HRESULT DummyQueryInterfaceISCMActivator(
  83. IN handle_t rpc,
  84. IN ORPCTHIS * ORPCthis,
  85. IN LOCALTHIS * localthis,
  86. OUT ORPCTHAT * ORPCthat,
  87. IN DWORD dummy
  88. )
  89. {
  90. CairoleDebugOut((DEB_ERROR, "SystemActivator Dummy function should never be called!\n"));
  91. ORPCthat->flags = 0;
  92. ORPCthat->extensions = NULL;
  93. return E_FAIL;
  94. }
  95. /*********************************************************************/
  96. /** Dummy IUnknown functions **/
  97. /*********************************************************************/
  98. HRESULT DummyAddRefISCMActivator(
  99. IN handle_t rpc,
  100. IN ORPCTHIS * ORPCthis,
  101. IN LOCALTHIS * LOCALthis,
  102. OUT ORPCTHAT * ORPCthat,
  103. IN DWORD dummy
  104. )
  105. {
  106. CairoleDebugOut((DEB_ERROR, "SystemActivator Dummy function should never be called!\n"));
  107. ORPCthat->flags = 0;
  108. ORPCthat->extensions = NULL;
  109. return E_FAIL;
  110. }
  111. /*********************************************************************/
  112. /** Dummy IUnknown functions **/
  113. /*********************************************************************/
  114. HRESULT DummyReleaseISCMActivator(
  115. IN handle_t rpc,
  116. IN ORPCTHIS * ORPCthis,
  117. IN LOCALTHIS * localthis,
  118. OUT ORPCTHAT * ORPCthat,
  119. IN DWORD dummy
  120. )
  121. {
  122. CairoleDebugOut((DEB_ERROR, "SystemActivator Dummy function should never be called!\n"));
  123. ORPCthat->flags = 0;
  124. ORPCthat->extensions = NULL;
  125. return E_FAIL;
  126. }
  127. /*
  128. ActivateFromPropertiesPreamble
  129. Does various stuff, loads custom activators, delegates.
  130. */
  131. HRESULT ActivateFromPropertiesPreamble(
  132. ActivationPropertiesIn *pActPropsIn,
  133. IActivationPropertiesOut **ppActOut,
  134. PACTIVATION_PARAMS pActParams
  135. )
  136. {
  137. HRESULT rethr;
  138. ILegacyInfo * pLegacyInfo = NULL;
  139. InstantiationInfo * pInstantiationInfo = NULL;
  140. IServerLocationInfo* pISLInfo = NULL;
  141. ISpecialSystemProperties* pISSP = NULL;
  142. BOOL IsGetPersist = FALSE;
  143. DWORD destCtx;
  144. IInstanceInfo *pInstanceInfo = NULL;
  145. BOOL bTookRefOnCProcess = FALSE;
  146. int nRetries = 0;
  147. IComClassInfo* pComClassInfo = NULL;
  148. *ppActOut = NULL;
  149. // Fill up ActParams for Generic Activation Path
  150. pActParams->pAuthInfo = NULL;
  151. rethr = pActPropsIn->QueryInterface(IID_IScmRequestInfo, (LPVOID*)&pActParams->pInScmResolverInfo);
  152. if (FAILED(rethr))
  153. goto exit_Activation;
  154. rethr = pActPropsIn->QueryInterface(IID_ILegacyInfo, (LPVOID*)&pLegacyInfo);
  155. if (FAILED(rethr))
  156. goto exit_Activation;
  157. pInstantiationInfo = pActPropsIn->GetInstantiationInfo();
  158. ASSERT(pInstantiationInfo != NULL);
  159. pActParams->pInstantiationInfo = pInstantiationInfo;
  160. if (pActParams->RemoteActivation)
  161. {
  162. pActParams->ProcessSignature = 0;
  163. pActParams->pEnvBlock = NULL;
  164. pActParams->pwszWinstaDesktop = NULL;
  165. pActParams->Apartment = FALSE;
  166. pActParams->pAuthInfo = 0;
  167. pActParams->pwszServer = NULL;
  168. }
  169. else
  170. {
  171. PRIV_SCM_INFO *pPrivScmInfo;
  172. rethr = pActParams->pInScmResolverInfo->GetScmInfo(&pPrivScmInfo);
  173. ASSERT(SUCCEEDED(rethr));
  174. if (FAILED(rethr))
  175. goto exit_Activation;
  176. CheckLocalCall( pActParams->hRpc );
  177. pActParams->RemoteActivation = FALSE;
  178. pActParams->ProcessSignature = (PVOID)pPrivScmInfo->ProcessSignature;
  179. pActParams->pEnvBlock = pPrivScmInfo->pEnvBlock;
  180. pActParams->EnvBlockLength = pPrivScmInfo->EnvBlockLength;
  181. pActParams->pwszWinstaDesktop = pPrivScmInfo->pwszWinstaDesktop;
  182. pActParams->Apartment = pPrivScmInfo->Apartment;
  183. COSERVERINFO *pServerInfo;
  184. rethr = pLegacyInfo->GetCOSERVERINFO(&pServerInfo);
  185. ASSERT(SUCCEEDED(rethr));
  186. if (FAILED(rethr))
  187. goto exit_Activation;
  188. if (pServerInfo)
  189. {
  190. rethr = CopyAuthInfo(pServerInfo->pAuthInfo, &pActParams->pAuthInfo);
  191. SecurityInfo::freeCOAUTHINFO(pServerInfo->pAuthInfo);
  192. pServerInfo->pAuthInfo = NULL;
  193. if (FAILED(rethr))
  194. goto exit_Activation;
  195. }
  196. }
  197. pActParams->pProcess = 0;
  198. pActParams->pToken = 0;
  199. // Make sure process request info is set to defaults before calling any custom activators
  200. if (pActPropsIn->QueryInterface(IID_IServerLocationInfo, (void**)&pISLInfo) == S_OK)
  201. {
  202. HRESULT hr;
  203. hr = pISLInfo->SetProcess(0, PRT_IGNORE);
  204. Win4Assert(hr == S_OK);
  205. pISLInfo->Release();
  206. }
  207. // Remember if client was impersonating or not
  208. if (pActPropsIn->QueryInterface(IID_ISpecialSystemProperties, (void**)&pISSP) == S_OK)
  209. {
  210. HRESULT hr;
  211. hr = pISSP->GetClientImpersonating(&pActParams->bClientImpersonating);
  212. Win4Assert(hr == S_OK);
  213. pISSP->Release();
  214. }
  215. // QI will only work if persistent activation is happening
  216. if (pActPropsIn->QueryInterface(IID_IInstanceInfo,
  217. (LPVOID*)&pInstanceInfo) == S_OK)
  218. {
  219. pActParams->pInstanceInfo = pInstanceInfo;
  220. // The only case where msgtype will already be GETPERSISTENTINSTANCE
  221. // is during an incoming nt4 client remote activation(see remactif)
  222. if (pActParams->MsgType == CREATEINSTANCE)
  223. {
  224. pActParams->MsgType = GETPERSISTENTINSTANCE;
  225. WCHAR *pwszObjectName;
  226. pInstanceInfo->GetFile(&pwszObjectName, &pActParams->Mode);
  227. if (pActParams->RemoteActivation)
  228. {
  229. WCHAR *pwszObjectName2;
  230. rethr = GetServerPath( pwszObjectName, &pwszObjectName2 );
  231. if (pwszObjectName != pwszObjectName2)
  232. {
  233. pInstanceInfo->SetFile(pwszObjectName2, pActParams->Mode);
  234. pInstanceInfo->GetFile(&pActParams->pwszPath, &pActParams->Mode);
  235. MIDL_user_free(pwszObjectName2);
  236. }
  237. }
  238. else
  239. {
  240. pActParams->pwszPath = pwszObjectName;
  241. }
  242. if ( FAILED(rethr) )
  243. goto exit_Activation;
  244. pInstanceInfo->GetStorageIFD(&pActParams->pIFDStorage);
  245. IsGetPersist = TRUE;
  246. }
  247. Win4Assert(pActParams->MsgType == GETPERSISTENTINSTANCE);
  248. }
  249. else
  250. {
  251. Win4Assert(pActParams->MsgType != GETPERSISTENTINSTANCE);
  252. if (pActParams->MsgType == GETCLASSOBJECT)
  253. pActParams->Mode = MODE_GET_CLASS_OBJECT;
  254. #ifdef DFSACTIVATION
  255. pActParams->FileWasOpened = FALSE;
  256. #endif
  257. }
  258. rethr = pInstantiationInfo->GetClsid(&pActParams->Clsid);
  259. if (pActParams->RemoteActivation)
  260. pActParams->ClsContext = CLSCTX_LOCAL_SERVER;
  261. else
  262. rethr = pInstantiationInfo->GetClsctx(&pActParams->ClsContext);
  263. ASSERT(!FAILED(rethr));
  264. rethr = pInstantiationInfo->GetRequestedIIDs(
  265. &pActParams->Interfaces,
  266. &pActParams->pIIDs);
  267. /* only one requested interface allowed for GetClassObject */
  268. if ((pActParams->MsgType == GETCLASSOBJECT) &&
  269. (pActParams->Interfaces != 1))
  270. {
  271. rethr = E_INVALIDARG;
  272. goto exit_Activation;
  273. }
  274. pActParams->UnsecureActivation = FALSE;
  275. pActParams->ORPCthis->flags = ORPCF_LOCAL;
  276. pActParams->Localthis->dwFlags = LOCALF_NONE;
  277. pActParams->ORPCthat->flags = 0;
  278. pActParams->ORPCthat->extensions = NULL;
  279. //
  280. // Get a CProcess for local callers.
  281. //
  282. if ( ! pActParams->RemoteActivation )
  283. {
  284. //
  285. // A local activation passes the "magic" signature from CRpcResolver.
  286. // Because ORPC calls cannot have context handles, the signature
  287. // is just a pointer to the process object.
  288. //
  289. pActParams->pProcess = ReferenceProcess( pActParams->ProcessSignature,
  290. TRUE );
  291. if ( ! pActParams->pProcess )
  292. {
  293. rethr = E_ACCESSDENIED;
  294. goto exit_Activation;
  295. }
  296. bTookRefOnCProcess = TRUE;
  297. }
  298. //
  299. // Get a CToken for all callers.
  300. //
  301. RPC_STATUS Status;
  302. Status = LookupOrCreateToken( pActParams->hRpc,
  303. FALSE,
  304. &pActParams->pToken );
  305. //
  306. // ERROR_ACCESS_DENIED is returned if RpcImpersonateClient fails.
  307. // We will take this to mean that the remote activation is coming
  308. // in unsecure. In this case we have no Token object and must do
  309. // permission checks manually. We set the winsta/desktop to an
  310. // empty string to distinguish this case during some ROT lookups.
  311. //
  312. // Unsecure remote clients can only connect to services or RunAs
  313. // servers.
  314. //
  315. if ( Status == ERROR_ACCESS_DENIED )
  316. {
  317. pActParams->pToken = 0;
  318. pActParams->pwszWinstaDesktop = L"";
  319. pActParams->UnsecureActivation = TRUE;
  320. Status = RPC_S_OK;
  321. }
  322. if ( Status != RPC_S_OK )
  323. {
  324. rethr = HRESULT_FROM_WIN32(Status);
  325. goto exit_Activation;
  326. }
  327. // Look up the (per-user) classinfo here before
  328. // the partition activators run.
  329. if (pActParams->pToken)
  330. {
  331. pActPropsIn->SetClientToken(pActParams->pToken->GetToken());
  332. if (!(pActParams->ClsContext & CLSCTX_INPROC_SERVER))
  333. {
  334. rethr = gpCatalogSCM->GetClassInfo ( pActParams->ClsContext,
  335. pActParams->pToken,
  336. pActParams->Clsid,
  337. IID_IComClassInfo,
  338. (void**) &pComClassInfo );
  339. }
  340. }
  341. else
  342. rethr = gpCatalog->GetClassInfo ( pActParams->Clsid,
  343. IID_IComClassInfo,
  344. (void**) &pComClassInfo );
  345. // catalog will return S_FALSE if the class is not
  346. // registered.
  347. if ( pComClassInfo == NULL || rethr != S_OK )
  348. rethr = REGDB_E_CLASSNOTREG;
  349. // Careful here: the lookup above may have failed registration info
  350. // for a local server activation, but we need to keep going since the
  351. // activation may still end up being sent to a remote machine.
  352. if (FAILED(rethr) && rethr != REGDB_E_CLASSNOTREG)
  353. goto exit_Activation;
  354. if (pComClassInfo)
  355. {
  356. pActPropsIn->SetClassInfo(pComClassInfo);
  357. pComClassInfo->Release();pComClassInfo=NULL;
  358. }
  359. // Set Activation Params "Local Blob"
  360. pActPropsIn->SetLocalBlob((void*)pActParams);
  361. pActParams->pActPropsIn = pActPropsIn;
  362. RETRY_ACTIVATION:
  363. //
  364. // Set the stage. For now, all scm-level activators must be
  365. // SERVER_MACHINE_STAGE activators, since more work needs to be
  366. // done to properly define the semantic/other differences
  367. // between "client" and "server" scm activators.
  368. //
  369. rethr = pActPropsIn->SetStageAndIndex(SERVER_MACHINE_STAGE, 0);
  370. if (FAILED (rethr)) goto exit_Activation;
  371. // Delegate onwards....
  372. if (pActParams->MsgType == GETCLASSOBJECT)
  373. rethr = pActPropsIn->DelegateGetClassObject(ppActOut);
  374. else
  375. rethr = pActPropsIn->DelegateCreateInstance(NULL, ppActOut);
  376. // Sajia - support for partitions
  377. // If the delegated activation returns ERROR_RETRY,
  378. // we walk the chain again, but AT MOST ONCE.
  379. if (ERROR_RETRY == rethr) {
  380. Win4Assert(!nRetries);
  381. if (!nRetries)
  382. {
  383. nRetries++;
  384. goto RETRY_ACTIVATION;
  385. }
  386. }
  387. exit_Activation:
  388. if (IsGetPersist)
  389. {
  390. if ( pActParams->pIFDROT )
  391. MIDL_user_free( pActParams->pIFDROT );
  392. }
  393. if (pActParams->pInScmResolverInfo)
  394. pActParams->pInScmResolverInfo->Release();
  395. if (pLegacyInfo)
  396. pLegacyInfo->Release();
  397. if (pActParams->pInstanceInfo)
  398. pActParams->pInstanceInfo->Release();
  399. if (pActParams->pAuthInfo)
  400. FreeAuthInfo(pActParams->pAuthInfo);
  401. if (pActParams->pToken)
  402. pActParams->pToken->Release();
  403. if (bTookRefOnCProcess)
  404. {
  405. ASSERT(pActParams->pProcess);
  406. ReleaseProcess(pActParams->pProcess);
  407. }
  408. if (pComClassInfo)
  409. {
  410. pComClassInfo->Release();
  411. }
  412. return rethr;
  413. }
  414. #if DBG == 1
  415. LONG ActivationExceptionFilter( DWORD lCode,
  416. LPEXCEPTION_POINTERS lpep )
  417. {
  418. Win4Assert(NULL && "Unexpected exception thrown");
  419. return TRUE;
  420. }
  421. #endif
  422. /*********************************************************************/
  423. /** Real Work of SCM Activation begins here After Custom Activators **/
  424. /** have been called. This will be called during all activations **/
  425. /** occuring in the SCM, local and remote **/
  426. /*********************************************************************/
  427. HRESULT ActivateFromProperties(
  428. IActivationPropertiesIn *pActIn,
  429. IActivationPropertiesOut **ppActOut
  430. )
  431. {
  432. HRESULT rethr;
  433. REMOTE_REQUEST_SCM_INFO * pScmRequestInfo=NULL;
  434. IScmReplyInfo * pOutScmResolverInfo = NULL;
  435. DWORD destCtx;
  436. REMOTE_REPLY_SCM_INFO *pScmReplyInfo=NULL;
  437. PRIV_RESOLVER_INFO *pPrivActOutInfo=NULL;
  438. ActivationPropertiesIn *pActPropsIn=NULL;
  439. WCHAR * pwszDummy;
  440. *ppActOut = NULL;
  441. // Get Activation Params "Local Blob"
  442. rethr = pActIn->QueryInterface(CLSID_ActivationPropertiesIn, (void**)&pActPropsIn);
  443. PACTIVATION_PARAMS pActParams;
  444. pActPropsIn->GetLocalBlob((void**)&pActParams);
  445. Win4Assert(pActParams != NULL);
  446. // This could have already been set in the lb rerouting case
  447. pActParams->activatedRemote = FALSE;
  448. if (pActParams->RemoteActivation)
  449. {
  450. Win4Assert(pActParams->pInScmResolverInfo);
  451. rethr = pActParams->pInScmResolverInfo->GetRemoteRequestInfo(&pScmRequestInfo);
  452. if (pScmRequestInfo == NULL)
  453. {
  454. if (SUCCEEDED(rethr))
  455. rethr = E_FAIL;
  456. goto exit_Activation;
  457. }
  458. pScmReplyInfo = (REMOTE_REPLY_SCM_INFO*)
  459. MIDL_user_allocate(sizeof(REMOTE_REPLY_SCM_INFO));
  460. if (pScmReplyInfo == NULL)
  461. {
  462. rethr = E_OUTOFMEMORY;
  463. goto exit_Activation;
  464. }
  465. memset(pScmReplyInfo, 0, sizeof(REMOTE_REPLY_SCM_INFO));
  466. pActParams->pOxidServer = &pScmReplyInfo->Oxid;
  467. //
  468. // The following OR fields are not used while servicing a
  469. // remote activation.
  470. //
  471. pActParams->ppServerORBindings = (DUALSTRINGARRAY **)NULL;
  472. pActParams->pOxidInfo = NULL;
  473. pActParams->pLocalMidOfRemote = NULL;
  474. pActParams->pDllServerModel = NULL;
  475. pActParams->ppwszDllServer = &pwszDummy;
  476. }
  477. else
  478. {
  479. pPrivActOutInfo = (PRIV_RESOLVER_INFO*)
  480. MIDL_user_allocate(sizeof(PRIV_RESOLVER_INFO));
  481. if (pPrivActOutInfo == NULL)
  482. {
  483. rethr = E_OUTOFMEMORY;
  484. goto exit_Activation;
  485. }
  486. memset(pPrivActOutInfo, 0, sizeof(PRIV_RESOLVER_INFO));
  487. pActParams->pFoundInROT = &pPrivActOutInfo->FoundInROT;
  488. pActParams->pOxidServer = &pPrivActOutInfo->OxidServer;
  489. pActParams->ppServerORBindings = &pPrivActOutInfo->pServerORBindings;
  490. *pActParams->ppServerORBindings = 0;
  491. pActParams->pOxidInfo = &pPrivActOutInfo->OxidInfo;
  492. pActParams->pOxidInfo->psa = 0;
  493. pActParams->pLocalMidOfRemote = &pPrivActOutInfo->LocalMidOfRemote;
  494. pActParams->pDllServerModel = &pPrivActOutInfo->DllServerModel;
  495. pActParams->ppwszDllServer = &pPrivActOutInfo->pwszDllServer;
  496. }
  497. {
  498. IServerLocationInfo *pServerLocationInfo = NULL;
  499. pServerLocationInfo = pActPropsIn->GetServerLocationInfo();
  500. Win4Assert(pServerLocationInfo != NULL);
  501. pServerLocationInfo->GetRemoteServerName(&pActParams->pwszServer);
  502. }
  503. pActPropsIn->GetClassInfo(IID_IComClassInfo, (void**)&pActParams->pComClassInfo);
  504. pActParams->ProtseqId = 0;
  505. *pActParams->pOxidServer = 0;
  506. *pActParams->ppwszDllServer = 0;
  507. RpcTryExcept
  508. {
  509. // Generic SCM Activation Path
  510. rethr = Activation( pActParams );
  511. }
  512. #if DBG == 1
  513. RpcExcept(ActivationExceptionFilter(GetExceptionCode(),
  514. GetExceptionInformation()) )
  515. #else
  516. RpcExcept(TRUE)
  517. #endif
  518. {
  519. rethr = HRESULT_FROM_WIN32(RpcExceptionCode());
  520. }
  521. RpcEndExcept
  522. if (rethr != S_OK)
  523. goto exit_ActWithoutResolvingInfo;
  524. if (pActParams->activatedRemote)
  525. {
  526. // if did remote activation for an incoming one
  527. // just exit
  528. if (pActParams->RemoteActivation)
  529. {
  530. *ppActOut = pActParams->pActPropsOut;
  531. goto exit_ActWithoutResolvingInfo;
  532. }
  533. if(!pActParams->IsLocalOxid)
  534. {
  535. //Set Tid/Pid to 0 for remote server
  536. Win4Assert(pActParams->pOxidInfo);
  537. pActParams->pOxidInfo->dwTid = 0;
  538. pActParams->pOxidInfo->dwPid = 0;
  539. }
  540. }
  541. ActivationPropertiesOut *pActPropsOut;
  542. pActPropsOut = pActParams->pActPropsOut;
  543. if (pActPropsOut == NULL)
  544. {
  545. rethr = pActPropsIn->GetReturnActivationProperties(&pActPropsOut);
  546. if (FAILED(rethr))
  547. goto exit_ActWithoutResolvingInfo;
  548. rethr = pActPropsOut->SetMarshalledResults(pActParams->Interfaces,
  549. pActParams->pIIDs,
  550. pActParams->pResults,
  551. pActParams->ppIFD);
  552. MIDL_user_free(pActParams->pIIDs);
  553. MIDL_user_free(pActParams->pResults);
  554. MIDL_user_free(pActParams->ppIFD);
  555. if (FAILED(rethr))
  556. goto exit_ActWithoutResolvingInfo;
  557. pActParams->pActPropsOut = pActPropsOut;
  558. }
  559. rethr = pActPropsOut->QueryInterface(
  560. IID_IScmReplyInfo,
  561. (LPVOID*)&pOutScmResolverInfo
  562. );
  563. if (FAILED(rethr))
  564. goto exit_ActWithoutResolvingInfo;
  565. if (pActParams->RemoteActivation)
  566. {
  567. RPC_STATUS sc;
  568. if (*pActParams->pOxidServer != 0)
  569. {
  570. sc = _ResolveOxid2(pActParams->hRpc,
  571. pActParams->pOxidServer,
  572. pScmRequestInfo->cRequestedProtseqs,
  573. pScmRequestInfo->pRequestedProtseqs,
  574. &pScmReplyInfo->pdsaOxidBindings,
  575. &pScmReplyInfo->ipidRemUnknown,
  576. &pScmReplyInfo->authnHint,
  577. &pScmReplyInfo->serverVersion );
  578. rethr = HRESULT_FROM_WIN32(sc);
  579. }
  580. pOutScmResolverInfo->SetRemoteReplyInfo(pScmReplyInfo);
  581. }
  582. else
  583. pOutScmResolverInfo->SetResolverInfo(pPrivActOutInfo);
  584. pOutScmResolverInfo->Release();
  585. *ppActOut = pActPropsOut;
  586. exit_Activation:
  587. if (pActParams->pComClassInfo)
  588. {
  589. pActParams->pComClassInfo->Release();
  590. }
  591. return rethr;
  592. // Go here if ActivationPropertiesOut is not created
  593. exit_ActWithoutResolvingInfo:
  594. MIDL_user_free(pScmReplyInfo);
  595. MIDL_user_free(pPrivActOutInfo);
  596. goto exit_Activation;
  597. }
  598. //
  599. // GetClassInfoFromClsid
  600. //
  601. // On success, returns a IComClassInfo for the requested class
  602. //
  603. // FUTURE: this function is basically a duplicate of one linked into
  604. // ole32. We should find a way to centralize all of this catalog
  605. // stuff and do away with this funky "this function is just here to
  606. // satisfy the linker" crud.
  607. //
  608. HRESULT GetClassInfoFromClsid(REFCLSID rclsid, IComClassInfo **ppClassInfo)
  609. {
  610. HRESULT hr = InitializeCatalogIfNecessary();
  611. if ( FAILED(hr) )
  612. {
  613. return hr;
  614. }
  615. else
  616. {
  617. // get the information object for the requested class
  618. // this may translate the CLSID via TreatAs and other mappings
  619. hr = gpCatalog->GetClassInfo(rclsid, IID_IComClassInfo, (void**)ppClassInfo);
  620. }
  621. return hr;
  622. }
  623. //This should never be called. It is mainly to link with actprops which
  624. //uses it to load persistent objects and should only do so in a server.
  625. HRESULT LoadPersistentObject(IUnknown *punk, IInstanceInfo *pInstanceInfo)
  626. {
  627. return E_NOTIMPL;
  628. }
  629. //This should never be called. It is mainly to link with actprops which
  630. //uses it for marshalling of returns
  631. void *GetDestCtxPtr(COMVERSION *pComVersion)
  632. {
  633. return NULL;
  634. }
  635. //
  636. // These should never be called. It is mainly to link with actprops which
  637. // uses it creating contexts
  638. //
  639. HRESULT CObjectContextCF_CreateInstance(IUnknown *pUnkOuter,
  640. REFIID riid,
  641. void** ppv)
  642. {
  643. return E_NOTIMPL;
  644. }
  645. HRESULT CObjectContext::QueryInterface(REFIID riid, void **ppv)
  646. {
  647. return E_NOTIMPL;
  648. }
  649. ULONG CObjectContext::AddRef()
  650. {
  651. return E_NOTIMPL;
  652. }
  653. ULONG CObjectContext::Release()
  654. {
  655. return E_NOTIMPL;
  656. }
  657. HRESULT CObjectContext::InternalQueryInterface(REFIID riid, void **ppv)
  658. {
  659. return E_NOTIMPL;
  660. }
  661. ULONG CObjectContext::InternalAddRef()
  662. {
  663. return E_NOTIMPL;
  664. }
  665. ULONG CObjectContext::InternalRelease()
  666. {
  667. return E_NOTIMPL;
  668. }