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.

3508 lines
103 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1996.
  5. //
  6. // File: call_as.c
  7. //
  8. // Contents: [call_as] wrapper functions for COMMON\types.
  9. //
  10. // Functions: IAdviseSink2_OnLinkSrcChange_Proxy
  11. // IAdviseSink2_OnLinkSrcChange_Stub
  12. // IAdviseSink_OnDataChange_Proxy
  13. // IAdviseSink_OnDataChange_Stub
  14. // IAdviseSink_OnViewChange_Proxy
  15. // IAdviseSink_OnViewChange_Stub
  16. // IAdviseSink_OnRename_Proxy
  17. // IAdviseSink_OnRename_Stub
  18. // IAdviseSink_OnSave_Proxy
  19. // IAdviseSink_OnSave_Stub
  20. // IAdviseSink_OnClose_Proxy
  21. // IAdviseSink_OnClose_Stub
  22. // IBindCtx_GetBindOptions_Proxy
  23. // IBindCtx_GetBindOptions_Stub
  24. // IBindCtx_SetBindOptions_Proxy
  25. // IBindCtx_SetBindOptions_Stub
  26. // IClassFactory_CreateInstance_Proxy
  27. // IClassFactory_CreateInstance_Stub
  28. // IDataObject_GetData_Proxy
  29. // IDataObject_GetData_Stub
  30. // IDataObject_GetDataHere_Proxy
  31. // IDataObject_GetDataHere_Stub
  32. // IDataObject_SetData_Proxy
  33. // IDataObject_SetData_Stub
  34. // IEnumConnectionPoints_Next_Proxy
  35. // IEnumConnectionPoints_Next_Stub
  36. // IEnumConnections_Next_Proxy
  37. // IEnumConnections_Next_Stub
  38. // IEnumFORMATETC_Next_Proxy
  39. // IEnumFORMATETC_Next_Stub
  40. // IEnumMoniker_Next_Proxy
  41. // IEnumMoniker_Next_Stub
  42. // IEnumSTATDATA_Next_Proxy
  43. // IEnumSTATDATA_Next_Stub
  44. // IEnumSTATSTG_Next_Proxy
  45. // IEnumSTATSTG_Next_Stub
  46. // IEnumString_Next_Proxy
  47. // IEnumString_Next_Stub
  48. // IEnumUnknown_Next_Proxy
  49. // IEnumUnknown_Next_Stub
  50. // IEnumOLEVERB_Next_Proxy
  51. // IEnumOLEVERB_Next_Stub
  52. // ILockBytes_ReadAt_Proxy
  53. // ILockBytes_ReadAt_Stub
  54. // ILockBytes_WriteAt_Proxy
  55. // ILockBytes_WriteAt_Stub
  56. // IMoniker_BindToObject_Proxy
  57. // IMoniker_BindToObject_Stub
  58. // IMoniker_BindToStorage_Proxy
  59. // IMoniker_BindToStorage_Stub
  60. // IClientSiteHandler_PrivQueryInterface_Proxy
  61. // IClientSiteHandler_PrivQueryInterface_Stub
  62. // IOleInPlaceActiveObject_TranslateAccelerator_Proxy
  63. // IOleInPlaceActiveObject_TranslateAccelerator_Stub
  64. // IOleInPlaceActiveObject_ResizeBorder_Proxy
  65. // IOleInPlaceActiveObject_ResizeBorder_Stub
  66. // IRunnableObject_IsRunning_Proxy
  67. // IRunnableObject_IsRunning_Stub
  68. // IStorage_OpenStream_Proxy
  69. // IStorage_OpenStream_Stub
  70. // IStorage_EnumElements_Proxy
  71. // IStorage_EnumElements_Stub
  72. // ISequentialStream_Read_Proxy
  73. // ISequentialStream_Read_Stub
  74. // IStream_Seek_Proxy
  75. // IStream_Seek_Stub
  76. // ISequentialStream_Write_Proxy
  77. // ISequentialStream_Write_Stub
  78. // IStream_CopyTo_Proxy
  79. // IStream_CopyTo_Stub
  80. // IOverlappedStream_ReadOverlapped_Proxy
  81. // IOverlappedStream_ReadOverlapped_Stub
  82. // IOverlappedStream_WriteOverlapped_Proxy
  83. // IOverlappedStream_WriteOverlapped_Stub
  84. // IEnumSTATPROPSTG_Next_Proxy
  85. // IEnumSTATPROPSTG_Next_Stub
  86. // IEnumSTATPROPSETSTG_Next_Proxy
  87. // IEnumSTATPROPSETSTG_Next_Stub
  88. //
  89. //
  90. // History: May-01-94 ShannonC Created
  91. // Jul-10-94 ShannonC Fix memory leak (bug #20124)
  92. // Aug-09-94 AlexT Add ResizeBorder proxy, stub
  93. // Apr-25-95 RyszardK Rewrote STGMEDIUM support
  94. // Nov-03-95 JohannP Added IClientSite proxy, stub
  95. //
  96. //--------------------------------------------------------------------------
  97. #include <rpcproxy.h>
  98. #include <debnot.h>
  99. #include "mega.h"
  100. #include "transmit.h"
  101. #include "stdidx.h"
  102. #pragma code_seg(".orpc")
  103. #define ASSERT(expr) Win4Assert(expr)
  104. HRESULT CreateCallback(
  105. BOOL (STDMETHODCALLTYPE *pfnContinue)(ULONG_PTR dwContinue),
  106. ULONG_PTR dwContinue,
  107. IContinue **ppContinue);
  108. BOOL CoIsSurrogateProcess();
  109. HRESULT CoRegisterSurrogatedObject(IUnknown *pObject);
  110. // The following is needed to avoid the async path when calling IAdviseSink
  111. // notifications cross-context. The async approach causes problems in the
  112. // cross-context case since the wrapper calls the real object and if it
  113. // implements IID_ICallFactory, creates a proxy for it. The proxy is basically
  114. // useless since ICallFactory is a [local] interface. So the notification
  115. // does not make it through to the other side.
  116. DEFINE_OLEGUID(IID_IStdIdentity, 0x0000001bL, 0, 0);
  117. BOOL IsStdIdentity(IAdviseSink* This)
  118. {
  119. void *pStdId;
  120. if (SUCCEEDED( This->lpVtbl->QueryInterface(This, &IID_IStdIdentity, &pStdId) ))
  121. {
  122. ((IUnknown *)pStdId)->lpVtbl->Release(pStdId);
  123. return TRUE;
  124. }
  125. return FALSE; //not an StdIdentity
  126. }
  127. //+-------------------------------------------------------------------------
  128. //
  129. // Function: IAdviseSink2_OnLinkSrcChange_Proxy
  130. //
  131. // Synopsis: Client-side [call_as] wrapper function for
  132. // IAdviseSink2::OnLinkSrcChange.
  133. //
  134. // Returns: void
  135. //
  136. //--------------------------------------------------------------------------
  137. void STDMETHODCALLTYPE IAdviseSink2_OnLinkSrcChange_Proxy(
  138. IAdviseSink2 __RPC_FAR * This,
  139. IMoniker __RPC_FAR *pmk)
  140. {
  141. __try
  142. {
  143. if (!IsStdIdentity((void *)This))
  144. {
  145. IAdviseSink2_RemoteOnLinkSrcChange_Proxy(This, pmk);
  146. }
  147. else
  148. {
  149. ICallFactory *pCF;
  150. if (SUCCEEDED(This->lpVtbl->QueryInterface(This, &IID_ICallFactory, (void **) &pCF)))
  151. {
  152. AsyncIAdviseSink2 *pAAS;
  153. if (SUCCEEDED(pCF->lpVtbl->CreateCall(pCF, &IID_AsyncIAdviseSink2, NULL,
  154. &IID_AsyncIAdviseSink2, (LPUNKNOWN *) &pAAS)))
  155. {
  156. pAAS->lpVtbl->Begin_OnLinkSrcChange(pAAS, pmk);
  157. pAAS->lpVtbl->Release(pAAS);
  158. }
  159. pCF->lpVtbl->Release(pCF);
  160. }
  161. }
  162. }
  163. __except(EXCEPTION_EXECUTE_HANDLER)
  164. {
  165. //Just ignore the exception.
  166. }
  167. }
  168. //+-------------------------------------------------------------------------
  169. //
  170. // Function: IAdviseSink2_OnLinkSrcChange_Stub
  171. //
  172. // Synopsis: Server-side [call_as] wrapper function for
  173. // IAdviseSink2::OnLinkSrcChange.
  174. //
  175. // Returns: S_OK
  176. //
  177. //--------------------------------------------------------------------------
  178. HRESULT STDMETHODCALLTYPE IAdviseSink2_OnLinkSrcChange_Stub(
  179. IAdviseSink2 __RPC_FAR * This,
  180. IMoniker __RPC_FAR *pmk)
  181. {
  182. This->lpVtbl->OnLinkSrcChange(This, pmk);
  183. return S_OK;
  184. }
  185. //+-------------------------------------------------------------------------
  186. //
  187. // Function: AsyncIAdviseSink2_Begin_OnLinkSrcChange_Proxy
  188. //
  189. // Synopsis: Client-side [call_as] wrapper function for
  190. // AsyncIAdviseSink2::Begin_OnLinkSrcChange.
  191. //
  192. // Returns: S_OK
  193. //
  194. //--------------------------------------------------------------------------
  195. void STDMETHODCALLTYPE AsyncIAdviseSink2_Begin_OnLinkSrcChange_Proxy(
  196. AsyncIAdviseSink2 __RPC_FAR * This,
  197. IMoniker __RPC_FAR *pmk)
  198. {
  199. AsyncIAdviseSink2_Begin_RemoteOnLinkSrcChange_Proxy(This, pmk);
  200. }
  201. //+-------------------------------------------------------------------------
  202. //
  203. // Function: AsyncIAdviseSink2_Finish_OnLinkSrcChange_Proxy
  204. //
  205. // Synopsis: Client-side [call_as] wrapper function for
  206. // AsyncIAdviseSink2::Finish_OnLinkSrcChange.
  207. //
  208. // Returns: S_OK
  209. //
  210. //--------------------------------------------------------------------------
  211. void STDMETHODCALLTYPE AsyncIAdviseSink2_Finish_OnLinkSrcChange_Proxy(
  212. AsyncIAdviseSink2 __RPC_FAR * This)
  213. {
  214. AsyncIAdviseSink2_Finish_RemoteOnLinkSrcChange_Proxy(This);
  215. }
  216. //+-------------------------------------------------------------------------
  217. //
  218. // Function: AsyncIAdviseSink2_Begin_OnLinkSrcChange_Stub
  219. //
  220. // Synopsis: Server-side [call_as] wrapper function for
  221. // AsyncIAdviseSink2::Begin_OnLinkSrcChange.
  222. //
  223. // Returns: S_OK
  224. //
  225. //--------------------------------------------------------------------------
  226. HRESULT STDMETHODCALLTYPE AsyncIAdviseSink2_Begin_OnLinkSrcChange_Stub(
  227. AsyncIAdviseSink2 __RPC_FAR * This,
  228. IMoniker __RPC_FAR *pmk)
  229. {
  230. This->lpVtbl->Begin_OnLinkSrcChange(This, pmk);
  231. return S_OK;
  232. }
  233. //+-------------------------------------------------------------------------
  234. //
  235. // Function: AsyncIAdviseSink2_Finish_OnLinkSrcChange_Stub
  236. //
  237. // Synopsis: Server-side [call_as] wrapper function for
  238. // AsyncIAdviseSink2::Finish_OnLinkSrcChange.
  239. //
  240. // Returns: S_OK
  241. //
  242. //--------------------------------------------------------------------------
  243. HRESULT STDMETHODCALLTYPE AsyncIAdviseSink2_Finish_OnLinkSrcChange_Stub(
  244. AsyncIAdviseSink2 __RPC_FAR * This)
  245. {
  246. This->lpVtbl->Finish_OnLinkSrcChange(This);
  247. return S_OK;
  248. }
  249. ////////////////////////////////////////////////////////////////////////////////////////
  250. //+-------------------------------------------------------------------------
  251. //
  252. // Function: IAdviseSink_OnDataChange_Proxy
  253. //
  254. // Synopsis: Client-side [call_as] wrapper function for
  255. // IAdviseSink::OnDataChange.
  256. //
  257. // Returns: void
  258. //
  259. //--------------------------------------------------------------------------
  260. void STDMETHODCALLTYPE IAdviseSink_OnDataChange_Proxy(
  261. IAdviseSink __RPC_FAR * This,
  262. FORMATETC __RPC_FAR *pFormatetc,
  263. STGMEDIUM __RPC_FAR *pStgmed)
  264. {
  265. __try
  266. {
  267. if (!IsStdIdentity((void *)This))
  268. {
  269. IAdviseSink_RemoteOnDataChange_Proxy(This, pFormatetc, pStgmed);
  270. }
  271. else
  272. {
  273. ICallFactory *pCF;
  274. if (SUCCEEDED(This->lpVtbl->QueryInterface(This, &IID_ICallFactory, (void **) &pCF)))
  275. {
  276. AsyncIAdviseSink *pAAS;
  277. if (SUCCEEDED(pCF->lpVtbl->CreateCall(pCF, &IID_AsyncIAdviseSink, NULL,
  278. &IID_AsyncIAdviseSink, (LPUNKNOWN*) &pAAS)))
  279. {
  280. pAAS->lpVtbl->Begin_OnDataChange(pAAS, pFormatetc, pStgmed);
  281. pAAS->lpVtbl->Release(pAAS);
  282. }
  283. pCF->lpVtbl->Release(pCF);
  284. }
  285. }
  286. }
  287. __except(EXCEPTION_EXECUTE_HANDLER)
  288. {
  289. //Just ignore the exception.
  290. }
  291. }
  292. //+-------------------------------------------------------------------------
  293. //
  294. // Function: IAdviseSink_OnDataChange_Stub
  295. //
  296. // Synopsis: Server-side [call_as] wrapper function for
  297. // IAdviseSink::OnDataChange.
  298. //
  299. // Returns: S_OK
  300. //
  301. //--------------------------------------------------------------------------
  302. HRESULT STDMETHODCALLTYPE IAdviseSink_OnDataChange_Stub(
  303. IAdviseSink __RPC_FAR * This,
  304. FORMATETC __RPC_FAR *pFormatetc,
  305. STGMEDIUM __RPC_FAR *pStgmed)
  306. {
  307. This->lpVtbl->OnDataChange(This, pFormatetc, pStgmed);
  308. return S_OK;
  309. }
  310. //+-------------------------------------------------------------------------
  311. //
  312. // Function: AsyncIAdviseSink_Begin_OnDataChange_Proxy
  313. //
  314. // Synopsis: Client-side [call_as] wrapper function for
  315. // AsyncIAdviseSink::Begin_OnDataChange.
  316. //
  317. // Returns: S_OK
  318. //
  319. //--------------------------------------------------------------------------
  320. void STDMETHODCALLTYPE AsyncIAdviseSink_Begin_OnDataChange_Proxy(
  321. AsyncIAdviseSink __RPC_FAR * This,
  322. FORMATETC __RPC_FAR *pFormatetc,
  323. STGMEDIUM __RPC_FAR *pStgmed)
  324. {
  325. AsyncIAdviseSink_Begin_RemoteOnDataChange_Proxy(This, pFormatetc, pStgmed);
  326. }
  327. //+-------------------------------------------------------------------------
  328. //
  329. // Function: AsyncIAdviseSink_Finish_OnDataChange_Proxy
  330. //
  331. // Synopsis: Client-side [call_as] wrapper function for
  332. // AsyncIAdviseSink::Finish_OnDataChange.
  333. //
  334. // Returns: S_OK
  335. //
  336. //--------------------------------------------------------------------------
  337. void STDMETHODCALLTYPE AsyncIAdviseSink_Finish_OnDataChange_Proxy(
  338. AsyncIAdviseSink __RPC_FAR * This)
  339. {
  340. AsyncIAdviseSink_Finish_RemoteOnDataChange_Proxy(This);
  341. }
  342. //+-------------------------------------------------------------------------
  343. //
  344. // Function: AsyncIAdviseSink_Begin_OnDataChange_Stub
  345. //
  346. // Synopsis: Server-side [call_as] wrapper function for
  347. // AsyncIAdviseSink::Begin_OnDataChange.
  348. //
  349. // Returns: S_OK
  350. //
  351. //--------------------------------------------------------------------------
  352. HRESULT STDMETHODCALLTYPE AsyncIAdviseSink_Begin_OnDataChange_Stub(
  353. AsyncIAdviseSink __RPC_FAR * This,
  354. FORMATETC __RPC_FAR *pFormatetc,
  355. STGMEDIUM __RPC_FAR *pStgmed)
  356. {
  357. This->lpVtbl->Begin_OnDataChange(This, pFormatetc, pStgmed);
  358. return S_OK;
  359. }
  360. //+-------------------------------------------------------------------------
  361. //
  362. // Function: AsyncIAdviseSink_Finish_OnDataChange_Stub
  363. //
  364. // Synopsis: Server-side [call_as] wrapper function for
  365. // AsyncIAdviseSink::Finish_OnDataChange.
  366. //
  367. // Returns: S_OK
  368. //
  369. //--------------------------------------------------------------------------
  370. HRESULT STDMETHODCALLTYPE AsyncIAdviseSink_Finish_OnDataChange_Stub(
  371. AsyncIAdviseSink __RPC_FAR * This)
  372. {
  373. This->lpVtbl->Finish_OnDataChange(This);
  374. return S_OK;
  375. }
  376. ////////////////////////////////////////////////////////////////////////////////
  377. ////////////////////////////////////////////////////////////////////////////////
  378. ////////////////////////////////////////////////////////////////////////////////////////
  379. //+-------------------------------------------------------------------------
  380. //
  381. // Function: IAdviseSink_OnViewChange_Proxy
  382. //
  383. // Synopsis: Client-side [call_as] wrapper function for
  384. // IAdviseSink::OnViewChange.
  385. //
  386. // Returns: void
  387. //
  388. //--------------------------------------------------------------------------
  389. void STDMETHODCALLTYPE IAdviseSink_OnViewChange_Proxy(
  390. IAdviseSink __RPC_FAR * This,
  391. DWORD dwAspect,
  392. LONG lindex)
  393. {
  394. __try
  395. {
  396. if (!IsStdIdentity((void *)This))
  397. {
  398. IAdviseSink_RemoteOnViewChange_Proxy(This, dwAspect, lindex);
  399. }
  400. else
  401. {
  402. ICallFactory *pCF;
  403. if (SUCCEEDED(This->lpVtbl->QueryInterface(This, &IID_ICallFactory, (void **) &pCF)))
  404. {
  405. AsyncIAdviseSink *pAAS;
  406. if (SUCCEEDED(pCF->lpVtbl->CreateCall(pCF, &IID_AsyncIAdviseSink, NULL,
  407. &IID_AsyncIAdviseSink, (LPUNKNOWN*) &pAAS)))
  408. {
  409. pAAS->lpVtbl->Begin_OnViewChange(pAAS, dwAspect, lindex);
  410. pAAS->lpVtbl->Release(pAAS);
  411. }
  412. pCF->lpVtbl->Release(pCF);
  413. }
  414. }
  415. }
  416. __except(EXCEPTION_EXECUTE_HANDLER)
  417. {
  418. //Just ignore the exception.
  419. }
  420. }
  421. //+-------------------------------------------------------------------------
  422. //
  423. // Function: IAdviseSink_OnViewChange_Stub
  424. //
  425. // Synopsis: Server-side [call_as] wrapper function for
  426. // IAdviseSink::OnViewChange.
  427. //
  428. // Returns: S_OK
  429. //
  430. //--------------------------------------------------------------------------
  431. HRESULT STDMETHODCALLTYPE IAdviseSink_OnViewChange_Stub(
  432. IAdviseSink __RPC_FAR * This,
  433. DWORD dwAspect,
  434. LONG lindex)
  435. {
  436. This->lpVtbl->OnViewChange(This, dwAspect, lindex);
  437. return S_OK;
  438. }
  439. //+-------------------------------------------------------------------------
  440. //
  441. // Function: AsyncIAdviseSink_Begin_OnViewChange_Proxy
  442. //
  443. // Synopsis: Client-side [call_as] wrapper function for
  444. // AsyncIAdviseSink::Begin_OnViewChange.
  445. //
  446. // Returns: S_OK
  447. //
  448. //--------------------------------------------------------------------------
  449. void STDMETHODCALLTYPE AsyncIAdviseSink_Begin_OnViewChange_Proxy(
  450. AsyncIAdviseSink __RPC_FAR * This,
  451. DWORD dwAspect,
  452. LONG lindex)
  453. {
  454. AsyncIAdviseSink_Begin_RemoteOnViewChange_Proxy(This, dwAspect, lindex);
  455. }
  456. //+-------------------------------------------------------------------------
  457. //
  458. // Function: AsyncIAdviseSink_Finish_OnViewChange_Proxy
  459. //
  460. // Synopsis: Client-side [call_as] wrapper function for
  461. // AsyncIAdviseSink::Finish_OnViewChange.
  462. //
  463. // Returns: S_OK
  464. //
  465. //--------------------------------------------------------------------------
  466. void STDMETHODCALLTYPE AsyncIAdviseSink_Finish_OnViewChange_Proxy(
  467. AsyncIAdviseSink __RPC_FAR * This)
  468. {
  469. AsyncIAdviseSink_Finish_RemoteOnViewChange_Proxy(This);
  470. }
  471. //+-------------------------------------------------------------------------
  472. //
  473. // Function: AsyncIAdviseSink_Begin_OnViewChange_Stub
  474. //
  475. // Synopsis: Server-side [call_as] wrapper function for
  476. // AsyncIAdviseSink::Begin_OnViewChange.
  477. //
  478. // Returns: S_OK
  479. //
  480. //--------------------------------------------------------------------------
  481. HRESULT STDMETHODCALLTYPE AsyncIAdviseSink_Begin_OnViewChange_Stub(
  482. AsyncIAdviseSink __RPC_FAR * This,
  483. DWORD dwAspect,
  484. LONG lindex)
  485. {
  486. This->lpVtbl->Begin_OnViewChange(This, dwAspect, lindex);
  487. return S_OK;
  488. }
  489. //+-------------------------------------------------------------------------
  490. //
  491. // Function: AsyncIAdviseSink_Finish_OnViewChange_Stub
  492. //
  493. // Synopsis: Server-side [call_as] wrapper function for
  494. // AsyncIAdviseSink::Finish_OnViewChange.
  495. //
  496. // Returns: S_OK
  497. //
  498. //--------------------------------------------------------------------------
  499. HRESULT STDMETHODCALLTYPE AsyncIAdviseSink_Finish_OnViewChange_Stub(
  500. AsyncIAdviseSink __RPC_FAR * This)
  501. {
  502. This->lpVtbl->Finish_OnViewChange(This);
  503. return S_OK;
  504. }
  505. ////////////////////////////////////////////////////////////////////////////////
  506. ////////////////////////////////////////////////////////////////////////////////
  507. //+-------------------------------------------------------------------------
  508. //
  509. // Function: IAdviseSink_OnRename_Proxy
  510. //
  511. // Synopsis: Client-side [call_as] wrapper function for
  512. // IAdviseSink::OnRename.
  513. //
  514. // Returns: void
  515. //
  516. //--------------------------------------------------------------------------
  517. void STDMETHODCALLTYPE IAdviseSink_OnRename_Proxy(
  518. IAdviseSink __RPC_FAR * This,
  519. IMoniker __RPC_FAR *pmk)
  520. {
  521. __try
  522. {
  523. if (!IsStdIdentity((void *)This))
  524. {
  525. IAdviseSink_RemoteOnRename_Proxy(This, pmk);
  526. }
  527. else
  528. {
  529. ICallFactory *pCF;
  530. if (SUCCEEDED(This->lpVtbl->QueryInterface(This, &IID_ICallFactory, (void **) &pCF)))
  531. {
  532. AsyncIAdviseSink *pAAS;
  533. if (SUCCEEDED(pCF->lpVtbl->CreateCall(pCF, &IID_AsyncIAdviseSink, NULL,
  534. &IID_AsyncIAdviseSink, (LPUNKNOWN*) &pAAS)))
  535. {
  536. pAAS->lpVtbl->Begin_OnRename(pAAS, pmk);
  537. pAAS->lpVtbl->Release(pAAS);
  538. }
  539. pCF->lpVtbl->Release(pCF);
  540. }
  541. }
  542. }
  543. __except(EXCEPTION_EXECUTE_HANDLER)
  544. {
  545. //Just ignore the exception.
  546. }
  547. }
  548. //+-------------------------------------------------------------------------
  549. //
  550. // Function: IAdviseSink_OnRename_Stub
  551. //
  552. // Synopsis: Server-side [call_as] wrapper function for
  553. // IAdviseSink::OnRename.
  554. //
  555. // Returns: S_OK
  556. //
  557. //--------------------------------------------------------------------------
  558. HRESULT STDMETHODCALLTYPE IAdviseSink_OnRename_Stub(
  559. IAdviseSink __RPC_FAR * This,
  560. IMoniker __RPC_FAR *pmk)
  561. {
  562. This->lpVtbl->OnRename(This, pmk);
  563. return S_OK;
  564. }
  565. //+-------------------------------------------------------------------------
  566. //
  567. // Function: AsyncIAdviseSink_Begin_OnRename_Proxy
  568. //
  569. // Synopsis: Client-side [call_as] wrapper function for
  570. // AsyncIAdviseSink::Begin_OnRename.
  571. //
  572. // Returns: S_OK
  573. //
  574. //--------------------------------------------------------------------------
  575. void STDMETHODCALLTYPE AsyncIAdviseSink_Begin_OnRename_Proxy(
  576. AsyncIAdviseSink __RPC_FAR * This,
  577. IMoniker __RPC_FAR *pmk)
  578. {
  579. AsyncIAdviseSink_Begin_RemoteOnRename_Proxy(This, pmk);
  580. }
  581. //+-------------------------------------------------------------------------
  582. //
  583. // Function: AsyncIAdviseSink_Finish_OnRename_Proxy
  584. //
  585. // Synopsis: Client-side [call_as] wrapper function for
  586. // AsyncIAdviseSink::Finish_OnRename.
  587. //
  588. // Returns: S_OK
  589. //
  590. //--------------------------------------------------------------------------
  591. void STDMETHODCALLTYPE AsyncIAdviseSink_Finish_OnRename_Proxy(
  592. AsyncIAdviseSink __RPC_FAR * This)
  593. {
  594. AsyncIAdviseSink_Finish_RemoteOnRename_Proxy(This);
  595. }
  596. //+-------------------------------------------------------------------------
  597. //
  598. // Function: AsyncIAdviseSink_Begin_OnRename_Stub
  599. //
  600. // Synopsis: Server-side [call_as] wrapper function for
  601. // AsyncIAdviseSink::Begin_OnRename.
  602. //
  603. // Returns: S_OK
  604. //
  605. //--------------------------------------------------------------------------
  606. HRESULT STDMETHODCALLTYPE AsyncIAdviseSink_Begin_OnRename_Stub(
  607. AsyncIAdviseSink __RPC_FAR * This,
  608. IMoniker __RPC_FAR *pmk)
  609. {
  610. This->lpVtbl->Begin_OnRename(This, pmk);
  611. return S_OK;
  612. }
  613. //+-------------------------------------------------------------------------
  614. //
  615. // Function: AsyncIAdviseSink_Finish_OnRename_Stub
  616. //
  617. // Synopsis: Server-side [call_as] wrapper function for
  618. // AsyncIAdviseSink::Finish_OnRename.
  619. //
  620. // Returns: S_OK
  621. //
  622. //--------------------------------------------------------------------------
  623. HRESULT STDMETHODCALLTYPE AsyncIAdviseSink_Finish_OnRename_Stub(
  624. AsyncIAdviseSink __RPC_FAR * This)
  625. {
  626. This->lpVtbl->Finish_OnRename(This);
  627. return S_OK;
  628. }
  629. ////////////////////////////////////////////////////////////////////////////////
  630. ////////////////////////////////////////////////////////////////////////////////
  631. //+-------------------------------------------------------------------------
  632. //
  633. // Function: IAdviseSink_OnSave_Proxy
  634. //
  635. // Synopsis: Client-side [call_as] wrapper function for
  636. // IAdviseSink::OnSave.
  637. //
  638. // Returns: void
  639. //
  640. //--------------------------------------------------------------------------
  641. void STDMETHODCALLTYPE IAdviseSink_OnSave_Proxy(
  642. IAdviseSink __RPC_FAR * This)
  643. {
  644. __try
  645. {
  646. if (!IsStdIdentity((void *)This))
  647. {
  648. IAdviseSink_RemoteOnSave_Proxy(This);
  649. }
  650. else
  651. {
  652. ICallFactory *pCF;
  653. if (SUCCEEDED(This->lpVtbl->QueryInterface(This, &IID_ICallFactory, (void **) &pCF)))
  654. {
  655. AsyncIAdviseSink *pAAS;
  656. if (SUCCEEDED(pCF->lpVtbl->CreateCall(pCF, &IID_AsyncIAdviseSink, NULL,
  657. &IID_AsyncIAdviseSink, (LPUNKNOWN*) &pAAS)))
  658. {
  659. pAAS->lpVtbl->Begin_OnSave(pAAS);
  660. pAAS->lpVtbl->Release(pAAS);
  661. }
  662. pCF->lpVtbl->Release(pCF);
  663. }
  664. }
  665. }
  666. __except(EXCEPTION_EXECUTE_HANDLER)
  667. {
  668. //Just ignore the exception.
  669. }
  670. }
  671. //+-------------------------------------------------------------------------
  672. //
  673. // Function: IAdviseSink_OnSave_Stub
  674. //
  675. // Synopsis: Server-side [call_as] wrapper function for
  676. // IAdviseSink::OnSave.
  677. //
  678. // Returns: S_OK
  679. //
  680. //--------------------------------------------------------------------------
  681. HRESULT STDMETHODCALLTYPE IAdviseSink_OnSave_Stub(
  682. IAdviseSink __RPC_FAR * This)
  683. {
  684. This->lpVtbl->OnSave(This);
  685. return S_OK;
  686. }
  687. //+-------------------------------------------------------------------------
  688. //
  689. // Function: AsyncIAdviseSink_Begin_OnSave_Proxy
  690. //
  691. // Synopsis: Client-side [call_as] wrapper function for
  692. // AsyncIAdviseSink::Begin_OnSave.
  693. //
  694. // Returns: S_OK
  695. //
  696. //--------------------------------------------------------------------------
  697. void STDMETHODCALLTYPE AsyncIAdviseSink_Begin_OnSave_Proxy(
  698. AsyncIAdviseSink __RPC_FAR * This)
  699. {
  700. AsyncIAdviseSink_Begin_RemoteOnSave_Proxy(This);
  701. }
  702. //+-------------------------------------------------------------------------
  703. //
  704. // Function: AsyncIAdviseSink_Finish_OnSave_Proxy
  705. //
  706. // Synopsis: Client-side [call_as] wrapper function for
  707. // AsyncIAdviseSink::Finish_OnSave.
  708. //
  709. // Returns: S_OK
  710. //
  711. //--------------------------------------------------------------------------
  712. void STDMETHODCALLTYPE AsyncIAdviseSink_Finish_OnSave_Proxy(
  713. AsyncIAdviseSink __RPC_FAR * This)
  714. {
  715. AsyncIAdviseSink_Finish_RemoteOnSave_Proxy(This);
  716. }
  717. //+-------------------------------------------------------------------------
  718. //
  719. // Function: AsyncIAdviseSink_Begin_OnSave_Stub
  720. //
  721. // Synopsis: Server-side [call_as] wrapper function for
  722. // AsyncIAdviseSink::Begin_OnSave.
  723. //
  724. // Returns: S_OK
  725. //
  726. //--------------------------------------------------------------------------
  727. HRESULT STDMETHODCALLTYPE AsyncIAdviseSink_Begin_OnSave_Stub(
  728. AsyncIAdviseSink __RPC_FAR * This)
  729. {
  730. This->lpVtbl->Begin_OnSave(This);
  731. return S_OK;
  732. }
  733. //+-------------------------------------------------------------------------
  734. //
  735. // Function: AsyncIAdviseSink_Finish_OnSave_Stub
  736. //
  737. // Synopsis: Server-side [call_as] wrapper function for
  738. // AsyncIAdviseSink::Finish_OnSave.
  739. //
  740. // Returns: S_OK
  741. //
  742. //--------------------------------------------------------------------------
  743. HRESULT STDMETHODCALLTYPE AsyncIAdviseSink_Finish_OnSave_Stub(
  744. AsyncIAdviseSink __RPC_FAR * This)
  745. {
  746. This->lpVtbl->Finish_OnSave(This);
  747. return S_OK;
  748. }
  749. ////////////////////////////////////////////////////////////////////////////////
  750. ////////////////////////////////////////////////////////////////////////////////
  751. //+-------------------------------------------------------------------------
  752. //
  753. // Function: IAdviseSink_OnClose_Proxy
  754. //
  755. // Synopsis: Client-side [call_as] wrapper function for
  756. // IAdviseSink::OnClose.
  757. //
  758. // Returns: void
  759. //
  760. //--------------------------------------------------------------------------
  761. void STDMETHODCALLTYPE IAdviseSink_OnClose_Proxy(
  762. IAdviseSink __RPC_FAR * This)
  763. {
  764. __try
  765. {
  766. // ignore the HRESULT return
  767. IAdviseSink_RemoteOnClose_Proxy(This);
  768. }
  769. __except(EXCEPTION_EXECUTE_HANDLER)
  770. {
  771. //Just ignore the exception.
  772. }
  773. }
  774. //+-------------------------------------------------------------------------
  775. //
  776. // Function: IAdviseSink_OnClose_Stub
  777. //
  778. // Synopsis: Server-side [call_as] wrapper function for
  779. // IAdviseSink::OnClose.
  780. //
  781. // Returns: S_OK
  782. //
  783. //--------------------------------------------------------------------------
  784. HRESULT STDMETHODCALLTYPE IAdviseSink_OnClose_Stub(
  785. IAdviseSink __RPC_FAR * This)
  786. {
  787. This->lpVtbl->OnClose(This);
  788. return S_OK;
  789. }
  790. //+-------------------------------------------------------------------------
  791. //
  792. // Function: AsyncIAdviseSink_Begin_OnClose_Proxy
  793. //
  794. // Synopsis: Client-side [call_as] wrapper function for
  795. // AsyncIAdviseSink::Begin_OnClose.
  796. //
  797. // Returns: S_OK
  798. //
  799. //--------------------------------------------------------------------------
  800. void STDMETHODCALLTYPE AsyncIAdviseSink_Begin_OnClose_Proxy(
  801. AsyncIAdviseSink __RPC_FAR * This)
  802. {
  803. AsyncIAdviseSink_Begin_RemoteOnClose_Proxy(This);
  804. }
  805. //+-------------------------------------------------------------------------
  806. //
  807. // Function: AsyncIAdviseSink_Finish_OnClose_Proxy
  808. //
  809. // Synopsis: Client-side [call_as] wrapper function for
  810. // AsyncIAdviseSink::Finish_OnClose.
  811. //
  812. // Returns: S_OK
  813. //
  814. //--------------------------------------------------------------------------
  815. void STDMETHODCALLTYPE AsyncIAdviseSink_Finish_OnClose_Proxy(
  816. AsyncIAdviseSink __RPC_FAR * This)
  817. {
  818. AsyncIAdviseSink_Finish_RemoteOnClose_Proxy(This);
  819. }
  820. //+-------------------------------------------------------------------------
  821. //
  822. // Function: AsyncIAdviseSink_Begin_OnClose_Stub
  823. //
  824. // Synopsis: Server-side [call_as] wrapper function for
  825. // AsyncIAdviseSink::Begin_OnClose.
  826. //
  827. // Returns: S_OK
  828. //
  829. //--------------------------------------------------------------------------
  830. HRESULT STDMETHODCALLTYPE AsyncIAdviseSink_Begin_OnClose_Stub(
  831. AsyncIAdviseSink __RPC_FAR * This)
  832. {
  833. This->lpVtbl->Begin_OnClose(This);
  834. return S_OK;
  835. }
  836. //+-------------------------------------------------------------------------
  837. //
  838. // Function: AsyncIAdviseSink_Finish_OnClose_Stub
  839. //
  840. // Synopsis: Server-side [call_as] wrapper function for
  841. // AsyncIAdviseSink::Finish_OnClose.
  842. //
  843. // Returns: S_OK
  844. //
  845. //--------------------------------------------------------------------------
  846. HRESULT STDMETHODCALLTYPE AsyncIAdviseSink_Finish_OnClose_Stub(
  847. AsyncIAdviseSink __RPC_FAR * This)
  848. {
  849. This->lpVtbl->Finish_OnClose(This);
  850. return S_OK;
  851. }
  852. ////////////////////////////////////////////////////////////////////////////////
  853. //+-------------------------------------------------------------------------
  854. //
  855. // Function: IBindCtx_GetBindOptions_Proxy
  856. //
  857. // Synopsis: Client-side [call_as] wrapper function for
  858. // IBindCtx::GetBindOptions.
  859. //
  860. // Returns: S_OK
  861. //
  862. // Notes: If the caller's BIND_OPTS is smaller than the current
  863. // BIND_OPTS definition, then we must truncate the results
  864. // so that we don't go off the end of the structure.
  865. //
  866. //--------------------------------------------------------------------------
  867. HRESULT STDMETHODCALLTYPE IBindCtx_GetBindOptions_Proxy(
  868. IBindCtx __RPC_FAR * This,
  869. BIND_OPTS __RPC_FAR *pbindopts)
  870. {
  871. HRESULT hr;
  872. if(pbindopts->cbStruct >= sizeof(BIND_OPTS2))
  873. {
  874. hr = IBindCtx_RemoteGetBindOptions_Proxy(This, (BIND_OPTS2 *) pbindopts);
  875. }
  876. else
  877. {
  878. BIND_OPTS2 bindOptions;
  879. //The pbindopts supplied by the caller is too small.
  880. //We need a BIND_OPTS2 for the marshalling code.
  881. memset(&bindOptions, 0, sizeof(BIND_OPTS2));
  882. memcpy(&bindOptions, pbindopts, pbindopts->cbStruct);
  883. hr = IBindCtx_RemoteGetBindOptions_Proxy(This, &bindOptions);
  884. if(SUCCEEDED(hr))
  885. {
  886. memcpy(pbindopts, &bindOptions, bindOptions.cbStruct);
  887. }
  888. }
  889. return hr;
  890. }
  891. //+-------------------------------------------------------------------------
  892. //
  893. // Function: IBindCtx_GetBindOptions_Stub
  894. //
  895. // Synopsis: Server-side [call_as] wrapper function for
  896. // IBindCtx::GetBindOptions.
  897. //
  898. // Returns: S_OK
  899. //
  900. //--------------------------------------------------------------------------
  901. HRESULT STDMETHODCALLTYPE IBindCtx_GetBindOptions_Stub(
  902. IBindCtx __RPC_FAR * This,
  903. BIND_OPTS2 __RPC_FAR *pbindopts)
  904. {
  905. HRESULT hr;
  906. //make sure we don't request more data than we can handle.
  907. if(pbindopts->cbStruct > sizeof(BIND_OPTS2))
  908. {
  909. pbindopts->cbStruct = sizeof(BIND_OPTS2);
  910. }
  911. hr = This->lpVtbl->GetBindOptions(This, (BIND_OPTS *)pbindopts);
  912. return hr;
  913. }
  914. //+-------------------------------------------------------------------------
  915. //
  916. // Function: IBindCtx_SetBindOptions_Proxy
  917. //
  918. // Synopsis: Client-side [call_as] wrapper function for
  919. // IBindCtx::SetBindOptions.
  920. //
  921. // Returns: S_OK
  922. //
  923. //--------------------------------------------------------------------------
  924. HRESULT STDMETHODCALLTYPE IBindCtx_SetBindOptions_Proxy(
  925. IBindCtx __RPC_FAR * This,
  926. BIND_OPTS __RPC_FAR *pbindopts)
  927. {
  928. HRESULT hr;
  929. if(sizeof(BIND_OPTS2) == pbindopts->cbStruct)
  930. {
  931. hr = IBindCtx_RemoteSetBindOptions_Proxy(This, (BIND_OPTS2 *) pbindopts);
  932. }
  933. else if(sizeof(BIND_OPTS2) > pbindopts->cbStruct)
  934. {
  935. BIND_OPTS2 bindOptions;
  936. memset(&bindOptions, 0, sizeof(bindOptions));
  937. memcpy(&bindOptions, pbindopts, pbindopts->cbStruct);
  938. hr = IBindCtx_RemoteSetBindOptions_Proxy(This, &bindOptions);
  939. }
  940. else
  941. {
  942. //The caller's BIND_OPTS is too large.
  943. //We don't want to truncate, so we return an error.
  944. hr = E_INVALIDARG;
  945. }
  946. return hr;
  947. }
  948. //+-------------------------------------------------------------------------
  949. //
  950. // Function: IBindCtx_SetBindOptions_Stub
  951. //
  952. // Synopsis: Server-side [call_as] wrapper function for
  953. // IBindCtx::SetBindOptions.
  954. //
  955. // Returns: S_OK
  956. //
  957. //--------------------------------------------------------------------------
  958. HRESULT STDMETHODCALLTYPE IBindCtx_SetBindOptions_Stub(
  959. IBindCtx __RPC_FAR * This,
  960. BIND_OPTS2 __RPC_FAR *pbindopts)
  961. {
  962. HRESULT hr;
  963. hr = This->lpVtbl->SetBindOptions(This, (BIND_OPTS *)pbindopts);
  964. return hr;
  965. }
  966. //+-------------------------------------------------------------------------
  967. //
  968. // Function: IClassFactory_CreateInstance_Proxy
  969. //
  970. // Synopsis: Client-side [call_as] wrapper function for
  971. // IClassFactory::CreateInstance.
  972. //
  973. // Returns: CLASS_E_NO_AGGREGREGRATION - if punkOuter != 0.
  974. // Any errors returned by Remote_CreateInstance_Proxy.
  975. // Any errors from QI() on Proxy IUnknown for local interfaces.
  976. //
  977. // Notes: We don't support remote aggregation. punkOuter must be zero.
  978. //
  979. // If the interface being created is implemented on the proxy,
  980. // we create the object and then QI() the proxy returned to us
  981. // for the interface.
  982. //
  983. //--------------------------------------------------------------------------
  984. HRESULT STDMETHODCALLTYPE IClassFactory_CreateInstance_Proxy(
  985. IClassFactory __RPC_FAR * This,
  986. IUnknown __RPC_FAR *pUnkOuter,
  987. REFIID riid,
  988. void __RPC_FAR *__RPC_FAR *ppvObject)
  989. {
  990. HRESULT hr;
  991. *ppvObject = 0;
  992. if(pUnkOuter != 0)
  993. {
  994. hr = CLASS_E_NOAGGREGATION;
  995. }
  996. else
  997. {
  998. BOOL fIsOnProxy = IsInterfaceImplementedByProxy(riid);
  999. IUnknown* pUnk = NULL;
  1000. hr = IClassFactory_RemoteCreateInstance_Proxy(This,
  1001. fIsOnProxy ? &IID_IUnknown : riid,
  1002. &pUnk);
  1003. if ( fIsOnProxy && SUCCEEDED(hr) && pUnk != NULL)
  1004. {
  1005. hr = pUnk->lpVtbl->QueryInterface(pUnk, riid, ppvObject);
  1006. pUnk->lpVtbl->Release(pUnk);
  1007. }
  1008. else
  1009. {
  1010. *ppvObject = (void*) pUnk;
  1011. }
  1012. }
  1013. return hr;
  1014. }
  1015. //+-------------------------------------------------------------------------
  1016. //
  1017. // Function: IClassFactory_CreateInstance_Stub
  1018. //
  1019. // Synopsis: Server-side [call_as] wrapper function for
  1020. // IClassFactory::CreateInstance.
  1021. //
  1022. // Returns: Any errors returned by CreateInstance.
  1023. //
  1024. // Notes: We don't support remote aggregation.
  1025. //
  1026. //--------------------------------------------------------------------------
  1027. HRESULT STDMETHODCALLTYPE IClassFactory_CreateInstance_Stub(
  1028. IClassFactory __RPC_FAR * This,
  1029. REFIID riid,
  1030. IUnknown __RPC_FAR *__RPC_FAR *ppvObject)
  1031. {
  1032. HRESULT hr;
  1033. hr = This->lpVtbl->CreateInstance(This, 0, riid, ppvObject);
  1034. if(FAILED(hr))
  1035. {
  1036. //If the server returns an error code, it must set *ppvObject to zero.
  1037. ASSERT(*ppvObject == 0);
  1038. //Set it to zero, in case we have a badly behaved server.
  1039. *ppvObject = 0;
  1040. }
  1041. else if (S_OK == hr && CoIsSurrogateProcess())
  1042. {
  1043. // Don't worry about any errors. The worst that will happen is that
  1044. // keyboard accelerators won't work.
  1045. CoRegisterSurrogatedObject(*ppvObject);
  1046. }
  1047. return hr;
  1048. }
  1049. //+-------------------------------------------------------------------------
  1050. //
  1051. // Function: IClassFactory_LockServer_Proxy
  1052. //
  1053. // Synopsis: Client-side [call_as] wrapper function for
  1054. // IClassFactory::LockServer.
  1055. //
  1056. // Returns: S_OK
  1057. //
  1058. // Notes: The server activation code does an implicit LockServer(TRUE)
  1059. // when it marshals the class object, and an implicit
  1060. // LockServer(FALSE) when the client releases it, so calls
  1061. // made by the client are ignored.
  1062. //
  1063. //--------------------------------------------------------------------------
  1064. HRESULT STDMETHODCALLTYPE IClassFactory_LockServer_Proxy(
  1065. IClassFactory __RPC_FAR * This,
  1066. BOOL fLock)
  1067. {
  1068. return S_OK;
  1069. }
  1070. //+-------------------------------------------------------------------------
  1071. //
  1072. // Function: IClassFactory_LockServer_Stub
  1073. //
  1074. // Synopsis: Server-side [call_as] wrapper function for
  1075. // IClassFactory::LockServer.
  1076. //
  1077. // Returns: S_OK
  1078. //
  1079. // Notes: The server activation code does an implicit LockServer(TRUE)
  1080. // when it marshals the class object, and an implicit
  1081. // LockServer(FALSE) when the client releases it, so calls
  1082. // made by the client are ignored.
  1083. //
  1084. //--------------------------------------------------------------------------
  1085. HRESULT STDMETHODCALLTYPE IClassFactory_LockServer_Stub(
  1086. IClassFactory __RPC_FAR * This,
  1087. BOOL fLock)
  1088. {
  1089. return This->lpVtbl->LockServer(This, fLock);
  1090. }
  1091. //+-------------------------------------------------------------------------
  1092. //
  1093. // Function: IDataObject_GetData_Proxy
  1094. //
  1095. // Synopsis: Client-side [call_as] wrapper function for
  1096. // IDataObject::GetData.
  1097. // pMedium is [out] only.
  1098. //
  1099. //--------------------------------------------------------------------------
  1100. HRESULT STDMETHODCALLTYPE IDataObject_GetData_Proxy(
  1101. IDataObject __RPC_FAR * This,
  1102. FORMATETC __RPC_FAR *pformatetcIn,
  1103. STGMEDIUM __RPC_FAR *pMedium)
  1104. {
  1105. HRESULT hr;
  1106. UserNdrDebugOut((UNDR_FORCE, "==GetData_Proxy\n"));
  1107. WdtpZeroMemory( pMedium, sizeof(STGMEDIUM) );
  1108. hr = IDataObject_RemoteGetData_Proxy(This, pformatetcIn, pMedium);
  1109. return hr;
  1110. }
  1111. //+-------------------------------------------------------------------------
  1112. //
  1113. // Function: IDataObject_GetData_Stub
  1114. //
  1115. // Synopsis: Server-side [call_as] wrapper function for
  1116. // IDataObject::GetData.
  1117. // pMedium is [out] only.
  1118. //
  1119. //--------------------------------------------------------------------------
  1120. HRESULT STDMETHODCALLTYPE IDataObject_GetData_Stub(
  1121. IDataObject __RPC_FAR * This,
  1122. FORMATETC __RPC_FAR *pformatetcIn,
  1123. STGMEDIUM __RPC_FAR * pMedium)
  1124. {
  1125. HRESULT hr;
  1126. UserNdrDebugOut((UNDR_FORCE, "==GetData_Stub\n"));
  1127. hr = This->lpVtbl->GetData(This, pformatetcIn, pMedium);
  1128. return hr;
  1129. }
  1130. //+-------------------------------------------------------------------------
  1131. //
  1132. // Function: IDataObject_GetDataHere_Proxy
  1133. //
  1134. // Synopsis: Client-side [call_as] wrapper function for
  1135. // IDataObject::GetDataHere.
  1136. // pMedium is [in,out].
  1137. //
  1138. // History: 05-19-94 AlexT Handle all cases correctly
  1139. //
  1140. //
  1141. //--------------------------------------------------------------------------
  1142. HRESULT STDMETHODCALLTYPE IDataObject_GetDataHere_Proxy(
  1143. IDataObject __RPC_FAR * This,
  1144. FORMATETC __RPC_FAR *pformatetc,
  1145. STGMEDIUM __RPC_FAR *pmedium)
  1146. {
  1147. HRESULT hr;
  1148. IUnknown * punkSaved;
  1149. IStorage * pStgSaved = NULL;
  1150. UserNdrDebugOut((UNDR_FORCE, "==GetDataHere_Proxy: %s\n", WdtpGetStgmedName(pmedium)));
  1151. if ((pmedium->tymed &
  1152. (TYMED_FILE | TYMED_ISTORAGE | TYMED_ISTREAM | TYMED_HGLOBAL)) == 0)
  1153. {
  1154. // We only support GetDataHere for files, storages, streams,
  1155. // and HGLOBALs
  1156. return(DV_E_TYMED);
  1157. }
  1158. if (pmedium->tymed != pformatetc->tymed)
  1159. {
  1160. // tymeds must match!
  1161. return(DV_E_TYMED);
  1162. }
  1163. // NULL the pUnkForRelease. It makes no sense to pass this parameter
  1164. // since the callee will never call it. NULLing saves all the marshalling
  1165. // and associated Rpc calls, and reduces complexity in this code.
  1166. punkSaved = pmedium->pUnkForRelease;
  1167. pmedium->pUnkForRelease = NULL;
  1168. // This is a hack to make Exchange 8.0.829.1 work HenryLee 04/18/96
  1169. // So probably can't remove it now JohnDoty 04/24/00
  1170. if (pmedium->tymed == TYMED_ISTORAGE || pmedium->tymed == TYMED_ISTREAM)
  1171. {
  1172. pStgSaved = pmedium->pstg;
  1173. if (pStgSaved)
  1174. pStgSaved->lpVtbl->AddRef(pStgSaved); // save the old pointer
  1175. }
  1176. hr = IDataObject_RemoteGetDataHere_Proxy(This, pformatetc, pmedium );
  1177. pmedium->pUnkForRelease = punkSaved;
  1178. if (pStgSaved != NULL)
  1179. {
  1180. if (pmedium->pstg != NULL) // discard the new one
  1181. (pmedium->pstg)->lpVtbl->Release(pmedium->pstg);
  1182. pmedium->pstg = pStgSaved; // restore old one
  1183. }
  1184. if(SUCCEEDED(hr) )
  1185. {
  1186. UserNdrDebugOut((UNDR_FORCE, " (GetDataHere_ProxyO: new if ptr)\n"));
  1187. }
  1188. else
  1189. UserNdrDebugOut((UNDR_FORCE, " (GetDataHere_ProxyO: didn't succeed : %lx)\n", hr));
  1190. return hr;
  1191. }
  1192. //+-------------------------------------------------------------------------
  1193. //
  1194. // Function: IDataObject_GetDataHere_Stub
  1195. //
  1196. // Synopsis: Client-side [call_as] wrapper function for
  1197. // IDataObject::GetData.
  1198. // pMedium is [in,out].
  1199. //
  1200. //--------------------------------------------------------------------------
  1201. HRESULT STDMETHODCALLTYPE IDataObject_GetDataHere_Stub(
  1202. IDataObject __RPC_FAR * This,
  1203. FORMATETC __RPC_FAR *pformatetc,
  1204. STGMEDIUM __RPC_FAR * pMedium)
  1205. {
  1206. HRESULT hr;
  1207. UserNdrDebugOut((UNDR_FORCE, "==GetDataHere_Stub: %s\n", WdtpGetStgmedName(pMedium)));
  1208. hr = This->lpVtbl->GetDataHere(This, pformatetc, pMedium);
  1209. return hr;
  1210. }
  1211. //+-------------------------------------------------------------------------
  1212. //
  1213. // Function: IDataObject_SetData_Proxy
  1214. //
  1215. // Synopsis: Client-side [call_as] wrapper function for
  1216. // IDataObject::SetData.
  1217. // This wrapper function uses FLAG_STGMEDIUM type.
  1218. // pMedium is [in].
  1219. //
  1220. // Notes: If fRelease is TRUE, then the callee is responsible for
  1221. // freeing the STGMEDIUM.
  1222. //
  1223. //--------------------------------------------------------------------------
  1224. HRESULT STDMETHODCALLTYPE IDataObject_SetData_Proxy(
  1225. IDataObject __RPC_FAR * This,
  1226. FORMATETC __RPC_FAR *pformatetc,
  1227. STGMEDIUM __RPC_FAR *pmedium,
  1228. BOOL fRelease)
  1229. {
  1230. HRESULT hr;
  1231. FLAG_STGMEDIUM RemoteStgmed;
  1232. #ifdef FUTURE
  1233. STGMEDIUM StgMedium;
  1234. // Potential performance improvement
  1235. if (!fRelease && pmedium->pUnkForRelease != NULL)
  1236. {
  1237. // Caller is retaining ownership of pmedium, but is providing
  1238. // a pUnkForRelease. We make sure the stub doesn't call the
  1239. // pUnkForRelease by sending a STGMEDIUM that has it as NULL.
  1240. StgMedium.tymed = pmedium->tymed;
  1241. StgMedium.hGlobal = pmedium->hGlobal;
  1242. StgMedium.pUnkForRelease = NULL;
  1243. pmedium = &StgMedium;
  1244. }
  1245. #endif
  1246. UserNdrDebugOut((UNDR_FORCE, " SetData_Proxy %s\n", WdtpGetStgmedName(pmedium)));
  1247. UserNdrDebugOut((UNDR_FORCE, " fRelease=%d, punk=%p\n", fRelease, pmedium->pUnkForRelease));
  1248. __try
  1249. {
  1250. RemoteStgmed.ContextFlags = 0;
  1251. RemoteStgmed.fPassOwnership = fRelease;
  1252. RemoteStgmed.Stgmed = *pmedium;
  1253. hr = IDataObject_RemoteSetData_Proxy( This,
  1254. pformatetc,
  1255. & RemoteStgmed,
  1256. fRelease);
  1257. if (fRelease && SUCCEEDED(hr))
  1258. {
  1259. // Caller has given ownership to callee.
  1260. // Free the resources left on this side.
  1261. // Context flags have been set by the unmarshalling routine.
  1262. if ( pmedium->tymed != TYMED_FILE )
  1263. STGMEDIUM_UserFree( &RemoteStgmed.ContextFlags, pmedium );
  1264. else
  1265. {
  1266. // For files, STGMEDIUM_UserFree dereferences pStubMsg via pFlags
  1267. // to get to the right freeing routine. As the StubMsg is gone,
  1268. // we need to free the file here.
  1269. NdrOleFree( pmedium->lpszFileName );
  1270. NukeHandleAndReleasePunk( pmedium );
  1271. }
  1272. }
  1273. }
  1274. __except(EXCEPTION_EXECUTE_HANDLER)
  1275. {
  1276. DWORD dwExceptionCode = GetExceptionCode();
  1277. if(FAILED((HRESULT) dwExceptionCode))
  1278. hr = (HRESULT) dwExceptionCode;
  1279. else
  1280. hr = HRESULT_FROM_WIN32(dwExceptionCode);
  1281. }
  1282. UserNdrDebugOut((UNDR_FORCE, " SetData_Proxy hr=%lx\n", hr));
  1283. return hr;
  1284. }
  1285. //+-------------------------------------------------------------------------
  1286. //
  1287. // Function: IDataObject_SetData_Stub
  1288. //
  1289. // Synopsis: Server-side [call_as] wrapper function for
  1290. // IDataObject::SetData.
  1291. // pMedium is [in].
  1292. //
  1293. // Notes: If fRelease is TRUE, then the callee is responsible for
  1294. // freeing the STGMEDIUM.
  1295. //
  1296. //--------------------------------------------------------------------------
  1297. HRESULT STDMETHODCALLTYPE IDataObject_SetData_Stub(
  1298. IDataObject __RPC_FAR * This,
  1299. FORMATETC __RPC_FAR *pformatetc,
  1300. FLAG_STGMEDIUM __RPC_FAR *pFlagStgmed,
  1301. BOOL fRelease)
  1302. {
  1303. HRESULT hr;
  1304. STGMEDIUM Stgmed;
  1305. __try
  1306. {
  1307. Stgmed = pFlagStgmed->Stgmed;
  1308. UserNdrDebugOut((UNDR_FORCE, " SetData_Stub %s\n", WdtpGetStgmedName(& Stgmed)));
  1309. UserNdrDebugOut((UNDR_FORCE, " fRelease=%d, punk=%p\n", fRelease, Stgmed.pUnkForRelease));
  1310. hr = This->lpVtbl->SetData( This,
  1311. pformatetc,
  1312. & Stgmed,
  1313. fRelease);
  1314. if ( fRelease && SUCCEEDED(hr) )
  1315. {
  1316. // The ownership was passed successfully.
  1317. // The user should free the object.
  1318. // Make it so that our userfree routine for user medium
  1319. // doesn't do anything to the user's object.
  1320. pFlagStgmed->Stgmed.tymed = TYMED_NULL;
  1321. }
  1322. }
  1323. __except(EXCEPTION_EXECUTE_HANDLER)
  1324. {
  1325. DWORD dwExceptionCode = GetExceptionCode();
  1326. if(FAILED((HRESULT) dwExceptionCode))
  1327. hr = (HRESULT) dwExceptionCode;
  1328. else
  1329. hr = HRESULT_FROM_WIN32(dwExceptionCode);
  1330. }
  1331. UserNdrDebugOut((UNDR_FORCE, " SetData_Stub hr=%lx\n", hr));
  1332. return hr;
  1333. }
  1334. //+-------------------------------------------------------------------------
  1335. //
  1336. // Function: IEnumConnectionPoints_Next_Proxy
  1337. //
  1338. // Synopsis: Client-side [call_as] wrapper function for
  1339. // IEnumConnectionPoints::Next. This wrapper function handles the
  1340. // case where lpcFetched is NULL.
  1341. //
  1342. // Notes: If lpcFetched != 0, then the number of elements
  1343. // fetched will be returned in *lpcFetched. If an error
  1344. // occurs, then *lpcFetched is set to zero.
  1345. //
  1346. //--------------------------------------------------------------------------
  1347. HRESULT STDMETHODCALLTYPE IEnumConnectionPoints_Next_Proxy(
  1348. IEnumConnectionPoints __RPC_FAR * This,
  1349. ULONG cConnections,
  1350. IConnectionPoint __RPC_FAR *__RPC_FAR *rgpcn,
  1351. ULONG __RPC_FAR *lpcFetched)
  1352. {
  1353. HRESULT hr;
  1354. ULONG cFetched = 0;
  1355. if((cConnections > 1) && (lpcFetched == 0))
  1356. return E_INVALIDARG;
  1357. hr = IEnumConnectionPoints_RemoteNext_Proxy(This, cConnections, rgpcn, &cFetched);
  1358. if(lpcFetched != 0)
  1359. *lpcFetched = cFetched;
  1360. return hr;
  1361. }
  1362. //+-------------------------------------------------------------------------
  1363. //
  1364. // Function: IEnumConnectionPoints_Next_Stub
  1365. //
  1366. // Synopsis: Server-side [call_as] wrapper function for
  1367. // IEnumConnectionPoints::Next.
  1368. //
  1369. //--------------------------------------------------------------------------
  1370. HRESULT STDMETHODCALLTYPE IEnumConnectionPoints_Next_Stub(
  1371. IEnumConnectionPoints __RPC_FAR * This,
  1372. ULONG cConnections,
  1373. IConnectionPoint __RPC_FAR *__RPC_FAR *rgpcn,
  1374. ULONG __RPC_FAR *lpcFetched)
  1375. {
  1376. HRESULT hr;
  1377. hr = This->lpVtbl->Next(This, cConnections, rgpcn, lpcFetched);
  1378. if(FAILED(hr))
  1379. {
  1380. //If the server returns an error code, it must set *lpcFetched to zero.
  1381. ASSERT(*lpcFetched == 0);
  1382. //Set *lpcFetched to zero in case we have a badly behaved server.
  1383. *lpcFetched = 0;
  1384. }
  1385. return hr;
  1386. }
  1387. //+-------------------------------------------------------------------------
  1388. //
  1389. // Function: IEnumConnections_Next_Proxy
  1390. //
  1391. // Synopsis: Client-side [call_as] wrapper function for
  1392. // IEnumConnections::Next. This wrapper function handles the
  1393. // case where lpcFetched is NULL.
  1394. //
  1395. // Notes: If lpcFetched != 0, then the number of elements
  1396. // fetched will be returned in *lpcFetched. If an error
  1397. // occurs, then *lpcFetched is set to zero.
  1398. //
  1399. //--------------------------------------------------------------------------
  1400. HRESULT STDMETHODCALLTYPE IEnumConnections_Next_Proxy(
  1401. IEnumConnections __RPC_FAR * This,
  1402. ULONG cConnections,
  1403. CONNECTDATA __RPC_FAR *rgpunk,
  1404. ULONG __RPC_FAR *lpcFetched)
  1405. {
  1406. HRESULT hr;
  1407. ULONG cFetched = 0;
  1408. if((cConnections > 1) && (lpcFetched == 0))
  1409. return E_INVALIDARG;
  1410. hr = IEnumConnections_RemoteNext_Proxy(This, cConnections, rgpunk, &cFetched);
  1411. if(lpcFetched != 0)
  1412. *lpcFetched = cFetched;
  1413. return hr;
  1414. }
  1415. //+-------------------------------------------------------------------------
  1416. //
  1417. // Function: IEnumConnections_Next_Stub
  1418. //
  1419. // Synopsis: Server-side [call_as] wrapper function for
  1420. // IEnumConnections::Next.
  1421. //
  1422. //--------------------------------------------------------------------------
  1423. HRESULT STDMETHODCALLTYPE IEnumConnections_Next_Stub(
  1424. IEnumConnections __RPC_FAR * This,
  1425. ULONG cConnections,
  1426. CONNECTDATA __RPC_FAR *rgpunk,
  1427. ULONG __RPC_FAR *lpcFetched)
  1428. {
  1429. HRESULT hr;
  1430. hr = This->lpVtbl->Next(This, cConnections, rgpunk, lpcFetched);
  1431. if(FAILED(hr))
  1432. {
  1433. //If the server returns an error code, it must set *lpcFetched to zero.
  1434. ASSERT(*lpcFetched == 0);
  1435. //Set *lpcFetched to zero in case we have a badly behaved server.
  1436. *lpcFetched = 0;
  1437. }
  1438. return hr;
  1439. }
  1440. //+-------------------------------------------------------------------------
  1441. //
  1442. // Function: IEnumFORMATETC_Next_Proxy
  1443. //
  1444. // Synopsis: Client-side [call_as] wrapper function for
  1445. // IEnumFORMATETC::Next.
  1446. //
  1447. // Notes: If pceltFetched != 0, then the number of elements
  1448. // fetched will be returned in *pceltFetched. If an error
  1449. // occurs, then *pceltFetched is set to zero.
  1450. //
  1451. //--------------------------------------------------------------------------
  1452. HRESULT STDMETHODCALLTYPE IEnumFORMATETC_Next_Proxy(
  1453. IEnumFORMATETC __RPC_FAR * This,
  1454. ULONG celt,
  1455. FORMATETC __RPC_FAR *rgelt,
  1456. ULONG __RPC_FAR *pceltFetched)
  1457. {
  1458. HRESULT hr;
  1459. ULONG celtFetched = 0;
  1460. if((celt > 1) && (pceltFetched == 0))
  1461. return E_INVALIDARG;
  1462. hr = IEnumFORMATETC_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1463. if(pceltFetched != 0)
  1464. *pceltFetched = celtFetched;
  1465. return hr;
  1466. }
  1467. //+-------------------------------------------------------------------------
  1468. //
  1469. // Function: IEnumFORMATETC_Next_Stub
  1470. //
  1471. // Synopsis: Server-side [call_as] wrapper function for
  1472. // IEnumFORMATETC::Next.
  1473. //
  1474. //--------------------------------------------------------------------------
  1475. HRESULT STDMETHODCALLTYPE IEnumFORMATETC_Next_Stub(
  1476. IEnumFORMATETC __RPC_FAR * This,
  1477. ULONG celt,
  1478. FORMATETC __RPC_FAR *rgelt,
  1479. ULONG __RPC_FAR *pceltFetched)
  1480. {
  1481. HRESULT hr;
  1482. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1483. if(FAILED(hr))
  1484. {
  1485. //If the server returns an error code, it must set *pceltFetched to zero.
  1486. ASSERT(*pceltFetched == 0);
  1487. //Set *pceltFetched to zero in case we have a badly behaved server.
  1488. *pceltFetched = 0;
  1489. }
  1490. return hr;
  1491. }
  1492. //+-------------------------------------------------------------------------
  1493. //
  1494. // Function: IEnumMoniker_Next_Proxy
  1495. //
  1496. // Synopsis: Client-side [call_as] wrapper function for
  1497. // IEnumMoniker::Next.
  1498. //
  1499. // Notes: If pceltFetched != 0, then the number of elements
  1500. // fetched will be returned in *pceltFetched. If an error
  1501. // occurs, then *pceltFetched is set to zero.
  1502. //
  1503. //--------------------------------------------------------------------------
  1504. HRESULT STDMETHODCALLTYPE IEnumMoniker_Next_Proxy(
  1505. IEnumMoniker __RPC_FAR * This,
  1506. ULONG celt,
  1507. IMoniker __RPC_FAR *__RPC_FAR *rgelt,
  1508. ULONG __RPC_FAR *pceltFetched)
  1509. {
  1510. HRESULT hr;
  1511. ULONG celtFetched = 0;
  1512. if((celt > 1) && (pceltFetched == 0))
  1513. return E_INVALIDARG;
  1514. hr = IEnumMoniker_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1515. if(pceltFetched != 0)
  1516. *pceltFetched = celtFetched;
  1517. return hr;
  1518. }
  1519. //+-------------------------------------------------------------------------
  1520. //
  1521. // Function: IEnumMoniker_Next_Stub
  1522. //
  1523. // Synopsis: Server-side [call_as] wrapper function for
  1524. // IEnumMoniker::Next.
  1525. //
  1526. //--------------------------------------------------------------------------
  1527. HRESULT STDMETHODCALLTYPE IEnumMoniker_Next_Stub(
  1528. IEnumMoniker __RPC_FAR * This,
  1529. ULONG celt,
  1530. IMoniker __RPC_FAR *__RPC_FAR *rgelt,
  1531. ULONG __RPC_FAR *pceltFetched)
  1532. {
  1533. HRESULT hr;
  1534. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1535. if(FAILED(hr))
  1536. {
  1537. //If the server returns an error code, it must set *pceltFetched to zero.
  1538. ASSERT(*pceltFetched == 0);
  1539. //Set *pceltFetched to zero in case we have a badly behaved server.
  1540. *pceltFetched = 0;
  1541. }
  1542. return hr;
  1543. }
  1544. //+-------------------------------------------------------------------------
  1545. //
  1546. // Function: IEnumSTATDATA_Next_Proxy
  1547. //
  1548. // Synopsis: Client-side [call_as] wrapper function for
  1549. // IEnumSTATDATA::Next. This wrapper function handles the
  1550. // case where pceltFetched is NULL.
  1551. //
  1552. // Notes: If pceltFetched != 0, then the number of elements
  1553. // fetched will be returned in *pceltFetched. If an error
  1554. // occurs, then *pceltFetched is set to zero.
  1555. //
  1556. //--------------------------------------------------------------------------
  1557. HRESULT STDMETHODCALLTYPE IEnumSTATDATA_Next_Proxy(
  1558. IEnumSTATDATA __RPC_FAR * This,
  1559. ULONG celt,
  1560. STATDATA __RPC_FAR *rgelt,
  1561. ULONG __RPC_FAR *pceltFetched)
  1562. {
  1563. HRESULT hr;
  1564. ULONG celtFetched = 0;
  1565. if((celt > 1) && (pceltFetched == 0))
  1566. return E_INVALIDARG;
  1567. hr = IEnumSTATDATA_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1568. if(pceltFetched != 0)
  1569. *pceltFetched = celtFetched;
  1570. return hr;
  1571. }
  1572. //+-------------------------------------------------------------------------
  1573. //
  1574. // Function: IEnumSTATDATA_Next_Stub
  1575. //
  1576. // Synopsis: Server-side [call_as] wrapper function for
  1577. // IEnumSTATDATA::Next.
  1578. //
  1579. //--------------------------------------------------------------------------
  1580. HRESULT STDMETHODCALLTYPE IEnumSTATDATA_Next_Stub(
  1581. IEnumSTATDATA __RPC_FAR * This,
  1582. ULONG celt,
  1583. STATDATA __RPC_FAR *rgelt,
  1584. ULONG __RPC_FAR *pceltFetched)
  1585. {
  1586. HRESULT hr;
  1587. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1588. if(FAILED(hr))
  1589. {
  1590. //If the server returns an error code, it must set *pceltFetched to zero.
  1591. ASSERT(*pceltFetched == 0);
  1592. //Set *pceltFetched to zero in case we have a badly behaved server.
  1593. *pceltFetched = 0;
  1594. }
  1595. return hr;
  1596. }
  1597. //+-------------------------------------------------------------------------
  1598. //
  1599. // Function: IEnumSTATSTG_Next_Proxy
  1600. //
  1601. // Synopsis: Client-side [call_as] wrapper function for
  1602. // IEnumSTATSTG::Next. This wrapper function handles the case
  1603. // where pceltFetched is NULL.
  1604. //
  1605. // Notes: If pceltFetched != 0, then the number of elements
  1606. // fetched will be returned in *pceltFetched. If an error
  1607. // occurs, then *pceltFetched is set to zero.
  1608. //
  1609. //--------------------------------------------------------------------------
  1610. HRESULT STDMETHODCALLTYPE IEnumSTATSTG_Next_Proxy(
  1611. IEnumSTATSTG __RPC_FAR * This,
  1612. ULONG celt,
  1613. STATSTG __RPC_FAR *rgelt,
  1614. ULONG __RPC_FAR *pceltFetched)
  1615. {
  1616. HRESULT hr;
  1617. ULONG celtFetched = 0;
  1618. if((celt > 1) && (pceltFetched == 0))
  1619. return E_INVALIDARG;
  1620. hr = IEnumSTATSTG_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1621. if(pceltFetched != 0)
  1622. *pceltFetched = celtFetched;
  1623. return hr;
  1624. }
  1625. //+-------------------------------------------------------------------------
  1626. //
  1627. // Function: IEnumSTATSTG_Next_Stub
  1628. //
  1629. // Synopsis: Server-side [call_as] wrapper function for
  1630. // IEnumSTATSTG::Next.
  1631. //
  1632. //--------------------------------------------------------------------------
  1633. HRESULT STDMETHODCALLTYPE IEnumSTATSTG_Next_Stub(
  1634. IEnumSTATSTG __RPC_FAR * This,
  1635. ULONG celt,
  1636. STATSTG __RPC_FAR *rgelt,
  1637. ULONG __RPC_FAR *pceltFetched)
  1638. {
  1639. HRESULT hr;
  1640. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1641. if(FAILED(hr))
  1642. {
  1643. //If the server returns an error code, it must set *pceltFetched to zero.
  1644. ASSERT(*pceltFetched == 0);
  1645. //Set *pceltFetched to zero in case we have a badly behaved server.
  1646. *pceltFetched = 0;
  1647. }
  1648. return hr;
  1649. }
  1650. //+-------------------------------------------------------------------------
  1651. //
  1652. // Function: IEnumString_Next_Proxy
  1653. //
  1654. // Synopsis: Client-side [call_as] wrapper function for
  1655. // IEnumString::Next. This wrapper function handles the
  1656. // case where pceltFetched is NULL.
  1657. //
  1658. // Notes: If pceltFetched != 0, then the number of elements
  1659. // fetched will be returned in *pceltFetched. If an error
  1660. // occurs, then *pceltFetched is set to zero.
  1661. //
  1662. //--------------------------------------------------------------------------
  1663. HRESULT STDMETHODCALLTYPE IEnumString_Next_Proxy(
  1664. IEnumString __RPC_FAR * This,
  1665. ULONG celt,
  1666. LPOLESTR __RPC_FAR *rgelt,
  1667. ULONG __RPC_FAR *pceltFetched)
  1668. {
  1669. HRESULT hr;
  1670. ULONG celtFetched = 0;
  1671. if((celt > 1) && (pceltFetched == 0))
  1672. return E_INVALIDARG;
  1673. hr = IEnumString_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1674. if(pceltFetched != 0)
  1675. *pceltFetched = celtFetched;
  1676. return hr;
  1677. }
  1678. //+-------------------------------------------------------------------------
  1679. //
  1680. // Function: IEnumString_Next_Stub
  1681. //
  1682. // Synopsis: Server-side [call_as] wrapper function for
  1683. // IEnumString::Next.
  1684. //
  1685. //--------------------------------------------------------------------------
  1686. HRESULT STDMETHODCALLTYPE IEnumString_Next_Stub(
  1687. IEnumString __RPC_FAR * This,
  1688. ULONG celt,
  1689. LPOLESTR __RPC_FAR *rgelt,
  1690. ULONG __RPC_FAR *pceltFetched)
  1691. {
  1692. HRESULT hr;
  1693. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1694. if(FAILED(hr))
  1695. {
  1696. //If the server returns an error code, it must set *pceltFetched to zero.
  1697. ASSERT(*pceltFetched == 0);
  1698. //Set *pceltFetched to zero in case we have a badly behaved server.
  1699. *pceltFetched = 0;
  1700. }
  1701. return hr;
  1702. }
  1703. //+-------------------------------------------------------------------------
  1704. //
  1705. // Function: IEnumUnknown_Next_Proxy
  1706. //
  1707. // Synopsis: Client-side [call_as] wrapper function for
  1708. // IEnumUnknown::Next. This wrapper function handles the
  1709. // case where pceltFetched is NULL.
  1710. //
  1711. // Notes: If pceltFetched != 0, then the number of elements
  1712. // fetched will be returned in *pceltFetched. If an error
  1713. // occurs, then *pceltFetched is set to zero.
  1714. //
  1715. //--------------------------------------------------------------------------
  1716. HRESULT STDMETHODCALLTYPE IEnumUnknown_Next_Proxy(
  1717. IEnumUnknown __RPC_FAR * This,
  1718. ULONG celt,
  1719. IUnknown __RPC_FAR *__RPC_FAR *rgelt,
  1720. ULONG __RPC_FAR *pceltFetched)
  1721. {
  1722. HRESULT hr;
  1723. ULONG celtFetched = 0;
  1724. if((celt > 1) && (pceltFetched == 0))
  1725. return E_INVALIDARG;
  1726. hr = IEnumUnknown_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1727. if(pceltFetched != 0)
  1728. *pceltFetched = celtFetched;
  1729. return hr;
  1730. }
  1731. //+-------------------------------------------------------------------------
  1732. //
  1733. // Function: IEnumUnknown_Next_Stub
  1734. //
  1735. // Synopsis: Server-side [call_as] wrapper function for
  1736. // IEnumUnknown::Next.
  1737. //
  1738. //--------------------------------------------------------------------------
  1739. HRESULT STDMETHODCALLTYPE IEnumUnknown_Next_Stub(
  1740. IEnumUnknown __RPC_FAR * This,
  1741. ULONG celt,
  1742. IUnknown __RPC_FAR *__RPC_FAR *rgelt,
  1743. ULONG __RPC_FAR *pceltFetched)
  1744. {
  1745. HRESULT hr;
  1746. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1747. if(FAILED(hr))
  1748. {
  1749. //If the server returns an error code, it must set *pceltFetched to zero.
  1750. ASSERT(*pceltFetched == 0);
  1751. //Set *pceltFetched to zero in case we have a badly behaved server.
  1752. *pceltFetched = 0;
  1753. }
  1754. return hr;
  1755. }
  1756. //+-------------------------------------------------------------------------
  1757. //
  1758. // Function: IEnumOLEVERB_Next_Proxy
  1759. //
  1760. // Synopsis: Client-side [call_as] wrapper function for
  1761. // IEnumOLEVERB::Next. This wrapper function handles the case
  1762. // where pceltFetched is NULL.
  1763. //
  1764. // Notes: If pceltFetched != 0, then the number of elements
  1765. // fetched will be returned in *pceltFetched. If an error
  1766. // occurs, then *pceltFetched is set to zero.
  1767. //
  1768. //--------------------------------------------------------------------------
  1769. HRESULT STDMETHODCALLTYPE IEnumOLEVERB_Next_Proxy(
  1770. IEnumOLEVERB __RPC_FAR * This,
  1771. ULONG celt,
  1772. LPOLEVERB rgelt,
  1773. ULONG __RPC_FAR *pceltFetched)
  1774. {
  1775. HRESULT hr;
  1776. ULONG celtFetched = 0;
  1777. if((celt > 1) && (pceltFetched == 0))
  1778. return E_INVALIDARG;
  1779. hr = IEnumOLEVERB_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1780. if(pceltFetched != 0)
  1781. *pceltFetched = celtFetched;
  1782. return hr;
  1783. }
  1784. //+-------------------------------------------------------------------------
  1785. //
  1786. // Function: IEnumOLEVERB_Next_Stub
  1787. //
  1788. // Synopsis: Server-side [call_as] wrapper function for
  1789. // IEnumOLEVERB::Next.
  1790. //
  1791. //--------------------------------------------------------------------------
  1792. HRESULT STDMETHODCALLTYPE IEnumOLEVERB_Next_Stub(
  1793. IEnumOLEVERB __RPC_FAR * This,
  1794. ULONG celt,
  1795. LPOLEVERB rgelt,
  1796. ULONG __RPC_FAR *pceltFetched)
  1797. {
  1798. HRESULT hr;
  1799. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1800. if(FAILED(hr))
  1801. {
  1802. //If the server returns an error code, it must set *pceltFetched to zero.
  1803. ASSERT(*pceltFetched == 0);
  1804. //Set *pceltFetched to zero in case we have a badly behaved server.
  1805. *pceltFetched = 0;
  1806. }
  1807. return hr;
  1808. }
  1809. //+-------------------------------------------------------------------------
  1810. //
  1811. // Function: ILockBytes_ReadAt_Proxy
  1812. //
  1813. // Synopsis: Client-side [call_as] wrapper function for
  1814. // ILockBytes::ReadAt. This wrapper function
  1815. // handles the case where pcbRead is NULL.
  1816. //
  1817. // Notes: If pcbRead != 0, then the number of bytes read
  1818. // will be returned in *pcbRead. If an error
  1819. // occurs, then *pcbRead is set to zero.
  1820. //
  1821. //--------------------------------------------------------------------------
  1822. HRESULT STDMETHODCALLTYPE ILockBytes_ReadAt_Proxy(
  1823. ILockBytes __RPC_FAR * This,
  1824. ULARGE_INTEGER ulOffset,
  1825. void __RPC_FAR *pv,
  1826. ULONG cb,
  1827. ULONG __RPC_FAR *pcbRead)
  1828. {
  1829. HRESULT hr;
  1830. ULONG cbRead = 0;
  1831. hr = ILockBytes_RemoteReadAt_Proxy(This, ulOffset, (byte __RPC_FAR *) pv, cb, &cbRead);
  1832. if(pcbRead != 0)
  1833. *pcbRead = cbRead;
  1834. return hr;
  1835. }
  1836. //+-------------------------------------------------------------------------
  1837. //
  1838. // Function: ILockBytes_ReadAt_Stub
  1839. //
  1840. // Synopsis: Server-side [call_as] wrapper function for
  1841. // ILockBytes::ReadAt.
  1842. //
  1843. //--------------------------------------------------------------------------
  1844. HRESULT STDMETHODCALLTYPE ILockBytes_ReadAt_Stub(
  1845. ILockBytes __RPC_FAR * This,
  1846. ULARGE_INTEGER ulOffset,
  1847. byte __RPC_FAR *pv,
  1848. ULONG cb,
  1849. ULONG __RPC_FAR *pcbRead)
  1850. {
  1851. HRESULT hr;
  1852. *pcbRead = 0;
  1853. hr = This->lpVtbl->ReadAt(This, ulOffset, (void __RPC_FAR *) pv, cb, pcbRead);
  1854. return hr;
  1855. }
  1856. //+-------------------------------------------------------------------------
  1857. //
  1858. // Function: ILockBytes_WriteAt_Proxy
  1859. //
  1860. // Synopsis: Client-side [call_as] wrapper function for
  1861. // ILockBytes::WriteAt. This wrapper function handles the
  1862. // case where pcbWritten is NULL.
  1863. //
  1864. // Notes: If pcbWritten != 0, then the number of bytes written
  1865. // will be returned in *pcbWritten. If an error
  1866. // occurs, then *pcbWritten is set to zero.
  1867. //
  1868. // History: ? ? Created
  1869. // 05-27-94 AlexT Actually return count of bytes written
  1870. //
  1871. //--------------------------------------------------------------------------
  1872. HRESULT STDMETHODCALLTYPE ILockBytes_WriteAt_Proxy(
  1873. ILockBytes __RPC_FAR * This,
  1874. ULARGE_INTEGER ulOffset,
  1875. const void __RPC_FAR *pv,
  1876. ULONG cb,
  1877. ULONG __RPC_FAR *pcbWritten)
  1878. {
  1879. HRESULT hr;
  1880. ULONG cbWritten = 0;
  1881. #if DBG == 1
  1882. //validate parameters.
  1883. if(pv == 0)
  1884. return STG_E_INVALIDPOINTER;
  1885. #endif
  1886. hr = ILockBytes_RemoteWriteAt_Proxy(This, ulOffset, (byte __RPC_FAR *)pv, cb, &cbWritten);
  1887. if(pcbWritten != 0)
  1888. *pcbWritten = cbWritten;
  1889. return hr;
  1890. }
  1891. //+-------------------------------------------------------------------------
  1892. //
  1893. // Function: ILockBytes_WriteAt_Stub
  1894. //
  1895. // Synopsis: Server-side [call_as] wrapper function for
  1896. // ILockBytes::WriteAt.
  1897. //
  1898. //--------------------------------------------------------------------------
  1899. HRESULT STDMETHODCALLTYPE ILockBytes_WriteAt_Stub(
  1900. ILockBytes __RPC_FAR * This,
  1901. ULARGE_INTEGER ulOffset,
  1902. const byte __RPC_FAR *pv,
  1903. ULONG cb,
  1904. ULONG __RPC_FAR *pcbWritten)
  1905. {
  1906. HRESULT hr;
  1907. *pcbWritten = 0;
  1908. hr = This->lpVtbl->WriteAt(This, ulOffset, pv, cb, pcbWritten);
  1909. return hr;
  1910. }
  1911. //+-------------------------------------------------------------------------
  1912. //
  1913. // Function: IMoniker_BindToObject_Proxy
  1914. //
  1915. // Synopsis: Client-side [call_as] wrapper function for
  1916. // IMoniker::BindToObject.
  1917. //
  1918. //--------------------------------------------------------------------------
  1919. HRESULT STDMETHODCALLTYPE IMoniker_BindToObject_Proxy(
  1920. IMoniker __RPC_FAR * This,
  1921. IBindCtx __RPC_FAR *pbc,
  1922. IMoniker __RPC_FAR *pmkToLeft,
  1923. REFIID riid,
  1924. void __RPC_FAR *__RPC_FAR *ppvObj)
  1925. {
  1926. HRESULT hr;
  1927. *ppvObj = 0;
  1928. hr = IMoniker_RemoteBindToObject_Proxy(
  1929. This, pbc, pmkToLeft, riid, (IUnknown **) ppvObj);
  1930. return hr;
  1931. }
  1932. //+-------------------------------------------------------------------------
  1933. //
  1934. // Function: IMoniker_BindToObject_Stub
  1935. //
  1936. // Synopsis: Server-side [call_as] wrapper function for
  1937. // IMoniker::BindToObject.
  1938. //
  1939. //--------------------------------------------------------------------------
  1940. HRESULT STDMETHODCALLTYPE IMoniker_BindToObject_Stub(
  1941. IMoniker __RPC_FAR * This,
  1942. IBindCtx __RPC_FAR *pbc,
  1943. IMoniker __RPC_FAR *pmkToLeft,
  1944. REFIID riid,
  1945. IUnknown __RPC_FAR *__RPC_FAR *ppvObj)
  1946. {
  1947. HRESULT hr;
  1948. hr = This->lpVtbl->BindToObject(
  1949. This, pbc, pmkToLeft, riid, (void **) ppvObj);
  1950. if(FAILED(hr))
  1951. {
  1952. //If the server returns an error code, it must set *ppvObj to zero.
  1953. ASSERT(*ppvObj == 0);
  1954. //Set it to zero in case we have a badly behaved server.
  1955. *ppvObj = 0;
  1956. }
  1957. return hr;
  1958. }
  1959. //+-------------------------------------------------------------------------
  1960. //
  1961. // Function: IMoniker_BindToStorage_Proxy
  1962. //
  1963. // Synopsis: Client-side [call_as] wrapper function for
  1964. // IMoniker::BindToStorage.
  1965. //
  1966. //--------------------------------------------------------------------------
  1967. HRESULT STDMETHODCALLTYPE IMoniker_BindToStorage_Proxy(
  1968. IMoniker __RPC_FAR * This,
  1969. IBindCtx __RPC_FAR *pbc,
  1970. IMoniker __RPC_FAR *pmkToLeft,
  1971. REFIID riid,
  1972. void __RPC_FAR *__RPC_FAR *ppvObj)
  1973. {
  1974. HRESULT hr;
  1975. *ppvObj = 0;
  1976. hr = IMoniker_RemoteBindToStorage_Proxy(
  1977. This, pbc, pmkToLeft, riid, (IUnknown **)ppvObj);
  1978. return hr;
  1979. }
  1980. //+-------------------------------------------------------------------------
  1981. //
  1982. // Function: IMoniker_BindToStorage_Stub
  1983. //
  1984. // Synopsis: Server-side [call_as] wrapper function for
  1985. // IMoniker::BindToStorage.
  1986. //
  1987. //--------------------------------------------------------------------------
  1988. HRESULT STDMETHODCALLTYPE IMoniker_BindToStorage_Stub(
  1989. IMoniker __RPC_FAR * This,
  1990. IBindCtx __RPC_FAR *pbc,
  1991. IMoniker __RPC_FAR *pmkToLeft,
  1992. REFIID riid,
  1993. IUnknown __RPC_FAR *__RPC_FAR *ppvObj)
  1994. {
  1995. HRESULT hr;
  1996. hr = This->lpVtbl->BindToStorage(
  1997. This, pbc, pmkToLeft, riid, (void **) ppvObj);
  1998. if(FAILED(hr))
  1999. {
  2000. //If the server returns an error code, it must set *ppvObj to zero.
  2001. ASSERT(*ppvObj == 0);
  2002. //Set it to zero in case we have a badly behaved server.
  2003. *ppvObj = 0;
  2004. }
  2005. return hr;
  2006. }
  2007. //+-------------------------------------------------------------------------
  2008. //
  2009. // Function: IOleCache2_UpdateCache_Proxy
  2010. //
  2011. // Synopsis: Client-side [call_as] wrapper function for
  2012. // IOleCache2:UpdateCache
  2013. //
  2014. //--------------------------------------------------------------------------
  2015. HRESULT STDMETHODCALLTYPE IOleCache2_UpdateCache_Proxy(
  2016. IOleCache2 __RPC_FAR * This,
  2017. LPDATAOBJECT pDataObject,
  2018. DWORD grfUpdf,
  2019. LPVOID pReserved)
  2020. {
  2021. HRESULT hr;
  2022. hr = IOleCache2_RemoteUpdateCache_Proxy(This,
  2023. pDataObject,
  2024. grfUpdf,
  2025. (LONG_PTR) pReserved);
  2026. return hr;
  2027. }
  2028. //+-------------------------------------------------------------------------
  2029. //
  2030. // Function: IOleCache2_UpdateCache_Stub
  2031. //
  2032. // Synopsis: Server-side [call_as] wrapper function for
  2033. // IOleCache2::UpdateCache.
  2034. //
  2035. //--------------------------------------------------------------------------
  2036. HRESULT STDMETHODCALLTYPE IOleCache2_UpdateCache_Stub(
  2037. IOleCache2 __RPC_FAR * This,
  2038. LPDATAOBJECT pDataObject,
  2039. DWORD grfUpdf,
  2040. LONG_PTR pReserved)
  2041. {
  2042. HRESULT hr;
  2043. hr = This->lpVtbl->UpdateCache(This,
  2044. pDataObject,
  2045. grfUpdf,
  2046. (void *)pReserved);
  2047. return hr;
  2048. }
  2049. //+-------------------------------------------------------------------------
  2050. //
  2051. // Function: IOleInPlaceActiveObject_TranslateAccelerator_Proxy
  2052. //
  2053. // Synopsis: Client-side [call_as] wrapper function for
  2054. // IOleInPlaceActiveObject::TranslateAccelerator.
  2055. //
  2056. // Returns: This function always returns S_FALSE.
  2057. //
  2058. // Notes: A container needs to process accelerators differently
  2059. // depending on whether an inplace server is running
  2060. // in process or as a local server. When the container
  2061. // calls IOleInPlaceActiveObject::TranslateAccelerator on
  2062. // an inprocess server, the server can return S_OK if it
  2063. // successfully translated the message. When the container
  2064. // calls IOleInPlaceActiveObject::TranslateAccelerator on
  2065. // a local server, the proxy will always return S_FALSE.
  2066. // In other words, a local server never gets the opportunity
  2067. // to translate messages from the container.
  2068. //
  2069. //--------------------------------------------------------------------------
  2070. HRESULT STDMETHODCALLTYPE IOleInPlaceActiveObject_TranslateAccelerator_Proxy(
  2071. IOleInPlaceActiveObject __RPC_FAR * This,
  2072. LPMSG lpmsg)
  2073. {
  2074. return S_FALSE;
  2075. }
  2076. //+-------------------------------------------------------------------------
  2077. //
  2078. // Function: IOleInPlaceActiveObject_TranslateAccelerator_Stub
  2079. //
  2080. // Synopsis: Server-side [call_as] wrapper function for
  2081. // IOleInPlaceActiveObject::TranslateAccelerator
  2082. //
  2083. // Notes: This function should never be called.
  2084. //
  2085. //--------------------------------------------------------------------------
  2086. HRESULT STDMETHODCALLTYPE IOleInPlaceActiveObject_TranslateAccelerator_Stub(
  2087. IOleInPlaceActiveObject __RPC_FAR * This)
  2088. {
  2089. return S_FALSE;
  2090. }
  2091. //+-------------------------------------------------------------------------
  2092. //
  2093. // Function: IOleInPlaceActiveObject_ResizeBorder_Proxy
  2094. //
  2095. // Synopsis: Client-side [call_as] wrapper function for
  2096. // IOleInPlaceActiveObject::ResizeBorder
  2097. //
  2098. // Notes: The pUIWindow interface is either an IOleInPlaceUIWindow or
  2099. // an IOleInPlaceFrame, based on fFrameWindow. We use
  2100. // fFrameWindow to tell the proxy exactly which interace it
  2101. // is so that it gets marshalled and unmarshalled correctly.
  2102. //
  2103. //--------------------------------------------------------------------------
  2104. HRESULT STDMETHODCALLTYPE IOleInPlaceActiveObject_ResizeBorder_Proxy(
  2105. IOleInPlaceActiveObject __RPC_FAR * This,
  2106. LPCRECT prcBorder,
  2107. IOleInPlaceUIWindow *pUIWindow,
  2108. BOOL fFrameWindow)
  2109. {
  2110. HRESULT hr;
  2111. REFIID riid;
  2112. if (fFrameWindow)
  2113. {
  2114. riid = &IID_IOleInPlaceFrame;
  2115. }
  2116. else
  2117. {
  2118. riid = &IID_IOleInPlaceUIWindow;
  2119. }
  2120. hr = IOleInPlaceActiveObject_RemoteResizeBorder_Proxy(
  2121. This, prcBorder, riid, pUIWindow, fFrameWindow);
  2122. return(hr);
  2123. }
  2124. //+-------------------------------------------------------------------------
  2125. //
  2126. // Function: IOleInPlaceActiveObject_ResizeBorder_Stub
  2127. //
  2128. // Synopsis: Server-side [call_as] wrapper function for
  2129. // IOleInPlaceActiveObject::ResizeBorder
  2130. //
  2131. //--------------------------------------------------------------------------
  2132. HRESULT STDMETHODCALLTYPE IOleInPlaceActiveObject_ResizeBorder_Stub(
  2133. IOleInPlaceActiveObject __RPC_FAR * This,
  2134. LPCRECT prcBorder,
  2135. REFIID riid,
  2136. IOleInPlaceUIWindow *pUIWindow,
  2137. BOOL fFrameWindow)
  2138. {
  2139. HRESULT hr;
  2140. hr = This->lpVtbl->ResizeBorder(This, prcBorder, pUIWindow, fFrameWindow);
  2141. return(hr);
  2142. }
  2143. //+-------------------------------------------------------------------------
  2144. //
  2145. // Function: IStorage_OpenStream_Proxy
  2146. //
  2147. // Synopsis: Client-side [call_as] wrapper function for
  2148. // IStorage::OpenStream.
  2149. //
  2150. //--------------------------------------------------------------------------
  2151. HRESULT STDMETHODCALLTYPE IStorage_OpenStream_Proxy(
  2152. IStorage __RPC_FAR * This,
  2153. const OLECHAR __RPC_FAR *pwcsName,
  2154. void __RPC_FAR *pReserved1,
  2155. DWORD grfMode,
  2156. DWORD reserved2,
  2157. IStream __RPC_FAR *__RPC_FAR *ppstm)
  2158. {
  2159. HRESULT hr;
  2160. #if DBG == 1
  2161. if(pReserved1 != 0)
  2162. return STG_E_INVALIDPARAMETER;
  2163. #endif
  2164. *ppstm = 0;
  2165. hr = IStorage_RemoteOpenStream_Proxy(
  2166. This, pwcsName, 0, 0, grfMode, reserved2, ppstm);
  2167. return hr;
  2168. }
  2169. //+-------------------------------------------------------------------------
  2170. //
  2171. // Function: IStorage_OpenStream_Stub
  2172. //
  2173. // Synopsis: Server-side [call_as] wrapper function for
  2174. // IStorage::OpenStream.
  2175. //
  2176. //--------------------------------------------------------------------------
  2177. HRESULT STDMETHODCALLTYPE IStorage_OpenStream_Stub(
  2178. IStorage __RPC_FAR * This,
  2179. const OLECHAR __RPC_FAR *pwcsName,
  2180. unsigned long cbReserved1,
  2181. byte __RPC_FAR *reserved1,
  2182. DWORD grfMode,
  2183. DWORD reserved2,
  2184. IStream __RPC_FAR *__RPC_FAR *ppstm)
  2185. {
  2186. HRESULT hr;
  2187. hr = This->lpVtbl->OpenStream(This, pwcsName, 0, grfMode, reserved2, ppstm);
  2188. if(FAILED(hr))
  2189. {
  2190. //If the server returns an error code, it must set *ppstm to zero.
  2191. ASSERT(*ppstm == 0);
  2192. //Set *ppstm to zero in case we have a badly behaved server.
  2193. *ppstm = 0;
  2194. }
  2195. return hr;
  2196. }
  2197. //+-------------------------------------------------------------------------
  2198. //
  2199. // Function: IStorage_EnumElements_Proxy
  2200. //
  2201. // Synopsis: Client-side [call_as] wrapper function for
  2202. // IStorage_EnumElements_Proxy
  2203. //
  2204. //--------------------------------------------------------------------------
  2205. HRESULT STDMETHODCALLTYPE IStorage_EnumElements_Proxy(
  2206. IStorage __RPC_FAR * This,
  2207. DWORD reserved1,
  2208. void __RPC_FAR *reserved2,
  2209. DWORD reserved3,
  2210. IEnumSTATSTG __RPC_FAR *__RPC_FAR *ppenum)
  2211. {
  2212. HRESULT hr;
  2213. *ppenum = 0;
  2214. hr = IStorage_RemoteEnumElements_Proxy(
  2215. This, reserved1, 0, 0, reserved3, ppenum);
  2216. return hr;
  2217. }
  2218. //+-------------------------------------------------------------------------
  2219. //
  2220. // Function: IStorage_EnumElements_Stub
  2221. //
  2222. // Synopsis: Server-side [call_as] wrapper function for
  2223. // IStorage::EnumElements.
  2224. //
  2225. //--------------------------------------------------------------------------
  2226. HRESULT STDMETHODCALLTYPE IStorage_EnumElements_Stub(
  2227. IStorage __RPC_FAR * This,
  2228. DWORD reserved1,
  2229. unsigned long cbReserved2,
  2230. byte __RPC_FAR *reserved2,
  2231. DWORD reserved3,
  2232. IEnumSTATSTG __RPC_FAR *__RPC_FAR *ppenum)
  2233. {
  2234. HRESULT hr;
  2235. hr = This->lpVtbl->EnumElements(This, reserved1, 0, reserved3, ppenum);
  2236. if(FAILED(hr))
  2237. {
  2238. //If the server returns an error code, it must set *ppenum to zero.
  2239. ASSERT(*ppenum == 0);
  2240. //Set *ppenum to zero in case we have a badly behaved server.
  2241. *ppenum = 0;
  2242. }
  2243. return hr;
  2244. }
  2245. //+-------------------------------------------------------------------------
  2246. //
  2247. // Function: IRunnableObject_IsRunning_Proxy
  2248. //
  2249. // Synopsis: Client-side [call_as] wrapper function for
  2250. // IRunnableObject::IsRunning.
  2251. //
  2252. //--------------------------------------------------------------------------
  2253. BOOL STDMETHODCALLTYPE IRunnableObject_IsRunning_Proxy(
  2254. IRunnableObject __RPC_FAR * This)
  2255. {
  2256. BOOL bIsRunning = TRUE;
  2257. HRESULT hr;
  2258. hr = IRunnableObject_RemoteIsRunning_Proxy(This);
  2259. if(S_FALSE == hr)
  2260. bIsRunning = FALSE;
  2261. return bIsRunning;
  2262. }
  2263. //+-------------------------------------------------------------------------
  2264. //
  2265. // Function: IRunnableObject_IsRunning_Stub
  2266. //
  2267. // Synopsis: Server-side [call_as] wrapper function for
  2268. // IRunnableObject::IsRunning.
  2269. //
  2270. //--------------------------------------------------------------------------
  2271. HRESULT STDMETHODCALLTYPE IRunnableObject_IsRunning_Stub(
  2272. IRunnableObject __RPC_FAR * This)
  2273. {
  2274. HRESULT hr;
  2275. BOOL bIsRunning;
  2276. bIsRunning = This->lpVtbl->IsRunning(This);
  2277. if(TRUE == bIsRunning)
  2278. hr = S_OK;
  2279. else
  2280. hr = S_FALSE;
  2281. return hr;
  2282. }
  2283. //+-------------------------------------------------------------------------
  2284. //
  2285. // Function: ISequentialStream_Read_Proxy
  2286. //
  2287. // Synopsis: Client-side [call_as] wrapper function for
  2288. // IStream::Read. This wrapper function handles the case
  2289. // where pcbRead is NULL.
  2290. //
  2291. // Notes: If pcbRead != 0, then the number of bytes read
  2292. // will be returned in *pcbRead. If an error
  2293. // occurs, then *pcbRead is set to zero.
  2294. //
  2295. //--------------------------------------------------------------------------
  2296. HRESULT STDMETHODCALLTYPE ISequentialStream_Read_Proxy(
  2297. ISequentialStream __RPC_FAR * This,
  2298. void __RPC_FAR *pv,
  2299. ULONG cb,
  2300. ULONG __RPC_FAR *pcbRead)
  2301. {
  2302. HRESULT hr;
  2303. ULONG cbRead = 0;
  2304. #if DBG == 1
  2305. //validate parameters.
  2306. if(pv == 0)
  2307. return STG_E_INVALIDPOINTER;
  2308. #endif //DBG == 1
  2309. hr = ISequentialStream_RemoteRead_Proxy(This, (byte *) pv, cb, &cbRead);
  2310. if(pcbRead != 0)
  2311. *pcbRead = cbRead;
  2312. return hr;
  2313. }
  2314. //+-------------------------------------------------------------------------
  2315. //
  2316. // Function: ISequentialStream_Read_Stub
  2317. //
  2318. // Synopsis: Server-side [call_as] wrapper function for
  2319. // IStream::Read.
  2320. //
  2321. //--------------------------------------------------------------------------
  2322. HRESULT STDMETHODCALLTYPE ISequentialStream_Read_Stub(
  2323. ISequentialStream __RPC_FAR * This,
  2324. byte __RPC_FAR *pv,
  2325. ULONG cb,
  2326. ULONG __RPC_FAR *pcbRead)
  2327. {
  2328. HRESULT hr;
  2329. *pcbRead = 0;
  2330. hr = This->lpVtbl->Read(This, (void *) pv, cb, pcbRead);
  2331. return hr;
  2332. }
  2333. //+-------------------------------------------------------------------------
  2334. //
  2335. // Function: IStream_Seek_Proxy
  2336. //
  2337. // Synopsis: Client-side [call_as] wrapper function for
  2338. // IStream::Seek. This wrapper function handles the case
  2339. // where plibNewPosition is NULL.
  2340. //
  2341. // Notes: If plibNewPosition != 0, then the new position
  2342. // will be returned in *plibNewPosition.
  2343. //
  2344. //--------------------------------------------------------------------------
  2345. HRESULT STDMETHODCALLTYPE IStream_Seek_Proxy(
  2346. IStream __RPC_FAR * This,
  2347. LARGE_INTEGER dlibMove,
  2348. DWORD dwOrigin,
  2349. ULARGE_INTEGER __RPC_FAR *plibNewPosition)
  2350. {
  2351. HRESULT hr;
  2352. ULARGE_INTEGER libNewPosition;
  2353. hr = IStream_RemoteSeek_Proxy(This, dlibMove, dwOrigin, &libNewPosition);
  2354. if(plibNewPosition != 0)
  2355. {
  2356. *plibNewPosition = libNewPosition;
  2357. }
  2358. return hr;
  2359. }
  2360. //+-------------------------------------------------------------------------
  2361. //
  2362. // Function: IStream_Seek_Stub
  2363. //
  2364. // Synopsis: Server-side [call_as] wrapper function for
  2365. // IStream::Seek.
  2366. //
  2367. //--------------------------------------------------------------------------
  2368. HRESULT STDMETHODCALLTYPE IStream_Seek_Stub(
  2369. IStream __RPC_FAR * This,
  2370. LARGE_INTEGER dlibMove,
  2371. DWORD dwOrigin,
  2372. ULARGE_INTEGER __RPC_FAR *plibNewPosition)
  2373. {
  2374. HRESULT hr;
  2375. hr = This->lpVtbl->Seek(This, dlibMove, dwOrigin, plibNewPosition);
  2376. return hr;
  2377. }
  2378. //+-------------------------------------------------------------------------
  2379. //
  2380. // Function: ISequentialStream_Write_Proxy
  2381. //
  2382. // Synopsis: Client-side [call_as] wrapper function for
  2383. // IStream::Write. This wrapper function handles the
  2384. // case where pcbWritten is NULL.
  2385. //
  2386. // Notes: If pcbWritten != 0, then the number of bytes written
  2387. // will be returned in *pcbWritten. If an error
  2388. // occurs, then *pcbWritten is set to zero.
  2389. //
  2390. //--------------------------------------------------------------------------
  2391. HRESULT STDMETHODCALLTYPE ISequentialStream_Write_Proxy(
  2392. ISequentialStream __RPC_FAR * This,
  2393. const void __RPC_FAR *pv,
  2394. ULONG cb,
  2395. ULONG __RPC_FAR *pcbWritten)
  2396. {
  2397. HRESULT hr;
  2398. ULONG cbWritten = 0;
  2399. #if DBG == 1
  2400. //validate parameters.
  2401. if(pv == 0)
  2402. return STG_E_INVALIDPOINTER;
  2403. #endif
  2404. hr = ISequentialStream_RemoteWrite_Proxy(This, (byte *) pv, cb, &cbWritten);
  2405. if(pcbWritten != 0)
  2406. *pcbWritten = cbWritten;
  2407. return hr;
  2408. }
  2409. //+-------------------------------------------------------------------------
  2410. //
  2411. // Function: ISequentialStream_Write_Stub
  2412. //
  2413. // Synopsis: Server-side [call_as] wrapper function for
  2414. // ISequentialStream::Write.
  2415. //
  2416. //--------------------------------------------------------------------------
  2417. HRESULT STDMETHODCALLTYPE ISequentialStream_Write_Stub(
  2418. ISequentialStream __RPC_FAR * This,
  2419. const byte __RPC_FAR *pv,
  2420. ULONG cb,
  2421. ULONG __RPC_FAR *pcbWritten)
  2422. {
  2423. HRESULT hr;
  2424. *pcbWritten = 0;
  2425. hr = This->lpVtbl->Write(This, (const void __RPC_FAR *) pv, cb, pcbWritten);
  2426. return hr;
  2427. }
  2428. //+-------------------------------------------------------------------------
  2429. //
  2430. // Function: IStream_CopyTo_Proxy
  2431. //
  2432. // Synopsis: Client-side [call_as] wrapper function for
  2433. // IStream::CopyTo. This wrapper function handles the
  2434. // cases where pcbRead is NULL or pcbWritten is NULL.
  2435. //
  2436. // Notes: If pcbRead != 0, then the number of bytes read
  2437. // will be returned in *pcbRead. If an error
  2438. // occurs, then *pcbRead is set to zero.
  2439. //
  2440. // If pcbWritten != 0, then the number of bytes written
  2441. // will be returned in *pcbWritten. If an error
  2442. // occurs, then *pcbWritten is set to zero.
  2443. //
  2444. //--------------------------------------------------------------------------
  2445. HRESULT STDMETHODCALLTYPE IStream_CopyTo_Proxy(
  2446. IStream __RPC_FAR * This,
  2447. IStream __RPC_FAR *pstm,
  2448. ULARGE_INTEGER cb,
  2449. ULARGE_INTEGER __RPC_FAR *pcbRead,
  2450. ULARGE_INTEGER __RPC_FAR *pcbWritten)
  2451. {
  2452. HRESULT hr;
  2453. ULARGE_INTEGER cbRead;
  2454. ULARGE_INTEGER cbWritten;
  2455. cbRead.LowPart = 0;
  2456. cbRead.HighPart = 0;
  2457. cbWritten.LowPart = 0;
  2458. cbWritten.HighPart = 0;
  2459. hr = IStream_RemoteCopyTo_Proxy(This, pstm, cb, &cbRead, &cbWritten);
  2460. if(pcbRead != 0)
  2461. *pcbRead = cbRead;
  2462. if(pcbWritten != 0)
  2463. *pcbWritten = cbWritten;
  2464. return hr;
  2465. }
  2466. //+-------------------------------------------------------------------------
  2467. //
  2468. // Function: IStream_CopyTo_Stub
  2469. //
  2470. // Synopsis: Server-side [call_as] wrapper function for
  2471. // IStream::CopyTo.
  2472. //
  2473. //--------------------------------------------------------------------------
  2474. HRESULT STDMETHODCALLTYPE IStream_CopyTo_Stub(
  2475. IStream __RPC_FAR * This,
  2476. IStream __RPC_FAR *pstm,
  2477. ULARGE_INTEGER cb,
  2478. ULARGE_INTEGER __RPC_FAR *pcbRead,
  2479. ULARGE_INTEGER __RPC_FAR *pcbWritten)
  2480. {
  2481. HRESULT hr;
  2482. pcbRead->LowPart = 0;
  2483. pcbRead->HighPart = 0;
  2484. pcbWritten->LowPart = 0;
  2485. pcbWritten->HighPart = 0;
  2486. hr = This->lpVtbl->CopyTo(This, pstm, cb, pcbRead, pcbWritten);
  2487. return hr;
  2488. }
  2489. //+-------------------------------------------------------------------------
  2490. //
  2491. // Function: IViewObject_Draw_Proxy
  2492. //
  2493. // Synopsis: Client-side [call_as] wrapper function for
  2494. // IViewObject::Draw.
  2495. //
  2496. //--------------------------------------------------------------------------
  2497. HRESULT STDMETHODCALLTYPE IViewObject_Draw_Proxy(
  2498. IViewObject __RPC_FAR * This,
  2499. DWORD dwDrawAspect,
  2500. LONG lindex,
  2501. void __RPC_FAR *pvAspect,
  2502. DVTARGETDEVICE __RPC_FAR *ptd,
  2503. HDC hdcTargetDev,
  2504. HDC hdcDraw,
  2505. LPCRECTL lprcBounds,
  2506. LPCRECTL lprcWBounds,
  2507. BOOL (STDMETHODCALLTYPE __RPC_FAR *pfnContinue )(ULONG_PTR dwContinue),
  2508. ULONG_PTR dwContinue)
  2509. {
  2510. HRESULT hr;
  2511. IContinue *pContinue = 0;
  2512. if(pvAspect != 0)
  2513. return E_INVALIDARG;
  2514. if(pfnContinue != 0)
  2515. {
  2516. hr = CreateCallback(pfnContinue, dwContinue, &pContinue);
  2517. if(FAILED(hr))
  2518. {
  2519. return hr;
  2520. }
  2521. }
  2522. hr = IViewObject_RemoteDraw_Proxy(This,
  2523. dwDrawAspect,
  2524. lindex,
  2525. (LONG_PTR) pvAspect,
  2526. ptd,
  2527. (LONG_PTR) hdcTargetDev,
  2528. (LONG_PTR) hdcDraw,
  2529. lprcBounds,
  2530. lprcWBounds,
  2531. pContinue);
  2532. if(pContinue != 0)
  2533. {
  2534. pContinue->lpVtbl->Release(pContinue);
  2535. }
  2536. return hr;
  2537. }
  2538. //+-------------------------------------------------------------------------
  2539. //
  2540. // Function: IViewObject_RemoteContinue
  2541. //
  2542. // Synopsis: Wrapper function for IContinue::FContinue. This function
  2543. // is used for marshalling the pfnContinue parameter in
  2544. // IViewObject::Draw.
  2545. //
  2546. // Algorithm: Cast the dwContinue to an IContinue * and then
  2547. // call IContinue::FContinue.
  2548. //
  2549. //--------------------------------------------------------------------------
  2550. BOOL STDAPICALLTYPE IViewObject_RemoteContinue(ULONG_PTR dwContinue)
  2551. {
  2552. BOOL bContinue = TRUE;
  2553. HRESULT hr;
  2554. IContinue *pContinue = (IContinue *) dwContinue;
  2555. if(pContinue != 0)
  2556. {
  2557. hr = pContinue->lpVtbl->FContinue(pContinue);
  2558. if(S_FALSE == hr)
  2559. bContinue = FALSE;
  2560. }
  2561. return bContinue;
  2562. }
  2563. //+-------------------------------------------------------------------------
  2564. //
  2565. // Function: IViewObject_Draw_Stub
  2566. //
  2567. // Synopsis: Server-side [call_as] wrapper function for
  2568. // IViewObject::Draw.
  2569. //
  2570. //--------------------------------------------------------------------------
  2571. HRESULT STDMETHODCALLTYPE IViewObject_Draw_Stub(
  2572. IViewObject __RPC_FAR * This,
  2573. DWORD dwDrawAspect,
  2574. LONG lindex,
  2575. ULONG_PTR pvAspect,
  2576. DVTARGETDEVICE __RPC_FAR *ptd,
  2577. ULONG_PTR hdcTargetDev,
  2578. ULONG_PTR hdcDraw,
  2579. LPCRECTL lprcBounds,
  2580. LPCRECTL lprcWBounds,
  2581. IContinue *pContinue)
  2582. {
  2583. HRESULT hr;
  2584. BOOL (STDMETHODCALLTYPE __RPC_FAR *pfnContinue )(ULONG_PTR dwContinue) = 0;
  2585. ULONG_PTR dwContinue = 0;
  2586. if(pContinue != 0)
  2587. {
  2588. pfnContinue = IViewObject_RemoteContinue;
  2589. dwContinue = (ULONG_PTR) pContinue;
  2590. }
  2591. hr = This->lpVtbl->Draw(This,
  2592. dwDrawAspect,
  2593. lindex,
  2594. (void *) pvAspect,
  2595. ptd,
  2596. (HDC) hdcTargetDev,
  2597. (HDC) hdcDraw,
  2598. lprcBounds,
  2599. lprcWBounds,
  2600. pfnContinue,
  2601. dwContinue);
  2602. return hr;
  2603. }
  2604. //+-------------------------------------------------------------------------
  2605. //
  2606. // Function: IViewObject_Freeze_Proxy
  2607. //
  2608. // Synopsis: Client-side [call_as] wrapper function for
  2609. // IViewObject::Freeze.
  2610. //
  2611. //--------------------------------------------------------------------------
  2612. HRESULT STDMETHODCALLTYPE IViewObject_Freeze_Proxy(
  2613. IViewObject __RPC_FAR * This,
  2614. DWORD dwDrawAspect,
  2615. LONG lindex,
  2616. void __RPC_FAR *pvAspect,
  2617. DWORD __RPC_FAR *pdwFreeze)
  2618. {
  2619. HRESULT hr;
  2620. if(pvAspect != 0)
  2621. return E_INVALIDARG;
  2622. hr = IViewObject_RemoteFreeze_Proxy(This,
  2623. dwDrawAspect,
  2624. lindex,
  2625. (LONG_PTR) pvAspect,
  2626. pdwFreeze);
  2627. return hr;
  2628. }
  2629. //+-------------------------------------------------------------------------
  2630. //
  2631. // Function: IViewObject_Freeze_Stub
  2632. //
  2633. // Synopsis: Server-side [call_as] wrapper function for
  2634. // IViewObject::Freeze.
  2635. //
  2636. //--------------------------------------------------------------------------
  2637. HRESULT STDMETHODCALLTYPE IViewObject_Freeze_Stub(
  2638. IViewObject __RPC_FAR * This,
  2639. DWORD dwDrawAspect,
  2640. LONG lindex,
  2641. ULONG_PTR pvAspect,
  2642. DWORD __RPC_FAR *pdwFreeze)
  2643. {
  2644. HRESULT hr;
  2645. hr = This->lpVtbl->Freeze(This,
  2646. dwDrawAspect,
  2647. lindex,
  2648. (void *) pvAspect,
  2649. pdwFreeze);
  2650. return hr;
  2651. }
  2652. //+-------------------------------------------------------------------------
  2653. //
  2654. // Function: IViewObject_GetAdvise_Proxy
  2655. //
  2656. // Synopsis: Client-side [call_as] wrapper function for
  2657. // IViewObject::GetAdvise.
  2658. //
  2659. //--------------------------------------------------------------------------
  2660. HRESULT STDMETHODCALLTYPE IViewObject_GetAdvise_Proxy(
  2661. IViewObject __RPC_FAR * This,
  2662. /* [unique][out] */ DWORD __RPC_FAR *pAspects,
  2663. /* [unique][out] */ DWORD __RPC_FAR *pAdvf,
  2664. /* [out] */ IAdviseSink __RPC_FAR *__RPC_FAR *ppAdvSink)
  2665. {
  2666. HRESULT hr;
  2667. DWORD dwAspects = 0;
  2668. DWORD dwAdvf = 0;
  2669. hr = IViewObject_RemoteGetAdvise_Proxy(This,
  2670. &dwAspects,
  2671. &dwAdvf,
  2672. ppAdvSink);
  2673. if(pAspects != NULL)
  2674. {
  2675. *pAspects = dwAspects;
  2676. }
  2677. if(pAdvf != NULL)
  2678. {
  2679. *pAdvf = dwAdvf;
  2680. }
  2681. return hr;
  2682. }
  2683. //+-------------------------------------------------------------------------
  2684. //
  2685. // Function: IViewObject_GetAdvise_Stub
  2686. //
  2687. // Synopsis: Server-side [call_as] wrapper function for
  2688. // IViewObject::GetAdvise.
  2689. //
  2690. //--------------------------------------------------------------------------
  2691. HRESULT STDMETHODCALLTYPE IViewObject_GetAdvise_Stub(
  2692. IViewObject __RPC_FAR * This,
  2693. /* [out] */ DWORD __RPC_FAR *pAspects,
  2694. /* [out] */ DWORD __RPC_FAR *pAdvf,
  2695. /* [out] */ IAdviseSink __RPC_FAR *__RPC_FAR *ppAdvSink)
  2696. {
  2697. HRESULT hr;
  2698. hr = This->lpVtbl->GetAdvise(This,
  2699. pAspects,
  2700. pAdvf,
  2701. ppAdvSink);
  2702. return hr;
  2703. }
  2704. //+-------------------------------------------------------------------------
  2705. //
  2706. // Function: IViewObject_GetColorSet_Proxy
  2707. //
  2708. // Synopsis: Client-side [call_as] wrapper function for
  2709. // IViewObject::GetColorSet.
  2710. //
  2711. //--------------------------------------------------------------------------
  2712. HRESULT STDMETHODCALLTYPE IViewObject_GetColorSet_Proxy(
  2713. IViewObject __RPC_FAR * This,
  2714. DWORD dwDrawAspect,
  2715. LONG lindex,
  2716. void __RPC_FAR *pvAspect,
  2717. DVTARGETDEVICE __RPC_FAR *ptd,
  2718. HDC hicTargetDev,
  2719. LOGPALETTE __RPC_FAR *__RPC_FAR *ppColorSet)
  2720. {
  2721. HRESULT hr;
  2722. if(pvAspect != 0)
  2723. return E_INVALIDARG;
  2724. hr = IViewObject_RemoteGetColorSet_Proxy(This,
  2725. dwDrawAspect,
  2726. lindex,
  2727. (LONG_PTR) pvAspect,
  2728. ptd,
  2729. (LONG_PTR) hicTargetDev,
  2730. ppColorSet);
  2731. return hr;
  2732. }
  2733. //+-------------------------------------------------------------------------
  2734. //
  2735. // Function: IViewObject_GetColorSet_Stub
  2736. //
  2737. // Synopsis: Server-side [call_as] wrapper function for
  2738. // IViewObject::GetColorSet.
  2739. //
  2740. //--------------------------------------------------------------------------
  2741. HRESULT STDMETHODCALLTYPE IViewObject_GetColorSet_Stub(
  2742. IViewObject __RPC_FAR * This,
  2743. DWORD dwDrawAspect,
  2744. LONG lindex,
  2745. ULONG_PTR pvAspect,
  2746. DVTARGETDEVICE __RPC_FAR *ptd,
  2747. ULONG_PTR hicTargetDev,
  2748. LOGPALETTE __RPC_FAR *__RPC_FAR *ppColorSet)
  2749. {
  2750. HRESULT hr;
  2751. hr = This->lpVtbl->GetColorSet(This,
  2752. dwDrawAspect,
  2753. lindex,
  2754. (void *)pvAspect,
  2755. ptd,
  2756. (HDC) hicTargetDev,
  2757. ppColorSet);
  2758. return hr;
  2759. }
  2760. //+-------------------------------------------------------------------------
  2761. //
  2762. // Function: IEnumSTATPROPSTG_Next_Proxy
  2763. //
  2764. // Synopsis:
  2765. //
  2766. //--------------------------------------------------------------------------
  2767. HRESULT STDMETHODCALLTYPE IEnumSTATPROPSTG_Next_Proxy(
  2768. IEnumSTATPROPSTG __RPC_FAR * This,
  2769. /* [in] */ ULONG celt,
  2770. /* [out] */ STATPROPSTG __RPC_FAR *rgelt,
  2771. /* [unique][out][in] */ ULONG __RPC_FAR *pceltFetched)
  2772. {
  2773. HRESULT hr;
  2774. ULONG celtFetched = 0;
  2775. if((celt > 1) && (pceltFetched == 0))
  2776. return E_INVALIDARG;
  2777. hr = IEnumSTATPROPSTG_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  2778. if (pceltFetched != 0)
  2779. {
  2780. *pceltFetched = celtFetched;
  2781. }
  2782. return hr;
  2783. }
  2784. //+-------------------------------------------------------------------------
  2785. //
  2786. // Function: IEnumSTATPROPSTG_Next_Stub
  2787. //
  2788. // Synopsis:
  2789. //
  2790. //--------------------------------------------------------------------------
  2791. HRESULT STDMETHODCALLTYPE IEnumSTATPROPSTG_Next_Stub(
  2792. IEnumSTATPROPSTG __RPC_FAR * This,
  2793. /* [in] */ ULONG celt,
  2794. /* [length_is][size_is][out] */ STATPROPSTG __RPC_FAR *rgelt,
  2795. /* [out] */ ULONG __RPC_FAR *pceltFetched)
  2796. {
  2797. return This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  2798. }
  2799. //+-------------------------------------------------------------------------
  2800. //
  2801. // Function: IEnumSTATPROPSETSTG_Next_Proxy
  2802. //
  2803. // Synopsis:
  2804. //
  2805. //--------------------------------------------------------------------------
  2806. HRESULT STDMETHODCALLTYPE IEnumSTATPROPSETSTG_Next_Proxy(
  2807. IEnumSTATPROPSETSTG __RPC_FAR * This,
  2808. /* [in] */ ULONG celt,
  2809. /* [out] */ STATPROPSETSTG __RPC_FAR *rgelt,
  2810. /* [unique][out][in] */ ULONG __RPC_FAR *pceltFetched)
  2811. {
  2812. HRESULT hr;
  2813. ULONG celtFetched = 0;
  2814. if((celt > 1) && (pceltFetched == 0))
  2815. return E_INVALIDARG;
  2816. hr = IEnumSTATPROPSETSTG_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  2817. if (pceltFetched != 0)
  2818. {
  2819. *pceltFetched = celtFetched;
  2820. }
  2821. return hr;
  2822. }
  2823. //+-------------------------------------------------------------------------
  2824. //
  2825. // Function: IEnumSTATPROPSETSTG_Next_Stub
  2826. //
  2827. // Synopsis:
  2828. //
  2829. //--------------------------------------------------------------------------
  2830. HRESULT STDMETHODCALLTYPE IEnumSTATPROPSETSTG_Next_Stub(
  2831. IEnumSTATPROPSETSTG __RPC_FAR * This,
  2832. /* [in] */ ULONG celt,
  2833. /* [length_is][size_is][out] */ STATPROPSETSTG __RPC_FAR *rgelt,
  2834. /* [out] */ ULONG __RPC_FAR *pceltFetched)
  2835. {
  2836. return This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  2837. }
  2838. #ifdef _CAIRO_
  2839. //+-------------------------------------------------------------------------
  2840. //
  2841. // Function: IOverlappedStream_ReadOverlapped_Proxy
  2842. //
  2843. // Synopsis:
  2844. //
  2845. //--------------------------------------------------------------------------
  2846. HRESULT STDMETHODCALLTYPE IOverlappedStream_ReadOverlapped_Proxy(
  2847. IOverlappedStream __RPC_FAR *This,
  2848. /* [in, size_is(cb)] */ void * pv,
  2849. /* [in] */ ULONG cb,
  2850. /* [out] */ ULONG * pcbRead,
  2851. /* [in,out] */ STGOVERLAPPED *lpOverlapped)
  2852. {
  2853. HRESULT hr = IOverlappedStream_RemoteReadOverlapped_Proxy (
  2854. /* IOverlappedStream * */ This,
  2855. /* [in, size_is(cb)] */ (byte *) pv,
  2856. /* [in] */ cb,
  2857. /* [out] */ pcbRead,
  2858. /* [in,out] */ lpOverlapped);
  2859. return hr;
  2860. }
  2861. //+-------------------------------------------------------------------------
  2862. //
  2863. // Function: IOverlappedStream_ReadOverlapped_Stub
  2864. //
  2865. // Synopsis:
  2866. //
  2867. //--------------------------------------------------------------------------
  2868. HRESULT STDMETHODCALLTYPE IOverlappedStream_ReadOverlapped_Stub (
  2869. IOverlappedStream __RPC_FAR *This,
  2870. /* [in, size_is(cb)] */ byte * pv,
  2871. /* [in] */ ULONG cb,
  2872. /* [out] */ ULONG * pcbRead,
  2873. /* [in,out] */ STGOVERLAPPED *lpOverlapped)
  2874. {
  2875. return This->lpVtbl->ReadOverlapped(
  2876. /* IOverlappedStream * */ This,
  2877. /* [in, size_is(cb)] */ pv,
  2878. /* [in] */ cb,
  2879. /* [out] */ pcbRead,
  2880. /* [in,out] */lpOverlapped);
  2881. }
  2882. //+-------------------------------------------------------------------------
  2883. //
  2884. // Function: IOverlappedStream_WriteOverlapped_Proxy
  2885. //
  2886. // Synopsis:
  2887. //
  2888. //--------------------------------------------------------------------------
  2889. HRESULT STDMETHODCALLTYPE IOverlappedStream_WriteOverlapped_Proxy(
  2890. IOverlappedStream __RPC_FAR *This,
  2891. /* [in, size_is(cb)] */ void *pv,
  2892. /* [in] */ ULONG cb,
  2893. /* [out] */ ULONG * pcbWritten,
  2894. /* [in,out] */ STGOVERLAPPED *lpOverlapped)
  2895. {
  2896. HRESULT hr = IOverlappedStream_RemoteWriteOverlapped_Proxy (
  2897. /* IOverlappedStream * */ This,
  2898. /* [in, size_is(cb)] */ (byte *)pv,
  2899. /* [in] */ cb,
  2900. /* [out] */ pcbWritten,
  2901. /* [in,out] */ lpOverlapped);
  2902. return hr;
  2903. }
  2904. //+-------------------------------------------------------------------------
  2905. //
  2906. // Function: IOverlappedStream_WriteOverlapped_Stub
  2907. //
  2908. // Synopsis:
  2909. //
  2910. //--------------------------------------------------------------------------
  2911. HRESULT STDMETHODCALLTYPE IOverlappedStream_WriteOverlapped_Stub (
  2912. IOverlappedStream __RPC_FAR *This,
  2913. /* [in, size_is(cb)] */ byte *pv,
  2914. /* [in] */ ULONG cb,
  2915. /* [out] */ ULONG * pcbWritten,
  2916. /* [in,out] */ STGOVERLAPPED *lpOverlapped)
  2917. {
  2918. return This->lpVtbl->WriteOverlapped(
  2919. /* IOverlappedStream * */ This,
  2920. /* [in, size_is(cb)] */ pv,
  2921. /* [in] */ cb,
  2922. /* [out] */ pcbWritten,
  2923. /* [in,out] */ lpOverlapped);
  2924. }
  2925. #endif // _CAIRO_
  2926. //+-------------------------------------------------------------------------
  2927. //
  2928. // Function: IFillLockBytes_FillAt_Proxy
  2929. //
  2930. // Synopsis: Client-side [call_as] wrapper function for
  2931. // IFillLockBytes::FillAt. This wrapper function handles the
  2932. // case where pcbWritten is NULL.
  2933. //
  2934. // Notes: If pcbWritten != 0, then the number of bytes written
  2935. // will be returned in *pcbWritten. If an error
  2936. // occurs, then *pcbWritten is set to zero.
  2937. //
  2938. // History: ? ? Created
  2939. // 05-27-94 AlexT Actually return count of bytes written
  2940. //
  2941. //--------------------------------------------------------------------------
  2942. HRESULT STDMETHODCALLTYPE IFillLockBytes_FillAt_Proxy(
  2943. IFillLockBytes __RPC_FAR * This,
  2944. ULARGE_INTEGER ulOffset,
  2945. const void __RPC_FAR *pv,
  2946. ULONG cb,
  2947. ULONG __RPC_FAR *pcbWritten)
  2948. {
  2949. HRESULT hr;
  2950. ULONG cbWritten = 0;
  2951. #if DBG == 1
  2952. //validate parameters.
  2953. if(pv == 0)
  2954. return STG_E_INVALIDPOINTER;
  2955. #endif
  2956. hr = IFillLockBytes_RemoteFillAt_Proxy(This, ulOffset, (byte __RPC_FAR *)pv, cb, &cbWritten);
  2957. if(pcbWritten != 0)
  2958. *pcbWritten = cbWritten;
  2959. return hr;
  2960. }
  2961. //+-------------------------------------------------------------------------
  2962. //
  2963. // Function: IFillLockBytes_FillAt_Stub
  2964. //
  2965. // Synopsis: Server-side [call_as] wrapper function for
  2966. // IFillLockBytes::FillAt.
  2967. //
  2968. //--------------------------------------------------------------------------
  2969. HRESULT STDMETHODCALLTYPE IFillLockBytes_FillAt_Stub(
  2970. IFillLockBytes __RPC_FAR * This,
  2971. ULARGE_INTEGER ulOffset,
  2972. const byte __RPC_FAR *pv,
  2973. ULONG cb,
  2974. ULONG __RPC_FAR *pcbWritten)
  2975. {
  2976. HRESULT hr;
  2977. *pcbWritten = 0;
  2978. hr = This->lpVtbl->FillAt(This, ulOffset, pv, cb, pcbWritten);
  2979. return hr;
  2980. }
  2981. //+-------------------------------------------------------------------------
  2982. //
  2983. // Function: IFillLockBytes_FillAppend_Proxy
  2984. //
  2985. // Synopsis: Client-side [call_as] wrapper function for
  2986. // IFillLockBytes::FillAppend. This wrapper function handles the
  2987. // case where pcbWritten is NULL.
  2988. //
  2989. // Notes: If pcbWritten != 0, then the number of bytes written
  2990. // will be returned in *pcbWritten. If an error
  2991. // occurs, then *pcbWritten is set to zero.
  2992. //
  2993. // History: ? ? Created
  2994. // 05-27-94 AlexT Actually return count of bytes written
  2995. //
  2996. //--------------------------------------------------------------------------
  2997. HRESULT STDMETHODCALLTYPE IFillLockBytes_FillAppend_Proxy(
  2998. IFillLockBytes __RPC_FAR * This,
  2999. const void __RPC_FAR *pv,
  3000. ULONG cb,
  3001. ULONG __RPC_FAR *pcbWritten)
  3002. {
  3003. HRESULT hr;
  3004. ULONG cbWritten = 0;
  3005. #if DBG == 1
  3006. //validate parameters.
  3007. if(pv == 0)
  3008. return STG_E_INVALIDPOINTER;
  3009. #endif
  3010. hr = IFillLockBytes_RemoteFillAppend_Proxy(This, (byte __RPC_FAR *)pv, cb, &cbWritten);
  3011. if(pcbWritten != 0)
  3012. *pcbWritten = cbWritten;
  3013. return hr;
  3014. }
  3015. //+-------------------------------------------------------------------------
  3016. //
  3017. // Function: IFillLockBytes_FillAppend_Stub
  3018. //
  3019. // Synopsis: Server-side [call_as] wrapper function for
  3020. // IFillLockBytes::FillAppend.
  3021. //
  3022. //--------------------------------------------------------------------------
  3023. HRESULT STDMETHODCALLTYPE IFillLockBytes_FillAppend_Stub(
  3024. IFillLockBytes __RPC_FAR * This,
  3025. const byte __RPC_FAR *pv,
  3026. ULONG cb,
  3027. ULONG __RPC_FAR *pcbWritten)
  3028. {
  3029. HRESULT hr;
  3030. *pcbWritten = 0;
  3031. hr = This->lpVtbl->FillAppend(This, pv, cb, pcbWritten);
  3032. return hr;
  3033. }