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.

788 lines
25 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. /*********************************************************************/
  23. /** Entry point for local GetClassObject activation requests **/
  24. /*********************************************************************/
  25. HRESULT SCMActivatorGetClassObject(
  26. IN handle_t hRpc,
  27. IN ORPCTHIS * ORPCthis,
  28. IN LOCALTHIS * LOCALthis,
  29. OUT ORPCTHAT * ORPCthat,
  30. IN MInterfacePointer * pInActProperties,
  31. OUT MInterfacePointer ** ppOutActProperties
  32. )
  33. {
  34. ACTIVATION_PARAMS ActParams;
  35. if (ORPCthis == NULL || LOCALthis == NULL || ORPCthat == NULL)
  36. return E_INVALIDARG;
  37. memset(&ActParams, 0, sizeof(ActParams));
  38. ActParams.MsgType = GETCLASSOBJECT;
  39. ActParams.hRpc = hRpc;
  40. ActParams.ORPCthis = ORPCthis;
  41. ActParams.Localthis = LOCALthis;
  42. ActParams.ORPCthat = ORPCthat;
  43. ActParams.oldActivationCall = FALSE;
  44. return PerformScmStage(CLIENT_MACHINE_STAGE,
  45. &ActParams,
  46. pInActProperties,
  47. ppOutActProperties);
  48. }
  49. /*********************************************************************/
  50. /** Entry point for local CreateInstance activation requests **/
  51. /*********************************************************************/
  52. HRESULT SCMActivatorCreateInstance(
  53. IN handle_t hRpc,
  54. IN ORPCTHIS * ORPCthis,
  55. IN LOCALTHIS * LOCALthis,
  56. OUT ORPCTHAT * ORPCthat,
  57. IN MInterfacePointer * pUnkOuter,
  58. IN MInterfacePointer * pInActProperties,
  59. OUT MInterfacePointer ** ppOutActProperties
  60. )
  61. {
  62. ACTIVATION_PARAMS ActParams;
  63. if (ORPCthis == NULL || LOCALthis == NULL || ORPCthat == NULL)
  64. return E_INVALIDARG;
  65. memset(&ActParams, 0, sizeof(ActParams));
  66. ActParams.MsgType = CREATEINSTANCE;
  67. ActParams.hRpc = hRpc;
  68. ActParams.ORPCthis = ORPCthis;
  69. ActParams.Localthis = LOCALthis;
  70. ActParams.ORPCthat = ORPCthat;
  71. ActParams.oldActivationCall = FALSE;
  72. return PerformScmStage(CLIENT_MACHINE_STAGE,
  73. &ActParams,
  74. pInActProperties,
  75. ppOutActProperties);
  76. }
  77. /*********************************************************************/
  78. /** Dummy IUnknown functions **/
  79. /*********************************************************************/
  80. HRESULT DummyQueryInterfaceISCMActivator(
  81. IN handle_t rpc,
  82. IN ORPCTHIS * ORPCthis,
  83. IN LOCALTHIS * localthis,
  84. OUT ORPCTHAT * ORPCthat,
  85. IN DWORD dummy
  86. )
  87. {
  88. CairoleDebugOut((DEB_ERROR, "SystemActivator Dummy function should never be called!\n"));
  89. ORPCthat->flags = 0;
  90. ORPCthat->extensions = NULL;
  91. return E_FAIL;
  92. }
  93. /*********************************************************************/
  94. /** Dummy IUnknown functions **/
  95. /*********************************************************************/
  96. HRESULT DummyAddRefISCMActivator(
  97. IN handle_t rpc,
  98. IN ORPCTHIS * ORPCthis,
  99. IN LOCALTHIS * LOCALthis,
  100. OUT ORPCTHAT * ORPCthat,
  101. IN DWORD dummy
  102. )
  103. {
  104. CairoleDebugOut((DEB_ERROR, "SystemActivator Dummy function should never be called!\n"));
  105. ORPCthat->flags = 0;
  106. ORPCthat->extensions = NULL;
  107. return E_FAIL;
  108. }
  109. /*********************************************************************/
  110. /** Dummy IUnknown functions **/
  111. /*********************************************************************/
  112. HRESULT DummyReleaseISCMActivator(
  113. IN handle_t rpc,
  114. IN ORPCTHIS * ORPCthis,
  115. IN LOCALTHIS * localthis,
  116. OUT ORPCTHAT * ORPCthat,
  117. IN DWORD dummy
  118. )
  119. {
  120. CairoleDebugOut((DEB_ERROR, "SystemActivator Dummy function should never be called!\n"));
  121. ORPCthat->flags = 0;
  122. ORPCthat->extensions = NULL;
  123. return E_FAIL;
  124. }
  125. /*
  126. ActivateFromPropertiesPreamble
  127. Does various stuff, loads custom activators, delegates.
  128. */
  129. HRESULT ActivateFromPropertiesPreamble(
  130. ActivationPropertiesIn *pActPropsIn,
  131. IActivationPropertiesOut **ppActOut,
  132. PACTIVATION_PARAMS pActParams
  133. )
  134. {
  135. HRESULT rethr;
  136. ILegacyInfo* pLegacyInfo = NULL;
  137. InstantiationInfo* pInstantiationInfo = NULL;
  138. IServerLocationInfo* pISLInfo = NULL;
  139. ISpecialSystemProperties* pISSP = NULL;
  140. IActivationSecurityInfo* pIActSecInfo = NULL;
  141. BOOL IsGetPersist = FALSE;
  142. DWORD destCtx;
  143. IInstanceInfo* pInstanceInfo = NULL;
  144. int nRetries = 0;
  145. IComClassInfo* pComClassInfo = NULL;
  146. *ppActOut = NULL;
  147. // Fill up ActParams for Generic Activation Path
  148. pActParams->pAuthInfo = NULL;
  149. pActParams->pProcess = 0;
  150. pActParams->pToken = 0;
  151. rethr = pActPropsIn->QueryInterface(IID_IScmRequestInfo, (LPVOID*)&pActParams->pInScmResolverInfo);
  152. if (FAILED(rethr)) goto exit_Activation;
  153. rethr = pActPropsIn->QueryInterface(IID_ILegacyInfo, (LPVOID*)&pLegacyInfo);
  154. if (FAILED(rethr)) goto exit_Activation;
  155. rethr = pActPropsIn->QueryInterface(IID_IActivationSecurityInfo, (LPVOID*)&pIActSecInfo);
  156. if (FAILED(rethr)) goto exit_Activation;
  157. pInstantiationInfo = pActPropsIn->GetInstantiationInfo();
  158. if (pInstantiationInfo == NULL)
  159. {
  160. rethr = E_OUTOFMEMORY;
  161. goto exit_Activation;
  162. }
  163. pActParams->pInstantiationInfo = pInstantiationInfo;
  164. if (pActParams->RemoteActivation)
  165. {
  166. pActParams->pProcess = NULL; // no CProcess for remote clients
  167. pActParams->pEnvBlock = NULL;
  168. pActParams->pwszWinstaDesktop = NULL;
  169. pActParams->Apartment = FALSE;
  170. pActParams->pAuthInfo = 0;
  171. pActParams->pwszServer = NULL;
  172. }
  173. else
  174. {
  175. PRIV_SCM_INFO *pPrivScmInfo;
  176. rethr = pActParams->pInScmResolverInfo->GetScmInfo(&pPrivScmInfo);
  177. if (FAILED(rethr)) goto exit_Activation;
  178. // Check local security
  179. pActParams->pProcess = CheckLocalSecurity(pActParams->hRpc,
  180. (PHPROCESS)pPrivScmInfo->ProcessSignature,
  181. TRUE); // *not* passed as a context handle
  182. if (!pActParams->pProcess)
  183. {
  184. rethr = E_ACCESSDENIED;
  185. goto exit_Activation;
  186. }
  187. pActParams->pEnvBlock = pPrivScmInfo->pEnvBlock;
  188. pActParams->EnvBlockLength = pPrivScmInfo->EnvBlockLength;
  189. pActParams->pwszWinstaDesktop = pPrivScmInfo->pwszWinstaDesktop;
  190. pActParams->Apartment = pPrivScmInfo->Apartment;
  191. COSERVERINFO *pServerInfo;
  192. // Retrieve the COSERVERINFO (originally from the client) and
  193. // save a copy. Then we free the COAUTHINFO part of the actprops
  194. // so that we don't accidently send it anywhere else.
  195. rethr = pLegacyInfo->GetCOSERVERINFO(&pServerInfo);
  196. ASSERT(SUCCEEDED(rethr));
  197. if (FAILED(rethr)) goto exit_Activation;
  198. if (pServerInfo)
  199. {
  200. rethr = CopyAuthInfo(pServerInfo->pAuthInfo, &pActParams->pAuthInfo);
  201. SecurityInfo::freeCOAUTHINFO(pServerInfo->pAuthInfo);
  202. pServerInfo->pAuthInfo = NULL;
  203. if (FAILED(rethr))
  204. goto exit_Activation;
  205. }
  206. }
  207. // Make sure caller has not set a COAUTHIDENTITY
  208. COAUTHIDENTITY* pAuthIdentBogus;
  209. rethr = pIActSecInfo->GetAuthIdentity(&pAuthIdentBogus);
  210. if (FAILED(rethr)) goto exit_Activation;
  211. if (pAuthIdentBogus != NULL)
  212. {
  213. // since we have never set this field on any MSFT platform (and
  214. // never will), this means we have a caller who is playing games
  215. rethr = E_ACCESSDENIED;
  216. ASSERT(!"pAuthIdentBogus was non-NULL");
  217. goto exit_Activation;
  218. }
  219. // Make sure process request info is set to defaults before calling any custom activators
  220. if (pActPropsIn->QueryInterface(IID_IServerLocationInfo, (void**)&pISLInfo) == S_OK)
  221. {
  222. HRESULT hr;
  223. hr = pISLInfo->SetProcess(0, PRT_IGNORE);
  224. ASSERT(hr == S_OK);
  225. pISLInfo->Release();
  226. }
  227. // Remember if client was impersonating or not
  228. if (pActPropsIn->QueryInterface(IID_ISpecialSystemProperties, (void**)&pISSP) == S_OK)
  229. {
  230. HRESULT hr;
  231. hr = pISSP->GetClientImpersonating(&pActParams->bClientImpersonating);
  232. ASSERT(hr == S_OK);
  233. pISSP->Release();
  234. }
  235. // QI will only work if persistent activation is happening
  236. if (pActPropsIn->QueryInterface(IID_IInstanceInfo,
  237. (LPVOID*)&pInstanceInfo) == S_OK)
  238. {
  239. pActParams->pInstanceInfo = pInstanceInfo;
  240. // The only case where msgtype will already be GETPERSISTENTINSTANCE
  241. // is during an incoming nt4 client remote activation(see remactif)
  242. if (pActParams->MsgType == CREATEINSTANCE)
  243. {
  244. pActParams->MsgType = GETPERSISTENTINSTANCE;
  245. WCHAR *pwszObjectName;
  246. pInstanceInfo->GetFile(&pwszObjectName, &pActParams->Mode);
  247. if (pActParams->RemoteActivation)
  248. {
  249. WCHAR *pwszObjectName2;
  250. rethr = GetServerPath( pwszObjectName, &pwszObjectName2 );
  251. if (pwszObjectName != pwszObjectName2)
  252. {
  253. pInstanceInfo->SetFile(pwszObjectName2, pActParams->Mode);
  254. pInstanceInfo->GetFile(&pActParams->pwszPath, &pActParams->Mode);
  255. MIDL_user_free(pwszObjectName2);
  256. }
  257. }
  258. else
  259. {
  260. pActParams->pwszPath = pwszObjectName;
  261. }
  262. if ( FAILED(rethr) )
  263. goto exit_Activation;
  264. pInstanceInfo->GetStorageIFD(&pActParams->pIFDStorage);
  265. IsGetPersist = TRUE;
  266. }
  267. ASSERT(pActParams->MsgType == GETPERSISTENTINSTANCE);
  268. }
  269. else
  270. {
  271. ASSERT(pActParams->MsgType != GETPERSISTENTINSTANCE);
  272. if (pActParams->MsgType == GETCLASSOBJECT)
  273. pActParams->Mode = MODE_GET_CLASS_OBJECT;
  274. #ifdef DFSACTIVATION
  275. pActParams->FileWasOpened = FALSE;
  276. #endif
  277. }
  278. rethr = pInstantiationInfo->GetClsid(&pActParams->Clsid);
  279. ASSERT(SUCCEEDED(rethr));
  280. if (pActParams->RemoteActivation)
  281. pActParams->ClsContext = CLSCTX_LOCAL_SERVER;
  282. else
  283. {
  284. rethr = pInstantiationInfo->GetClsctx(&pActParams->ClsContext);
  285. ASSERT(SUCCEEDED(rethr));
  286. }
  287. rethr = pInstantiationInfo->GetRequestedIIDs(
  288. &pActParams->Interfaces,
  289. &pActParams->pIIDs);
  290. ASSERT(SUCCEEDED(rethr));
  291. /* only one requested interface allowed for GetClassObject */
  292. if ((pActParams->MsgType == GETCLASSOBJECT) && (pActParams->Interfaces != 1))
  293. {
  294. rethr = E_INVALIDARG;
  295. goto exit_Activation;
  296. }
  297. pActParams->ORPCthis->flags = ORPCF_LOCAL;
  298. pActParams->Localthis->dwFlags = LOCALF_NONE;
  299. pActParams->ORPCthat->flags = 0;
  300. pActParams->ORPCthat->extensions = NULL;
  301. //
  302. // Get a CToken for all callers. Only allow unsecure for
  303. // remote clients.
  304. //
  305. RPC_STATUS status;
  306. status = LookupOrCreateTokenForRPCClient(pActParams->hRpc,
  307. pActParams->RemoteActivation,
  308. &pActParams->pToken,
  309. &pActParams->UnsecureActivation);
  310. if (status != RPC_S_OK)
  311. {
  312. rethr = HRESULT_FROM_WIN32(status);
  313. goto exit_Activation;
  314. }
  315. // UNDONE: figure out if this is still necessary for correct
  316. // rot lookups.
  317. if (pActParams->UnsecureActivation)
  318. {
  319. pActParams->pwszWinstaDesktop = L"";
  320. }
  321. ASSERT(pActParams->pToken);
  322. // Look up the (per-user) classinfo here before
  323. // the partition activators run.
  324. if (!pActParams->UnsecureActivation)
  325. {
  326. pActPropsIn->SetClientToken(pActParams->pToken->GetToken());
  327. if (!(pActParams->ClsContext & CLSCTX_INPROC_SERVER))
  328. {
  329. rethr = gpCatalogSCM->GetClassInfo ( pActParams->ClsContext,
  330. pActParams->pToken,
  331. pActParams->Clsid,
  332. IID_IComClassInfo,
  333. (void**) &pComClassInfo );
  334. }
  335. }
  336. else
  337. rethr = gpCatalog->GetClassInfo ( pActParams->Clsid,
  338. IID_IComClassInfo,
  339. (void**) &pComClassInfo );
  340. // catalog will return S_FALSE if the class is not
  341. // registered.
  342. if ( pComClassInfo == NULL || rethr != S_OK )
  343. rethr = REGDB_E_CLASSNOTREG;
  344. // Careful here: the lookup above may have failed registration info
  345. // for a local server activation, but we need to keep going since the
  346. // activation may still end up being sent to a remote machine.
  347. if (FAILED(rethr) && rethr != REGDB_E_CLASSNOTREG)
  348. goto exit_Activation;
  349. if (pComClassInfo)
  350. {
  351. HRESULT temphr = pActPropsIn->SetClassInfo(pComClassInfo);
  352. pComClassInfo->Release();
  353. pComClassInfo=NULL;
  354. if (FAILED(temphr))
  355. {
  356. rethr = temphr;
  357. goto exit_Activation;
  358. }
  359. }
  360. // Set Activation Params "Local Blob"
  361. pActPropsIn->SetLocalBlob((void*)pActParams);
  362. pActParams->pActPropsIn = pActPropsIn;
  363. RETRY_ACTIVATION:
  364. //
  365. // Set the stage. For now, all scm-level activators must be
  366. // SERVER_MACHINE_STAGE activators, since more work needs to be
  367. // done to properly define the semantic/other differences
  368. // between "client" and "server" scm activators.
  369. //
  370. rethr = pActPropsIn->SetStageAndIndex(SERVER_MACHINE_STAGE, 0);
  371. if (FAILED (rethr)) goto exit_Activation;
  372. // Delegate onwards....
  373. if (pActParams->MsgType == GETCLASSOBJECT)
  374. rethr = pActPropsIn->DelegateGetClassObject(ppActOut);
  375. else
  376. rethr = pActPropsIn->DelegateCreateInstance(NULL, ppActOut);
  377. // Sajia - support for partitions
  378. // If the delegated activation returns ERROR_RETRY,
  379. // we walk the chain again, but AT MOST ONCE.
  380. if (HRESULT_FROM_WIN32(ERROR_RETRY) == rethr) {
  381. ASSERT(!nRetries);
  382. if (!nRetries)
  383. {
  384. nRetries++;
  385. goto RETRY_ACTIVATION;
  386. }
  387. }
  388. exit_Activation:
  389. if (IsGetPersist)
  390. {
  391. if ( pActParams->pIFDROT )
  392. MIDL_user_free( pActParams->pIFDROT );
  393. }
  394. if (pActParams->pInScmResolverInfo)
  395. pActParams->pInScmResolverInfo->Release();
  396. if (pLegacyInfo)
  397. pLegacyInfo->Release();
  398. if (pIActSecInfo)
  399. pIActSecInfo->Release();
  400. if (pActParams->pInstanceInfo)
  401. pActParams->pInstanceInfo->Release();
  402. if (pActParams->pAuthInfo)
  403. SecurityInfo::freeCOAUTHINFO(pActParams->pAuthInfo);
  404. if (pActParams->pToken)
  405. pActParams->pToken->Release();
  406. if (pActParams->pProcess)
  407. ReleaseProcess(pActParams->pProcess);
  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. ASSERT(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. ASSERT(pActParams != NULL);
  446. // This could have already been set in the lb rerouting case
  447. pActParams->activatedRemote = FALSE;
  448. if (pActParams->RemoteActivation)
  449. {
  450. ASSERT(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. ASSERT(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. ASSERT(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. // COM+ 31260, don't free pActParams->pIIDs since it is owned by ActPropsIn
  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. }