Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3393 lines
102 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, pbindopts->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. UserNdrDebugOut((UNDR_FORCE, " SetData_Proxy %s\n", WdtpGetStgmedName(pmedium)));
  1233. UserNdrDebugOut((UNDR_FORCE, " fRelease=%d, punk=%p\n", fRelease, pmedium->pUnkForRelease));
  1234. __try
  1235. {
  1236. RemoteStgmed.ContextFlags = 0;
  1237. RemoteStgmed.fPassOwnership = fRelease;
  1238. RemoteStgmed.Stgmed = *pmedium;
  1239. hr = IDataObject_RemoteSetData_Proxy( This,
  1240. pformatetc,
  1241. & RemoteStgmed,
  1242. fRelease);
  1243. if (fRelease && SUCCEEDED(hr))
  1244. {
  1245. // Caller has given ownership to callee.
  1246. // Free the resources left on this side.
  1247. // Context flags have been set by the unmarshalling routine.
  1248. if ( pmedium->tymed != TYMED_FILE )
  1249. STGMEDIUM_UserFree( &RemoteStgmed.ContextFlags, pmedium );
  1250. else
  1251. {
  1252. // For files, STGMEDIUM_UserFree dereferences pStubMsg via pFlags
  1253. // to get to the right freeing routine. As the StubMsg is gone,
  1254. // we need to free the file here.
  1255. NdrOleFree( pmedium->lpszFileName );
  1256. NukeHandleAndReleasePunk( pmedium );
  1257. }
  1258. }
  1259. }
  1260. __except(EXCEPTION_EXECUTE_HANDLER)
  1261. {
  1262. DWORD dwExceptionCode = GetExceptionCode();
  1263. if(FAILED((HRESULT) dwExceptionCode))
  1264. hr = (HRESULT) dwExceptionCode;
  1265. else
  1266. hr = HRESULT_FROM_WIN32(dwExceptionCode);
  1267. }
  1268. UserNdrDebugOut((UNDR_FORCE, " SetData_Proxy hr=%lx\n", hr));
  1269. return hr;
  1270. }
  1271. //+-------------------------------------------------------------------------
  1272. //
  1273. // Function: IDataObject_SetData_Stub
  1274. //
  1275. // Synopsis: Server-side [call_as] wrapper function for
  1276. // IDataObject::SetData.
  1277. // pMedium is [in].
  1278. //
  1279. // Notes: If fRelease is TRUE, then the callee is responsible for
  1280. // freeing the STGMEDIUM.
  1281. //
  1282. //--------------------------------------------------------------------------
  1283. HRESULT STDMETHODCALLTYPE IDataObject_SetData_Stub(
  1284. IDataObject __RPC_FAR * This,
  1285. FORMATETC __RPC_FAR *pformatetc,
  1286. FLAG_STGMEDIUM __RPC_FAR *pFlagStgmed,
  1287. BOOL fRelease)
  1288. {
  1289. HRESULT hr;
  1290. STGMEDIUM Stgmed;
  1291. __try
  1292. {
  1293. Stgmed = pFlagStgmed->Stgmed;
  1294. UserNdrDebugOut((UNDR_FORCE, " SetData_Stub %s\n", WdtpGetStgmedName(& Stgmed)));
  1295. UserNdrDebugOut((UNDR_FORCE, " fRelease=%d, punk=%p\n", fRelease, Stgmed.pUnkForRelease));
  1296. hr = This->lpVtbl->SetData( This,
  1297. pformatetc,
  1298. & Stgmed,
  1299. fRelease);
  1300. if ( fRelease && SUCCEEDED(hr) )
  1301. {
  1302. // The ownership was passed successfully.
  1303. // The user should free the object.
  1304. // Make it so that our userfree routine for user medium
  1305. // doesn't do anything to the user's object.
  1306. pFlagStgmed->Stgmed.tymed = TYMED_NULL;
  1307. }
  1308. }
  1309. __except(EXCEPTION_EXECUTE_HANDLER)
  1310. {
  1311. DWORD dwExceptionCode = GetExceptionCode();
  1312. if(FAILED((HRESULT) dwExceptionCode))
  1313. hr = (HRESULT) dwExceptionCode;
  1314. else
  1315. hr = HRESULT_FROM_WIN32(dwExceptionCode);
  1316. }
  1317. UserNdrDebugOut((UNDR_FORCE, " SetData_Stub hr=%lx\n", hr));
  1318. return hr;
  1319. }
  1320. //+-------------------------------------------------------------------------
  1321. //
  1322. // Function: IEnumConnectionPoints_Next_Proxy
  1323. //
  1324. // Synopsis: Client-side [call_as] wrapper function for
  1325. // IEnumConnectionPoints::Next. This wrapper function handles the
  1326. // case where lpcFetched is NULL.
  1327. //
  1328. // Notes: If lpcFetched != 0, then the number of elements
  1329. // fetched will be returned in *lpcFetched. If an error
  1330. // occurs, then *lpcFetched is set to zero.
  1331. //
  1332. //--------------------------------------------------------------------------
  1333. HRESULT STDMETHODCALLTYPE IEnumConnectionPoints_Next_Proxy(
  1334. IEnumConnectionPoints __RPC_FAR * This,
  1335. ULONG cConnections,
  1336. IConnectionPoint __RPC_FAR *__RPC_FAR *rgpcn,
  1337. ULONG __RPC_FAR *lpcFetched)
  1338. {
  1339. HRESULT hr;
  1340. ULONG cFetched = 0;
  1341. if((cConnections > 1) && (lpcFetched == 0))
  1342. return E_INVALIDARG;
  1343. hr = IEnumConnectionPoints_RemoteNext_Proxy(This, cConnections, rgpcn, &cFetched);
  1344. if(lpcFetched != 0)
  1345. *lpcFetched = cFetched;
  1346. return hr;
  1347. }
  1348. //+-------------------------------------------------------------------------
  1349. //
  1350. // Function: IEnumConnectionPoints_Next_Stub
  1351. //
  1352. // Synopsis: Server-side [call_as] wrapper function for
  1353. // IEnumConnectionPoints::Next.
  1354. //
  1355. //--------------------------------------------------------------------------
  1356. HRESULT STDMETHODCALLTYPE IEnumConnectionPoints_Next_Stub(
  1357. IEnumConnectionPoints __RPC_FAR * This,
  1358. ULONG cConnections,
  1359. IConnectionPoint __RPC_FAR *__RPC_FAR *rgpcn,
  1360. ULONG __RPC_FAR *lpcFetched)
  1361. {
  1362. HRESULT hr;
  1363. hr = This->lpVtbl->Next(This, cConnections, rgpcn, lpcFetched);
  1364. if(FAILED(hr))
  1365. {
  1366. //If the server returns an error code, it must set *lpcFetched to zero.
  1367. ASSERT(*lpcFetched == 0);
  1368. //Set *lpcFetched to zero in case we have a badly behaved server.
  1369. *lpcFetched = 0;
  1370. }
  1371. return hr;
  1372. }
  1373. //+-------------------------------------------------------------------------
  1374. //
  1375. // Function: IEnumConnections_Next_Proxy
  1376. //
  1377. // Synopsis: Client-side [call_as] wrapper function for
  1378. // IEnumConnections::Next. This wrapper function handles the
  1379. // case where lpcFetched is NULL.
  1380. //
  1381. // Notes: If lpcFetched != 0, then the number of elements
  1382. // fetched will be returned in *lpcFetched. If an error
  1383. // occurs, then *lpcFetched is set to zero.
  1384. //
  1385. //--------------------------------------------------------------------------
  1386. HRESULT STDMETHODCALLTYPE IEnumConnections_Next_Proxy(
  1387. IEnumConnections __RPC_FAR * This,
  1388. ULONG cConnections,
  1389. CONNECTDATA __RPC_FAR *rgpunk,
  1390. ULONG __RPC_FAR *lpcFetched)
  1391. {
  1392. HRESULT hr;
  1393. ULONG cFetched = 0;
  1394. if((cConnections > 1) && (lpcFetched == 0))
  1395. return E_INVALIDARG;
  1396. hr = IEnumConnections_RemoteNext_Proxy(This, cConnections, rgpunk, &cFetched);
  1397. if(lpcFetched != 0)
  1398. *lpcFetched = cFetched;
  1399. return hr;
  1400. }
  1401. //+-------------------------------------------------------------------------
  1402. //
  1403. // Function: IEnumConnections_Next_Stub
  1404. //
  1405. // Synopsis: Server-side [call_as] wrapper function for
  1406. // IEnumConnections::Next.
  1407. //
  1408. //--------------------------------------------------------------------------
  1409. HRESULT STDMETHODCALLTYPE IEnumConnections_Next_Stub(
  1410. IEnumConnections __RPC_FAR * This,
  1411. ULONG cConnections,
  1412. CONNECTDATA __RPC_FAR *rgpunk,
  1413. ULONG __RPC_FAR *lpcFetched)
  1414. {
  1415. HRESULT hr;
  1416. hr = This->lpVtbl->Next(This, cConnections, rgpunk, lpcFetched);
  1417. if(FAILED(hr))
  1418. {
  1419. //If the server returns an error code, it must set *lpcFetched to zero.
  1420. ASSERT(*lpcFetched == 0);
  1421. //Set *lpcFetched to zero in case we have a badly behaved server.
  1422. *lpcFetched = 0;
  1423. }
  1424. return hr;
  1425. }
  1426. //+-------------------------------------------------------------------------
  1427. //
  1428. // Function: IEnumFORMATETC_Next_Proxy
  1429. //
  1430. // Synopsis: Client-side [call_as] wrapper function for
  1431. // IEnumFORMATETC::Next.
  1432. //
  1433. // Notes: If pceltFetched != 0, then the number of elements
  1434. // fetched will be returned in *pceltFetched. If an error
  1435. // occurs, then *pceltFetched is set to zero.
  1436. //
  1437. //--------------------------------------------------------------------------
  1438. HRESULT STDMETHODCALLTYPE IEnumFORMATETC_Next_Proxy(
  1439. IEnumFORMATETC __RPC_FAR * This,
  1440. ULONG celt,
  1441. FORMATETC __RPC_FAR *rgelt,
  1442. ULONG __RPC_FAR *pceltFetched)
  1443. {
  1444. HRESULT hr;
  1445. ULONG celtFetched = 0;
  1446. if((celt > 1) && (pceltFetched == 0))
  1447. return E_INVALIDARG;
  1448. hr = IEnumFORMATETC_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1449. if(pceltFetched != 0)
  1450. *pceltFetched = celtFetched;
  1451. return hr;
  1452. }
  1453. //+-------------------------------------------------------------------------
  1454. //
  1455. // Function: IEnumFORMATETC_Next_Stub
  1456. //
  1457. // Synopsis: Server-side [call_as] wrapper function for
  1458. // IEnumFORMATETC::Next.
  1459. //
  1460. //--------------------------------------------------------------------------
  1461. HRESULT STDMETHODCALLTYPE IEnumFORMATETC_Next_Stub(
  1462. IEnumFORMATETC __RPC_FAR * This,
  1463. ULONG celt,
  1464. FORMATETC __RPC_FAR *rgelt,
  1465. ULONG __RPC_FAR *pceltFetched)
  1466. {
  1467. HRESULT hr;
  1468. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1469. if(FAILED(hr))
  1470. {
  1471. //If the server returns an error code, it must set *pceltFetched to zero.
  1472. ASSERT(*pceltFetched == 0);
  1473. //Set *pceltFetched to zero in case we have a badly behaved server.
  1474. *pceltFetched = 0;
  1475. }
  1476. return hr;
  1477. }
  1478. //+-------------------------------------------------------------------------
  1479. //
  1480. // Function: IEnumMoniker_Next_Proxy
  1481. //
  1482. // Synopsis: Client-side [call_as] wrapper function for
  1483. // IEnumMoniker::Next.
  1484. //
  1485. // Notes: If pceltFetched != 0, then the number of elements
  1486. // fetched will be returned in *pceltFetched. If an error
  1487. // occurs, then *pceltFetched is set to zero.
  1488. //
  1489. //--------------------------------------------------------------------------
  1490. HRESULT STDMETHODCALLTYPE IEnumMoniker_Next_Proxy(
  1491. IEnumMoniker __RPC_FAR * This,
  1492. ULONG celt,
  1493. IMoniker __RPC_FAR *__RPC_FAR *rgelt,
  1494. ULONG __RPC_FAR *pceltFetched)
  1495. {
  1496. HRESULT hr;
  1497. ULONG celtFetched = 0;
  1498. if((celt > 1) && (pceltFetched == 0))
  1499. return E_INVALIDARG;
  1500. hr = IEnumMoniker_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1501. if(pceltFetched != 0)
  1502. *pceltFetched = celtFetched;
  1503. return hr;
  1504. }
  1505. //+-------------------------------------------------------------------------
  1506. //
  1507. // Function: IEnumMoniker_Next_Stub
  1508. //
  1509. // Synopsis: Server-side [call_as] wrapper function for
  1510. // IEnumMoniker::Next.
  1511. //
  1512. //--------------------------------------------------------------------------
  1513. HRESULT STDMETHODCALLTYPE IEnumMoniker_Next_Stub(
  1514. IEnumMoniker __RPC_FAR * This,
  1515. ULONG celt,
  1516. IMoniker __RPC_FAR *__RPC_FAR *rgelt,
  1517. ULONG __RPC_FAR *pceltFetched)
  1518. {
  1519. HRESULT hr;
  1520. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1521. if(FAILED(hr))
  1522. {
  1523. //If the server returns an error code, it must set *pceltFetched to zero.
  1524. ASSERT(*pceltFetched == 0);
  1525. //Set *pceltFetched to zero in case we have a badly behaved server.
  1526. *pceltFetched = 0;
  1527. }
  1528. return hr;
  1529. }
  1530. //+-------------------------------------------------------------------------
  1531. //
  1532. // Function: IEnumSTATDATA_Next_Proxy
  1533. //
  1534. // Synopsis: Client-side [call_as] wrapper function for
  1535. // IEnumSTATDATA::Next. This wrapper function handles the
  1536. // case where pceltFetched is NULL.
  1537. //
  1538. // Notes: If pceltFetched != 0, then the number of elements
  1539. // fetched will be returned in *pceltFetched. If an error
  1540. // occurs, then *pceltFetched is set to zero.
  1541. //
  1542. //--------------------------------------------------------------------------
  1543. HRESULT STDMETHODCALLTYPE IEnumSTATDATA_Next_Proxy(
  1544. IEnumSTATDATA __RPC_FAR * This,
  1545. ULONG celt,
  1546. STATDATA __RPC_FAR *rgelt,
  1547. ULONG __RPC_FAR *pceltFetched)
  1548. {
  1549. HRESULT hr;
  1550. ULONG celtFetched = 0;
  1551. if((celt > 1) && (pceltFetched == 0))
  1552. return E_INVALIDARG;
  1553. hr = IEnumSTATDATA_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1554. if(pceltFetched != 0)
  1555. *pceltFetched = celtFetched;
  1556. return hr;
  1557. }
  1558. //+-------------------------------------------------------------------------
  1559. //
  1560. // Function: IEnumSTATDATA_Next_Stub
  1561. //
  1562. // Synopsis: Server-side [call_as] wrapper function for
  1563. // IEnumSTATDATA::Next.
  1564. //
  1565. //--------------------------------------------------------------------------
  1566. HRESULT STDMETHODCALLTYPE IEnumSTATDATA_Next_Stub(
  1567. IEnumSTATDATA __RPC_FAR * This,
  1568. ULONG celt,
  1569. STATDATA __RPC_FAR *rgelt,
  1570. ULONG __RPC_FAR *pceltFetched)
  1571. {
  1572. HRESULT hr;
  1573. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1574. if(FAILED(hr))
  1575. {
  1576. //If the server returns an error code, it must set *pceltFetched to zero.
  1577. ASSERT(*pceltFetched == 0);
  1578. //Set *pceltFetched to zero in case we have a badly behaved server.
  1579. *pceltFetched = 0;
  1580. }
  1581. return hr;
  1582. }
  1583. //+-------------------------------------------------------------------------
  1584. //
  1585. // Function: IEnumSTATSTG_Next_Proxy
  1586. //
  1587. // Synopsis: Client-side [call_as] wrapper function for
  1588. // IEnumSTATSTG::Next. This wrapper function handles the case
  1589. // where pceltFetched is NULL.
  1590. //
  1591. // Notes: If pceltFetched != 0, then the number of elements
  1592. // fetched will be returned in *pceltFetched. If an error
  1593. // occurs, then *pceltFetched is set to zero.
  1594. //
  1595. //--------------------------------------------------------------------------
  1596. HRESULT STDMETHODCALLTYPE IEnumSTATSTG_Next_Proxy(
  1597. IEnumSTATSTG __RPC_FAR * This,
  1598. ULONG celt,
  1599. STATSTG __RPC_FAR *rgelt,
  1600. ULONG __RPC_FAR *pceltFetched)
  1601. {
  1602. HRESULT hr;
  1603. ULONG celtFetched = 0;
  1604. if((celt > 1) && (pceltFetched == 0))
  1605. return E_INVALIDARG;
  1606. hr = IEnumSTATSTG_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1607. if(pceltFetched != 0)
  1608. *pceltFetched = celtFetched;
  1609. return hr;
  1610. }
  1611. //+-------------------------------------------------------------------------
  1612. //
  1613. // Function: IEnumSTATSTG_Next_Stub
  1614. //
  1615. // Synopsis: Server-side [call_as] wrapper function for
  1616. // IEnumSTATSTG::Next.
  1617. //
  1618. //--------------------------------------------------------------------------
  1619. HRESULT STDMETHODCALLTYPE IEnumSTATSTG_Next_Stub(
  1620. IEnumSTATSTG __RPC_FAR * This,
  1621. ULONG celt,
  1622. STATSTG __RPC_FAR *rgelt,
  1623. ULONG __RPC_FAR *pceltFetched)
  1624. {
  1625. HRESULT hr;
  1626. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1627. if(FAILED(hr))
  1628. {
  1629. //If the server returns an error code, it must set *pceltFetched to zero.
  1630. ASSERT(*pceltFetched == 0);
  1631. //Set *pceltFetched to zero in case we have a badly behaved server.
  1632. *pceltFetched = 0;
  1633. }
  1634. return hr;
  1635. }
  1636. //+-------------------------------------------------------------------------
  1637. //
  1638. // Function: IEnumString_Next_Proxy
  1639. //
  1640. // Synopsis: Client-side [call_as] wrapper function for
  1641. // IEnumString::Next. This wrapper function handles the
  1642. // case where pceltFetched is NULL.
  1643. //
  1644. // Notes: If pceltFetched != 0, then the number of elements
  1645. // fetched will be returned in *pceltFetched. If an error
  1646. // occurs, then *pceltFetched is set to zero.
  1647. //
  1648. //--------------------------------------------------------------------------
  1649. HRESULT STDMETHODCALLTYPE IEnumString_Next_Proxy(
  1650. IEnumString __RPC_FAR * This,
  1651. ULONG celt,
  1652. LPOLESTR __RPC_FAR *rgelt,
  1653. ULONG __RPC_FAR *pceltFetched)
  1654. {
  1655. HRESULT hr;
  1656. ULONG celtFetched = 0;
  1657. if((celt > 1) && (pceltFetched == 0))
  1658. return E_INVALIDARG;
  1659. hr = IEnumString_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1660. if(pceltFetched != 0)
  1661. *pceltFetched = celtFetched;
  1662. return hr;
  1663. }
  1664. //+-------------------------------------------------------------------------
  1665. //
  1666. // Function: IEnumString_Next_Stub
  1667. //
  1668. // Synopsis: Server-side [call_as] wrapper function for
  1669. // IEnumString::Next.
  1670. //
  1671. //--------------------------------------------------------------------------
  1672. HRESULT STDMETHODCALLTYPE IEnumString_Next_Stub(
  1673. IEnumString __RPC_FAR * This,
  1674. ULONG celt,
  1675. LPOLESTR __RPC_FAR *rgelt,
  1676. ULONG __RPC_FAR *pceltFetched)
  1677. {
  1678. HRESULT hr;
  1679. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1680. if(FAILED(hr))
  1681. {
  1682. //If the server returns an error code, it must set *pceltFetched to zero.
  1683. ASSERT(*pceltFetched == 0);
  1684. //Set *pceltFetched to zero in case we have a badly behaved server.
  1685. *pceltFetched = 0;
  1686. }
  1687. return hr;
  1688. }
  1689. //+-------------------------------------------------------------------------
  1690. //
  1691. // Function: IEnumUnknown_Next_Proxy
  1692. //
  1693. // Synopsis: Client-side [call_as] wrapper function for
  1694. // IEnumUnknown::Next. This wrapper function handles the
  1695. // case where pceltFetched is NULL.
  1696. //
  1697. // Notes: If pceltFetched != 0, then the number of elements
  1698. // fetched will be returned in *pceltFetched. If an error
  1699. // occurs, then *pceltFetched is set to zero.
  1700. //
  1701. //--------------------------------------------------------------------------
  1702. HRESULT STDMETHODCALLTYPE IEnumUnknown_Next_Proxy(
  1703. IEnumUnknown __RPC_FAR * This,
  1704. ULONG celt,
  1705. IUnknown __RPC_FAR *__RPC_FAR *rgelt,
  1706. ULONG __RPC_FAR *pceltFetched)
  1707. {
  1708. HRESULT hr;
  1709. ULONG celtFetched = 0;
  1710. if((celt > 1) && (pceltFetched == 0))
  1711. return E_INVALIDARG;
  1712. hr = IEnumUnknown_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1713. if(pceltFetched != 0)
  1714. *pceltFetched = celtFetched;
  1715. return hr;
  1716. }
  1717. //+-------------------------------------------------------------------------
  1718. //
  1719. // Function: IEnumUnknown_Next_Stub
  1720. //
  1721. // Synopsis: Server-side [call_as] wrapper function for
  1722. // IEnumUnknown::Next.
  1723. //
  1724. //--------------------------------------------------------------------------
  1725. HRESULT STDMETHODCALLTYPE IEnumUnknown_Next_Stub(
  1726. IEnumUnknown __RPC_FAR * This,
  1727. ULONG celt,
  1728. IUnknown __RPC_FAR *__RPC_FAR *rgelt,
  1729. ULONG __RPC_FAR *pceltFetched)
  1730. {
  1731. HRESULT hr;
  1732. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1733. if(FAILED(hr))
  1734. {
  1735. //If the server returns an error code, it must set *pceltFetched to zero.
  1736. ASSERT(*pceltFetched == 0);
  1737. //Set *pceltFetched to zero in case we have a badly behaved server.
  1738. *pceltFetched = 0;
  1739. }
  1740. return hr;
  1741. }
  1742. //+-------------------------------------------------------------------------
  1743. //
  1744. // Function: IEnumOLEVERB_Next_Proxy
  1745. //
  1746. // Synopsis: Client-side [call_as] wrapper function for
  1747. // IEnumOLEVERB::Next. This wrapper function handles the case
  1748. // where pceltFetched is NULL.
  1749. //
  1750. // Notes: If pceltFetched != 0, then the number of elements
  1751. // fetched will be returned in *pceltFetched. If an error
  1752. // occurs, then *pceltFetched is set to zero.
  1753. //
  1754. //--------------------------------------------------------------------------
  1755. HRESULT STDMETHODCALLTYPE IEnumOLEVERB_Next_Proxy(
  1756. IEnumOLEVERB __RPC_FAR * This,
  1757. ULONG celt,
  1758. LPOLEVERB rgelt,
  1759. ULONG __RPC_FAR *pceltFetched)
  1760. {
  1761. HRESULT hr;
  1762. ULONG celtFetched = 0;
  1763. if((celt > 1) && (pceltFetched == 0))
  1764. return E_INVALIDARG;
  1765. hr = IEnumOLEVERB_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  1766. if(pceltFetched != 0)
  1767. *pceltFetched = celtFetched;
  1768. return hr;
  1769. }
  1770. //+-------------------------------------------------------------------------
  1771. //
  1772. // Function: IEnumOLEVERB_Next_Stub
  1773. //
  1774. // Synopsis: Server-side [call_as] wrapper function for
  1775. // IEnumOLEVERB::Next.
  1776. //
  1777. //--------------------------------------------------------------------------
  1778. HRESULT STDMETHODCALLTYPE IEnumOLEVERB_Next_Stub(
  1779. IEnumOLEVERB __RPC_FAR * This,
  1780. ULONG celt,
  1781. LPOLEVERB rgelt,
  1782. ULONG __RPC_FAR *pceltFetched)
  1783. {
  1784. HRESULT hr;
  1785. hr = This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  1786. if(FAILED(hr))
  1787. {
  1788. //If the server returns an error code, it must set *pceltFetched to zero.
  1789. ASSERT(*pceltFetched == 0);
  1790. //Set *pceltFetched to zero in case we have a badly behaved server.
  1791. *pceltFetched = 0;
  1792. }
  1793. return hr;
  1794. }
  1795. //+-------------------------------------------------------------------------
  1796. //
  1797. // Function: ILockBytes_ReadAt_Proxy
  1798. //
  1799. // Synopsis: Client-side [call_as] wrapper function for
  1800. // ILockBytes::ReadAt. This wrapper function
  1801. // handles the case where pcbRead is NULL.
  1802. //
  1803. // Notes: If pcbRead != 0, then the number of bytes read
  1804. // will be returned in *pcbRead. If an error
  1805. // occurs, then *pcbRead is set to zero.
  1806. //
  1807. //--------------------------------------------------------------------------
  1808. HRESULT STDMETHODCALLTYPE ILockBytes_ReadAt_Proxy(
  1809. ILockBytes __RPC_FAR * This,
  1810. ULARGE_INTEGER ulOffset,
  1811. void __RPC_FAR *pv,
  1812. ULONG cb,
  1813. ULONG __RPC_FAR *pcbRead)
  1814. {
  1815. HRESULT hr;
  1816. ULONG cbRead = 0;
  1817. hr = ILockBytes_RemoteReadAt_Proxy(This, ulOffset, (byte __RPC_FAR *) pv, cb, &cbRead);
  1818. if(pcbRead != 0)
  1819. *pcbRead = cbRead;
  1820. return hr;
  1821. }
  1822. //+-------------------------------------------------------------------------
  1823. //
  1824. // Function: ILockBytes_ReadAt_Stub
  1825. //
  1826. // Synopsis: Server-side [call_as] wrapper function for
  1827. // ILockBytes::ReadAt.
  1828. //
  1829. //--------------------------------------------------------------------------
  1830. HRESULT STDMETHODCALLTYPE ILockBytes_ReadAt_Stub(
  1831. ILockBytes __RPC_FAR * This,
  1832. ULARGE_INTEGER ulOffset,
  1833. byte __RPC_FAR *pv,
  1834. ULONG cb,
  1835. ULONG __RPC_FAR *pcbRead)
  1836. {
  1837. HRESULT hr;
  1838. *pcbRead = 0;
  1839. hr = This->lpVtbl->ReadAt(This, ulOffset, (void __RPC_FAR *) pv, cb, pcbRead);
  1840. return hr;
  1841. }
  1842. //+-------------------------------------------------------------------------
  1843. //
  1844. // Function: ILockBytes_WriteAt_Proxy
  1845. //
  1846. // Synopsis: Client-side [call_as] wrapper function for
  1847. // ILockBytes::WriteAt. This wrapper function handles the
  1848. // case where pcbWritten is NULL.
  1849. //
  1850. // Notes: If pcbWritten != 0, then the number of bytes written
  1851. // will be returned in *pcbWritten. If an error
  1852. // occurs, then *pcbWritten is set to zero.
  1853. //
  1854. // History: ? ? Created
  1855. // 05-27-94 AlexT Actually return count of bytes written
  1856. //
  1857. //--------------------------------------------------------------------------
  1858. HRESULT STDMETHODCALLTYPE ILockBytes_WriteAt_Proxy(
  1859. ILockBytes __RPC_FAR * This,
  1860. ULARGE_INTEGER ulOffset,
  1861. const void __RPC_FAR *pv,
  1862. ULONG cb,
  1863. ULONG __RPC_FAR *pcbWritten)
  1864. {
  1865. HRESULT hr;
  1866. ULONG cbWritten = 0;
  1867. #if DBG == 1
  1868. //validate parameters.
  1869. if(pv == 0)
  1870. return STG_E_INVALIDPOINTER;
  1871. #endif
  1872. hr = ILockBytes_RemoteWriteAt_Proxy(This, ulOffset, (byte __RPC_FAR *)pv, cb, &cbWritten);
  1873. if(pcbWritten != 0)
  1874. *pcbWritten = cbWritten;
  1875. return hr;
  1876. }
  1877. //+-------------------------------------------------------------------------
  1878. //
  1879. // Function: ILockBytes_WriteAt_Stub
  1880. //
  1881. // Synopsis: Server-side [call_as] wrapper function for
  1882. // ILockBytes::WriteAt.
  1883. //
  1884. //--------------------------------------------------------------------------
  1885. HRESULT STDMETHODCALLTYPE ILockBytes_WriteAt_Stub(
  1886. ILockBytes __RPC_FAR * This,
  1887. ULARGE_INTEGER ulOffset,
  1888. const byte __RPC_FAR *pv,
  1889. ULONG cb,
  1890. ULONG __RPC_FAR *pcbWritten)
  1891. {
  1892. HRESULT hr;
  1893. *pcbWritten = 0;
  1894. hr = This->lpVtbl->WriteAt(This, ulOffset, pv, cb, pcbWritten);
  1895. return hr;
  1896. }
  1897. //+-------------------------------------------------------------------------
  1898. //
  1899. // Function: IMoniker_BindToObject_Proxy
  1900. //
  1901. // Synopsis: Client-side [call_as] wrapper function for
  1902. // IMoniker::BindToObject.
  1903. //
  1904. //--------------------------------------------------------------------------
  1905. HRESULT STDMETHODCALLTYPE IMoniker_BindToObject_Proxy(
  1906. IMoniker __RPC_FAR * This,
  1907. IBindCtx __RPC_FAR *pbc,
  1908. IMoniker __RPC_FAR *pmkToLeft,
  1909. REFIID riid,
  1910. void __RPC_FAR *__RPC_FAR *ppvObj)
  1911. {
  1912. HRESULT hr;
  1913. *ppvObj = 0;
  1914. hr = IMoniker_RemoteBindToObject_Proxy(
  1915. This, pbc, pmkToLeft, riid, (IUnknown **) ppvObj);
  1916. return hr;
  1917. }
  1918. //+-------------------------------------------------------------------------
  1919. //
  1920. // Function: IMoniker_BindToObject_Stub
  1921. //
  1922. // Synopsis: Server-side [call_as] wrapper function for
  1923. // IMoniker::BindToObject.
  1924. //
  1925. //--------------------------------------------------------------------------
  1926. HRESULT STDMETHODCALLTYPE IMoniker_BindToObject_Stub(
  1927. IMoniker __RPC_FAR * This,
  1928. IBindCtx __RPC_FAR *pbc,
  1929. IMoniker __RPC_FAR *pmkToLeft,
  1930. REFIID riid,
  1931. IUnknown __RPC_FAR *__RPC_FAR *ppvObj)
  1932. {
  1933. HRESULT hr;
  1934. hr = This->lpVtbl->BindToObject(
  1935. This, pbc, pmkToLeft, riid, (void **) ppvObj);
  1936. if(FAILED(hr))
  1937. {
  1938. //If the server returns an error code, it must set *ppvObj to zero.
  1939. ASSERT(*ppvObj == 0);
  1940. //Set it to zero in case we have a badly behaved server.
  1941. *ppvObj = 0;
  1942. }
  1943. return hr;
  1944. }
  1945. //+-------------------------------------------------------------------------
  1946. //
  1947. // Function: IMoniker_BindToStorage_Proxy
  1948. //
  1949. // Synopsis: Client-side [call_as] wrapper function for
  1950. // IMoniker::BindToStorage.
  1951. //
  1952. //--------------------------------------------------------------------------
  1953. HRESULT STDMETHODCALLTYPE IMoniker_BindToStorage_Proxy(
  1954. IMoniker __RPC_FAR * This,
  1955. IBindCtx __RPC_FAR *pbc,
  1956. IMoniker __RPC_FAR *pmkToLeft,
  1957. REFIID riid,
  1958. void __RPC_FAR *__RPC_FAR *ppvObj)
  1959. {
  1960. HRESULT hr;
  1961. *ppvObj = 0;
  1962. hr = IMoniker_RemoteBindToStorage_Proxy(
  1963. This, pbc, pmkToLeft, riid, (IUnknown **)ppvObj);
  1964. return hr;
  1965. }
  1966. //+-------------------------------------------------------------------------
  1967. //
  1968. // Function: IMoniker_BindToStorage_Stub
  1969. //
  1970. // Synopsis: Server-side [call_as] wrapper function for
  1971. // IMoniker::BindToStorage.
  1972. //
  1973. //--------------------------------------------------------------------------
  1974. HRESULT STDMETHODCALLTYPE IMoniker_BindToStorage_Stub(
  1975. IMoniker __RPC_FAR * This,
  1976. IBindCtx __RPC_FAR *pbc,
  1977. IMoniker __RPC_FAR *pmkToLeft,
  1978. REFIID riid,
  1979. IUnknown __RPC_FAR *__RPC_FAR *ppvObj)
  1980. {
  1981. HRESULT hr;
  1982. hr = This->lpVtbl->BindToStorage(
  1983. This, pbc, pmkToLeft, riid, (void **) ppvObj);
  1984. if(FAILED(hr))
  1985. {
  1986. //If the server returns an error code, it must set *ppvObj to zero.
  1987. ASSERT(*ppvObj == 0);
  1988. //Set it to zero in case we have a badly behaved server.
  1989. *ppvObj = 0;
  1990. }
  1991. return hr;
  1992. }
  1993. //+-------------------------------------------------------------------------
  1994. //
  1995. // Function: IOleCache2_UpdateCache_Proxy
  1996. //
  1997. // Synopsis: Client-side [call_as] wrapper function for
  1998. // IOleCache2:UpdateCache
  1999. //
  2000. //--------------------------------------------------------------------------
  2001. HRESULT STDMETHODCALLTYPE IOleCache2_UpdateCache_Proxy(
  2002. IOleCache2 __RPC_FAR * This,
  2003. LPDATAOBJECT pDataObject,
  2004. DWORD grfUpdf,
  2005. LPVOID pReserved)
  2006. {
  2007. HRESULT hr;
  2008. hr = IOleCache2_RemoteUpdateCache_Proxy(This,
  2009. pDataObject,
  2010. grfUpdf,
  2011. (LONG_PTR) pReserved);
  2012. return hr;
  2013. }
  2014. //+-------------------------------------------------------------------------
  2015. //
  2016. // Function: IOleCache2_UpdateCache_Stub
  2017. //
  2018. // Synopsis: Server-side [call_as] wrapper function for
  2019. // IOleCache2::UpdateCache.
  2020. //
  2021. //--------------------------------------------------------------------------
  2022. HRESULT STDMETHODCALLTYPE IOleCache2_UpdateCache_Stub(
  2023. IOleCache2 __RPC_FAR * This,
  2024. LPDATAOBJECT pDataObject,
  2025. DWORD grfUpdf,
  2026. LONG_PTR pReserved)
  2027. {
  2028. HRESULT hr;
  2029. hr = This->lpVtbl->UpdateCache(This,
  2030. pDataObject,
  2031. grfUpdf,
  2032. (void *)pReserved);
  2033. return hr;
  2034. }
  2035. //+-------------------------------------------------------------------------
  2036. //
  2037. // Function: IOleInPlaceActiveObject_TranslateAccelerator_Proxy
  2038. //
  2039. // Synopsis: Client-side [call_as] wrapper function for
  2040. // IOleInPlaceActiveObject::TranslateAccelerator.
  2041. //
  2042. // Returns: This function always returns S_FALSE.
  2043. //
  2044. // Notes: A container needs to process accelerators differently
  2045. // depending on whether an inplace server is running
  2046. // in process or as a local server. When the container
  2047. // calls IOleInPlaceActiveObject::TranslateAccelerator on
  2048. // an inprocess server, the server can return S_OK if it
  2049. // successfully translated the message. When the container
  2050. // calls IOleInPlaceActiveObject::TranslateAccelerator on
  2051. // a local server, the proxy will always return S_FALSE.
  2052. // In other words, a local server never gets the opportunity
  2053. // to translate messages from the container.
  2054. //
  2055. //--------------------------------------------------------------------------
  2056. HRESULT STDMETHODCALLTYPE IOleInPlaceActiveObject_TranslateAccelerator_Proxy(
  2057. IOleInPlaceActiveObject __RPC_FAR * This,
  2058. LPMSG lpmsg)
  2059. {
  2060. return S_FALSE;
  2061. }
  2062. //+-------------------------------------------------------------------------
  2063. //
  2064. // Function: IOleInPlaceActiveObject_TranslateAccelerator_Stub
  2065. //
  2066. // Synopsis: Server-side [call_as] wrapper function for
  2067. // IOleInPlaceActiveObject::TranslateAccelerator
  2068. //
  2069. // Notes: This function should never be called.
  2070. //
  2071. //--------------------------------------------------------------------------
  2072. HRESULT STDMETHODCALLTYPE IOleInPlaceActiveObject_TranslateAccelerator_Stub(
  2073. IOleInPlaceActiveObject __RPC_FAR * This)
  2074. {
  2075. return S_FALSE;
  2076. }
  2077. //+-------------------------------------------------------------------------
  2078. //
  2079. // Function: IOleInPlaceActiveObject_ResizeBorder_Proxy
  2080. //
  2081. // Synopsis: Client-side [call_as] wrapper function for
  2082. // IOleInPlaceActiveObject::ResizeBorder
  2083. //
  2084. // Notes: The pUIWindow interface is either an IOleInPlaceUIWindow or
  2085. // an IOleInPlaceFrame, based on fFrameWindow. We use
  2086. // fFrameWindow to tell the proxy exactly which interace it
  2087. // is so that it gets marshalled and unmarshalled correctly.
  2088. //
  2089. //--------------------------------------------------------------------------
  2090. HRESULT STDMETHODCALLTYPE IOleInPlaceActiveObject_ResizeBorder_Proxy(
  2091. IOleInPlaceActiveObject __RPC_FAR * This,
  2092. LPCRECT prcBorder,
  2093. IOleInPlaceUIWindow *pUIWindow,
  2094. BOOL fFrameWindow)
  2095. {
  2096. HRESULT hr;
  2097. REFIID riid;
  2098. if (fFrameWindow)
  2099. {
  2100. riid = &IID_IOleInPlaceFrame;
  2101. }
  2102. else
  2103. {
  2104. riid = &IID_IOleInPlaceUIWindow;
  2105. }
  2106. hr = IOleInPlaceActiveObject_RemoteResizeBorder_Proxy(
  2107. This, prcBorder, riid, pUIWindow, fFrameWindow);
  2108. return(hr);
  2109. }
  2110. //+-------------------------------------------------------------------------
  2111. //
  2112. // Function: IOleInPlaceActiveObject_ResizeBorder_Stub
  2113. //
  2114. // Synopsis: Server-side [call_as] wrapper function for
  2115. // IOleInPlaceActiveObject::ResizeBorder
  2116. //
  2117. //--------------------------------------------------------------------------
  2118. HRESULT STDMETHODCALLTYPE IOleInPlaceActiveObject_ResizeBorder_Stub(
  2119. IOleInPlaceActiveObject __RPC_FAR * This,
  2120. LPCRECT prcBorder,
  2121. REFIID riid,
  2122. IOleInPlaceUIWindow *pUIWindow,
  2123. BOOL fFrameWindow)
  2124. {
  2125. HRESULT hr;
  2126. hr = This->lpVtbl->ResizeBorder(This, prcBorder, pUIWindow, fFrameWindow);
  2127. return(hr);
  2128. }
  2129. //+-------------------------------------------------------------------------
  2130. //
  2131. // Function: IStorage_OpenStream_Proxy
  2132. //
  2133. // Synopsis: Client-side [call_as] wrapper function for
  2134. // IStorage::OpenStream.
  2135. //
  2136. //--------------------------------------------------------------------------
  2137. HRESULT STDMETHODCALLTYPE IStorage_OpenStream_Proxy(
  2138. IStorage __RPC_FAR * This,
  2139. const OLECHAR __RPC_FAR *pwcsName,
  2140. void __RPC_FAR *pReserved1,
  2141. DWORD grfMode,
  2142. DWORD reserved2,
  2143. IStream __RPC_FAR *__RPC_FAR *ppstm)
  2144. {
  2145. HRESULT hr;
  2146. #if DBG == 1
  2147. if(pReserved1 != 0)
  2148. return STG_E_INVALIDPARAMETER;
  2149. #endif
  2150. *ppstm = 0;
  2151. hr = IStorage_RemoteOpenStream_Proxy(
  2152. This, pwcsName, 0, 0, grfMode, reserved2, ppstm);
  2153. return hr;
  2154. }
  2155. //+-------------------------------------------------------------------------
  2156. //
  2157. // Function: IStorage_OpenStream_Stub
  2158. //
  2159. // Synopsis: Server-side [call_as] wrapper function for
  2160. // IStorage::OpenStream.
  2161. //
  2162. //--------------------------------------------------------------------------
  2163. HRESULT STDMETHODCALLTYPE IStorage_OpenStream_Stub(
  2164. IStorage __RPC_FAR * This,
  2165. const OLECHAR __RPC_FAR *pwcsName,
  2166. unsigned long cbReserved1,
  2167. byte __RPC_FAR *reserved1,
  2168. DWORD grfMode,
  2169. DWORD reserved2,
  2170. IStream __RPC_FAR *__RPC_FAR *ppstm)
  2171. {
  2172. HRESULT hr;
  2173. hr = This->lpVtbl->OpenStream(This, pwcsName, 0, grfMode, reserved2, ppstm);
  2174. if(FAILED(hr))
  2175. {
  2176. //If the server returns an error code, it must set *ppstm to zero.
  2177. ASSERT(*ppstm == 0);
  2178. //Set *ppstm to zero in case we have a badly behaved server.
  2179. *ppstm = 0;
  2180. }
  2181. return hr;
  2182. }
  2183. //+-------------------------------------------------------------------------
  2184. //
  2185. // Function: IStorage_EnumElements_Proxy
  2186. //
  2187. // Synopsis: Client-side [call_as] wrapper function for
  2188. // IStorage_EnumElements_Proxy
  2189. //
  2190. //--------------------------------------------------------------------------
  2191. HRESULT STDMETHODCALLTYPE IStorage_EnumElements_Proxy(
  2192. IStorage __RPC_FAR * This,
  2193. DWORD reserved1,
  2194. void __RPC_FAR *reserved2,
  2195. DWORD reserved3,
  2196. IEnumSTATSTG __RPC_FAR *__RPC_FAR *ppenum)
  2197. {
  2198. HRESULT hr;
  2199. *ppenum = 0;
  2200. hr = IStorage_RemoteEnumElements_Proxy(
  2201. This, reserved1, 0, 0, reserved3, ppenum);
  2202. return hr;
  2203. }
  2204. //+-------------------------------------------------------------------------
  2205. //
  2206. // Function: IStorage_EnumElements_Stub
  2207. //
  2208. // Synopsis: Server-side [call_as] wrapper function for
  2209. // IStorage::EnumElements.
  2210. //
  2211. //--------------------------------------------------------------------------
  2212. HRESULT STDMETHODCALLTYPE IStorage_EnumElements_Stub(
  2213. IStorage __RPC_FAR * This,
  2214. DWORD reserved1,
  2215. unsigned long cbReserved2,
  2216. byte __RPC_FAR *reserved2,
  2217. DWORD reserved3,
  2218. IEnumSTATSTG __RPC_FAR *__RPC_FAR *ppenum)
  2219. {
  2220. HRESULT hr;
  2221. hr = This->lpVtbl->EnumElements(This, reserved1, 0, reserved3, ppenum);
  2222. if(FAILED(hr))
  2223. {
  2224. //If the server returns an error code, it must set *ppenum to zero.
  2225. ASSERT(*ppenum == 0);
  2226. //Set *ppenum to zero in case we have a badly behaved server.
  2227. *ppenum = 0;
  2228. }
  2229. return hr;
  2230. }
  2231. //+-------------------------------------------------------------------------
  2232. //
  2233. // Function: IRunnableObject_IsRunning_Proxy
  2234. //
  2235. // Synopsis: Client-side [call_as] wrapper function for
  2236. // IRunnableObject::IsRunning.
  2237. //
  2238. //--------------------------------------------------------------------------
  2239. BOOL STDMETHODCALLTYPE IRunnableObject_IsRunning_Proxy(
  2240. IRunnableObject __RPC_FAR * This)
  2241. {
  2242. BOOL bIsRunning = TRUE;
  2243. HRESULT hr;
  2244. hr = IRunnableObject_RemoteIsRunning_Proxy(This);
  2245. if(S_FALSE == hr)
  2246. bIsRunning = FALSE;
  2247. return bIsRunning;
  2248. }
  2249. //+-------------------------------------------------------------------------
  2250. //
  2251. // Function: IRunnableObject_IsRunning_Stub
  2252. //
  2253. // Synopsis: Server-side [call_as] wrapper function for
  2254. // IRunnableObject::IsRunning.
  2255. //
  2256. //--------------------------------------------------------------------------
  2257. HRESULT STDMETHODCALLTYPE IRunnableObject_IsRunning_Stub(
  2258. IRunnableObject __RPC_FAR * This)
  2259. {
  2260. HRESULT hr;
  2261. BOOL bIsRunning;
  2262. bIsRunning = This->lpVtbl->IsRunning(This);
  2263. if(TRUE == bIsRunning)
  2264. hr = S_OK;
  2265. else
  2266. hr = S_FALSE;
  2267. return hr;
  2268. }
  2269. //+-------------------------------------------------------------------------
  2270. //
  2271. // Function: ISequentialStream_Read_Proxy
  2272. //
  2273. // Synopsis: Client-side [call_as] wrapper function for
  2274. // IStream::Read. This wrapper function handles the case
  2275. // where pcbRead is NULL.
  2276. //
  2277. // Notes: If pcbRead != 0, then the number of bytes read
  2278. // will be returned in *pcbRead. If an error
  2279. // occurs, then *pcbRead is set to zero.
  2280. //
  2281. //--------------------------------------------------------------------------
  2282. HRESULT STDMETHODCALLTYPE ISequentialStream_Read_Proxy(
  2283. ISequentialStream __RPC_FAR * This,
  2284. void __RPC_FAR *pv,
  2285. ULONG cb,
  2286. ULONG __RPC_FAR *pcbRead)
  2287. {
  2288. HRESULT hr;
  2289. ULONG cbRead = 0;
  2290. #if DBG == 1
  2291. //validate parameters.
  2292. if(pv == 0)
  2293. return STG_E_INVALIDPOINTER;
  2294. #endif //DBG == 1
  2295. hr = ISequentialStream_RemoteRead_Proxy(This, (byte *) pv, cb, &cbRead);
  2296. if(pcbRead != 0)
  2297. *pcbRead = cbRead;
  2298. return hr;
  2299. }
  2300. //+-------------------------------------------------------------------------
  2301. //
  2302. // Function: ISequentialStream_Read_Stub
  2303. //
  2304. // Synopsis: Server-side [call_as] wrapper function for
  2305. // IStream::Read.
  2306. //
  2307. //--------------------------------------------------------------------------
  2308. HRESULT STDMETHODCALLTYPE ISequentialStream_Read_Stub(
  2309. ISequentialStream __RPC_FAR * This,
  2310. byte __RPC_FAR *pv,
  2311. ULONG cb,
  2312. ULONG __RPC_FAR *pcbRead)
  2313. {
  2314. HRESULT hr;
  2315. *pcbRead = 0;
  2316. hr = This->lpVtbl->Read(This, (void *) pv, cb, pcbRead);
  2317. return hr;
  2318. }
  2319. //+-------------------------------------------------------------------------
  2320. //
  2321. // Function: IStream_Seek_Proxy
  2322. //
  2323. // Synopsis: Client-side [call_as] wrapper function for
  2324. // IStream::Seek. This wrapper function handles the case
  2325. // where plibNewPosition is NULL.
  2326. //
  2327. // Notes: If plibNewPosition != 0, then the new position
  2328. // will be returned in *plibNewPosition.
  2329. //
  2330. //--------------------------------------------------------------------------
  2331. HRESULT STDMETHODCALLTYPE IStream_Seek_Proxy(
  2332. IStream __RPC_FAR * This,
  2333. LARGE_INTEGER dlibMove,
  2334. DWORD dwOrigin,
  2335. ULARGE_INTEGER __RPC_FAR *plibNewPosition)
  2336. {
  2337. HRESULT hr;
  2338. ULARGE_INTEGER libNewPosition;
  2339. hr = IStream_RemoteSeek_Proxy(This, dlibMove, dwOrigin, &libNewPosition);
  2340. if(plibNewPosition != 0)
  2341. {
  2342. *plibNewPosition = libNewPosition;
  2343. }
  2344. return hr;
  2345. }
  2346. //+-------------------------------------------------------------------------
  2347. //
  2348. // Function: IStream_Seek_Stub
  2349. //
  2350. // Synopsis: Server-side [call_as] wrapper function for
  2351. // IStream::Seek.
  2352. //
  2353. //--------------------------------------------------------------------------
  2354. HRESULT STDMETHODCALLTYPE IStream_Seek_Stub(
  2355. IStream __RPC_FAR * This,
  2356. LARGE_INTEGER dlibMove,
  2357. DWORD dwOrigin,
  2358. ULARGE_INTEGER __RPC_FAR *plibNewPosition)
  2359. {
  2360. HRESULT hr;
  2361. hr = This->lpVtbl->Seek(This, dlibMove, dwOrigin, plibNewPosition);
  2362. return hr;
  2363. }
  2364. //+-------------------------------------------------------------------------
  2365. //
  2366. // Function: ISequentialStream_Write_Proxy
  2367. //
  2368. // Synopsis: Client-side [call_as] wrapper function for
  2369. // IStream::Write. This wrapper function handles the
  2370. // case where pcbWritten is NULL.
  2371. //
  2372. // Notes: If pcbWritten != 0, then the number of bytes written
  2373. // will be returned in *pcbWritten. If an error
  2374. // occurs, then *pcbWritten is set to zero.
  2375. //
  2376. //--------------------------------------------------------------------------
  2377. HRESULT STDMETHODCALLTYPE ISequentialStream_Write_Proxy(
  2378. ISequentialStream __RPC_FAR * This,
  2379. const void __RPC_FAR *pv,
  2380. ULONG cb,
  2381. ULONG __RPC_FAR *pcbWritten)
  2382. {
  2383. HRESULT hr;
  2384. ULONG cbWritten = 0;
  2385. #if DBG == 1
  2386. //validate parameters.
  2387. if(pv == 0)
  2388. return STG_E_INVALIDPOINTER;
  2389. #endif
  2390. hr = ISequentialStream_RemoteWrite_Proxy(This, (byte *) pv, cb, &cbWritten);
  2391. if(pcbWritten != 0)
  2392. *pcbWritten = cbWritten;
  2393. return hr;
  2394. }
  2395. //+-------------------------------------------------------------------------
  2396. //
  2397. // Function: ISequentialStream_Write_Stub
  2398. //
  2399. // Synopsis: Server-side [call_as] wrapper function for
  2400. // ISequentialStream::Write.
  2401. //
  2402. //--------------------------------------------------------------------------
  2403. HRESULT STDMETHODCALLTYPE ISequentialStream_Write_Stub(
  2404. ISequentialStream __RPC_FAR * This,
  2405. const byte __RPC_FAR *pv,
  2406. ULONG cb,
  2407. ULONG __RPC_FAR *pcbWritten)
  2408. {
  2409. HRESULT hr;
  2410. *pcbWritten = 0;
  2411. hr = This->lpVtbl->Write(This, (const void __RPC_FAR *) pv, cb, pcbWritten);
  2412. return hr;
  2413. }
  2414. //+-------------------------------------------------------------------------
  2415. //
  2416. // Function: IStream_CopyTo_Proxy
  2417. //
  2418. // Synopsis: Client-side [call_as] wrapper function for
  2419. // IStream::CopyTo. This wrapper function handles the
  2420. // cases where pcbRead is NULL or pcbWritten is NULL.
  2421. //
  2422. // Notes: If pcbRead != 0, then the number of bytes read
  2423. // will be returned in *pcbRead. If an error
  2424. // occurs, then *pcbRead is set to zero.
  2425. //
  2426. // If pcbWritten != 0, then the number of bytes written
  2427. // will be returned in *pcbWritten. If an error
  2428. // occurs, then *pcbWritten is set to zero.
  2429. //
  2430. //--------------------------------------------------------------------------
  2431. HRESULT STDMETHODCALLTYPE IStream_CopyTo_Proxy(
  2432. IStream __RPC_FAR * This,
  2433. IStream __RPC_FAR *pstm,
  2434. ULARGE_INTEGER cb,
  2435. ULARGE_INTEGER __RPC_FAR *pcbRead,
  2436. ULARGE_INTEGER __RPC_FAR *pcbWritten)
  2437. {
  2438. HRESULT hr;
  2439. ULARGE_INTEGER cbRead;
  2440. ULARGE_INTEGER cbWritten;
  2441. cbRead.LowPart = 0;
  2442. cbRead.HighPart = 0;
  2443. cbWritten.LowPart = 0;
  2444. cbWritten.HighPart = 0;
  2445. hr = IStream_RemoteCopyTo_Proxy(This, pstm, cb, &cbRead, &cbWritten);
  2446. if(pcbRead != 0)
  2447. *pcbRead = cbRead;
  2448. if(pcbWritten != 0)
  2449. *pcbWritten = cbWritten;
  2450. return hr;
  2451. }
  2452. //+-------------------------------------------------------------------------
  2453. //
  2454. // Function: IStream_CopyTo_Stub
  2455. //
  2456. // Synopsis: Server-side [call_as] wrapper function for
  2457. // IStream::CopyTo.
  2458. //
  2459. //--------------------------------------------------------------------------
  2460. HRESULT STDMETHODCALLTYPE IStream_CopyTo_Stub(
  2461. IStream __RPC_FAR * This,
  2462. IStream __RPC_FAR *pstm,
  2463. ULARGE_INTEGER cb,
  2464. ULARGE_INTEGER __RPC_FAR *pcbRead,
  2465. ULARGE_INTEGER __RPC_FAR *pcbWritten)
  2466. {
  2467. HRESULT hr;
  2468. pcbRead->LowPart = 0;
  2469. pcbRead->HighPart = 0;
  2470. pcbWritten->LowPart = 0;
  2471. pcbWritten->HighPart = 0;
  2472. hr = This->lpVtbl->CopyTo(This, pstm, cb, pcbRead, pcbWritten);
  2473. return hr;
  2474. }
  2475. //+-------------------------------------------------------------------------
  2476. //
  2477. // Function: IViewObject_Draw_Proxy
  2478. //
  2479. // Synopsis: Client-side [call_as] wrapper function for
  2480. // IViewObject::Draw.
  2481. //
  2482. //--------------------------------------------------------------------------
  2483. HRESULT STDMETHODCALLTYPE IViewObject_Draw_Proxy(
  2484. IViewObject __RPC_FAR * This,
  2485. DWORD dwDrawAspect,
  2486. LONG lindex,
  2487. void __RPC_FAR *pvAspect,
  2488. DVTARGETDEVICE __RPC_FAR *ptd,
  2489. HDC hdcTargetDev,
  2490. HDC hdcDraw,
  2491. LPCRECTL lprcBounds,
  2492. LPCRECTL lprcWBounds,
  2493. BOOL (STDMETHODCALLTYPE __RPC_FAR *pfnContinue )(ULONG_PTR dwContinue),
  2494. ULONG_PTR dwContinue)
  2495. {
  2496. HRESULT hr;
  2497. IContinue *pContinue = 0;
  2498. if(pvAspect != 0)
  2499. return E_INVALIDARG;
  2500. if(pfnContinue != 0)
  2501. {
  2502. hr = CreateCallback(pfnContinue, dwContinue, &pContinue);
  2503. if(FAILED(hr))
  2504. {
  2505. return hr;
  2506. }
  2507. }
  2508. hr = IViewObject_RemoteDraw_Proxy(This,
  2509. dwDrawAspect,
  2510. lindex,
  2511. (LONG_PTR) pvAspect,
  2512. ptd,
  2513. (LONG_PTR) hdcTargetDev,
  2514. (LONG_PTR) hdcDraw,
  2515. lprcBounds,
  2516. lprcWBounds,
  2517. pContinue);
  2518. if(pContinue != 0)
  2519. {
  2520. pContinue->lpVtbl->Release(pContinue);
  2521. }
  2522. return hr;
  2523. }
  2524. //+-------------------------------------------------------------------------
  2525. //
  2526. // Function: IViewObject_RemoteContinue
  2527. //
  2528. // Synopsis: Wrapper function for IContinue::FContinue. This function
  2529. // is used for marshalling the pfnContinue parameter in
  2530. // IViewObject::Draw.
  2531. //
  2532. // Algorithm: Cast the dwContinue to an IContinue * and then
  2533. // call IContinue::FContinue.
  2534. //
  2535. //--------------------------------------------------------------------------
  2536. BOOL STDAPICALLTYPE IViewObject_RemoteContinue(ULONG_PTR dwContinue)
  2537. {
  2538. BOOL bContinue = TRUE;
  2539. HRESULT hr;
  2540. IContinue *pContinue = (IContinue *) dwContinue;
  2541. if(pContinue != 0)
  2542. {
  2543. hr = pContinue->lpVtbl->FContinue(pContinue);
  2544. if(S_FALSE == hr)
  2545. bContinue = FALSE;
  2546. }
  2547. return bContinue;
  2548. }
  2549. //+-------------------------------------------------------------------------
  2550. //
  2551. // Function: IViewObject_Draw_Stub
  2552. //
  2553. // Synopsis: Server-side [call_as] wrapper function for
  2554. // IViewObject::Draw.
  2555. //
  2556. //--------------------------------------------------------------------------
  2557. HRESULT STDMETHODCALLTYPE IViewObject_Draw_Stub(
  2558. IViewObject __RPC_FAR * This,
  2559. DWORD dwDrawAspect,
  2560. LONG lindex,
  2561. ULONG_PTR pvAspect,
  2562. DVTARGETDEVICE __RPC_FAR *ptd,
  2563. ULONG_PTR hdcTargetDev,
  2564. ULONG_PTR hdcDraw,
  2565. LPCRECTL lprcBounds,
  2566. LPCRECTL lprcWBounds,
  2567. IContinue *pContinue)
  2568. {
  2569. HRESULT hr;
  2570. BOOL (STDMETHODCALLTYPE __RPC_FAR *pfnContinue )(ULONG_PTR dwContinue) = 0;
  2571. ULONG_PTR dwContinue = 0;
  2572. if(pContinue != 0)
  2573. {
  2574. pfnContinue = IViewObject_RemoteContinue;
  2575. dwContinue = (ULONG_PTR) pContinue;
  2576. }
  2577. hr = This->lpVtbl->Draw(This,
  2578. dwDrawAspect,
  2579. lindex,
  2580. (void *) pvAspect,
  2581. ptd,
  2582. (HDC) hdcTargetDev,
  2583. (HDC) hdcDraw,
  2584. lprcBounds,
  2585. lprcWBounds,
  2586. pfnContinue,
  2587. dwContinue);
  2588. return hr;
  2589. }
  2590. //+-------------------------------------------------------------------------
  2591. //
  2592. // Function: IViewObject_Freeze_Proxy
  2593. //
  2594. // Synopsis: Client-side [call_as] wrapper function for
  2595. // IViewObject::Freeze.
  2596. //
  2597. //--------------------------------------------------------------------------
  2598. HRESULT STDMETHODCALLTYPE IViewObject_Freeze_Proxy(
  2599. IViewObject __RPC_FAR * This,
  2600. DWORD dwDrawAspect,
  2601. LONG lindex,
  2602. void __RPC_FAR *pvAspect,
  2603. DWORD __RPC_FAR *pdwFreeze)
  2604. {
  2605. HRESULT hr;
  2606. if(pvAspect != 0)
  2607. return E_INVALIDARG;
  2608. hr = IViewObject_RemoteFreeze_Proxy(This,
  2609. dwDrawAspect,
  2610. lindex,
  2611. (LONG_PTR) pvAspect,
  2612. pdwFreeze);
  2613. return hr;
  2614. }
  2615. //+-------------------------------------------------------------------------
  2616. //
  2617. // Function: IViewObject_Freeze_Stub
  2618. //
  2619. // Synopsis: Server-side [call_as] wrapper function for
  2620. // IViewObject::Freeze.
  2621. //
  2622. //--------------------------------------------------------------------------
  2623. HRESULT STDMETHODCALLTYPE IViewObject_Freeze_Stub(
  2624. IViewObject __RPC_FAR * This,
  2625. DWORD dwDrawAspect,
  2626. LONG lindex,
  2627. ULONG_PTR pvAspect,
  2628. DWORD __RPC_FAR *pdwFreeze)
  2629. {
  2630. HRESULT hr;
  2631. hr = This->lpVtbl->Freeze(This,
  2632. dwDrawAspect,
  2633. lindex,
  2634. (void *) pvAspect,
  2635. pdwFreeze);
  2636. return hr;
  2637. }
  2638. //+-------------------------------------------------------------------------
  2639. //
  2640. // Function: IViewObject_GetAdvise_Proxy
  2641. //
  2642. // Synopsis: Client-side [call_as] wrapper function for
  2643. // IViewObject::GetAdvise.
  2644. //
  2645. //--------------------------------------------------------------------------
  2646. HRESULT STDMETHODCALLTYPE IViewObject_GetAdvise_Proxy(
  2647. IViewObject __RPC_FAR * This,
  2648. /* [unique][out] */ DWORD __RPC_FAR *pAspects,
  2649. /* [unique][out] */ DWORD __RPC_FAR *pAdvf,
  2650. /* [out] */ IAdviseSink __RPC_FAR *__RPC_FAR *ppAdvSink)
  2651. {
  2652. HRESULT hr;
  2653. DWORD dwAspects = 0;
  2654. DWORD dwAdvf = 0;
  2655. hr = IViewObject_RemoteGetAdvise_Proxy(This,
  2656. &dwAspects,
  2657. &dwAdvf,
  2658. ppAdvSink);
  2659. if(pAspects != NULL)
  2660. {
  2661. *pAspects = dwAspects;
  2662. }
  2663. if(pAdvf != NULL)
  2664. {
  2665. *pAdvf = dwAdvf;
  2666. }
  2667. return hr;
  2668. }
  2669. //+-------------------------------------------------------------------------
  2670. //
  2671. // Function: IViewObject_GetAdvise_Stub
  2672. //
  2673. // Synopsis: Server-side [call_as] wrapper function for
  2674. // IViewObject::GetAdvise.
  2675. //
  2676. //--------------------------------------------------------------------------
  2677. HRESULT STDMETHODCALLTYPE IViewObject_GetAdvise_Stub(
  2678. IViewObject __RPC_FAR * This,
  2679. /* [out] */ DWORD __RPC_FAR *pAspects,
  2680. /* [out] */ DWORD __RPC_FAR *pAdvf,
  2681. /* [out] */ IAdviseSink __RPC_FAR *__RPC_FAR *ppAdvSink)
  2682. {
  2683. HRESULT hr;
  2684. hr = This->lpVtbl->GetAdvise(This,
  2685. pAspects,
  2686. pAdvf,
  2687. ppAdvSink);
  2688. return hr;
  2689. }
  2690. //+-------------------------------------------------------------------------
  2691. //
  2692. // Function: IViewObject_GetColorSet_Proxy
  2693. //
  2694. // Synopsis: Client-side [call_as] wrapper function for
  2695. // IViewObject::GetColorSet.
  2696. //
  2697. //--------------------------------------------------------------------------
  2698. HRESULT STDMETHODCALLTYPE IViewObject_GetColorSet_Proxy(
  2699. IViewObject __RPC_FAR * This,
  2700. DWORD dwDrawAspect,
  2701. LONG lindex,
  2702. void __RPC_FAR *pvAspect,
  2703. DVTARGETDEVICE __RPC_FAR *ptd,
  2704. HDC hicTargetDev,
  2705. LOGPALETTE __RPC_FAR *__RPC_FAR *ppColorSet)
  2706. {
  2707. HRESULT hr;
  2708. if(pvAspect != 0)
  2709. return E_INVALIDARG;
  2710. hr = IViewObject_RemoteGetColorSet_Proxy(This,
  2711. dwDrawAspect,
  2712. lindex,
  2713. (LONG_PTR) pvAspect,
  2714. ptd,
  2715. (LONG_PTR) hicTargetDev,
  2716. ppColorSet);
  2717. return hr;
  2718. }
  2719. //+-------------------------------------------------------------------------
  2720. //
  2721. // Function: IViewObject_GetColorSet_Stub
  2722. //
  2723. // Synopsis: Server-side [call_as] wrapper function for
  2724. // IViewObject::GetColorSet.
  2725. //
  2726. //--------------------------------------------------------------------------
  2727. HRESULT STDMETHODCALLTYPE IViewObject_GetColorSet_Stub(
  2728. IViewObject __RPC_FAR * This,
  2729. DWORD dwDrawAspect,
  2730. LONG lindex,
  2731. ULONG_PTR pvAspect,
  2732. DVTARGETDEVICE __RPC_FAR *ptd,
  2733. ULONG_PTR hicTargetDev,
  2734. LOGPALETTE __RPC_FAR *__RPC_FAR *ppColorSet)
  2735. {
  2736. HRESULT hr;
  2737. hr = This->lpVtbl->GetColorSet(This,
  2738. dwDrawAspect,
  2739. lindex,
  2740. (void *)pvAspect,
  2741. ptd,
  2742. (HDC) hicTargetDev,
  2743. ppColorSet);
  2744. return hr;
  2745. }
  2746. //+-------------------------------------------------------------------------
  2747. //
  2748. // Function: IEnumSTATPROPSTG_Next_Proxy
  2749. //
  2750. // Synopsis:
  2751. //
  2752. //--------------------------------------------------------------------------
  2753. HRESULT STDMETHODCALLTYPE IEnumSTATPROPSTG_Next_Proxy(
  2754. IEnumSTATPROPSTG __RPC_FAR * This,
  2755. /* [in] */ ULONG celt,
  2756. /* [out] */ STATPROPSTG __RPC_FAR *rgelt,
  2757. /* [unique][out][in] */ ULONG __RPC_FAR *pceltFetched)
  2758. {
  2759. HRESULT hr;
  2760. ULONG celtFetched = 0;
  2761. if((celt > 1) && (pceltFetched == 0))
  2762. return E_INVALIDARG;
  2763. hr = IEnumSTATPROPSTG_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  2764. if (pceltFetched != 0)
  2765. {
  2766. *pceltFetched = celtFetched;
  2767. }
  2768. return hr;
  2769. }
  2770. //+-------------------------------------------------------------------------
  2771. //
  2772. // Function: IEnumSTATPROPSTG_Next_Stub
  2773. //
  2774. // Synopsis:
  2775. //
  2776. //--------------------------------------------------------------------------
  2777. HRESULT STDMETHODCALLTYPE IEnumSTATPROPSTG_Next_Stub(
  2778. IEnumSTATPROPSTG __RPC_FAR * This,
  2779. /* [in] */ ULONG celt,
  2780. /* [length_is][size_is][out] */ STATPROPSTG __RPC_FAR *rgelt,
  2781. /* [out] */ ULONG __RPC_FAR *pceltFetched)
  2782. {
  2783. return This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  2784. }
  2785. //+-------------------------------------------------------------------------
  2786. //
  2787. // Function: IEnumSTATPROPSETSTG_Next_Proxy
  2788. //
  2789. // Synopsis:
  2790. //
  2791. //--------------------------------------------------------------------------
  2792. HRESULT STDMETHODCALLTYPE IEnumSTATPROPSETSTG_Next_Proxy(
  2793. IEnumSTATPROPSETSTG __RPC_FAR * This,
  2794. /* [in] */ ULONG celt,
  2795. /* [out] */ STATPROPSETSTG __RPC_FAR *rgelt,
  2796. /* [unique][out][in] */ ULONG __RPC_FAR *pceltFetched)
  2797. {
  2798. HRESULT hr;
  2799. ULONG celtFetched = 0;
  2800. if((celt > 1) && (pceltFetched == 0))
  2801. return E_INVALIDARG;
  2802. hr = IEnumSTATPROPSETSTG_RemoteNext_Proxy(This, celt, rgelt, &celtFetched);
  2803. if (pceltFetched != 0)
  2804. {
  2805. *pceltFetched = celtFetched;
  2806. }
  2807. return hr;
  2808. }
  2809. //+-------------------------------------------------------------------------
  2810. //
  2811. // Function: IEnumSTATPROPSETSTG_Next_Stub
  2812. //
  2813. // Synopsis:
  2814. //
  2815. //--------------------------------------------------------------------------
  2816. HRESULT STDMETHODCALLTYPE IEnumSTATPROPSETSTG_Next_Stub(
  2817. IEnumSTATPROPSETSTG __RPC_FAR * This,
  2818. /* [in] */ ULONG celt,
  2819. /* [length_is][size_is][out] */ STATPROPSETSTG __RPC_FAR *rgelt,
  2820. /* [out] */ ULONG __RPC_FAR *pceltFetched)
  2821. {
  2822. return This->lpVtbl->Next(This, celt, rgelt, pceltFetched);
  2823. }
  2824. //+-------------------------------------------------------------------------
  2825. //
  2826. // Function: IFillLockBytes_FillAt_Proxy
  2827. //
  2828. // Synopsis: Client-side [call_as] wrapper function for
  2829. // IFillLockBytes::FillAt. This wrapper function handles the
  2830. // case where pcbWritten is NULL.
  2831. //
  2832. // Notes: If pcbWritten != 0, then the number of bytes written
  2833. // will be returned in *pcbWritten. If an error
  2834. // occurs, then *pcbWritten is set to zero.
  2835. //
  2836. // History: ? ? Created
  2837. // 05-27-94 AlexT Actually return count of bytes written
  2838. //
  2839. //--------------------------------------------------------------------------
  2840. HRESULT STDMETHODCALLTYPE IFillLockBytes_FillAt_Proxy(
  2841. IFillLockBytes __RPC_FAR * This,
  2842. ULARGE_INTEGER ulOffset,
  2843. const void __RPC_FAR *pv,
  2844. ULONG cb,
  2845. ULONG __RPC_FAR *pcbWritten)
  2846. {
  2847. HRESULT hr;
  2848. ULONG cbWritten = 0;
  2849. #if DBG == 1
  2850. //validate parameters.
  2851. if(pv == 0)
  2852. return STG_E_INVALIDPOINTER;
  2853. #endif
  2854. hr = IFillLockBytes_RemoteFillAt_Proxy(This, ulOffset, (byte __RPC_FAR *)pv, cb, &cbWritten);
  2855. if(pcbWritten != 0)
  2856. *pcbWritten = cbWritten;
  2857. return hr;
  2858. }
  2859. //+-------------------------------------------------------------------------
  2860. //
  2861. // Function: IFillLockBytes_FillAt_Stub
  2862. //
  2863. // Synopsis: Server-side [call_as] wrapper function for
  2864. // IFillLockBytes::FillAt.
  2865. //
  2866. //--------------------------------------------------------------------------
  2867. HRESULT STDMETHODCALLTYPE IFillLockBytes_FillAt_Stub(
  2868. IFillLockBytes __RPC_FAR * This,
  2869. ULARGE_INTEGER ulOffset,
  2870. const byte __RPC_FAR *pv,
  2871. ULONG cb,
  2872. ULONG __RPC_FAR *pcbWritten)
  2873. {
  2874. HRESULT hr;
  2875. *pcbWritten = 0;
  2876. hr = This->lpVtbl->FillAt(This, ulOffset, pv, cb, pcbWritten);
  2877. return hr;
  2878. }
  2879. //+-------------------------------------------------------------------------
  2880. //
  2881. // Function: IFillLockBytes_FillAppend_Proxy
  2882. //
  2883. // Synopsis: Client-side [call_as] wrapper function for
  2884. // IFillLockBytes::FillAppend. This wrapper function handles the
  2885. // case where pcbWritten is NULL.
  2886. //
  2887. // Notes: If pcbWritten != 0, then the number of bytes written
  2888. // will be returned in *pcbWritten. If an error
  2889. // occurs, then *pcbWritten is set to zero.
  2890. //
  2891. // History: ? ? Created
  2892. // 05-27-94 AlexT Actually return count of bytes written
  2893. //
  2894. //--------------------------------------------------------------------------
  2895. HRESULT STDMETHODCALLTYPE IFillLockBytes_FillAppend_Proxy(
  2896. IFillLockBytes __RPC_FAR * This,
  2897. const void __RPC_FAR *pv,
  2898. ULONG cb,
  2899. ULONG __RPC_FAR *pcbWritten)
  2900. {
  2901. HRESULT hr;
  2902. ULONG cbWritten = 0;
  2903. #if DBG == 1
  2904. //validate parameters.
  2905. if(pv == 0)
  2906. return STG_E_INVALIDPOINTER;
  2907. #endif
  2908. hr = IFillLockBytes_RemoteFillAppend_Proxy(This, (byte __RPC_FAR *)pv, cb, &cbWritten);
  2909. if(pcbWritten != 0)
  2910. *pcbWritten = cbWritten;
  2911. return hr;
  2912. }
  2913. //+-------------------------------------------------------------------------
  2914. //
  2915. // Function: IFillLockBytes_FillAppend_Stub
  2916. //
  2917. // Synopsis: Server-side [call_as] wrapper function for
  2918. // IFillLockBytes::FillAppend.
  2919. //
  2920. //--------------------------------------------------------------------------
  2921. HRESULT STDMETHODCALLTYPE IFillLockBytes_FillAppend_Stub(
  2922. IFillLockBytes __RPC_FAR * This,
  2923. const byte __RPC_FAR *pv,
  2924. ULONG cb,
  2925. ULONG __RPC_FAR *pcbWritten)
  2926. {
  2927. HRESULT hr;
  2928. *pcbWritten = 0;
  2929. hr = This->lpVtbl->FillAppend(This, pv, cb, pcbWritten);
  2930. return hr;
  2931. }