widl: Always check the runtimeclass interfaces presence.
[wine/zf.git] / dlls / ole32 / usrmarshal.c
blobc58053489bed53f2c62e22292c3d2c0e3f7173b5
1 /*
2 * Miscellaneous Marshaling Routines
4 * Copyright 2005 Robert Shearman
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdio.h>
22 #include <stdarg.h>
23 #include <string.h>
25 #define COBJMACROS
26 #define NONAMELESSUNION
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winuser.h"
32 #include "winerror.h"
34 #include "ole2.h"
35 #include "oleauto.h"
36 #include "rpcproxy.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(ole);
42 #define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
43 #define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
44 #define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
45 #define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
47 #define USER_MARSHAL_PTR_PREFIX \
48 ( (DWORD)'U' | ( (DWORD)'s' << 8 ) | \
49 ( (DWORD)'e' << 16 ) | ( (DWORD)'r' << 24 ) )
51 ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG *pFlags, ULONG RealFlags, ULONG StartingSize, IUnknown *punk, REFIID riid);
52 unsigned char * WINAPI WdtpInterfacePointer_UserMarshal(ULONG *pFlags, ULONG RealFlags, unsigned char *pBuffer,
53 IUnknown *punk, REFIID riid);
54 unsigned char * WINAPI WdtpInterfacePointer_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, IUnknown **ppunk, REFIID riid);
56 static const char* debugstr_user_flags(ULONG *pFlags)
58 char buf[12];
59 const char* loword;
60 switch (LOWORD(*pFlags))
62 case MSHCTX_LOCAL:
63 loword="MSHCTX_LOCAL";
64 break;
65 case MSHCTX_NOSHAREDMEM:
66 loword="MSHCTX_NOSHAREDMEM";
67 break;
68 case MSHCTX_DIFFERENTMACHINE:
69 loword="MSHCTX_DIFFERENTMACHINE";
70 break;
71 case MSHCTX_INPROC:
72 loword="MSHCTX_INPROC";
73 break;
74 default:
75 sprintf(buf, "%d", LOWORD(*pFlags));
76 loword=buf;
79 if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION)
80 return wine_dbg_sprintf("MAKELONG(%s, NDR_LOCAL_DATA_REPRESENTATION)", loword);
81 else
82 return wine_dbg_sprintf("MAKELONG(%s, 0x%04x)", loword, HIWORD(*pFlags));
85 /******************************************************************************
86 * HMETAFILE_UserSize [OLE32.@]
88 * Calculates the buffer size required to marshal a metafile.
90 * PARAMS
91 * pFlags [I] Flags. See notes.
92 * StartingSize [I] Starting size of the buffer. This value is added on to
93 * the buffer size required for the clip format.
94 * phmf [I] Metafile to size.
96 * RETURNS
97 * The buffer size required to marshal a metafile plus the starting size.
99 * NOTES
100 * Even though the function is documented to take a pointer to a ULONG in
101 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
102 * the first parameter is a ULONG.
103 * This function is only intended to be called by the RPC runtime.
105 ULONG __RPC_USER HMETAFILE_UserSize(ULONG *pFlags, ULONG StartingSize, HMETAFILE *phmf)
107 ULONG size = StartingSize;
109 TRACE("(%s, %d, &%p\n", debugstr_user_flags(pFlags), StartingSize, *phmf);
111 ALIGN_LENGTH(size, 3);
113 size += sizeof(ULONG);
114 if (LOWORD(*pFlags) == MSHCTX_INPROC)
115 size += sizeof(ULONG_PTR);
116 else
118 size += sizeof(ULONG);
120 if (*phmf)
122 UINT mfsize;
124 size += 2 * sizeof(ULONG);
125 mfsize = GetMetaFileBitsEx(*phmf, 0, NULL);
126 size += mfsize;
130 return size;
133 /******************************************************************************
134 * HMETAFILE_UserMarshal [OLE32.@]
136 * Marshals a metafile into a buffer.
138 * PARAMS
139 * pFlags [I] Flags. See notes.
140 * pBuffer [I] Buffer to marshal the clip format into.
141 * phEmf [I] Metafile to marshal.
143 * RETURNS
144 * The end of the marshaled data in the buffer.
146 * NOTES
147 * Even though the function is documented to take a pointer to a ULONG in
148 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
149 * the first parameter is a ULONG.
150 * This function is only intended to be called by the RPC runtime.
152 unsigned char * __RPC_USER HMETAFILE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILE *phmf)
154 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phmf);
156 ALIGN_POINTER(pBuffer, 3);
158 if (LOWORD(*pFlags) == MSHCTX_INPROC)
160 if (sizeof(*phmf) == 8)
161 *(ULONG *)pBuffer = WDT_INPROC64_CALL;
162 else
163 *(ULONG *)pBuffer = WDT_INPROC_CALL;
164 pBuffer += sizeof(ULONG);
165 *(HMETAFILE *)pBuffer = *phmf;
166 pBuffer += sizeof(HMETAFILE);
168 else
170 *(ULONG *)pBuffer = WDT_REMOTE_CALL;
171 pBuffer += sizeof(ULONG);
172 *(ULONG *)pBuffer = (ULONG)(ULONG_PTR)*phmf;
173 pBuffer += sizeof(ULONG);
175 if (*phmf)
177 UINT mfsize = GetMetaFileBitsEx(*phmf, 0, NULL);
179 *(ULONG *)pBuffer = mfsize;
180 pBuffer += sizeof(ULONG);
181 *(ULONG *)pBuffer = mfsize;
182 pBuffer += sizeof(ULONG);
183 GetMetaFileBitsEx(*phmf, mfsize, pBuffer);
184 pBuffer += mfsize;
188 return pBuffer;
191 /******************************************************************************
192 * HMETAFILE_UserUnmarshal [OLE32.@]
194 * Unmarshals a metafile from a buffer.
196 * PARAMS
197 * pFlags [I] Flags. See notes.
198 * pBuffer [I] Buffer to marshal the clip format from.
199 * phmf [O] Address that receive the unmarshaled metafile.
201 * RETURNS
202 * The end of the marshaled data in the buffer.
204 * NOTES
205 * Even though the function is documented to take a pointer to an ULONG in
206 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
207 * the first parameter is an ULONG.
208 * This function is only intended to be called by the RPC runtime.
210 unsigned char * __RPC_USER HMETAFILE_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILE *phmf)
212 ULONG fContext;
214 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, phmf);
216 ALIGN_POINTER(pBuffer, 3);
218 fContext = *(ULONG *)pBuffer;
219 pBuffer += sizeof(ULONG);
221 if (((fContext == WDT_INPROC_CALL) && (sizeof(*phmf) < 8)) ||
222 ((fContext == WDT_INPROC64_CALL) && (sizeof(*phmf) == 8)))
224 *phmf = *(HMETAFILE *)pBuffer;
225 pBuffer += sizeof(*phmf);
227 else if (fContext == WDT_REMOTE_CALL)
229 ULONG handle;
231 handle = *(ULONG *)pBuffer;
232 pBuffer += sizeof(ULONG);
234 if (handle)
236 ULONG size;
237 size = *(ULONG *)pBuffer;
238 pBuffer += sizeof(ULONG);
239 if (size != *(ULONG *)pBuffer)
241 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
242 return pBuffer;
244 pBuffer += sizeof(ULONG);
245 *phmf = SetMetaFileBitsEx(size, pBuffer);
246 pBuffer += size;
248 else
249 *phmf = NULL;
251 else
252 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
254 return pBuffer;
257 /******************************************************************************
258 * HMETAFILE_UserFree [OLE32.@]
260 * Frees an unmarshaled metafile.
262 * PARAMS
263 * pFlags [I] Flags. See notes.
264 * phmf [I] Metafile to free.
266 * RETURNS
267 * The end of the marshaled data in the buffer.
269 * NOTES
270 * Even though the function is documented to take a pointer to a ULONG in
271 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
272 * which the first parameter is a ULONG.
273 * This function is only intended to be called by the RPC runtime.
275 void __RPC_USER HMETAFILE_UserFree(ULONG *pFlags, HMETAFILE *phmf)
277 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phmf);
279 if (LOWORD(*pFlags) != MSHCTX_INPROC)
280 DeleteMetaFile(*phmf);
283 /******************************************************************************
284 * HENHMETAFILE_UserSize [OLE32.@]
286 * Calculates the buffer size required to marshal an enhanced metafile.
288 * PARAMS
289 * pFlags [I] Flags. See notes.
290 * StartingSize [I] Starting size of the buffer. This value is added on to
291 * the buffer size required for the clip format.
292 * phEmf [I] Enhanced metafile to size.
294 * RETURNS
295 * The buffer size required to marshal an enhanced metafile plus the starting size.
297 * NOTES
298 * Even though the function is documented to take a pointer to a ULONG in
299 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
300 * the first parameter is a ULONG.
301 * This function is only intended to be called by the RPC runtime.
303 ULONG __RPC_USER HENHMETAFILE_UserSize(ULONG *pFlags, ULONG size, HENHMETAFILE *phEmf)
305 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), size, *phEmf);
307 ALIGN_LENGTH(size, 3);
309 size += sizeof(ULONG);
310 if (LOWORD(*pFlags) == MSHCTX_INPROC)
311 size += sizeof(ULONG_PTR);
312 else
314 size += sizeof(ULONG);
316 if (*phEmf)
318 UINT emfsize;
320 size += 2 * sizeof(ULONG);
321 emfsize = GetEnhMetaFileBits(*phEmf, 0, NULL);
322 size += emfsize;
326 return size;
329 /******************************************************************************
330 * HENHMETAFILE_UserMarshal [OLE32.@]
332 * Marshals an enhance metafile into a buffer.
334 * PARAMS
335 * pFlags [I] Flags. See notes.
336 * pBuffer [I] Buffer to marshal the clip format into.
337 * phEmf [I] Enhanced metafile to marshal.
339 * RETURNS
340 * The end of the marshaled data in the buffer.
342 * NOTES
343 * Even though the function is documented to take a pointer to a ULONG in
344 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
345 * the first parameter is a ULONG.
346 * This function is only intended to be called by the RPC runtime.
348 unsigned char * __RPC_USER HENHMETAFILE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HENHMETAFILE *phEmf)
350 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phEmf);
352 ALIGN_POINTER(pBuffer, 3);
354 if (LOWORD(*pFlags) == MSHCTX_INPROC)
356 if (sizeof(*phEmf) == 8)
357 *(ULONG *)pBuffer = WDT_INPROC64_CALL;
358 else
359 *(ULONG *)pBuffer = WDT_INPROC_CALL;
360 pBuffer += sizeof(ULONG);
361 *(HENHMETAFILE *)pBuffer = *phEmf;
362 pBuffer += sizeof(HENHMETAFILE);
364 else
366 *(ULONG *)pBuffer = WDT_REMOTE_CALL;
367 pBuffer += sizeof(ULONG);
368 *(ULONG *)pBuffer = (ULONG)(ULONG_PTR)*phEmf;
369 pBuffer += sizeof(ULONG);
371 if (*phEmf)
373 UINT emfsize = GetEnhMetaFileBits(*phEmf, 0, NULL);
375 *(ULONG *)pBuffer = emfsize;
376 pBuffer += sizeof(ULONG);
377 *(ULONG *)pBuffer = emfsize;
378 pBuffer += sizeof(ULONG);
379 GetEnhMetaFileBits(*phEmf, emfsize, pBuffer);
380 pBuffer += emfsize;
384 return pBuffer;
387 /******************************************************************************
388 * HENHMETAFILE_UserUnmarshal [OLE32.@]
390 * Unmarshals an enhanced metafile from a buffer.
392 * PARAMS
393 * pFlags [I] Flags. See notes.
394 * pBuffer [I] Buffer to marshal the clip format from.
395 * phEmf [O] Address that receive the unmarshaled enhanced metafile.
397 * RETURNS
398 * The end of the marshaled data in the buffer.
400 * NOTES
401 * Even though the function is documented to take a pointer to an ULONG in
402 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
403 * the first parameter is an ULONG.
404 * This function is only intended to be called by the RPC runtime.
406 unsigned char * __RPC_USER HENHMETAFILE_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HENHMETAFILE *phEmf)
408 ULONG fContext;
410 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, phEmf);
412 ALIGN_POINTER(pBuffer, 3);
414 fContext = *(ULONG *)pBuffer;
415 pBuffer += sizeof(ULONG);
417 if (((fContext == WDT_INPROC_CALL) && (sizeof(*phEmf) < 8)) ||
418 ((fContext == WDT_INPROC64_CALL) && (sizeof(*phEmf) == 8)))
420 *phEmf = *(HENHMETAFILE *)pBuffer;
421 pBuffer += sizeof(*phEmf);
423 else if (fContext == WDT_REMOTE_CALL)
425 ULONG handle;
427 handle = *(ULONG *)pBuffer;
428 pBuffer += sizeof(ULONG);
430 if (handle)
432 ULONG size;
433 size = *(ULONG *)pBuffer;
434 pBuffer += sizeof(ULONG);
435 if (size != *(ULONG *)pBuffer)
437 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
438 return pBuffer;
440 pBuffer += sizeof(ULONG);
441 *phEmf = SetEnhMetaFileBits(size, pBuffer);
442 pBuffer += size;
444 else
445 *phEmf = NULL;
447 else
448 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
450 return pBuffer;
453 /******************************************************************************
454 * HENHMETAFILE_UserFree [OLE32.@]
456 * Frees an unmarshaled enhanced metafile.
458 * PARAMS
459 * pFlags [I] Flags. See notes.
460 * phEmf [I] Enhanced metafile to free.
462 * RETURNS
463 * The end of the marshaled data in the buffer.
465 * NOTES
466 * Even though the function is documented to take a pointer to a ULONG in
467 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
468 * which the first parameter is a ULONG.
469 * This function is only intended to be called by the RPC runtime.
471 void __RPC_USER HENHMETAFILE_UserFree(ULONG *pFlags, HENHMETAFILE *phEmf)
473 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phEmf);
475 if (LOWORD(*pFlags) != MSHCTX_INPROC)
476 DeleteEnhMetaFile(*phEmf);
479 /******************************************************************************
480 * HMETAFILEPICT_UserSize [OLE32.@]
482 * Calculates the buffer size required to marshal an metafile pict.
484 * PARAMS
485 * pFlags [I] Flags. See notes.
486 * StartingSize [I] Starting size of the buffer. This value is added on to
487 * the buffer size required for the clip format.
488 * phMfp [I] Metafile pict to size.
490 * RETURNS
491 * The buffer size required to marshal a metafile pict plus the starting size.
493 * NOTES
494 * Even though the function is documented to take a pointer to a ULONG in
495 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
496 * the first parameter is a ULONG.
497 * This function is only intended to be called by the RPC runtime.
499 ULONG __RPC_USER HMETAFILEPICT_UserSize(ULONG *pFlags, ULONG size, HMETAFILEPICT *phMfp)
501 TRACE("(%s, %d, &%p)\n", debugstr_user_flags(pFlags), size, *phMfp);
503 ALIGN_LENGTH(size, 3);
505 size += sizeof(ULONG);
507 if(LOWORD(*pFlags) == MSHCTX_INPROC)
508 size += sizeof(HMETAFILEPICT);
509 else
511 size += sizeof(ULONG);
513 if (*phMfp)
515 METAFILEPICT *mfpict = GlobalLock(*phMfp);
517 /* FIXME: raise an exception if mfpict is NULL? */
518 size += 3 * sizeof(ULONG);
519 size += sizeof(ULONG);
521 size = HMETAFILE_UserSize(pFlags, size, &mfpict->hMF);
523 GlobalUnlock(*phMfp);
527 return size;
530 /******************************************************************************
531 * HMETAFILEPICT_UserMarshal [OLE32.@]
533 * Marshals a metafile pict into a buffer.
535 * PARAMS
536 * pFlags [I] Flags. See notes.
537 * pBuffer [I] Buffer to marshal the clip format into.
538 * phMfp [I] Metafile pict to marshal.
540 * RETURNS
541 * The end of the marshaled data in the buffer.
543 * NOTES
544 * Even though the function is documented to take a pointer to a ULONG in
545 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
546 * the first parameter is a ULONG.
547 * This function is only intended to be called by the RPC runtime.
549 unsigned char * __RPC_USER HMETAFILEPICT_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILEPICT *phMfp)
551 TRACE("(%s, %p, &%p)\n", debugstr_user_flags(pFlags), pBuffer, *phMfp);
553 ALIGN_POINTER(pBuffer, 3);
555 if (LOWORD(*pFlags) == MSHCTX_INPROC)
557 if (sizeof(HMETAFILEPICT) == 8)
558 *(ULONG *)pBuffer = WDT_INPROC64_CALL;
559 else
560 *(ULONG *)pBuffer = WDT_INPROC_CALL;
561 pBuffer += sizeof(ULONG);
562 *(HMETAFILEPICT *)pBuffer = *phMfp;
563 pBuffer += sizeof(HMETAFILEPICT);
565 else
567 *(ULONG *)pBuffer = WDT_REMOTE_CALL;
568 pBuffer += sizeof(ULONG);
569 *(ULONG *)pBuffer = (ULONG)(ULONG_PTR)*phMfp;
570 pBuffer += sizeof(ULONG);
572 if (*phMfp)
574 METAFILEPICT *mfpict = GlobalLock(*phMfp);
575 remoteMETAFILEPICT * remmfpict = (remoteMETAFILEPICT *)pBuffer;
577 /* FIXME: raise an exception if mfpict is NULL? */
578 remmfpict->mm = mfpict->mm;
579 remmfpict->xExt = mfpict->xExt;
580 remmfpict->yExt = mfpict->yExt;
581 pBuffer += 3 * sizeof(ULONG);
582 *(ULONG *)pBuffer = USER_MARSHAL_PTR_PREFIX;
583 pBuffer += sizeof(ULONG);
585 pBuffer = HMETAFILE_UserMarshal(pFlags, pBuffer, &mfpict->hMF);
587 GlobalUnlock(*phMfp);
590 return pBuffer;
593 /******************************************************************************
594 * HMETAFILEPICT_UserUnmarshal [OLE32.@]
596 * Unmarshals an metafile pict from a buffer.
598 * PARAMS
599 * pFlags [I] Flags. See notes.
600 * pBuffer [I] Buffer to marshal the clip format from.
601 * phMfp [O] Address that receive the unmarshaled metafile pict.
603 * RETURNS
604 * The end of the marshaled data in the buffer.
606 * NOTES
607 * Even though the function is documented to take a pointer to an ULONG in
608 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
609 * the first parameter is an ULONG.
610 * This function is only intended to be called by the RPC runtime.
612 unsigned char * __RPC_USER HMETAFILEPICT_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILEPICT *phMfp)
614 ULONG fContext;
616 TRACE("(%s, %p, %p)\n", debugstr_user_flags(pFlags), pBuffer, phMfp);
618 ALIGN_POINTER(pBuffer, 3);
620 fContext = *(ULONG *)pBuffer;
621 pBuffer += sizeof(ULONG);
623 if ((fContext == WDT_INPROC_CALL) || fContext == WDT_INPROC64_CALL)
625 *phMfp = *(HMETAFILEPICT *)pBuffer;
626 pBuffer += sizeof(HMETAFILEPICT);
628 else
630 ULONG handle = *(ULONG *)pBuffer;
631 pBuffer += sizeof(ULONG);
632 *phMfp = NULL;
634 if(handle)
636 METAFILEPICT *mfpict;
637 const remoteMETAFILEPICT *remmfpict;
638 ULONG user_marshal_prefix;
640 remmfpict = (const remoteMETAFILEPICT *)pBuffer;
642 *phMfp = GlobalAlloc(GMEM_MOVEABLE, sizeof(METAFILEPICT));
643 if (!*phMfp)
644 RpcRaiseException(E_OUTOFMEMORY);
646 mfpict = GlobalLock(*phMfp);
647 mfpict->mm = remmfpict->mm;
648 mfpict->xExt = remmfpict->xExt;
649 mfpict->yExt = remmfpict->yExt;
650 pBuffer += 3 * sizeof(ULONG);
651 user_marshal_prefix = *(ULONG *)pBuffer;
652 pBuffer += sizeof(ULONG);
654 if (user_marshal_prefix != USER_MARSHAL_PTR_PREFIX)
655 RpcRaiseException(RPC_X_INVALID_TAG);
657 pBuffer = HMETAFILE_UserUnmarshal(pFlags, pBuffer, &mfpict->hMF);
659 GlobalUnlock(*phMfp);
662 return pBuffer;
665 /******************************************************************************
666 * HMETAFILEPICT_UserFree [OLE32.@]
668 * Frees an unmarshaled metafile pict.
670 * PARAMS
671 * pFlags [I] Flags. See notes.
672 * phMfp [I] Metafile pict to free.
674 * RETURNS
675 * The end of the marshaled data in the buffer.
677 * NOTES
678 * Even though the function is documented to take a pointer to a ULONG in
679 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
680 * which the first parameter is a ULONG.
681 * This function is only intended to be called by the RPC runtime.
683 void __RPC_USER HMETAFILEPICT_UserFree(ULONG *pFlags, HMETAFILEPICT *phMfp)
685 TRACE("(%s, &%p)\n", debugstr_user_flags(pFlags), *phMfp);
687 if ((LOWORD(*pFlags) != MSHCTX_INPROC) && *phMfp)
689 METAFILEPICT *mfpict;
691 mfpict = GlobalLock(*phMfp);
692 /* FIXME: raise an exception if mfpict is NULL? */
693 HMETAFILE_UserFree(pFlags, &mfpict->hMF);
694 GlobalUnlock(*phMfp);
696 GlobalFree(*phMfp);
700 /******************************************************************************
701 * STGMEDIUM_UserSize [OLE32.@]
703 * Calculates the buffer size required to marshal an STGMEDIUM.
705 * PARAMS
706 * pFlags [I] Flags. See notes.
707 * StartingSize [I] Starting size of the buffer. This value is added on to
708 * the buffer size required for the clip format.
709 * pStgMedium [I] STGMEDIUM to size.
711 * RETURNS
712 * The buffer size required to marshal an STGMEDIUM plus the starting size.
714 * NOTES
715 * Even though the function is documented to take a pointer to a ULONG in
716 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
717 * the first parameter is a ULONG.
718 * This function is only intended to be called by the RPC runtime.
720 ULONG __RPC_USER STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, STGMEDIUM *pStgMedium)
722 ULONG size = StartingSize;
724 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, pStgMedium);
726 ALIGN_LENGTH(size, 3);
728 size += 2 * sizeof(DWORD);
729 if (pStgMedium->tymed != TYMED_NULL)
730 size += sizeof(DWORD);
732 switch (pStgMedium->tymed)
734 case TYMED_NULL:
735 TRACE("TYMED_NULL\n");
736 break;
737 case TYMED_HGLOBAL:
738 TRACE("TYMED_HGLOBAL\n");
739 if (pStgMedium->u.hGlobal)
740 size = HGLOBAL_UserSize(pFlags, size, &pStgMedium->u.hGlobal);
741 break;
742 case TYMED_FILE:
743 TRACE("TYMED_FILE\n");
744 if (pStgMedium->u.lpszFileName)
746 TRACE("file name is %s\n", debugstr_w(pStgMedium->u.lpszFileName));
747 size += 3 * sizeof(DWORD) +
748 (lstrlenW(pStgMedium->u.lpszFileName) + 1) * sizeof(WCHAR);
750 break;
751 case TYMED_ISTREAM:
752 TRACE("TYMED_ISTREAM\n");
753 if (pStgMedium->u.pstm)
755 IUnknown *unk;
756 IStream_QueryInterface(pStgMedium->u.pstm, &IID_IUnknown, (void**)&unk);
757 size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), size, unk, &IID_IStream);
758 IUnknown_Release(unk);
760 break;
761 case TYMED_ISTORAGE:
762 TRACE("TYMED_ISTORAGE\n");
763 if (pStgMedium->u.pstg)
765 IUnknown *unk;
766 IStorage_QueryInterface(pStgMedium->u.pstg, &IID_IUnknown, (void**)&unk);
767 size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), size, unk, &IID_IStorage);
768 IUnknown_Release(unk);
770 break;
771 case TYMED_GDI:
772 TRACE("TYMED_GDI\n");
773 if (pStgMedium->u.hBitmap)
774 size = HBITMAP_UserSize(pFlags, size, &pStgMedium->u.hBitmap);
775 break;
776 case TYMED_MFPICT:
777 TRACE("TYMED_MFPICT\n");
778 if (pStgMedium->u.hMetaFilePict)
779 size = HMETAFILEPICT_UserSize(pFlags, size, &pStgMedium->u.hMetaFilePict);
780 break;
781 case TYMED_ENHMF:
782 TRACE("TYMED_ENHMF\n");
783 if (pStgMedium->u.hEnhMetaFile)
784 size = HENHMETAFILE_UserSize(pFlags, size, &pStgMedium->u.hEnhMetaFile);
785 break;
786 default:
787 RaiseException(DV_E_TYMED, 0, 0, NULL);
790 if (pStgMedium->pUnkForRelease)
791 size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), size, pStgMedium->pUnkForRelease, &IID_IUnknown);
793 return size;
796 /******************************************************************************
797 * STGMEDIUM_UserMarshal [OLE32.@]
799 * Marshals a STGMEDIUM into a buffer.
801 * PARAMS
802 * pFlags [I] Flags. See notes.
803 * pBuffer [I] Buffer to marshal the clip format into.
804 * pCF [I] STGMEDIUM to marshal.
806 * RETURNS
807 * The end of the marshaled data in the buffer.
809 * NOTES
810 * Even though the function is documented to take a pointer to a ULONG in
811 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
812 * the first parameter is a ULONG.
813 * This function is only intended to be called by the RPC runtime.
815 unsigned char * __RPC_USER STGMEDIUM_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, STGMEDIUM *pStgMedium)
817 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pStgMedium);
819 ALIGN_POINTER(pBuffer, 3);
821 *(DWORD *)pBuffer = pStgMedium->tymed;
822 pBuffer += sizeof(DWORD);
823 if (pStgMedium->tymed != TYMED_NULL)
825 *(DWORD *)pBuffer = (DWORD)(DWORD_PTR)pStgMedium->u.pstg;
826 pBuffer += sizeof(DWORD);
828 *(DWORD *)pBuffer = (DWORD)(DWORD_PTR)pStgMedium->pUnkForRelease;
829 pBuffer += sizeof(DWORD);
831 switch (pStgMedium->tymed)
833 case TYMED_NULL:
834 TRACE("TYMED_NULL\n");
835 break;
836 case TYMED_HGLOBAL:
837 TRACE("TYMED_HGLOBAL\n");
838 if (pStgMedium->u.hGlobal)
839 pBuffer = HGLOBAL_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hGlobal);
840 break;
841 case TYMED_FILE:
842 TRACE("TYMED_FILE\n");
843 if (pStgMedium->u.lpszFileName)
845 DWORD len;
846 len = lstrlenW(pStgMedium->u.lpszFileName);
847 /* conformance */
848 *(DWORD *)pBuffer = len + 1;
849 pBuffer += sizeof(DWORD);
850 /* offset */
851 *(DWORD *)pBuffer = 0;
852 pBuffer += sizeof(DWORD);
853 /* variance */
854 *(DWORD *)pBuffer = len + 1;
855 pBuffer += sizeof(DWORD);
857 TRACE("file name is %s\n", debugstr_w(pStgMedium->u.lpszFileName));
858 memcpy(pBuffer, pStgMedium->u.lpszFileName, (len + 1) * sizeof(WCHAR));
860 break;
861 case TYMED_ISTREAM:
862 TRACE("TYMED_ISTREAM\n");
863 if (pStgMedium->u.pstm)
865 IUnknown *unk;
866 IStream_QueryInterface(pStgMedium->u.pstm, &IID_IUnknown, (void**)&unk);
867 pBuffer = WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), pBuffer, unk, &IID_IStream);
868 IUnknown_Release(unk);
870 break;
871 case TYMED_ISTORAGE:
872 TRACE("TYMED_ISTORAGE\n");
873 if (pStgMedium->u.pstg)
875 IUnknown *unk;
876 IStorage_QueryInterface(pStgMedium->u.pstg, &IID_IUnknown, (void**)&unk);
877 pBuffer = WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), pBuffer, unk, &IID_IStorage);
878 IUnknown_Release(unk);
880 break;
881 case TYMED_GDI:
882 TRACE("TYMED_GDI\n");
883 if (pStgMedium->u.hBitmap)
884 pBuffer = HBITMAP_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hBitmap);
885 break;
886 case TYMED_MFPICT:
887 TRACE("TYMED_MFPICT\n");
888 if (pStgMedium->u.hMetaFilePict)
889 pBuffer = HMETAFILEPICT_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hMetaFilePict);
890 break;
891 case TYMED_ENHMF:
892 TRACE("TYMED_ENHMF\n");
893 if (pStgMedium->u.hEnhMetaFile)
894 pBuffer = HENHMETAFILE_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hEnhMetaFile);
895 break;
896 default:
897 RaiseException(DV_E_TYMED, 0, 0, NULL);
900 if (pStgMedium->pUnkForRelease)
901 pBuffer = WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), pBuffer, pStgMedium->pUnkForRelease, &IID_IUnknown);
903 return pBuffer;
906 /******************************************************************************
907 * STGMEDIUM_UserUnmarshal [OLE32.@]
909 * Unmarshals a STGMEDIUM from a buffer.
911 * PARAMS
912 * pFlags [I] Flags. See notes.
913 * pBuffer [I] Buffer to marshal the clip format from.
914 * pStgMedium [O] Address that receive the unmarshaled STGMEDIUM.
916 * RETURNS
917 * The end of the marshaled data in the buffer.
919 * NOTES
920 * Even though the function is documented to take a pointer to an ULONG in
921 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
922 * the first parameter is an ULONG.
923 * This function is only intended to be called by the RPC runtime.
925 unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, STGMEDIUM *pStgMedium)
927 DWORD content = 0;
928 DWORD releaseunk;
930 ALIGN_POINTER(pBuffer, 3);
932 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pStgMedium);
934 pStgMedium->tymed = *(DWORD *)pBuffer;
935 pBuffer += sizeof(DWORD);
936 if (pStgMedium->tymed != TYMED_NULL)
938 content = *(DWORD *)pBuffer;
939 pBuffer += sizeof(DWORD);
941 releaseunk = *(DWORD *)pBuffer;
942 pBuffer += sizeof(DWORD);
944 switch (pStgMedium->tymed)
946 case TYMED_NULL:
947 TRACE("TYMED_NULL\n");
948 break;
949 case TYMED_HGLOBAL:
950 TRACE("TYMED_HGLOBAL\n");
951 if (content)
952 pBuffer = HGLOBAL_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hGlobal);
953 break;
954 case TYMED_FILE:
955 TRACE("TYMED_FILE\n");
956 if (content)
958 DWORD conformance;
959 DWORD variance;
960 conformance = *(DWORD *)pBuffer;
961 pBuffer += sizeof(DWORD);
962 if (*(DWORD *)pBuffer != 0)
964 ERR("invalid offset %d\n", *(DWORD *)pBuffer);
965 RpcRaiseException(RPC_S_INVALID_BOUND);
966 return NULL;
968 pBuffer += sizeof(DWORD);
969 variance = *(DWORD *)pBuffer;
970 pBuffer += sizeof(DWORD);
971 if (conformance != variance)
973 ERR("conformance (%d) and variance (%d) should be equal\n",
974 conformance, variance);
975 RpcRaiseException(RPC_S_INVALID_BOUND);
976 return NULL;
978 if (conformance > 0x7fffffff)
980 ERR("conformance 0x%x too large\n", conformance);
981 RpcRaiseException(RPC_S_INVALID_BOUND);
982 return NULL;
984 pStgMedium->u.lpszFileName = CoTaskMemAlloc(conformance * sizeof(WCHAR));
985 if (!pStgMedium->u.lpszFileName) RpcRaiseException(ERROR_OUTOFMEMORY);
986 TRACE("unmarshalled file name is %s\n", debugstr_wn((const WCHAR *)pBuffer, variance));
987 memcpy(pStgMedium->u.lpszFileName, pBuffer, variance * sizeof(WCHAR));
988 pBuffer += variance * sizeof(WCHAR);
990 else
991 pStgMedium->u.lpszFileName = NULL;
992 break;
993 case TYMED_ISTREAM:
994 TRACE("TYMED_ISTREAM\n");
995 if (content)
997 pBuffer = WdtpInterfacePointer_UserUnmarshal(pFlags, pBuffer, (IUnknown**)&pStgMedium->u.pstm, &IID_IStream);
999 else
1001 if (pStgMedium->u.pstm) IStream_Release( pStgMedium->u.pstm );
1002 pStgMedium->u.pstm = NULL;
1004 break;
1005 case TYMED_ISTORAGE:
1006 TRACE("TYMED_ISTORAGE\n");
1007 if (content)
1009 pBuffer = WdtpInterfacePointer_UserUnmarshal(pFlags, pBuffer, (IUnknown**)&pStgMedium->u.pstg, &IID_IStorage);
1011 else
1013 if (pStgMedium->u.pstg) IStorage_Release( pStgMedium->u.pstg );
1014 pStgMedium->u.pstg = NULL;
1016 break;
1017 case TYMED_GDI:
1018 TRACE("TYMED_GDI\n");
1019 if (content)
1020 pBuffer = HBITMAP_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hBitmap);
1021 else
1022 pStgMedium->u.hBitmap = NULL;
1023 break;
1024 case TYMED_MFPICT:
1025 TRACE("TYMED_MFPICT\n");
1026 if (content)
1027 pBuffer = HMETAFILEPICT_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hMetaFilePict);
1028 else
1029 pStgMedium->u.hMetaFilePict = NULL;
1030 break;
1031 case TYMED_ENHMF:
1032 TRACE("TYMED_ENHMF\n");
1033 if (content)
1034 pBuffer = HENHMETAFILE_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hEnhMetaFile);
1035 else
1036 pStgMedium->u.hEnhMetaFile = NULL;
1037 break;
1038 default:
1039 RaiseException(DV_E_TYMED, 0, 0, NULL);
1042 if (releaseunk)
1043 pBuffer = WdtpInterfacePointer_UserUnmarshal(pFlags, pBuffer, &pStgMedium->pUnkForRelease, &IID_IUnknown);
1044 /* Unlike the IStream / IStorage ifaces, the existing pUnkForRelease
1045 is left intact if a NULL ptr is unmarshalled - see the tests. */
1047 return pBuffer;
1050 /******************************************************************************
1051 * STGMEDIUM_UserFree [OLE32.@]
1053 * Frees an unmarshaled STGMEDIUM.
1055 * PARAMS
1056 * pFlags [I] Flags. See notes.
1057 * pStgmedium [I] STGMEDIUM to free.
1059 * RETURNS
1060 * The end of the marshaled data in the buffer.
1062 * NOTES
1063 * Even though the function is documented to take a pointer to a ULONG in
1064 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1065 * which the first parameter is a ULONG.
1066 * This function is only intended to be called by the RPC runtime.
1068 void __RPC_USER STGMEDIUM_UserFree(ULONG *flags, STGMEDIUM *med)
1070 TRACE("(%s, %p)\n", debugstr_user_flags(flags), med);
1072 switch (med->tymed)
1074 case TYMED_NULL:
1075 case TYMED_FILE:
1076 case TYMED_ISTREAM:
1077 case TYMED_ISTORAGE:
1078 ReleaseStgMedium(med);
1079 break;
1080 case TYMED_HGLOBAL:
1081 case TYMED_GDI:
1082 case TYMED_MFPICT:
1083 case TYMED_ENHMF:
1084 if (LOWORD(*flags) == MSHCTX_INPROC)
1085 med->tymed = TYMED_NULL;
1086 ReleaseStgMedium(med);
1087 break;
1088 default:
1089 RaiseException(DV_E_TYMED, 0, 0, NULL);
1093 ULONG __RPC_USER ASYNC_STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, ASYNC_STGMEDIUM *pStgMedium)
1095 TRACE("\n");
1096 return STGMEDIUM_UserSize(pFlags, StartingSize, pStgMedium);
1099 unsigned char * __RPC_USER ASYNC_STGMEDIUM_UserMarshal( ULONG *pFlags, unsigned char *pBuffer, ASYNC_STGMEDIUM *pStgMedium)
1101 TRACE("\n");
1102 return STGMEDIUM_UserMarshal(pFlags, pBuffer, pStgMedium);
1105 unsigned char * __RPC_USER ASYNC_STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, ASYNC_STGMEDIUM *pStgMedium)
1107 TRACE("\n");
1108 return STGMEDIUM_UserUnmarshal(pFlags, pBuffer, pStgMedium);
1111 void __RPC_USER ASYNC_STGMEDIUM_UserFree(ULONG *pFlags, ASYNC_STGMEDIUM *pStgMedium)
1113 TRACE("\n");
1114 STGMEDIUM_UserFree(pFlags, pStgMedium);
1117 ULONG __RPC_USER FLAG_STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, FLAG_STGMEDIUM *pStgMedium)
1119 FIXME(":stub\n");
1120 return StartingSize;
1123 unsigned char * __RPC_USER FLAG_STGMEDIUM_UserMarshal( ULONG *pFlags, unsigned char *pBuffer, FLAG_STGMEDIUM *pStgMedium)
1125 FIXME(":stub\n");
1126 return pBuffer;
1129 unsigned char * __RPC_USER FLAG_STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, FLAG_STGMEDIUM *pStgMedium)
1131 FIXME(":stub\n");
1132 return pBuffer;
1135 void __RPC_USER FLAG_STGMEDIUM_UserFree(ULONG *pFlags, FLAG_STGMEDIUM *pStgMedium)
1137 FIXME(":stub\n");
1140 ULONG __RPC_USER SNB_UserSize(ULONG *pFlags, ULONG StartingSize, SNB *pSnb)
1142 ULONG size = StartingSize;
1144 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, pSnb);
1146 ALIGN_LENGTH(size, 3);
1148 /* two counters from RemSNB header, plus one more ULONG */
1149 size += 3*sizeof(ULONG);
1151 /* now actual data length */
1152 if (*pSnb)
1154 WCHAR **ptrW = *pSnb;
1156 while (*ptrW)
1158 size += (lstrlenW(*ptrW) + 1)*sizeof(WCHAR);
1159 ptrW++;
1163 return size;
1166 struct SNB_wire {
1167 ULONG charcnt;
1168 ULONG strcnt;
1169 ULONG datalen;
1170 WCHAR data[1];
1173 unsigned char * __RPC_USER SNB_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, SNB *pSnb)
1175 struct SNB_wire *wire;
1176 ULONG size;
1178 TRACE("(%s, %p, %p)\n", debugstr_user_flags(pFlags), pBuffer, pSnb);
1180 ALIGN_POINTER(pBuffer, 3);
1182 wire = (struct SNB_wire*)pBuffer;
1183 wire->charcnt = wire->strcnt = 0;
1184 size = 3*sizeof(ULONG);
1186 if (*pSnb)
1188 WCHAR **ptrW = *pSnb;
1189 WCHAR *dataW = wire->data;
1191 while (*ptrW)
1193 ULONG len = lstrlenW(*ptrW) + 1;
1195 wire->strcnt++;
1196 wire->charcnt += len;
1197 memcpy(dataW, *ptrW, len*sizeof(WCHAR));
1198 dataW += len;
1200 size += len*sizeof(WCHAR);
1201 ptrW++;
1205 wire->datalen = wire->charcnt;
1206 return pBuffer + size;
1209 unsigned char * __RPC_USER SNB_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, SNB *pSnb)
1211 USER_MARSHAL_CB *umcb = (USER_MARSHAL_CB*)pFlags;
1212 struct SNB_wire *wire;
1214 TRACE("(%s, %p, %p)\n", debugstr_user_flags(pFlags), pBuffer, pSnb);
1216 wire = (struct SNB_wire*)pBuffer;
1218 if (*pSnb)
1219 umcb->pStubMsg->pfnFree(*pSnb);
1221 if (wire->datalen == 0)
1222 *pSnb = NULL;
1223 else
1225 WCHAR *src = wire->data, *dest;
1226 WCHAR **ptrW;
1227 ULONG i;
1229 ptrW = *pSnb = umcb->pStubMsg->pfnAllocate((wire->strcnt+1)*sizeof(WCHAR*) + wire->datalen*sizeof(WCHAR));
1230 dest = (WCHAR*)(*pSnb + wire->strcnt + 1);
1232 for (i = 0; i < wire->strcnt; i++)
1234 ULONG len = lstrlenW(src);
1235 memcpy(dest, src, (len + 1)*sizeof(WCHAR));
1236 *ptrW = dest;
1237 src += len + 1;
1238 dest += len + 1;
1239 ptrW++;
1241 *ptrW = NULL;
1244 return pBuffer + 3*sizeof(ULONG) + wire->datalen*sizeof(WCHAR);
1247 void __RPC_USER SNB_UserFree(ULONG *pFlags, SNB *pSnb)
1249 USER_MARSHAL_CB *umcb = (USER_MARSHAL_CB*)pFlags;
1250 TRACE("(%p)\n", pSnb);
1251 if (*pSnb)
1252 umcb->pStubMsg->pfnFree(*pSnb);
1255 /* call_as/local stubs for unknwn.idl */
1257 HRESULT CALLBACK IClassFactory_CreateInstance_Proxy(
1258 IClassFactory* This,
1259 IUnknown *pUnkOuter,
1260 REFIID riid,
1261 void **ppvObject)
1263 TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject);
1264 *ppvObject = NULL;
1265 if (pUnkOuter)
1267 ERR("aggregation is not allowed on remote objects\n");
1268 return CLASS_E_NOAGGREGATION;
1270 return IClassFactory_RemoteCreateInstance_Proxy(This, riid,
1271 (IUnknown **) ppvObject);
1274 HRESULT __RPC_STUB IClassFactory_CreateInstance_Stub(
1275 IClassFactory* This,
1276 REFIID riid,
1277 IUnknown **ppvObject)
1279 TRACE("(%s, %p)\n", debugstr_guid(riid), ppvObject);
1280 return IClassFactory_CreateInstance(This, NULL, riid, (void **) ppvObject);
1283 HRESULT CALLBACK IClassFactory_LockServer_Proxy(
1284 IClassFactory* This,
1285 BOOL fLock)
1287 FIXME(":stub\n");
1288 return E_NOTIMPL;
1291 HRESULT __RPC_STUB IClassFactory_LockServer_Stub(
1292 IClassFactory* This,
1293 BOOL fLock)
1295 FIXME(":stub\n");
1296 return E_NOTIMPL;
1299 /* call_as/local stubs for objidl.idl */
1301 HRESULT CALLBACK IEnumUnknown_Next_Proxy(
1302 IEnumUnknown* This,
1303 ULONG celt,
1304 IUnknown **rgelt,
1305 ULONG *pceltFetched)
1307 ULONG fetched;
1308 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
1309 if (!pceltFetched) pceltFetched = &fetched;
1310 return IEnumUnknown_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
1313 HRESULT __RPC_STUB IEnumUnknown_Next_Stub(
1314 IEnumUnknown* This,
1315 ULONG celt,
1316 IUnknown **rgelt,
1317 ULONG *pceltFetched)
1319 HRESULT hr;
1320 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
1321 *pceltFetched = 0;
1322 hr = IEnumUnknown_Next(This, celt, rgelt, pceltFetched);
1323 if (hr == S_OK) *pceltFetched = celt;
1324 return hr;
1327 HRESULT CALLBACK IBindCtx_SetBindOptions_Proxy(
1328 IBindCtx* This,
1329 BIND_OPTS *pbindopts)
1331 FIXME(":stub\n");
1332 return E_NOTIMPL;
1335 HRESULT __RPC_STUB IBindCtx_SetBindOptions_Stub(
1336 IBindCtx* This,
1337 BIND_OPTS2 *pbindopts)
1339 FIXME(":stub\n");
1340 return E_NOTIMPL;
1343 HRESULT CALLBACK IBindCtx_GetBindOptions_Proxy(
1344 IBindCtx* This,
1345 BIND_OPTS *pbindopts)
1347 FIXME(":stub\n");
1348 return E_NOTIMPL;
1351 HRESULT __RPC_STUB IBindCtx_GetBindOptions_Stub(
1352 IBindCtx* This,
1353 BIND_OPTS2 *pbindopts)
1355 FIXME(":stub\n");
1356 return E_NOTIMPL;
1359 HRESULT CALLBACK IEnumMoniker_Next_Proxy(
1360 IEnumMoniker* This,
1361 ULONG celt,
1362 IMoniker **rgelt,
1363 ULONG *pceltFetched)
1365 ULONG fetched;
1366 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
1367 if (!pceltFetched) pceltFetched = &fetched;
1368 return IEnumMoniker_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
1371 HRESULT __RPC_STUB IEnumMoniker_Next_Stub(
1372 IEnumMoniker* This,
1373 ULONG celt,
1374 IMoniker **rgelt,
1375 ULONG *pceltFetched)
1377 HRESULT hr;
1378 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
1379 *pceltFetched = 0;
1380 hr = IEnumMoniker_Next(This, celt, rgelt, pceltFetched);
1381 if (hr == S_OK) *pceltFetched = celt;
1382 return hr;
1385 BOOL CALLBACK IRunnableObject_IsRunning_Proxy(
1386 IRunnableObject* This)
1388 BOOL rv;
1389 FIXME(":stub\n");
1390 memset(&rv, 0, sizeof rv);
1391 return rv;
1394 HRESULT __RPC_STUB IRunnableObject_IsRunning_Stub(
1395 IRunnableObject* This)
1397 FIXME(":stub\n");
1398 return E_NOTIMPL;
1401 HRESULT CALLBACK IMoniker_BindToObject_Proxy(
1402 IMoniker* This,
1403 IBindCtx *pbc,
1404 IMoniker *pmkToLeft,
1405 REFIID riidResult,
1406 void **ppvResult)
1408 FIXME(":stub\n");
1409 return E_NOTIMPL;
1412 HRESULT __RPC_STUB IMoniker_BindToObject_Stub(
1413 IMoniker* This,
1414 IBindCtx *pbc,
1415 IMoniker *pmkToLeft,
1416 REFIID riidResult,
1417 IUnknown **ppvResult)
1419 FIXME(":stub\n");
1420 return E_NOTIMPL;
1423 HRESULT CALLBACK IMoniker_BindToStorage_Proxy(
1424 IMoniker* This,
1425 IBindCtx *pbc,
1426 IMoniker *pmkToLeft,
1427 REFIID riid,
1428 void **ppvObj)
1430 TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObj);
1431 return IMoniker_RemoteBindToStorage_Proxy(This, pbc, pmkToLeft, riid, (IUnknown**)ppvObj);
1434 HRESULT __RPC_STUB IMoniker_BindToStorage_Stub(
1435 IMoniker* This,
1436 IBindCtx *pbc,
1437 IMoniker *pmkToLeft,
1438 REFIID riid,
1439 IUnknown **ppvObj)
1441 TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObj);
1442 return IMoniker_BindToStorage(This, pbc, pmkToLeft, riid, (void**)ppvObj);
1445 HRESULT CALLBACK IEnumString_Next_Proxy(
1446 IEnumString* This,
1447 ULONG celt,
1448 LPOLESTR *rgelt,
1449 ULONG *pceltFetched)
1451 ULONG fetched;
1452 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
1453 if (!pceltFetched) pceltFetched = &fetched;
1454 return IEnumString_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
1457 HRESULT __RPC_STUB IEnumString_Next_Stub(
1458 IEnumString* This,
1459 ULONG celt,
1460 LPOLESTR *rgelt,
1461 ULONG *pceltFetched)
1463 HRESULT hr;
1464 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
1465 *pceltFetched = 0;
1466 hr = IEnumString_Next(This, celt, rgelt, pceltFetched);
1467 if (hr == S_OK) *pceltFetched = celt;
1468 return hr;
1471 HRESULT CALLBACK ISequentialStream_Read_Proxy(
1472 ISequentialStream* This,
1473 void *pv,
1474 ULONG cb,
1475 ULONG *pcbRead)
1477 ULONG read;
1478 HRESULT hr;
1480 TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbRead);
1482 hr = ISequentialStream_RemoteRead_Proxy(This, pv, cb, &read);
1483 if(pcbRead) *pcbRead = read;
1485 return hr;
1488 HRESULT __RPC_STUB ISequentialStream_Read_Stub(
1489 ISequentialStream* This,
1490 byte *pv,
1491 ULONG cb,
1492 ULONG *pcbRead)
1494 TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbRead);
1495 return ISequentialStream_Read(This, pv, cb, pcbRead);
1498 HRESULT CALLBACK ISequentialStream_Write_Proxy(
1499 ISequentialStream* This,
1500 const void *pv,
1501 ULONG cb,
1502 ULONG *pcbWritten)
1504 ULONG written;
1505 HRESULT hr;
1507 TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten);
1509 hr = ISequentialStream_RemoteWrite_Proxy(This, pv, cb, &written);
1510 if(pcbWritten) *pcbWritten = written;
1512 return hr;
1515 HRESULT __RPC_STUB ISequentialStream_Write_Stub(
1516 ISequentialStream* This,
1517 const byte *pv,
1518 ULONG cb,
1519 ULONG *pcbWritten)
1521 TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten);
1522 return ISequentialStream_Write(This, pv, cb, pcbWritten);
1525 HRESULT CALLBACK IStream_Seek_Proxy(
1526 IStream* This,
1527 LARGE_INTEGER dlibMove,
1528 DWORD dwOrigin,
1529 ULARGE_INTEGER *plibNewPosition)
1531 ULARGE_INTEGER newpos;
1532 HRESULT hr;
1534 TRACE("(%p)->(%s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition);
1536 hr = IStream_RemoteSeek_Proxy(This, dlibMove, dwOrigin, &newpos);
1537 if(plibNewPosition) *plibNewPosition = newpos;
1539 return hr;
1542 HRESULT __RPC_STUB IStream_Seek_Stub(
1543 IStream* This,
1544 LARGE_INTEGER dlibMove,
1545 DWORD dwOrigin,
1546 ULARGE_INTEGER *plibNewPosition)
1548 TRACE("(%p)->(%s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition);
1549 return IStream_Seek(This, dlibMove, dwOrigin, plibNewPosition);
1552 HRESULT CALLBACK IStream_CopyTo_Proxy(
1553 IStream* This,
1554 IStream *pstm,
1555 ULARGE_INTEGER cb,
1556 ULARGE_INTEGER *pcbRead,
1557 ULARGE_INTEGER *pcbWritten)
1559 ULARGE_INTEGER read, written;
1560 HRESULT hr;
1562 TRACE("(%p)->(%p, %s, %p, %p)\n", This, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten);
1564 hr = IStream_RemoteCopyTo_Proxy(This, pstm, cb, &read, &written);
1565 if(pcbRead) *pcbRead = read;
1566 if(pcbWritten) *pcbWritten = written;
1568 return hr;
1571 HRESULT __RPC_STUB IStream_CopyTo_Stub(
1572 IStream* This,
1573 IStream *pstm,
1574 ULARGE_INTEGER cb,
1575 ULARGE_INTEGER *pcbRead,
1576 ULARGE_INTEGER *pcbWritten)
1578 TRACE("(%p)->(%p, %s, %p, %p)\n", This, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten);
1580 return IStream_CopyTo(This, pstm, cb, pcbRead, pcbWritten);
1583 HRESULT CALLBACK IEnumSTATSTG_Next_Proxy(
1584 IEnumSTATSTG* This,
1585 ULONG celt,
1586 STATSTG *rgelt,
1587 ULONG *pceltFetched)
1589 ULONG fetched;
1590 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
1591 if (!pceltFetched) pceltFetched = &fetched;
1592 return IEnumSTATSTG_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
1595 HRESULT __RPC_STUB IEnumSTATSTG_Next_Stub(
1596 IEnumSTATSTG* This,
1597 ULONG celt,
1598 STATSTG *rgelt,
1599 ULONG *pceltFetched)
1601 HRESULT hr;
1602 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
1603 *pceltFetched = 0;
1604 hr = IEnumSTATSTG_Next(This, celt, rgelt, pceltFetched);
1605 if (hr == S_OK) *pceltFetched = celt;
1606 return hr;
1609 HRESULT CALLBACK IStorage_OpenStream_Proxy(
1610 IStorage* This,
1611 LPCOLESTR pwcsName,
1612 void *reserved1,
1613 DWORD grfMode,
1614 DWORD reserved2,
1615 IStream **ppstm)
1617 TRACE("(%p)->(%s, %p, %08x, %d %p)\n", This, debugstr_w(pwcsName), reserved1, grfMode, reserved2, ppstm);
1618 if(reserved1) WARN("reserved1 %p\n", reserved1);
1620 return IStorage_RemoteOpenStream_Proxy(This, pwcsName, 0, NULL, grfMode, reserved2, ppstm);
1623 HRESULT __RPC_STUB IStorage_OpenStream_Stub(
1624 IStorage* This,
1625 LPCOLESTR pwcsName,
1626 ULONG cbReserved1,
1627 byte *reserved1,
1628 DWORD grfMode,
1629 DWORD reserved2,
1630 IStream **ppstm)
1632 TRACE("(%p)->(%s, %d, %p, %08x, %d %p)\n", This, debugstr_w(pwcsName), cbReserved1, reserved1, grfMode, reserved2, ppstm);
1633 if(cbReserved1 || reserved1) WARN("cbReserved1 %d reserved1 %p\n", cbReserved1, reserved1);
1635 return IStorage_OpenStream(This, pwcsName, NULL, grfMode, reserved2, ppstm);
1638 HRESULT CALLBACK IStorage_EnumElements_Proxy(
1639 IStorage* This,
1640 DWORD reserved1,
1641 void *reserved2,
1642 DWORD reserved3,
1643 IEnumSTATSTG **ppenum)
1645 TRACE("(%p)->(%d, %p, %d, %p)\n", This, reserved1, reserved2, reserved3, ppenum);
1646 if(reserved2) WARN("reserved2 %p\n", reserved2);
1648 return IStorage_RemoteEnumElements_Proxy(This, reserved1, 0, NULL, reserved3, ppenum);
1651 HRESULT __RPC_STUB IStorage_EnumElements_Stub(
1652 IStorage* This,
1653 DWORD reserved1,
1654 ULONG cbReserved2,
1655 byte *reserved2,
1656 DWORD reserved3,
1657 IEnumSTATSTG **ppenum)
1659 TRACE("(%p)->(%d, %d, %p, %d, %p)\n", This, reserved1, cbReserved2, reserved2, reserved3, ppenum);
1660 if(cbReserved2 || reserved2) WARN("cbReserved2 %d reserved2 %p\n", cbReserved2, reserved2);
1662 return IStorage_EnumElements(This, reserved1, NULL, reserved3, ppenum);
1665 HRESULT CALLBACK ILockBytes_ReadAt_Proxy(
1666 ILockBytes* This,
1667 ULARGE_INTEGER ulOffset,
1668 void *pv,
1669 ULONG cb,
1670 ULONG *pcbRead)
1672 ULONG read;
1673 HRESULT hr;
1675 TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbRead);
1677 hr = ILockBytes_RemoteReadAt_Proxy(This, ulOffset, pv, cb, &read);
1678 if(pcbRead) *pcbRead = read;
1680 return hr;
1683 HRESULT __RPC_STUB ILockBytes_ReadAt_Stub(
1684 ILockBytes* This,
1685 ULARGE_INTEGER ulOffset,
1686 byte *pv,
1687 ULONG cb,
1688 ULONG *pcbRead)
1690 TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbRead);
1691 return ILockBytes_ReadAt(This, ulOffset, pv, cb, pcbRead);
1694 HRESULT CALLBACK ILockBytes_WriteAt_Proxy(
1695 ILockBytes* This,
1696 ULARGE_INTEGER ulOffset,
1697 const void *pv,
1698 ULONG cb,
1699 ULONG *pcbWritten)
1701 ULONG written;
1702 HRESULT hr;
1704 TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten);
1706 hr = ILockBytes_RemoteWriteAt_Proxy(This, ulOffset, pv, cb, &written);
1707 if(pcbWritten) *pcbWritten = written;
1709 return hr;
1712 HRESULT __RPC_STUB ILockBytes_WriteAt_Stub(
1713 ILockBytes* This,
1714 ULARGE_INTEGER ulOffset,
1715 const byte *pv,
1716 ULONG cb,
1717 ULONG *pcbWritten)
1719 TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten);
1720 return ILockBytes_WriteAt(This, ulOffset, pv, cb, pcbWritten);
1723 HRESULT CALLBACK IFillLockBytes_FillAppend_Proxy(
1724 IFillLockBytes* This,
1725 const void *pv,
1726 ULONG cb,
1727 ULONG *pcbWritten)
1729 ULONG written;
1730 HRESULT hr;
1732 TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten);
1734 hr = IFillLockBytes_RemoteFillAppend_Proxy(This, pv, cb, &written);
1735 if(pcbWritten) *pcbWritten = written;
1737 return hr;
1740 HRESULT __RPC_STUB IFillLockBytes_FillAppend_Stub(
1741 IFillLockBytes* This,
1742 const byte *pv,
1743 ULONG cb,
1744 ULONG *pcbWritten)
1746 TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten);
1747 return IFillLockBytes_FillAppend(This, pv, cb, pcbWritten);
1750 HRESULT CALLBACK IFillLockBytes_FillAt_Proxy(
1751 IFillLockBytes* This,
1752 ULARGE_INTEGER ulOffset,
1753 const void *pv,
1754 ULONG cb,
1755 ULONG *pcbWritten)
1757 ULONG written;
1758 HRESULT hr;
1760 TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten);
1762 hr = IFillLockBytes_RemoteFillAt_Proxy(This, ulOffset, pv, cb, &written);
1763 if(pcbWritten) *pcbWritten = written;
1765 return hr;
1768 HRESULT __RPC_STUB IFillLockBytes_FillAt_Stub(
1769 IFillLockBytes* This,
1770 ULARGE_INTEGER ulOffset,
1771 const byte *pv,
1772 ULONG cb,
1773 ULONG *pcbWritten)
1775 TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten);
1776 return IFillLockBytes_FillAt(This, ulOffset, pv, cb, pcbWritten);
1779 HRESULT CALLBACK IEnumFORMATETC_Next_Proxy(
1780 IEnumFORMATETC* This,
1781 ULONG celt,
1782 FORMATETC *rgelt,
1783 ULONG *pceltFetched)
1785 ULONG fetched;
1786 if (!pceltFetched) pceltFetched = &fetched;
1787 return IEnumFORMATETC_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
1790 HRESULT __RPC_STUB IEnumFORMATETC_Next_Stub(
1791 IEnumFORMATETC* This,
1792 ULONG celt,
1793 FORMATETC *rgelt,
1794 ULONG *pceltFetched)
1796 HRESULT hr;
1797 *pceltFetched = 0;
1798 hr = IEnumFORMATETC_Next(This, celt, rgelt, pceltFetched);
1799 if (hr == S_OK) *pceltFetched = celt;
1800 return hr;
1803 HRESULT CALLBACK IEnumSTATDATA_Next_Proxy(
1804 IEnumSTATDATA* This,
1805 ULONG celt,
1806 STATDATA *rgelt,
1807 ULONG *pceltFetched)
1809 ULONG fetched;
1810 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
1811 if (!pceltFetched) pceltFetched = &fetched;
1812 return IEnumSTATDATA_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
1815 HRESULT __RPC_STUB IEnumSTATDATA_Next_Stub(
1816 IEnumSTATDATA* This,
1817 ULONG celt,
1818 STATDATA *rgelt,
1819 ULONG *pceltFetched)
1821 HRESULT hr;
1822 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
1823 *pceltFetched = 0;
1824 hr = IEnumSTATDATA_Next(This, celt, rgelt, pceltFetched);
1825 if (hr == S_OK) *pceltFetched = celt;
1826 return hr;
1829 void CALLBACK IAdviseSink_OnDataChange_Proxy(
1830 IAdviseSink* This,
1831 FORMATETC *pFormatetc,
1832 STGMEDIUM *pStgmed)
1834 TRACE("(%p)->(%p, %p)\n", This, pFormatetc, pStgmed);
1835 IAdviseSink_RemoteOnDataChange_Proxy(This, pFormatetc, pStgmed);
1838 HRESULT __RPC_STUB IAdviseSink_OnDataChange_Stub(
1839 IAdviseSink* This,
1840 FORMATETC *pFormatetc,
1841 ASYNC_STGMEDIUM *pStgmed)
1843 TRACE("(%p)->(%p, %p)\n", This, pFormatetc, pStgmed);
1844 IAdviseSink_OnDataChange(This, pFormatetc, pStgmed);
1845 return S_OK;
1848 void CALLBACK IAdviseSink_OnViewChange_Proxy(
1849 IAdviseSink* This,
1850 DWORD dwAspect,
1851 LONG lindex)
1853 TRACE("(%p)->(%d, %d)\n", This, dwAspect, lindex);
1854 IAdviseSink_RemoteOnViewChange_Proxy(This, dwAspect, lindex);
1857 HRESULT __RPC_STUB IAdviseSink_OnViewChange_Stub(
1858 IAdviseSink* This,
1859 DWORD dwAspect,
1860 LONG lindex)
1862 TRACE("(%p)->(%d, %d)\n", This, dwAspect, lindex);
1863 IAdviseSink_OnViewChange(This, dwAspect, lindex);
1864 return S_OK;
1867 void CALLBACK IAdviseSink_OnRename_Proxy(
1868 IAdviseSink* This,
1869 IMoniker *pmk)
1871 TRACE("(%p)->(%p)\n", This, pmk);
1872 IAdviseSink_RemoteOnRename_Proxy(This, pmk);
1875 HRESULT __RPC_STUB IAdviseSink_OnRename_Stub(
1876 IAdviseSink* This,
1877 IMoniker *pmk)
1879 TRACE("(%p)->(%p)\n", This, pmk);
1880 IAdviseSink_OnRename(This, pmk);
1881 return S_OK;
1884 void CALLBACK IAdviseSink_OnSave_Proxy(
1885 IAdviseSink* This)
1887 TRACE("(%p)\n", This);
1888 IAdviseSink_RemoteOnSave_Proxy(This);
1891 HRESULT __RPC_STUB IAdviseSink_OnSave_Stub(
1892 IAdviseSink* This)
1894 TRACE("(%p)\n", This);
1895 IAdviseSink_OnSave(This);
1896 return S_OK;
1899 void CALLBACK IAdviseSink_OnClose_Proxy(
1900 IAdviseSink* This)
1902 TRACE("(%p)\n", This);
1903 IAdviseSink_RemoteOnClose_Proxy(This);
1906 HRESULT __RPC_STUB IAdviseSink_OnClose_Stub(
1907 IAdviseSink* This)
1909 TRACE("(%p)\n", This);
1910 IAdviseSink_OnClose(This);
1911 return S_OK;
1914 void CALLBACK IAdviseSink2_OnLinkSrcChange_Proxy(
1915 IAdviseSink2* This,
1916 IMoniker *pmk)
1918 TRACE("(%p)->(%p)\n", This, pmk);
1919 IAdviseSink2_RemoteOnLinkSrcChange_Proxy(This, pmk);
1922 HRESULT __RPC_STUB IAdviseSink2_OnLinkSrcChange_Stub(
1923 IAdviseSink2* This,
1924 IMoniker *pmk)
1926 TRACE("(%p)->(%p)\n", This, pmk);
1927 IAdviseSink2_OnLinkSrcChange(This, pmk);
1928 return S_OK;
1931 HRESULT CALLBACK IDataObject_GetData_Proxy(
1932 IDataObject* This,
1933 FORMATETC *pformatetcIn,
1934 STGMEDIUM *pmedium)
1936 TRACE("(%p)->(%p, %p)\n", This, pformatetcIn, pmedium);
1937 return IDataObject_RemoteGetData_Proxy(This, pformatetcIn, pmedium);
1940 HRESULT __RPC_STUB IDataObject_GetData_Stub(
1941 IDataObject* This,
1942 FORMATETC *pformatetcIn,
1943 STGMEDIUM *pRemoteMedium)
1945 TRACE("(%p)->(%p, %p)\n", This, pformatetcIn, pRemoteMedium);
1946 return IDataObject_GetData(This, pformatetcIn, pRemoteMedium);
1949 HRESULT CALLBACK IDataObject_GetDataHere_Proxy(IDataObject *iface, FORMATETC *fmt, STGMEDIUM *med)
1951 IUnknown *release;
1952 IStorage *stg = NULL;
1953 HRESULT hr;
1955 TRACE("(%p)->(%p, %p)\n", iface, fmt, med);
1957 if ((med->tymed & (TYMED_HGLOBAL | TYMED_FILE | TYMED_ISTREAM | TYMED_ISTORAGE)) == 0)
1958 return DV_E_TYMED;
1959 if (med->tymed != fmt->tymed)
1960 return DV_E_TYMED;
1962 release = med->pUnkForRelease;
1963 med->pUnkForRelease = NULL;
1965 if (med->tymed == TYMED_ISTREAM || med->tymed == TYMED_ISTORAGE)
1967 stg = med->u.pstg; /* This may actually be a stream, but that's ok */
1968 if (stg) IStorage_AddRef( stg );
1971 hr = IDataObject_RemoteGetDataHere_Proxy(iface, fmt, med);
1973 med->pUnkForRelease = release;
1974 if (stg)
1976 if (med->u.pstg)
1977 IStorage_Release( med->u.pstg );
1978 med->u.pstg = stg;
1981 return hr;
1984 HRESULT __RPC_STUB IDataObject_GetDataHere_Stub(
1985 IDataObject* This,
1986 FORMATETC *pformatetc,
1987 STGMEDIUM *pRemoteMedium)
1989 TRACE("(%p)->(%p, %p)\n", This, pformatetc, pRemoteMedium);
1990 return IDataObject_GetDataHere(This, pformatetc, pRemoteMedium);
1993 HRESULT CALLBACK IDataObject_SetData_Proxy(
1994 IDataObject* This,
1995 FORMATETC *pformatetc,
1996 STGMEDIUM *pmedium,
1997 BOOL fRelease)
1999 FIXME(":stub\n");
2000 return E_NOTIMPL;
2003 HRESULT __RPC_STUB IDataObject_SetData_Stub(
2004 IDataObject* This,
2005 FORMATETC *pformatetc,
2006 FLAG_STGMEDIUM *pmedium,
2007 BOOL fRelease)
2009 FIXME(":stub\n");
2010 return E_NOTIMPL;
2013 /* call_as/local stubs for oleidl.idl */
2015 HRESULT CALLBACK IOleInPlaceActiveObject_TranslateAccelerator_Proxy(
2016 IOleInPlaceActiveObject* This,
2017 LPMSG lpmsg)
2019 TRACE("(%p %p)\n", This, lpmsg);
2020 return IOleInPlaceActiveObject_RemoteTranslateAccelerator_Proxy(This);
2023 HRESULT __RPC_STUB IOleInPlaceActiveObject_TranslateAccelerator_Stub(
2024 IOleInPlaceActiveObject* This)
2026 TRACE("(%p)\n", This);
2027 return S_FALSE;
2030 HRESULT CALLBACK IOleInPlaceActiveObject_ResizeBorder_Proxy(
2031 IOleInPlaceActiveObject* This,
2032 LPCRECT prcBorder,
2033 IOleInPlaceUIWindow *pUIWindow,
2034 BOOL fFrameWindow)
2036 FIXME(":stub\n");
2037 return E_NOTIMPL;
2040 HRESULT __RPC_STUB IOleInPlaceActiveObject_ResizeBorder_Stub(
2041 IOleInPlaceActiveObject* This,
2042 LPCRECT prcBorder,
2043 REFIID riid,
2044 IOleInPlaceUIWindow *pUIWindow,
2045 BOOL fFrameWindow)
2047 FIXME(":stub\n");
2048 return E_NOTIMPL;
2051 HRESULT CALLBACK IOleCache2_UpdateCache_Proxy(
2052 IOleCache2* This,
2053 LPDATAOBJECT pDataObject,
2054 DWORD grfUpdf,
2055 LPVOID pReserved)
2057 TRACE("(%p, %p, 0x%08x, %p)\n", This, pDataObject, grfUpdf, pReserved);
2058 return IOleCache2_RemoteUpdateCache_Proxy(This, pDataObject, grfUpdf, (LONG_PTR)pReserved);
2061 HRESULT __RPC_STUB IOleCache2_UpdateCache_Stub(
2062 IOleCache2* This,
2063 LPDATAOBJECT pDataObject,
2064 DWORD grfUpdf,
2065 LONG_PTR pReserved)
2067 TRACE("(%p, %p, 0x%08x, %li)\n", This, pDataObject, grfUpdf, pReserved);
2068 return IOleCache2_UpdateCache(This, pDataObject, grfUpdf, (void*)pReserved);
2071 HRESULT CALLBACK IEnumOLEVERB_Next_Proxy(
2072 IEnumOLEVERB* This,
2073 ULONG celt,
2074 LPOLEVERB rgelt,
2075 ULONG *pceltFetched)
2077 ULONG fetched;
2078 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2079 if (!pceltFetched) pceltFetched = &fetched;
2080 return IEnumOLEVERB_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2083 HRESULT __RPC_STUB IEnumOLEVERB_Next_Stub(
2084 IEnumOLEVERB* This,
2085 ULONG celt,
2086 LPOLEVERB rgelt,
2087 ULONG *pceltFetched)
2089 HRESULT hr;
2090 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2091 *pceltFetched = 0;
2092 hr = IEnumOLEVERB_Next(This, celt, rgelt, pceltFetched);
2093 if (hr == S_OK) *pceltFetched = celt;
2094 return hr;
2097 HRESULT CALLBACK IViewObject_Draw_Proxy(
2098 IViewObject* This,
2099 DWORD dwDrawAspect,
2100 LONG lindex,
2101 void *pvAspect,
2102 DVTARGETDEVICE *ptd,
2103 HDC hdcTargetDev,
2104 HDC hdcDraw,
2105 LPCRECTL lprcBounds,
2106 LPCRECTL lprcWBounds,
2107 BOOL (STDMETHODCALLTYPE *pfnContinue)(ULONG_PTR dwContinue),
2108 ULONG_PTR dwContinue)
2110 FIXME(":stub\n");
2111 return E_NOTIMPL;
2114 HRESULT __RPC_STUB IViewObject_Draw_Stub(
2115 IViewObject* This,
2116 DWORD dwDrawAspect,
2117 LONG lindex,
2118 ULONG_PTR pvAspect,
2119 DVTARGETDEVICE *ptd,
2120 ULONG_PTR hdcTargetDev,
2121 ULONG_PTR hdcDraw,
2122 LPCRECTL lprcBounds,
2123 LPCRECTL lprcWBounds,
2124 IContinue *pContinue)
2126 FIXME(":stub\n");
2127 return E_NOTIMPL;
2130 HRESULT CALLBACK IViewObject_GetColorSet_Proxy(
2131 IViewObject* This,
2132 DWORD dwDrawAspect,
2133 LONG lindex,
2134 void *pvAspect,
2135 DVTARGETDEVICE *ptd,
2136 HDC hicTargetDev,
2137 LOGPALETTE **ppColorSet)
2139 FIXME(":stub\n");
2140 return E_NOTIMPL;
2143 HRESULT __RPC_STUB IViewObject_GetColorSet_Stub(
2144 IViewObject* This,
2145 DWORD dwDrawAspect,
2146 LONG lindex,
2147 ULONG_PTR pvAspect,
2148 DVTARGETDEVICE *ptd,
2149 ULONG_PTR hicTargetDev,
2150 LOGPALETTE **ppColorSet)
2152 FIXME(":stub\n");
2153 return E_NOTIMPL;
2156 HRESULT CALLBACK IViewObject_Freeze_Proxy(
2157 IViewObject* This,
2158 DWORD dwDrawAspect,
2159 LONG lindex,
2160 void *pvAspect,
2161 DWORD *pdwFreeze)
2163 FIXME(":stub\n");
2164 return E_NOTIMPL;
2167 HRESULT __RPC_STUB IViewObject_Freeze_Stub(
2168 IViewObject* This,
2169 DWORD dwDrawAspect,
2170 LONG lindex,
2171 ULONG_PTR pvAspect,
2172 DWORD *pdwFreeze)
2174 FIXME(":stub\n");
2175 return E_NOTIMPL;
2178 HRESULT CALLBACK IViewObject_GetAdvise_Proxy(
2179 IViewObject* This,
2180 DWORD *pAspects,
2181 DWORD *pAdvf,
2182 IAdviseSink **ppAdvSink)
2184 FIXME(":stub\n");
2185 return E_NOTIMPL;
2188 HRESULT __RPC_STUB IViewObject_GetAdvise_Stub(
2189 IViewObject* This,
2190 DWORD *pAspects,
2191 DWORD *pAdvf,
2192 IAdviseSink **ppAdvSink)
2194 FIXME(":stub\n");
2195 return E_NOTIMPL;