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
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
39 #include "wine/unicode.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(ole);
44 #define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
45 #define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
46 #define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
47 #define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
49 #define USER_MARSHAL_PTR_PREFIX \
50 ( (DWORD)'U' | ( (DWORD)'s' << 8 ) | \
51 ( (DWORD)'e' << 16 ) | ( (DWORD)'r' << 24 ) )
53 static const char* debugstr_user_flags(ULONG *pFlags)
57 switch (LOWORD(*pFlags))
60 loword="MSHCTX_LOCAL";
62 case MSHCTX_NOSHAREDMEM:
63 loword="MSHCTX_NOSHAREDMEM";
65 case MSHCTX_DIFFERENTMACHINE:
66 loword="MSHCTX_DIFFERENTMACHINE";
69 loword="MSHCTX_INPROC";
72 sprintf(buf, "%d", LOWORD(*pFlags));
76 if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION)
77 return wine_dbg_sprintf("MAKELONG(NDR_LOCAL_REPRESENTATION, %s)", loword);
79 return wine_dbg_sprintf("MAKELONG(0x%04x, %s)", HIWORD(*pFlags), loword);
82 /******************************************************************************
83 * CLIPFORMAT_UserSize [OLE32.@]
85 * Calculates the buffer size required to marshal a clip format.
88 * pFlags [I] Flags. See notes.
89 * StartingSize [I] Starting size of the buffer. This value is added on to
90 * the buffer size required for the clip format.
91 * pCF [I] Clip format to size.
94 * The buffer size required to marshal a clip format plus the starting size.
97 * Even though the function is documented to take a pointer to an unsigned
98 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
99 * the first parameter is an unsigned long.
100 * This function is only intended to be called by the RPC runtime.
102 ULONG __RPC_USER CLIPFORMAT_UserSize(ULONG *pFlags, ULONG StartingSize, CLIPFORMAT *pCF)
104 ULONG size = StartingSize;
106 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, pCF);
108 size += sizeof(userCLIPFORMAT);
110 /* only need to marshal the name if it is not a pre-defined type and
111 * we are going remote */
112 if ((*pCF >= 0xc000) && (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE))
116 size += 3 * sizeof(INT);
117 /* urg! this function is badly designed because it won't tell us how
118 * much space is needed without doing a dummy run of storing the
119 * name into a buffer */
120 ret = GetClipboardFormatNameW(*pCF, format, sizeof(format)/sizeof(format[0])-1);
122 RaiseException(DV_E_CLIPFORMAT, 0, 0, NULL);
123 size += (ret + 1) * sizeof(WCHAR);
128 /******************************************************************************
129 * CLIPFORMAT_UserMarshal [OLE32.@]
131 * Marshals a clip format into a buffer.
134 * pFlags [I] Flags. See notes.
135 * pBuffer [I] Buffer to marshal the clip format into.
136 * pCF [I] Clip format to marshal.
139 * The end of the marshaled data in the buffer.
142 * Even though the function is documented to take a pointer to an unsigned
143 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
144 * the first parameter is an unsigned long.
145 * This function is only intended to be called by the RPC runtime.
147 unsigned char * __RPC_USER CLIPFORMAT_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, CLIPFORMAT *pCF)
149 wireCLIPFORMAT wirecf = (wireCLIPFORMAT)pBuffer;
151 TRACE("(%s, %p, &0x%04x\n", debugstr_user_flags(pFlags), pBuffer, *pCF);
153 wirecf->u.dwValue = *pCF;
154 pBuffer += sizeof(*wirecf);
156 /* only need to marshal the name if it is not a pre-defined type and
157 * we are going remote */
158 if ((*pCF >= 0xc000) && (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE))
162 wirecf->fContext = WDT_REMOTE_CALL;
163 len = GetClipboardFormatNameW(*pCF, format, sizeof(format)/sizeof(format[0])-1);
165 RaiseException(DV_E_CLIPFORMAT, 0, 0, NULL);
167 *(INT *)pBuffer = len;
168 pBuffer += sizeof(INT);
170 pBuffer += sizeof(INT);
171 *(INT *)pBuffer = len;
172 pBuffer += sizeof(INT);
173 TRACE("marshaling format name %s\n", debugstr_wn(format, len-1));
174 lstrcpynW((LPWSTR)pBuffer, format, len);
175 pBuffer += len * sizeof(WCHAR);
176 *(WCHAR *)pBuffer = '\0';
177 pBuffer += sizeof(WCHAR);
180 wirecf->fContext = WDT_INPROC_CALL;
185 /******************************************************************************
186 * CLIPFORMAT_UserUnmarshal [OLE32.@]
188 * Unmarshals a clip format from a buffer.
191 * pFlags [I] Flags. See notes.
192 * pBuffer [I] Buffer to marshal the clip format from.
193 * pCF [O] Address that receive the unmarshaled clip format.
196 * The end of the marshaled data in the buffer.
199 * Even though the function is documented to take a pointer to an unsigned
200 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
201 * the first parameter is an unsigned long.
202 * This function is only intended to be called by the RPC runtime.
204 unsigned char * __RPC_USER CLIPFORMAT_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, CLIPFORMAT *pCF)
206 wireCLIPFORMAT wirecf = (wireCLIPFORMAT)pBuffer;
208 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pCF);
210 pBuffer += sizeof(*wirecf);
211 if (wirecf->fContext == WDT_INPROC_CALL)
212 *pCF = (CLIPFORMAT)wirecf->u.dwValue;
213 else if (wirecf->fContext == WDT_REMOTE_CALL)
216 INT len = *(INT *)pBuffer;
217 pBuffer += sizeof(INT);
218 if (*(INT *)pBuffer != 0)
219 RaiseException(RPC_S_INVALID_BOUND, 0, 0, NULL);
220 pBuffer += sizeof(INT);
221 if (*(INT *)pBuffer != len)
222 RaiseException(RPC_S_INVALID_BOUND, 0, 0, NULL);
223 pBuffer += sizeof(INT);
224 if (((WCHAR *)pBuffer)[len] != '\0')
225 RaiseException(RPC_S_INVALID_BOUND, 0, 0, NULL);
226 TRACE("unmarshaling clip format %s\n", debugstr_w((LPCWSTR)pBuffer));
227 cf = RegisterClipboardFormatW((LPCWSTR)pBuffer);
228 pBuffer += (len + 1) * sizeof(WCHAR);
230 RaiseException(DV_E_CLIPFORMAT, 0, 0, NULL);
234 /* code not really appropriate, but nearest I can find */
235 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
239 /******************************************************************************
240 * CLIPFORMAT_UserFree [OLE32.@]
242 * Frees an unmarshaled clip format.
245 * pFlags [I] Flags. See notes.
246 * pCF [I] Clip format to free.
249 * The end of the marshaled data in the buffer.
252 * Even though the function is documented to take a pointer to an unsigned
253 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB
254 * structure, of which the first parameter is an unsigned long.
255 * This function is only intended to be called by the RPC runtime.
257 void __RPC_USER CLIPFORMAT_UserFree(ULONG *pFlags, CLIPFORMAT *pCF)
259 /* there is no inverse of the RegisterClipboardFormat function,
260 * so nothing to do */
263 static ULONG handle_UserSize(ULONG *pFlags, ULONG StartingSize, HANDLE *handle)
265 if (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE)
267 ERR("can't remote a local handle\n");
268 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
271 return StartingSize + sizeof(RemotableHandle);
274 static unsigned char * handle_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HANDLE *handle)
276 RemotableHandle *remhandle = (RemotableHandle *)pBuffer;
277 if (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE)
279 ERR("can't remote a local handle\n");
280 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
283 remhandle->fContext = WDT_INPROC_CALL;
284 remhandle->u.hInproc = (LONG_PTR)*handle;
285 return pBuffer + sizeof(RemotableHandle);
288 static unsigned char * handle_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HANDLE *handle)
290 RemotableHandle *remhandle = (RemotableHandle *)pBuffer;
291 if (remhandle->fContext != WDT_INPROC_CALL)
292 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
293 *handle = (HANDLE)remhandle->u.hInproc;
294 return pBuffer + sizeof(RemotableHandle);
297 static void handle_UserFree(ULONG *pFlags, HANDLE *phMenu)
302 #define IMPL_WIREM_HANDLE(type) \
303 ULONG __RPC_USER type##_UserSize(ULONG *pFlags, ULONG StartingSize, type *handle) \
305 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, handle); \
306 return handle_UserSize(pFlags, StartingSize, (HANDLE *)handle); \
309 unsigned char * __RPC_USER type##_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
311 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *handle); \
312 return handle_UserMarshal(pFlags, pBuffer, (HANDLE *)handle); \
315 unsigned char * __RPC_USER type##_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
317 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, handle); \
318 return handle_UserUnmarshal(pFlags, pBuffer, (HANDLE *)handle); \
321 void __RPC_USER type##_UserFree(ULONG *pFlags, type *handle) \
323 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *handle); \
324 handle_UserFree(pFlags, (HANDLE *)handle); \
327 IMPL_WIREM_HANDLE(HACCEL)
328 IMPL_WIREM_HANDLE(HMENU)
329 IMPL_WIREM_HANDLE(HWND)
331 /******************************************************************************
332 * HGLOBAL_UserSize [OLE32.@]
334 * Calculates the buffer size required to marshal an HGLOBAL.
337 * pFlags [I] Flags. See notes.
338 * StartingSize [I] Starting size of the buffer. This value is added on to
339 * the buffer size required for the clip format.
340 * phGlobal [I] HGLOBAL to size.
343 * The buffer size required to marshal an HGLOBAL plus the starting size.
346 * Even though the function is documented to take a pointer to a ULONG in
347 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
348 * the first parameter is a ULONG.
349 * This function is only intended to be called by the RPC runtime.
351 ULONG __RPC_USER HGLOBAL_UserSize(ULONG *pFlags, ULONG StartingSize, HGLOBAL *phGlobal)
353 ULONG size = StartingSize;
355 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, phGlobal);
357 ALIGN_LENGTH(size, 3);
359 size += sizeof(ULONG);
361 if (LOWORD(*pFlags == MSHCTX_INPROC))
362 size += sizeof(HGLOBAL);
365 size += sizeof(ULONG);
369 size += 3 * sizeof(ULONG);
370 ret = GlobalSize(*phGlobal);
378 /******************************************************************************
379 * HGLOBAL_UserMarshal [OLE32.@]
381 * Marshals an HGLOBAL into a buffer.
384 * pFlags [I] Flags. See notes.
385 * pBuffer [I] Buffer to marshal the clip format into.
386 * phGlobal [I] HGLOBAL to marshal.
389 * The end of the marshaled data in the buffer.
392 * Even though the function is documented to take a pointer to a ULONG in
393 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
394 * the first parameter is a ULONG.
395 * This function is only intended to be called by the RPC runtime.
397 unsigned char * __RPC_USER HGLOBAL_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HGLOBAL *phGlobal)
399 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phGlobal);
401 ALIGN_POINTER(pBuffer, 3);
403 if (LOWORD(*pFlags == MSHCTX_INPROC))
405 if (sizeof(*phGlobal) == 8)
406 *(ULONG *)pBuffer = WDT_INPROC64_CALL;
408 *(ULONG *)pBuffer = WDT_INPROC_CALL;
409 pBuffer += sizeof(ULONG);
410 *(HGLOBAL *)pBuffer = *phGlobal;
411 pBuffer += sizeof(HGLOBAL);
415 *(ULONG *)pBuffer = WDT_REMOTE_CALL;
416 pBuffer += sizeof(ULONG);
417 *(ULONG *)pBuffer = (ULONG)*phGlobal;
418 pBuffer += sizeof(ULONG);
421 const unsigned char *memory;
422 SIZE_T size = GlobalSize(*phGlobal);
423 *(ULONG *)pBuffer = (ULONG)size;
424 pBuffer += sizeof(ULONG);
425 *(ULONG *)pBuffer = (ULONG)*phGlobal;
426 pBuffer += sizeof(ULONG);
427 *(ULONG *)pBuffer = (ULONG)size;
428 pBuffer += sizeof(ULONG);
430 memory = GlobalLock(*phGlobal);
431 memcpy(pBuffer, memory, size);
433 GlobalUnlock(*phGlobal);
440 /******************************************************************************
441 * HGLOBAL_UserUnmarshal [OLE32.@]
443 * Unmarshals an HGLOBAL from a buffer.
446 * pFlags [I] Flags. See notes.
447 * pBuffer [I] Buffer to marshal the clip format from.
448 * phGlobal [O] Address that receive the unmarshaled HGLOBAL.
451 * The end of the marshaled data in the buffer.
454 * Even though the function is documented to take a pointer to an ULONG in
455 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
456 * the first parameter is an ULONG.
457 * This function is only intended to be called by the RPC runtime.
459 unsigned char * __RPC_USER HGLOBAL_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HGLOBAL *phGlobal)
463 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phGlobal);
465 ALIGN_POINTER(pBuffer, 3);
467 fContext = *(ULONG *)pBuffer;
468 pBuffer += sizeof(ULONG);
470 if (((fContext == WDT_INPROC_CALL) && (sizeof(*phGlobal) < 8)) ||
471 ((fContext == WDT_INPROC64_CALL) && (sizeof(*phGlobal) == 8)))
473 *phGlobal = *(HGLOBAL *)pBuffer;
474 pBuffer += sizeof(*phGlobal);
476 else if (fContext == WDT_REMOTE_CALL)
480 handle = *(ULONG *)pBuffer;
481 pBuffer += sizeof(ULONG);
488 size = *(ULONG *)pBuffer;
489 pBuffer += sizeof(ULONG);
490 /* redundancy is bad - it means you have to check consistency like
492 if (*(ULONG *)pBuffer != handle)
494 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
497 pBuffer += sizeof(ULONG);
498 /* redundancy is bad - it means you have to check consistency like
500 if (*(ULONG *)pBuffer != size)
502 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
505 pBuffer += sizeof(ULONG);
507 /* FIXME: check size is not too big */
509 *phGlobal = GlobalAlloc(GMEM_MOVEABLE, size);
510 memory = GlobalLock(*phGlobal);
511 memcpy(memory, pBuffer, size);
513 GlobalUnlock(*phGlobal);
519 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
524 /******************************************************************************
525 * HGLOBAL_UserFree [OLE32.@]
527 * Frees an unmarshaled HGLOBAL.
530 * pFlags [I] Flags. See notes.
531 * phGlobal [I] HGLOBAL to free.
534 * The end of the marshaled data in the buffer.
537 * Even though the function is documented to take a pointer to a ULONG in
538 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
539 * which the first parameter is a ULONG.
540 * This function is only intended to be called by the RPC runtime.
542 void __RPC_USER HGLOBAL_UserFree(ULONG *pFlags, HGLOBAL *phGlobal)
544 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phGlobal);
546 if (LOWORD(*pFlags != MSHCTX_INPROC) && *phGlobal)
547 GlobalFree(*phGlobal);
550 /******************************************************************************
551 * HBITMAP_UserSize [OLE32.@]
553 * Calculates the buffer size required to marshal a bitmap.
556 * pFlags [I] Flags. See notes.
557 * StartingSize [I] Starting size of the buffer. This value is added on to
558 * the buffer size required for the clip format.
559 * phBmp [I] Bitmap to size.
562 * The buffer size required to marshal an bitmap plus the starting size.
565 * Even though the function is documented to take a pointer to a ULONG in
566 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
567 * the first parameter is a ULONG.
568 * This function is only intended to be called by the RPC runtime.
570 ULONG __RPC_USER HBITMAP_UserSize(ULONG *pFlags, ULONG StartingSize, HBITMAP *phBmp)
576 /******************************************************************************
577 * HBITMAP_UserMarshal [OLE32.@]
579 * Marshals a bitmap into a buffer.
582 * pFlags [I] Flags. See notes.
583 * pBuffer [I] Buffer to marshal the clip format into.
584 * phBmp [I] Bitmap to marshal.
587 * The end of the marshaled data in the buffer.
590 * Even though the function is documented to take a pointer to a ULONG in
591 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
592 * the first parameter is a ULONG.
593 * This function is only intended to be called by the RPC runtime.
595 unsigned char * __RPC_USER HBITMAP_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HBITMAP *phBmp)
601 /******************************************************************************
602 * HBITMAP_UserUnmarshal [OLE32.@]
604 * Unmarshals a bitmap from a buffer.
607 * pFlags [I] Flags. See notes.
608 * pBuffer [I] Buffer to marshal the clip format from.
609 * phBmp [O] Address that receive the unmarshaled bitmap.
612 * The end of the marshaled data in the buffer.
615 * Even though the function is documented to take a pointer to an ULONG in
616 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
617 * the first parameter is an ULONG.
618 * This function is only intended to be called by the RPC runtime.
620 unsigned char * __RPC_USER HBITMAP_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HBITMAP *phBmp)
626 /******************************************************************************
627 * HBITMAP_UserFree [OLE32.@]
629 * Frees an unmarshaled bitmap.
632 * pFlags [I] Flags. See notes.
633 * phBmp [I] Bitmap to free.
636 * The end of the marshaled data in the buffer.
639 * Even though the function is documented to take a pointer to a ULONG in
640 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
641 * which the first parameter is a ULONG.
642 * This function is only intended to be called by the RPC runtime.
644 void __RPC_USER HBITMAP_UserFree(ULONG *pFlags, HBITMAP *phBmp)
649 /******************************************************************************
650 * HICON_UserSize [OLE32.@]
652 * Calculates the buffer size required to marshal an icon.
655 * pFlags [I] Flags. See notes.
656 * StartingSize [I] Starting size of the buffer. This value is added on to
657 * the buffer size required for the icon.
658 * phIcon [I] Icon to size.
661 * The buffer size required to marshal an icon plus the starting size.
664 * Even though the function is documented to take a pointer to a ULONG in
665 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
666 * the first parameter is a ULONG.
667 * This function is only intended to be called by the RPC runtime.
669 ULONG __RPC_USER HICON_UserSize(ULONG *pFlags, ULONG StartingSize, HICON *phIcon)
675 /******************************************************************************
676 * HICON_UserMarshal [OLE32.@]
678 * Marshals an icon into a buffer.
681 * pFlags [I] Flags. See notes.
682 * pBuffer [I] Buffer to marshal the icon into.
683 * phIcon [I] Icon to marshal.
686 * The end of the marshaled data in the buffer.
689 * Even though the function is documented to take a pointer to a ULONG in
690 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
691 * the first parameter is a ULONG.
692 * This function is only intended to be called by the RPC runtime.
694 unsigned char * __RPC_USER HICON_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HICON *phIcon)
700 /******************************************************************************
701 * HICON_UserUnmarshal [OLE32.@]
703 * Unmarshals an icon from a buffer.
706 * pFlags [I] Flags. See notes.
707 * pBuffer [I] Buffer to marshal the icon from.
708 * phIcon [O] Address that receive the unmarshaled icon.
711 * The end of the marshaled data in the buffer.
714 * Even though the function is documented to take a pointer to an ULONG in
715 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
716 * the first parameter is an ULONG.
717 * This function is only intended to be called by the RPC runtime.
719 unsigned char * __RPC_USER HICON_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HICON *phIcon)
725 /******************************************************************************
726 * HICON_UserFree [OLE32.@]
728 * Frees an unmarshaled icon.
731 * pFlags [I] Flags. See notes.
732 * phIcon [I] Icon to free.
735 * The end of the marshaled data in the buffer.
738 * Even though the function is documented to take a pointer to a ULONG in
739 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
740 * which the first parameter is a ULONG.
741 * This function is only intended to be called by the RPC runtime.
743 void __RPC_USER HICON_UserFree(ULONG *pFlags, HICON *phIcon)
748 /******************************************************************************
749 * HDC_UserSize [OLE32.@]
751 * Calculates the buffer size required to marshal an HDC.
754 * pFlags [I] Flags. See notes.
755 * StartingSize [I] Starting size of the buffer. This value is added on to
756 * the buffer size required for the clip format.
757 * phGlobal [I] HDC to size.
760 * The buffer size required to marshal an HDC plus the starting size.
763 * Even though the function is documented to take a pointer to a ULONG in
764 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
765 * the first parameter is a ULONG.
766 * This function is only intended to be called by the RPC runtime.
768 ULONG __RPC_USER HDC_UserSize(ULONG *pFlags, ULONG StartingSize, HDC *phdc)
774 /******************************************************************************
775 * HDC_UserMarshal [OLE32.@]
777 * Marshals an HDC into a buffer.
780 * pFlags [I] Flags. See notes.
781 * pBuffer [I] Buffer to marshal the clip format into.
782 * phdc [I] HDC to marshal.
785 * The end of the marshaled data in the buffer.
788 * Even though the function is documented to take a pointer to a ULONG in
789 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
790 * the first parameter is a ULONG.
791 * This function is only intended to be called by the RPC runtime.
793 unsigned char * __RPC_USER HDC_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HDC *phdc)
799 /******************************************************************************
800 * HDC_UserUnmarshal [OLE32.@]
802 * Unmarshals an HDC from a buffer.
805 * pFlags [I] Flags. See notes.
806 * pBuffer [I] Buffer to marshal the clip format from.
807 * phdc [O] Address that receive the unmarshaled HDC.
810 * The end of the marshaled data in the buffer.
813 * Even though the function is documented to take a pointer to an ULONG in
814 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
815 * the first parameter is an ULONG.
816 * This function is only intended to be called by the RPC runtime.
818 unsigned char * __RPC_USER HDC_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HDC *phdc)
824 /******************************************************************************
825 * HDC_UserFree [OLE32.@]
827 * Frees an unmarshaled HDC.
830 * pFlags [I] Flags. See notes.
831 * phdc [I] HDC to free.
834 * The end of the marshaled data in the buffer.
837 * Even though the function is documented to take a pointer to a ULONG in
838 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
839 * which the first parameter is a ULONG.
840 * This function is only intended to be called by the RPC runtime.
842 void __RPC_USER HDC_UserFree(ULONG *pFlags, HDC *phdc)
847 /******************************************************************************
848 * HPALETTE_UserSize [OLE32.@]
850 * Calculates the buffer size required to marshal a palette.
853 * pFlags [I] Flags. See notes.
854 * StartingSize [I] Starting size of the buffer. This value is added on to
855 * the buffer size required for the clip format.
856 * phPal [I] Palette to size.
859 * The buffer size required to marshal a palette plus the starting size.
862 * Even though the function is documented to take a pointer to a ULONG in
863 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
864 * the first parameter is a ULONG.
865 * This function is only intended to be called by the RPC runtime.
867 ULONG __RPC_USER HPALETTE_UserSize(ULONG *pFlags, ULONG StartingSize, HPALETTE *phPal)
873 /******************************************************************************
874 * HPALETTE_UserMarshal [OLE32.@]
876 * Marshals a palette into a buffer.
879 * pFlags [I] Flags. See notes.
880 * pBuffer [I] Buffer to marshal the clip format into.
881 * phPal [I] Palette to marshal.
884 * The end of the marshaled data in the buffer.
887 * Even though the function is documented to take a pointer to a ULONG in
888 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
889 * the first parameter is a ULONG.
890 * This function is only intended to be called by the RPC runtime.
892 unsigned char * __RPC_USER HPALETTE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HPALETTE *phPal)
898 /******************************************************************************
899 * HPALETTE_UserUnmarshal [OLE32.@]
901 * Unmarshals a palette from a buffer.
904 * pFlags [I] Flags. See notes.
905 * pBuffer [I] Buffer to marshal the clip format from.
906 * phPal [O] Address that receive the unmarshaled palette.
909 * The end of the marshaled data in the buffer.
912 * Even though the function is documented to take a pointer to an ULONG in
913 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
914 * the first parameter is an ULONG.
915 * This function is only intended to be called by the RPC runtime.
917 unsigned char * __RPC_USER HPALETTE_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HPALETTE *phPal)
923 /******************************************************************************
924 * HPALETTE_UserFree [OLE32.@]
926 * Frees an unmarshaled palette.
929 * pFlags [I] Flags. See notes.
930 * phPal [I] Palette to free.
933 * The end of the marshaled data in the buffer.
936 * Even though the function is documented to take a pointer to a ULONG in
937 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
938 * which the first parameter is a ULONG.
939 * This function is only intended to be called by the RPC runtime.
941 void __RPC_USER HPALETTE_UserFree(ULONG *pFlags, HPALETTE *phPal)
947 /******************************************************************************
948 * HMETAFILE_UserSize [OLE32.@]
950 * Calculates the buffer size required to marshal a metafile.
953 * pFlags [I] Flags. See notes.
954 * StartingSize [I] Starting size of the buffer. This value is added on to
955 * the buffer size required for the clip format.
956 * phmf [I] Metafile to size.
959 * The buffer size required to marshal a metafile plus the starting size.
962 * Even though the function is documented to take a pointer to a ULONG in
963 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
964 * the first parameter is a ULONG.
965 * This function is only intended to be called by the RPC runtime.
967 ULONG __RPC_USER HMETAFILE_UserSize(ULONG *pFlags, ULONG StartingSize, HMETAFILE *phmf)
969 ULONG size = StartingSize;
971 TRACE("(%s, %d, &%p\n", debugstr_user_flags(pFlags), StartingSize, *phmf);
973 ALIGN_LENGTH(size, 3);
975 size += sizeof(ULONG);
976 if (LOWORD(*pFlags) == MSHCTX_INPROC)
977 size += sizeof(ULONG_PTR);
980 size += sizeof(ULONG);
986 size += 2 * sizeof(ULONG);
987 mfsize = GetMetaFileBitsEx(*phmf, 0, NULL);
995 /******************************************************************************
996 * HMETAFILE_UserMarshal [OLE32.@]
998 * Marshals a metafile into a buffer.
1001 * pFlags [I] Flags. See notes.
1002 * pBuffer [I] Buffer to marshal the clip format into.
1003 * phEmf [I] Metafile to marshal.
1006 * The end of the marshaled data in the buffer.
1009 * Even though the function is documented to take a pointer to a ULONG in
1010 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1011 * the first parameter is a ULONG.
1012 * This function is only intended to be called by the RPC runtime.
1014 unsigned char * __RPC_USER HMETAFILE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILE *phmf)
1016 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phmf);
1018 ALIGN_POINTER(pBuffer, 3);
1020 if (LOWORD(*pFlags) == MSHCTX_INPROC)
1022 if (sizeof(*phmf) == 8)
1023 *(ULONG *)pBuffer = WDT_INPROC64_CALL;
1025 *(ULONG *)pBuffer = WDT_INPROC_CALL;
1026 pBuffer += sizeof(ULONG);
1027 *(HMETAFILE *)pBuffer = *phmf;
1028 pBuffer += sizeof(HMETAFILE);
1032 *(ULONG *)pBuffer = WDT_REMOTE_CALL;
1033 pBuffer += sizeof(ULONG);
1034 *(ULONG *)pBuffer = (ULONG)(ULONG_PTR)*phmf;
1035 pBuffer += sizeof(ULONG);
1039 UINT mfsize = GetMetaFileBitsEx(*phmf, 0, NULL);
1041 *(ULONG *)pBuffer = mfsize;
1042 pBuffer += sizeof(ULONG);
1043 *(ULONG *)pBuffer = mfsize;
1044 pBuffer += sizeof(ULONG);
1045 GetMetaFileBitsEx(*phmf, mfsize, pBuffer);
1053 /******************************************************************************
1054 * HMETAFILE_UserUnmarshal [OLE32.@]
1056 * Unmarshals a metafile from a buffer.
1059 * pFlags [I] Flags. See notes.
1060 * pBuffer [I] Buffer to marshal the clip format from.
1061 * phmf [O] Address that receive the unmarshaled metafile.
1064 * The end of the marshaled data in the buffer.
1067 * Even though the function is documented to take a pointer to an ULONG in
1068 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1069 * the first parameter is an ULONG.
1070 * This function is only intended to be called by the RPC runtime.
1072 unsigned char * __RPC_USER HMETAFILE_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILE *phmf)
1076 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, phmf);
1078 ALIGN_POINTER(pBuffer, 3);
1080 fContext = *(ULONG *)pBuffer;
1081 pBuffer += sizeof(ULONG);
1083 if (((fContext == WDT_INPROC_CALL) && (sizeof(*phmf) < 8)) ||
1084 ((fContext == WDT_INPROC64_CALL) && (sizeof(*phmf) == 8)))
1086 *phmf = *(HMETAFILE *)pBuffer;
1087 pBuffer += sizeof(*phmf);
1089 else if (fContext == WDT_REMOTE_CALL)
1093 handle = *(ULONG *)pBuffer;
1094 pBuffer += sizeof(ULONG);
1099 size = *(ULONG *)pBuffer;
1100 pBuffer += sizeof(ULONG);
1101 if (size != *(ULONG *)pBuffer)
1103 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
1106 pBuffer += sizeof(ULONG);
1107 *phmf = SetMetaFileBitsEx(size, pBuffer);
1114 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
1119 /******************************************************************************
1120 * HMETAFILE_UserFree [OLE32.@]
1122 * Frees an unmarshaled metafile.
1125 * pFlags [I] Flags. See notes.
1126 * phmf [I] Metafile to free.
1129 * The end of the marshaled data in the buffer.
1132 * Even though the function is documented to take a pointer to a ULONG in
1133 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1134 * which the first parameter is a ULONG.
1135 * This function is only intended to be called by the RPC runtime.
1137 void __RPC_USER HMETAFILE_UserFree(ULONG *pFlags, HMETAFILE *phmf)
1139 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phmf);
1141 if (LOWORD(*pFlags) != MSHCTX_INPROC)
1142 DeleteMetaFile(*phmf);
1145 /******************************************************************************
1146 * HENHMETAFILE_UserSize [OLE32.@]
1148 * Calculates the buffer size required to marshal an enhanced metafile.
1151 * pFlags [I] Flags. See notes.
1152 * StartingSize [I] Starting size of the buffer. This value is added on to
1153 * the buffer size required for the clip format.
1154 * phEmf [I] Enhanced metafile to size.
1157 * The buffer size required to marshal an enhanced metafile plus the starting size.
1160 * Even though the function is documented to take a pointer to a ULONG in
1161 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1162 * the first parameter is a ULONG.
1163 * This function is only intended to be called by the RPC runtime.
1165 ULONG __RPC_USER HENHMETAFILE_UserSize(ULONG *pFlags, ULONG StartingSize, HENHMETAFILE *phEmf)
1167 ULONG size = StartingSize;
1169 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, *phEmf);
1171 size += sizeof(ULONG);
1172 if (LOWORD(*pFlags) == MSHCTX_INPROC)
1173 size += sizeof(ULONG_PTR);
1176 size += sizeof(ULONG);
1182 size += 2 * sizeof(ULONG);
1183 emfsize = GetEnhMetaFileBits(*phEmf, 0, NULL);
1191 /******************************************************************************
1192 * HENHMETAFILE_UserMarshal [OLE32.@]
1194 * Marshals an enhance metafile into a buffer.
1197 * pFlags [I] Flags. See notes.
1198 * pBuffer [I] Buffer to marshal the clip format into.
1199 * phEmf [I] Enhanced metafile to marshal.
1202 * The end of the marshaled data in the buffer.
1205 * Even though the function is documented to take a pointer to a ULONG in
1206 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1207 * the first parameter is a ULONG.
1208 * This function is only intended to be called by the RPC runtime.
1210 unsigned char * __RPC_USER HENHMETAFILE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HENHMETAFILE *phEmf)
1212 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phEmf);
1214 if (LOWORD(*pFlags) == MSHCTX_INPROC)
1216 if (sizeof(*phEmf) == 8)
1217 *(ULONG *)pBuffer = WDT_INPROC64_CALL;
1219 *(ULONG *)pBuffer = WDT_INPROC_CALL;
1220 pBuffer += sizeof(ULONG);
1221 *(HENHMETAFILE *)pBuffer = *phEmf;
1222 pBuffer += sizeof(HENHMETAFILE);
1226 *(ULONG *)pBuffer = WDT_REMOTE_CALL;
1227 pBuffer += sizeof(ULONG);
1228 *(ULONG *)pBuffer = (ULONG)(ULONG_PTR)*phEmf;
1229 pBuffer += sizeof(ULONG);
1233 UINT emfsize = GetEnhMetaFileBits(*phEmf, 0, NULL);
1235 *(ULONG *)pBuffer = emfsize;
1236 pBuffer += sizeof(ULONG);
1237 *(ULONG *)pBuffer = emfsize;
1238 pBuffer += sizeof(ULONG);
1239 GetEnhMetaFileBits(*phEmf, emfsize, pBuffer);
1247 /******************************************************************************
1248 * HENHMETAFILE_UserUnmarshal [OLE32.@]
1250 * Unmarshals an enhanced metafile from a buffer.
1253 * pFlags [I] Flags. See notes.
1254 * pBuffer [I] Buffer to marshal the clip format from.
1255 * phEmf [O] Address that receive the unmarshaled enhanced metafile.
1258 * The end of the marshaled data in the buffer.
1261 * Even though the function is documented to take a pointer to an ULONG in
1262 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1263 * the first parameter is an ULONG.
1264 * This function is only intended to be called by the RPC runtime.
1266 unsigned char * __RPC_USER HENHMETAFILE_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HENHMETAFILE *phEmf)
1270 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, phEmf);
1272 fContext = *(ULONG *)pBuffer;
1273 pBuffer += sizeof(ULONG);
1275 if (((fContext == WDT_INPROC_CALL) && (sizeof(*phEmf) < 8)) ||
1276 ((fContext == WDT_INPROC64_CALL) && (sizeof(*phEmf) == 8)))
1278 *phEmf = *(HENHMETAFILE *)pBuffer;
1279 pBuffer += sizeof(*phEmf);
1281 else if (fContext == WDT_REMOTE_CALL)
1285 handle = *(ULONG *)pBuffer;
1286 pBuffer += sizeof(ULONG);
1291 size = *(ULONG *)pBuffer;
1292 pBuffer += sizeof(ULONG);
1293 if (size != *(ULONG *)pBuffer)
1295 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
1298 pBuffer += sizeof(ULONG);
1299 *phEmf = SetEnhMetaFileBits(size, pBuffer);
1306 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
1311 /******************************************************************************
1312 * HENHMETAFILE_UserFree [OLE32.@]
1314 * Frees an unmarshaled enhanced metafile.
1317 * pFlags [I] Flags. See notes.
1318 * phEmf [I] Enhanced metafile to free.
1321 * The end of the marshaled data in the buffer.
1324 * Even though the function is documented to take a pointer to a ULONG in
1325 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1326 * which the first parameter is a ULONG.
1327 * This function is only intended to be called by the RPC runtime.
1329 void __RPC_USER HENHMETAFILE_UserFree(ULONG *pFlags, HENHMETAFILE *phEmf)
1331 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phEmf);
1333 if (LOWORD(*pFlags) != MSHCTX_INPROC)
1334 DeleteEnhMetaFile(*phEmf);
1337 /******************************************************************************
1338 * HMETAFILEPICT_UserSize [OLE32.@]
1340 * Calculates the buffer size required to marshal an metafile pict.
1343 * pFlags [I] Flags. See notes.
1344 * StartingSize [I] Starting size of the buffer. This value is added on to
1345 * the buffer size required for the clip format.
1346 * phMfp [I] Metafile pict to size.
1349 * The buffer size required to marshal a metafile pict plus the starting size.
1352 * Even though the function is documented to take a pointer to a ULONG in
1353 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1354 * the first parameter is a ULONG.
1355 * This function is only intended to be called by the RPC runtime.
1357 ULONG __RPC_USER HMETAFILEPICT_UserSize(ULONG *pFlags, ULONG StartingSize, HMETAFILEPICT *phMfp)
1359 ULONG size = StartingSize;
1361 TRACE("(%s, %d, &%p)\n", debugstr_user_flags(pFlags), StartingSize, *phMfp);
1363 size += sizeof(ULONG);
1364 size += sizeof(HMETAFILEPICT);
1366 if ((LOWORD(*pFlags) != MSHCTX_INPROC) && *phMfp)
1368 METAFILEPICT *mfpict = GlobalLock(*phMfp);
1370 /* FIXME: raise an exception if mfpict is NULL? */
1371 size += FIELD_OFFSET(remoteMETAFILEPICT, hMF);
1372 size += sizeof(ULONG);
1374 size = HMETAFILE_UserSize(pFlags, size, &mfpict->hMF);
1376 GlobalUnlock(*phMfp);
1382 /******************************************************************************
1383 * HMETAFILEPICT_UserMarshal [OLE32.@]
1385 * Marshals a metafile pict into a buffer.
1388 * pFlags [I] Flags. See notes.
1389 * pBuffer [I] Buffer to marshal the clip format into.
1390 * phMfp [I] Metafile pict to marshal.
1393 * The end of the marshaled data in the buffer.
1396 * Even though the function is documented to take a pointer to a ULONG in
1397 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1398 * the first parameter is a ULONG.
1399 * This function is only intended to be called by the RPC runtime.
1401 unsigned char * __RPC_USER HMETAFILEPICT_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILEPICT *phMfp)
1403 TRACE("(%s, %p, &%p)\n", debugstr_user_flags(pFlags), pBuffer, *phMfp);
1405 if (LOWORD(*pFlags) == MSHCTX_INPROC)
1406 *(ULONG *)pBuffer = WDT_INPROC_CALL;
1408 *(ULONG *)pBuffer = WDT_REMOTE_CALL;
1409 pBuffer += sizeof(ULONG);
1411 *(HMETAFILEPICT *)pBuffer = *phMfp;
1412 pBuffer += sizeof(HMETAFILEPICT);
1414 if ((LOWORD(*pFlags) != MSHCTX_INPROC) && *phMfp)
1416 METAFILEPICT *mfpict = GlobalLock(*phMfp);
1417 remoteMETAFILEPICT * remmfpict = (remoteMETAFILEPICT *)pBuffer;
1419 /* FIXME: raise an exception if mfpict is NULL? */
1420 remmfpict->mm = mfpict->mm;
1421 remmfpict->xExt = mfpict->xExt;
1422 remmfpict->yExt = mfpict->yExt;
1423 pBuffer += FIELD_OFFSET(remoteMETAFILEPICT, hMF);
1424 *(ULONG *)pBuffer = USER_MARSHAL_PTR_PREFIX;
1425 pBuffer += sizeof(ULONG);
1427 pBuffer = HMETAFILE_UserMarshal(pFlags, pBuffer, &mfpict->hMF);
1429 GlobalUnlock(*phMfp);
1435 /******************************************************************************
1436 * HMETAFILEPICT_UserUnmarshal [OLE32.@]
1438 * Unmarshals an metafile pict from a buffer.
1441 * pFlags [I] Flags. See notes.
1442 * pBuffer [I] Buffer to marshal the clip format from.
1443 * phMfp [O] Address that receive the unmarshaled metafile pict.
1446 * The end of the marshaled data in the buffer.
1449 * Even though the function is documented to take a pointer to an ULONG in
1450 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1451 * the first parameter is an ULONG.
1452 * This function is only intended to be called by the RPC runtime.
1454 unsigned char * __RPC_USER HMETAFILEPICT_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILEPICT *phMfp)
1458 TRACE("(%s, %p, %p)\n", debugstr_user_flags(pFlags), pBuffer, phMfp);
1460 fContext = *(ULONG *)pBuffer;
1461 pBuffer += sizeof(ULONG);
1463 if ((fContext == WDT_INPROC_CALL) || !*(HMETAFILEPICT *)pBuffer)
1465 *phMfp = *(HMETAFILEPICT *)pBuffer;
1466 pBuffer += sizeof(HMETAFILEPICT);
1470 METAFILEPICT *mfpict;
1471 const remoteMETAFILEPICT *remmfpict;
1472 ULONG user_marshal_prefix;
1474 pBuffer += sizeof(HMETAFILEPICT);
1475 remmfpict = (const remoteMETAFILEPICT *)pBuffer;
1477 *phMfp = GlobalAlloc(GMEM_MOVEABLE, sizeof(METAFILEPICT));
1479 RpcRaiseException(E_OUTOFMEMORY);
1481 mfpict = GlobalLock(*phMfp);
1482 mfpict->mm = remmfpict->mm;
1483 mfpict->xExt = remmfpict->xExt;
1484 mfpict->yExt = remmfpict->yExt;
1485 pBuffer += FIELD_OFFSET(remoteMETAFILEPICT, hMF);
1486 user_marshal_prefix = *(ULONG *)pBuffer;
1487 pBuffer += sizeof(ULONG);
1489 if (user_marshal_prefix != USER_MARSHAL_PTR_PREFIX)
1490 RpcRaiseException(RPC_X_INVALID_TAG);
1492 pBuffer = HMETAFILE_UserUnmarshal(pFlags, pBuffer, &mfpict->hMF);
1494 GlobalUnlock(*phMfp);
1500 /******************************************************************************
1501 * HMETAFILEPICT_UserFree [OLE32.@]
1503 * Frees an unmarshaled metafile pict.
1506 * pFlags [I] Flags. See notes.
1507 * phMfp [I] Metafile pict to free.
1510 * The end of the marshaled data in the buffer.
1513 * Even though the function is documented to take a pointer to a ULONG in
1514 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1515 * which the first parameter is a ULONG.
1516 * This function is only intended to be called by the RPC runtime.
1518 void __RPC_USER HMETAFILEPICT_UserFree(ULONG *pFlags, HMETAFILEPICT *phMfp)
1520 TRACE("(%s, &%p)\n", debugstr_user_flags(pFlags), *phMfp);
1522 if ((LOWORD(*pFlags) != MSHCTX_INPROC) && *phMfp)
1524 METAFILEPICT *mfpict;
1526 mfpict = GlobalLock(*phMfp);
1527 /* FIXME: raise an exception if mfpict is NULL? */
1528 HMETAFILE_UserFree(pFlags, &mfpict->hMF);
1529 GlobalUnlock(*phMfp);
1535 /******************************************************************************
1536 * WdtpInterfacePointer_UserSize [OLE32.@]
1538 * Calculates the buffer size required to marshal an interface pointer.
1541 * pFlags [I] Flags. See notes.
1542 * RealFlags [I] The MSHCTX to use when marshaling the interface.
1543 * punk [I] Interface pointer to size.
1544 * StartingSize [I] Starting size of the buffer. This value is added on to
1545 * the buffer size required for the clip format.
1546 * riid [I] ID of interface to size.
1549 * The buffer size required to marshal an interface pointer plus the starting size.
1552 * Even though the function is documented to take a pointer to a ULONG in
1553 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1554 * the first parameter is a ULONG.
1556 ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG *pFlags, ULONG RealFlags, IUnknown *punk, ULONG StartingSize, REFIID riid)
1558 FIXME("(%s, 0%x, %p, %d, %s): stub\n", debugstr_user_flags(pFlags), RealFlags, punk, StartingSize, debugstr_guid(riid));
1562 /******************************************************************************
1563 * WdtpInterfacePointer_UserMarshal [OLE32.@]
1565 * Marshals an interface pointer into a buffer.
1568 * pFlags [I] Flags. See notes.
1569 * RealFlags [I] The MSHCTX to use when marshaling the interface.
1570 * pBuffer [I] Buffer to marshal the clip format into.
1571 * punk [I] Interface pointer to marshal.
1572 * riid [I] ID of interface to marshal.
1575 * The end of the marshaled data in the buffer.
1578 * Even though the function is documented to take a pointer to a ULONG in
1579 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1580 * the first parameter is a ULONG.
1582 unsigned char * WINAPI WdtpInterfacePointer_UserMarshal(ULONG *pFlags, ULONG RealFlags, unsigned char *pBuffer, IUnknown *punk, REFIID riid)
1584 FIXME("(%s, 0x%x, %p, &%p, %s): stub\n", debugstr_user_flags(pFlags), RealFlags, pBuffer, punk, debugstr_guid(riid));
1588 /******************************************************************************
1589 * WdtpInterfacePointer_UserUnmarshal [OLE32.@]
1591 * Unmarshals an interface pointer from a buffer.
1594 * pFlags [I] Flags. See notes.
1595 * pBuffer [I] Buffer to marshal the clip format from.
1596 * ppunk [I/O] Address that receives the unmarshaled interface pointer.
1597 * riid [I] ID of interface to unmarshal.
1600 * The end of the marshaled data in the buffer.
1603 * Even though the function is documented to take a pointer to an ULONG in
1604 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1605 * the first parameter is an ULONG.
1607 unsigned char * WINAPI WdtpInterfacePointer_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, IUnknown **ppunk, REFIID riid)
1609 FIXME("(%s, %p, %p, %s): stub\n", debugstr_user_flags(pFlags), pBuffer, ppunk, debugstr_guid(riid));
1613 /******************************************************************************
1614 * WdtpInterfacePointer_UserFree [OLE32.@]
1616 * Frees an unmarshaled interface pointer.
1619 * punk [I] Interface pointer to free.
1624 void WINAPI WdtpInterfacePointer_UserFree(IUnknown *punk)
1626 FIXME("(%p): stub\n", punk);
1629 /******************************************************************************
1630 * STGMEDIUM_UserSize [OLE32.@]
1632 * Calculates the buffer size required to marshal an STGMEDIUM.
1635 * pFlags [I] Flags. See notes.
1636 * StartingSize [I] Starting size of the buffer. This value is added on to
1637 * the buffer size required for the clip format.
1638 * pStgMedium [I] STGMEDIUM to size.
1641 * The buffer size required to marshal an STGMEDIUM plus the starting size.
1644 * Even though the function is documented to take a pointer to a ULONG in
1645 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1646 * the first parameter is a ULONG.
1647 * This function is only intended to be called by the RPC runtime.
1649 ULONG __RPC_USER STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, STGMEDIUM *pStgMedium)
1651 ULONG size = StartingSize;
1653 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, pStgMedium);
1655 ALIGN_LENGTH(size, 3);
1657 size += 2 * sizeof(DWORD);
1658 if (pStgMedium->tymed != TYMED_NULL)
1659 size += sizeof(DWORD);
1661 switch (pStgMedium->tymed)
1664 TRACE("TYMED_NULL\n");
1667 TRACE("TYMED_HGLOBAL\n");
1668 if (pStgMedium->u.hGlobal)
1669 size = HGLOBAL_UserSize(pFlags, size, &pStgMedium->u.hGlobal);
1672 TRACE("TYMED_FILE\n");
1673 if (pStgMedium->u.lpszFileName)
1675 TRACE("file name is %s\n", debugstr_w(pStgMedium->u.lpszFileName));
1676 size += 3 * sizeof(DWORD) +
1677 (strlenW(pStgMedium->u.lpszFileName) + 1) * sizeof(WCHAR);
1681 TRACE("TYMED_ISTREAM\n");
1682 if (pStgMedium->u.pstm)
1684 FIXME("not implemented for IStream %p\n", pStgMedium->u.pstm);
1687 case TYMED_ISTORAGE:
1688 TRACE("TYMED_ISTORAGE\n");
1689 if (pStgMedium->u.pstg)
1691 FIXME("not implemented for IStorage %p\n", pStgMedium->u.pstg);
1695 TRACE("TYMED_GDI\n");
1696 if (pStgMedium->u.hBitmap)
1698 FIXME("not implemented for GDI object %p\n", pStgMedium->u.hBitmap);
1702 TRACE("TYMED_MFPICT\n");
1703 if (pStgMedium->u.hMetaFilePict)
1704 size = HMETAFILEPICT_UserSize(pFlags, size, &pStgMedium->u.hMetaFilePict);
1707 TRACE("TYMED_ENHMF\n");
1708 if (pStgMedium->u.hEnhMetaFile)
1709 size = HENHMETAFILE_UserSize(pFlags, size, &pStgMedium->u.hEnhMetaFile);
1712 RaiseException(DV_E_TYMED, 0, 0, NULL);
1715 if (pStgMedium->pUnkForRelease)
1716 FIXME("buffer size pUnkForRelease\n");
1721 /******************************************************************************
1722 * STGMEDIUM_UserMarshal [OLE32.@]
1724 * Marshals a STGMEDIUM into a buffer.
1727 * pFlags [I] Flags. See notes.
1728 * pBuffer [I] Buffer to marshal the clip format into.
1729 * pCF [I] STGMEDIUM to marshal.
1732 * The end of the marshaled data in the buffer.
1735 * Even though the function is documented to take a pointer to a ULONG in
1736 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1737 * the first parameter is a ULONG.
1738 * This function is only intended to be called by the RPC runtime.
1740 unsigned char * __RPC_USER STGMEDIUM_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, STGMEDIUM *pStgMedium)
1742 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pStgMedium);
1744 ALIGN_POINTER(pBuffer, 3);
1746 *(DWORD *)pBuffer = pStgMedium->tymed;
1747 pBuffer += sizeof(DWORD);
1748 if (pStgMedium->tymed != TYMED_NULL)
1750 *(DWORD *)pBuffer = (DWORD)(DWORD_PTR)pStgMedium->u.pstg;
1751 pBuffer += sizeof(DWORD);
1753 *(DWORD *)pBuffer = (DWORD)(DWORD_PTR)pStgMedium->pUnkForRelease;
1754 pBuffer += sizeof(DWORD);
1756 switch (pStgMedium->tymed)
1759 TRACE("TYMED_NULL\n");
1762 TRACE("TYMED_HGLOBAL\n");
1763 if (pStgMedium->u.hGlobal)
1764 pBuffer = HGLOBAL_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hGlobal);
1767 TRACE("TYMED_FILE\n");
1768 if (pStgMedium->u.lpszFileName)
1771 len = strlenW(pStgMedium->u.lpszFileName);
1773 *(DWORD *)pBuffer = len + 1;
1774 pBuffer += sizeof(DWORD);
1776 *(DWORD *)pBuffer = 0;
1777 pBuffer += sizeof(DWORD);
1779 *(DWORD *)pBuffer = len + 1;
1780 pBuffer += sizeof(DWORD);
1782 TRACE("file name is %s\n", debugstr_w(pStgMedium->u.lpszFileName));
1783 memcpy(pBuffer, pStgMedium->u.lpszFileName, (len + 1) * sizeof(WCHAR));
1787 TRACE("TYMED_ISTREAM\n");
1788 if (pStgMedium->u.pstm)
1790 FIXME("not implemented for IStream %p\n", pStgMedium->u.pstm);
1793 case TYMED_ISTORAGE:
1794 TRACE("TYMED_ISTORAGE\n");
1795 if (pStgMedium->u.pstg)
1797 FIXME("not implemented for IStorage %p\n", pStgMedium->u.pstg);
1801 TRACE("TYMED_GDI\n");
1802 if (pStgMedium->u.hBitmap)
1804 FIXME("not implemented for GDI object %p\n", pStgMedium->u.hBitmap);
1808 TRACE("TYMED_MFPICT\n");
1809 if (pStgMedium->u.hMetaFilePict)
1810 pBuffer = HMETAFILEPICT_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hMetaFilePict);
1813 TRACE("TYMED_ENHMF\n");
1814 if (pStgMedium->u.hEnhMetaFile)
1815 pBuffer = HENHMETAFILE_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hEnhMetaFile);
1818 RaiseException(DV_E_TYMED, 0, 0, NULL);
1821 if (pStgMedium->pUnkForRelease)
1822 FIXME("marshal pUnkForRelease\n");
1827 /******************************************************************************
1828 * STGMEDIUM_UserUnmarshal [OLE32.@]
1830 * Unmarshals a STGMEDIUM from a buffer.
1833 * pFlags [I] Flags. See notes.
1834 * pBuffer [I] Buffer to marshal the clip format from.
1835 * pStgMedium [O] Address that receive the unmarshaled STGMEDIUM.
1838 * The end of the marshaled data in the buffer.
1841 * Even though the function is documented to take a pointer to an ULONG in
1842 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1843 * the first parameter is an ULONG.
1844 * This function is only intended to be called by the RPC runtime.
1846 unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, STGMEDIUM *pStgMedium)
1851 ALIGN_POINTER(pBuffer, 3);
1853 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pStgMedium);
1855 pStgMedium->tymed = *(DWORD *)pBuffer;
1856 pBuffer += sizeof(DWORD);
1857 if (pStgMedium->tymed != TYMED_NULL)
1859 content = *(DWORD *)pBuffer;
1860 pBuffer += sizeof(DWORD);
1862 releaseunk = *(DWORD *)pBuffer;
1863 pBuffer += sizeof(DWORD);
1865 switch (pStgMedium->tymed)
1868 TRACE("TYMED_NULL\n");
1871 TRACE("TYMED_HGLOBAL\n");
1873 pBuffer = HGLOBAL_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hGlobal);
1876 TRACE("TYMED_FILE\n");
1881 conformance = *(DWORD *)pBuffer;
1882 pBuffer += sizeof(DWORD);
1883 if (*(DWORD *)pBuffer != 0)
1885 ERR("invalid offset %d\n", *(DWORD *)pBuffer);
1886 RpcRaiseException(RPC_S_INVALID_BOUND);
1889 pBuffer += sizeof(DWORD);
1890 variance = *(DWORD *)pBuffer;
1891 pBuffer += sizeof(DWORD);
1892 if (conformance != variance)
1894 ERR("conformance (%d) and variance (%d) should be equal\n",
1895 conformance, variance);
1896 RpcRaiseException(RPC_S_INVALID_BOUND);
1899 if (conformance > 0x7fffffff)
1901 ERR("conformance 0x%x too large\n", conformance);
1902 RpcRaiseException(RPC_S_INVALID_BOUND);
1905 pStgMedium->u.lpszFileName = CoTaskMemAlloc(conformance * sizeof(WCHAR));
1906 if (!pStgMedium->u.lpszFileName) RpcRaiseException(ERROR_OUTOFMEMORY);
1907 TRACE("unmarshalled file name is %s\n", debugstr_wn((const WCHAR *)pBuffer, variance));
1908 memcpy(pStgMedium->u.lpszFileName, pBuffer, variance * sizeof(WCHAR));
1909 pBuffer += variance * sizeof(WCHAR);
1912 pStgMedium->u.lpszFileName = NULL;
1915 TRACE("TYMED_ISTREAM\n");
1918 FIXME("not implemented for IStream\n");
1921 pStgMedium->u.pstm = NULL;
1923 case TYMED_ISTORAGE:
1924 TRACE("TYMED_ISTORAGE\n");
1927 FIXME("not implemented for IStorage\n");
1930 pStgMedium->u.pstg = NULL;
1933 TRACE("TYMED_GDI\n");
1936 FIXME("not implemented for GDI object\n");
1939 pStgMedium->u.hBitmap = NULL;
1942 TRACE("TYMED_MFPICT\n");
1944 pBuffer = HMETAFILEPICT_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hMetaFilePict);
1946 pStgMedium->u.hMetaFilePict = NULL;
1949 TRACE("TYMED_ENHMF\n");
1951 pBuffer = HENHMETAFILE_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hEnhMetaFile);
1953 pStgMedium->u.hEnhMetaFile = NULL;
1956 RaiseException(DV_E_TYMED, 0, 0, NULL);
1959 pStgMedium->pUnkForRelease = NULL;
1961 FIXME("unmarshal pUnkForRelease\n");
1966 /******************************************************************************
1967 * STGMEDIUM_UserFree [OLE32.@]
1969 * Frees an unmarshaled STGMEDIUM.
1972 * pFlags [I] Flags. See notes.
1973 * pStgmedium [I] STGMEDIUM to free.
1976 * The end of the marshaled data in the buffer.
1979 * Even though the function is documented to take a pointer to a ULONG in
1980 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1981 * which the first parameter is a ULONG.
1982 * This function is only intended to be called by the RPC runtime.
1984 void __RPC_USER STGMEDIUM_UserFree(ULONG *pFlags, STGMEDIUM *pStgMedium)
1986 TRACE("(%s, %p\n", debugstr_user_flags(pFlags), pStgMedium);
1988 ReleaseStgMedium(pStgMedium);
1991 ULONG __RPC_USER ASYNC_STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, ASYNC_STGMEDIUM *pStgMedium)
1994 return STGMEDIUM_UserSize(pFlags, StartingSize, pStgMedium);
1997 unsigned char * __RPC_USER ASYNC_STGMEDIUM_UserMarshal( ULONG *pFlags, unsigned char *pBuffer, ASYNC_STGMEDIUM *pStgMedium)
2000 return STGMEDIUM_UserMarshal(pFlags, pBuffer, pStgMedium);
2003 unsigned char * __RPC_USER ASYNC_STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, ASYNC_STGMEDIUM *pStgMedium)
2006 return STGMEDIUM_UserUnmarshal(pFlags, pBuffer, pStgMedium);
2009 void __RPC_USER ASYNC_STGMEDIUM_UserFree(ULONG *pFlags, ASYNC_STGMEDIUM *pStgMedium)
2012 STGMEDIUM_UserFree(pFlags, pStgMedium);
2015 ULONG __RPC_USER FLAG_STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, FLAG_STGMEDIUM *pStgMedium)
2018 return StartingSize;
2021 unsigned char * __RPC_USER FLAG_STGMEDIUM_UserMarshal( ULONG *pFlags, unsigned char *pBuffer, FLAG_STGMEDIUM *pStgMedium)
2027 unsigned char * __RPC_USER FLAG_STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, FLAG_STGMEDIUM *pStgMedium)
2033 void __RPC_USER FLAG_STGMEDIUM_UserFree(ULONG *pFlags, FLAG_STGMEDIUM *pStgMedium)
2038 ULONG __RPC_USER SNB_UserSize(ULONG *pFlags, ULONG StartingSize, SNB *pSnb)
2041 return StartingSize;
2044 unsigned char * __RPC_USER SNB_UserMarshal( ULONG *pFlags, unsigned char *pBuffer, SNB *pSnb)
2050 unsigned char * __RPC_USER SNB_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, SNB *pSnb)
2056 void __RPC_USER SNB_UserFree(ULONG *pFlags, SNB *pSnb)
2061 /* call_as/local stubs for unknwn.idl */
2063 HRESULT CALLBACK IClassFactory_CreateInstance_Proxy(
2064 IClassFactory* This,
2065 IUnknown *pUnkOuter,
2069 TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject);
2073 ERR("aggregation is not allowed on remote objects\n");
2074 return CLASS_E_NOAGGREGATION;
2076 return IClassFactory_RemoteCreateInstance_Proxy(This, riid,
2077 (IUnknown **) ppvObject);
2080 HRESULT __RPC_STUB IClassFactory_CreateInstance_Stub(
2081 IClassFactory* This,
2083 IUnknown **ppvObject)
2085 TRACE("(%s, %p)\n", debugstr_guid(riid), ppvObject);
2086 return IClassFactory_CreateInstance(This, NULL, riid, (void **) ppvObject);
2089 HRESULT CALLBACK IClassFactory_LockServer_Proxy(
2090 IClassFactory* This,
2097 HRESULT __RPC_STUB IClassFactory_LockServer_Stub(
2098 IClassFactory* This,
2105 /* call_as/local stubs for objidl.idl */
2107 HRESULT CALLBACK IEnumUnknown_Next_Proxy(
2111 ULONG *pceltFetched)
2114 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2115 if (!pceltFetched) pceltFetched = &fetched;
2116 return IEnumUnknown_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2119 HRESULT __RPC_STUB IEnumUnknown_Next_Stub(
2123 ULONG *pceltFetched)
2126 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2128 hr = IEnumUnknown_Next(This, celt, rgelt, pceltFetched);
2129 if (hr == S_OK) *pceltFetched = celt;
2133 HRESULT CALLBACK IBindCtx_SetBindOptions_Proxy(
2135 BIND_OPTS *pbindopts)
2141 HRESULT __RPC_STUB IBindCtx_SetBindOptions_Stub(
2143 BIND_OPTS2 *pbindopts)
2149 HRESULT CALLBACK IBindCtx_GetBindOptions_Proxy(
2151 BIND_OPTS *pbindopts)
2157 HRESULT __RPC_STUB IBindCtx_GetBindOptions_Stub(
2159 BIND_OPTS2 *pbindopts)
2165 HRESULT CALLBACK IEnumMoniker_Next_Proxy(
2169 ULONG *pceltFetched)
2172 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2173 if (!pceltFetched) pceltFetched = &fetched;
2174 return IEnumMoniker_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2177 HRESULT __RPC_STUB IEnumMoniker_Next_Stub(
2181 ULONG *pceltFetched)
2184 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2186 hr = IEnumMoniker_Next(This, celt, rgelt, pceltFetched);
2187 if (hr == S_OK) *pceltFetched = celt;
2191 BOOL CALLBACK IRunnableObject_IsRunning_Proxy(
2192 IRunnableObject* This)
2196 memset(&rv, 0, sizeof rv);
2200 HRESULT __RPC_STUB IRunnableObject_IsRunning_Stub(
2201 IRunnableObject* This)
2207 HRESULT CALLBACK IMoniker_BindToObject_Proxy(
2210 IMoniker *pmkToLeft,
2218 HRESULT __RPC_STUB IMoniker_BindToObject_Stub(
2221 IMoniker *pmkToLeft,
2223 IUnknown **ppvResult)
2229 HRESULT CALLBACK IMoniker_BindToStorage_Proxy(
2232 IMoniker *pmkToLeft,
2240 HRESULT __RPC_STUB IMoniker_BindToStorage_Stub(
2243 IMoniker *pmkToLeft,
2251 HRESULT CALLBACK IEnumString_Next_Proxy(
2255 ULONG *pceltFetched)
2258 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2259 if (!pceltFetched) pceltFetched = &fetched;
2260 return IEnumString_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2263 HRESULT __RPC_STUB IEnumString_Next_Stub(
2267 ULONG *pceltFetched)
2270 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2272 hr = IEnumString_Next(This, celt, rgelt, pceltFetched);
2273 if (hr == S_OK) *pceltFetched = celt;
2277 HRESULT CALLBACK ISequentialStream_Read_Proxy(
2278 ISequentialStream* This,
2287 HRESULT __RPC_STUB ISequentialStream_Read_Stub(
2288 ISequentialStream* This,
2297 HRESULT CALLBACK ISequentialStream_Write_Proxy(
2298 ISequentialStream* This,
2307 HRESULT __RPC_STUB ISequentialStream_Write_Stub(
2308 ISequentialStream* This,
2317 HRESULT CALLBACK IStream_Seek_Proxy(
2319 LARGE_INTEGER dlibMove,
2321 ULARGE_INTEGER *plibNewPosition)
2327 HRESULT __RPC_STUB IStream_Seek_Stub(
2329 LARGE_INTEGER dlibMove,
2331 ULARGE_INTEGER *plibNewPosition)
2337 HRESULT CALLBACK IStream_CopyTo_Proxy(
2341 ULARGE_INTEGER *pcbRead,
2342 ULARGE_INTEGER *pcbWritten)
2348 HRESULT __RPC_STUB IStream_CopyTo_Stub(
2352 ULARGE_INTEGER *pcbRead,
2353 ULARGE_INTEGER *pcbWritten)
2359 HRESULT CALLBACK IEnumSTATSTG_Next_Proxy(
2363 ULONG *pceltFetched)
2366 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2367 if (!pceltFetched) pceltFetched = &fetched;
2368 return IEnumSTATSTG_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2371 HRESULT __RPC_STUB IEnumSTATSTG_Next_Stub(
2375 ULONG *pceltFetched)
2378 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2380 hr = IEnumSTATSTG_Next(This, celt, rgelt, pceltFetched);
2381 if (hr == S_OK) *pceltFetched = celt;
2385 HRESULT CALLBACK IStorage_OpenStream_Proxy(
2397 HRESULT __RPC_STUB IStorage_OpenStream_Stub(
2400 unsigned long cbReserved1,
2410 HRESULT CALLBACK IStorage_EnumElements_Proxy(
2415 IEnumSTATSTG **ppenum)
2421 HRESULT __RPC_STUB IStorage_EnumElements_Stub(
2424 unsigned long cbReserved2,
2427 IEnumSTATSTG **ppenum)
2433 HRESULT CALLBACK ILockBytes_ReadAt_Proxy(
2435 ULARGE_INTEGER ulOffset,
2444 HRESULT __RPC_STUB ILockBytes_ReadAt_Stub(
2446 ULARGE_INTEGER ulOffset,
2455 HRESULT CALLBACK ILockBytes_WriteAt_Proxy(
2457 ULARGE_INTEGER ulOffset,
2466 HRESULT __RPC_STUB ILockBytes_WriteAt_Stub(
2468 ULARGE_INTEGER ulOffset,
2477 HRESULT CALLBACK IFillLockBytes_FillAppend_Proxy(
2478 IFillLockBytes* This,
2487 HRESULT __RPC_STUB IFillLockBytes_FillAppend_Stub(
2488 IFillLockBytes* This,
2497 HRESULT CALLBACK IFillLockBytes_FillAt_Proxy(
2498 IFillLockBytes* This,
2499 ULARGE_INTEGER ulOffset,
2508 HRESULT __RPC_STUB IFillLockBytes_FillAt_Stub(
2509 IFillLockBytes* This,
2510 ULARGE_INTEGER ulOffset,
2519 HRESULT CALLBACK IEnumFORMATETC_Next_Proxy(
2520 IEnumFORMATETC* This,
2523 ULONG *pceltFetched)
2526 if (!pceltFetched) pceltFetched = &fetched;
2527 return IEnumFORMATETC_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2530 HRESULT __RPC_STUB IEnumFORMATETC_Next_Stub(
2531 IEnumFORMATETC* This,
2534 ULONG *pceltFetched)
2538 hr = IEnumFORMATETC_Next(This, celt, rgelt, pceltFetched);
2539 if (hr == S_OK) *pceltFetched = celt;
2543 HRESULT CALLBACK IEnumSTATDATA_Next_Proxy(
2544 IEnumSTATDATA* This,
2547 ULONG *pceltFetched)
2550 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2551 if (!pceltFetched) pceltFetched = &fetched;
2552 return IEnumSTATDATA_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2555 HRESULT __RPC_STUB IEnumSTATDATA_Next_Stub(
2556 IEnumSTATDATA* This,
2559 ULONG *pceltFetched)
2562 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2564 hr = IEnumSTATDATA_Next(This, celt, rgelt, pceltFetched);
2565 if (hr == S_OK) *pceltFetched = celt;
2569 void CALLBACK IAdviseSink_OnDataChange_Proxy(
2571 FORMATETC *pFormatetc,
2577 HRESULT __RPC_STUB IAdviseSink_OnDataChange_Stub(
2579 FORMATETC *pFormatetc,
2580 ASYNC_STGMEDIUM *pStgmed)
2586 void CALLBACK IAdviseSink_OnViewChange_Proxy(
2594 HRESULT __RPC_STUB IAdviseSink_OnViewChange_Stub(
2603 void CALLBACK IAdviseSink_OnRename_Proxy(
2610 HRESULT __RPC_STUB IAdviseSink_OnRename_Stub(
2618 void CALLBACK IAdviseSink_OnSave_Proxy(
2624 HRESULT __RPC_STUB IAdviseSink_OnSave_Stub(
2631 void CALLBACK IAdviseSink_OnClose_Proxy(
2637 HRESULT __RPC_STUB IAdviseSink_OnClose_Stub(
2644 void CALLBACK IAdviseSink2_OnLinkSrcChange_Proxy(
2651 HRESULT __RPC_STUB IAdviseSink2_OnLinkSrcChange_Stub(
2659 HRESULT CALLBACK IDataObject_GetData_Proxy(
2661 FORMATETC *pformatetcIn,
2668 HRESULT __RPC_STUB IDataObject_GetData_Stub(
2670 FORMATETC *pformatetcIn,
2671 STGMEDIUM *pRemoteMedium)
2677 HRESULT CALLBACK IDataObject_GetDataHere_Proxy(
2679 FORMATETC *pformatetc,
2686 HRESULT __RPC_STUB IDataObject_GetDataHere_Stub(
2688 FORMATETC *pformatetc,
2689 STGMEDIUM *pRemoteMedium)
2695 HRESULT CALLBACK IDataObject_SetData_Proxy(
2697 FORMATETC *pformatetc,
2705 HRESULT __RPC_STUB IDataObject_SetData_Stub(
2707 FORMATETC *pformatetc,
2708 FLAG_STGMEDIUM *pmedium,
2715 /* call_as/local stubs for oleidl.idl */
2717 HRESULT CALLBACK IOleInPlaceActiveObject_TranslateAccelerator_Proxy(
2718 IOleInPlaceActiveObject* This,
2725 HRESULT __RPC_STUB IOleInPlaceActiveObject_TranslateAccelerator_Stub(
2726 IOleInPlaceActiveObject* This)
2732 HRESULT CALLBACK IOleInPlaceActiveObject_ResizeBorder_Proxy(
2733 IOleInPlaceActiveObject* This,
2735 IOleInPlaceUIWindow *pUIWindow,
2742 HRESULT __RPC_STUB IOleInPlaceActiveObject_ResizeBorder_Stub(
2743 IOleInPlaceActiveObject* This,
2746 IOleInPlaceUIWindow *pUIWindow,
2753 HRESULT CALLBACK IOleCache2_UpdateCache_Proxy(
2755 LPDATAOBJECT pDataObject,
2763 HRESULT __RPC_STUB IOleCache2_UpdateCache_Stub(
2765 LPDATAOBJECT pDataObject,
2773 HRESULT CALLBACK IEnumOLEVERB_Next_Proxy(
2777 ULONG *pceltFetched)
2780 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2781 if (!pceltFetched) pceltFetched = &fetched;
2782 return IEnumOLEVERB_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2785 HRESULT __RPC_STUB IEnumOLEVERB_Next_Stub(
2789 ULONG *pceltFetched)
2792 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2794 hr = IEnumOLEVERB_Next(This, celt, rgelt, pceltFetched);
2795 if (hr == S_OK) *pceltFetched = celt;
2799 HRESULT CALLBACK IViewObject_Draw_Proxy(
2804 DVTARGETDEVICE *ptd,
2807 LPCRECTL lprcBounds,
2808 LPCRECTL lprcWBounds,
2809 BOOL (STDMETHODCALLTYPE *pfnContinue)(ULONG_PTR dwContinue),
2810 ULONG_PTR dwContinue)
2816 HRESULT __RPC_STUB IViewObject_Draw_Stub(
2821 DVTARGETDEVICE *ptd,
2822 ULONG_PTR hdcTargetDev,
2824 LPCRECTL lprcBounds,
2825 LPCRECTL lprcWBounds,
2826 IContinue *pContinue)
2832 HRESULT CALLBACK IViewObject_GetColorSet_Proxy(
2837 DVTARGETDEVICE *ptd,
2839 LOGPALETTE **ppColorSet)
2845 HRESULT __RPC_STUB IViewObject_GetColorSet_Stub(
2850 DVTARGETDEVICE *ptd,
2851 ULONG_PTR hicTargetDev,
2852 LOGPALETTE **ppColorSet)
2858 HRESULT CALLBACK IViewObject_Freeze_Proxy(
2869 HRESULT __RPC_STUB IViewObject_Freeze_Stub(
2880 HRESULT CALLBACK IViewObject_GetAdvise_Proxy(
2884 IAdviseSink **ppAdvSink)
2890 HRESULT __RPC_STUB IViewObject_GetAdvise_Stub(
2894 IAdviseSink **ppAdvSink)