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
38 #include "wine/unicode.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(ole
);
43 #define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
44 #define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
45 #define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
46 #define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
48 #define USER_MARSHAL_PTR_PREFIX \
49 ( (DWORD)'U' | ( (DWORD)'s' << 8 ) | \
50 ( (DWORD)'e' << 16 ) | ( (DWORD)'r' << 24 ) )
52 static const char* debugstr_user_flags(ULONG
*pFlags
)
56 switch (LOWORD(*pFlags
))
59 loword
="MSHCTX_LOCAL";
61 case MSHCTX_NOSHAREDMEM
:
62 loword
="MSHCTX_NOSHAREDMEM";
64 case MSHCTX_DIFFERENTMACHINE
:
65 loword
="MSHCTX_DIFFERENTMACHINE";
68 loword
="MSHCTX_INPROC";
71 sprintf(buf
, "%d", LOWORD(*pFlags
));
75 if (HIWORD(*pFlags
) == NDR_LOCAL_DATA_REPRESENTATION
)
76 return wine_dbg_sprintf("MAKELONG(%s, NDR_LOCAL_DATA_REPRESENTATION)", loword
);
78 return wine_dbg_sprintf("MAKELONG(%s, 0x%04x)", loword
, HIWORD(*pFlags
));
81 /******************************************************************************
82 * CLIPFORMAT_UserSize [OLE32.@]
84 * Calculates the buffer size required to marshal a clip format.
87 * pFlags [I] Flags. See notes.
88 * StartingSize [I] Starting size of the buffer. This value is added on to
89 * the buffer size required for the clip format.
90 * pCF [I] Clip format to size.
93 * The buffer size required to marshal a clip format plus the starting size.
96 * Even though the function is documented to take a pointer to an unsigned
97 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
98 * the first parameter is an unsigned long.
99 * This function is only intended to be called by the RPC runtime.
101 ULONG __RPC_USER
CLIPFORMAT_UserSize(ULONG
*pFlags
, ULONG size
, CLIPFORMAT
*pCF
)
103 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags
), size
, pCF
);
105 ALIGN_LENGTH(size
, 3);
109 /* only need to marshal the name if it is not a pre-defined type and
110 * we are going remote */
111 if ((*pCF
>= 0xc000) && (LOWORD(*pFlags
) == MSHCTX_DIFFERENTMACHINE
))
115 size
+= 3 * sizeof(UINT
);
116 /* urg! this function is badly designed because it won't tell us how
117 * much space is needed without doing a dummy run of storing the
118 * name into a buffer */
119 ret
= GetClipboardFormatNameW(*pCF
, format
, ARRAY_SIZE(format
)-1);
121 RaiseException(DV_E_CLIPFORMAT
, 0, 0, NULL
);
122 size
+= (ret
+ 1) * sizeof(WCHAR
);
127 /******************************************************************************
128 * CLIPFORMAT_UserMarshal [OLE32.@]
130 * Marshals a clip format into a buffer.
133 * pFlags [I] Flags. See notes.
134 * pBuffer [I] Buffer to marshal the clip format into.
135 * pCF [I] Clip format to marshal.
138 * The end of the marshaled data in the buffer.
141 * Even though the function is documented to take a pointer to an unsigned
142 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
143 * the first parameter is an unsigned long.
144 * This function is only intended to be called by the RPC runtime.
146 unsigned char * __RPC_USER
CLIPFORMAT_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, CLIPFORMAT
*pCF
)
148 TRACE("(%s, %p, &0x%04x\n", debugstr_user_flags(pFlags
), pBuffer
, *pCF
);
150 ALIGN_POINTER(pBuffer
, 3);
152 /* only need to marshal the name if it is not a pre-defined type and
153 * we are going remote */
154 if ((*pCF
>= 0xc000) && (LOWORD(*pFlags
) == MSHCTX_DIFFERENTMACHINE
))
159 *(DWORD
*)pBuffer
= WDT_REMOTE_CALL
;
161 *(DWORD
*)pBuffer
= *pCF
;
164 len
= GetClipboardFormatNameW(*pCF
, format
, ARRAY_SIZE(format
)-1);
166 RaiseException(DV_E_CLIPFORMAT
, 0, 0, NULL
);
168 *(UINT
*)pBuffer
= len
;
169 pBuffer
+= sizeof(UINT
);
170 *(UINT
*)pBuffer
= 0;
171 pBuffer
+= sizeof(UINT
);
172 *(UINT
*)pBuffer
= len
;
173 pBuffer
+= sizeof(UINT
);
174 TRACE("marshaling format name %s\n", debugstr_w(format
));
175 memcpy(pBuffer
, format
, len
* sizeof(WCHAR
));
176 pBuffer
+= len
* sizeof(WCHAR
);
180 *(DWORD
*)pBuffer
= WDT_INPROC_CALL
;
182 *(DWORD
*)pBuffer
= *pCF
;
189 /******************************************************************************
190 * CLIPFORMAT_UserUnmarshal [OLE32.@]
192 * Unmarshals a clip format from a buffer.
195 * pFlags [I] Flags. See notes.
196 * pBuffer [I] Buffer to marshal the clip format from.
197 * pCF [O] Address that receive the unmarshaled clip format.
200 * The end of the marshaled data in the buffer.
203 * Even though the function is documented to take a pointer to an unsigned
204 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
205 * the first parameter is an unsigned long.
206 * This function is only intended to be called by the RPC runtime.
208 unsigned char * __RPC_USER
CLIPFORMAT_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, CLIPFORMAT
*pCF
)
212 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags
), pBuffer
, pCF
);
214 ALIGN_POINTER(pBuffer
, 3);
216 fContext
= *(DWORD
*)pBuffer
;
219 if (fContext
== WDT_INPROC_CALL
)
221 *pCF
= *(CLIPFORMAT
*)pBuffer
;
224 else if (fContext
== WDT_REMOTE_CALL
)
229 /* pointer ID for registered clip format string */
230 if (*(DWORD
*)pBuffer
== 0)
231 RaiseException(RPC_S_INVALID_BOUND
, 0, 0, NULL
);
234 len
= *(UINT
*)pBuffer
;
235 pBuffer
+= sizeof(UINT
);
236 if (*(UINT
*)pBuffer
!= 0)
237 RaiseException(RPC_S_INVALID_BOUND
, 0, 0, NULL
);
238 pBuffer
+= sizeof(UINT
);
239 if (*(UINT
*)pBuffer
!= len
)
240 RaiseException(RPC_S_INVALID_BOUND
, 0, 0, NULL
);
241 pBuffer
+= sizeof(UINT
);
242 if (((WCHAR
*)pBuffer
)[len
- 1] != '\0')
243 RaiseException(RPC_S_INVALID_BOUND
, 0, 0, NULL
);
244 TRACE("unmarshaling clip format %s\n", debugstr_w((LPCWSTR
)pBuffer
));
245 cf
= RegisterClipboardFormatW((LPCWSTR
)pBuffer
);
246 pBuffer
+= len
* sizeof(WCHAR
);
248 RaiseException(DV_E_CLIPFORMAT
, 0, 0, NULL
);
252 /* code not really appropriate, but nearest I can find */
253 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
257 /******************************************************************************
258 * CLIPFORMAT_UserFree [OLE32.@]
260 * Frees an unmarshaled clip format.
263 * pFlags [I] Flags. See notes.
264 * pCF [I] Clip format to free.
267 * The end of the marshaled data in the buffer.
270 * Even though the function is documented to take a pointer to an unsigned
271 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB
272 * structure, of which the first parameter is an unsigned long.
273 * This function is only intended to be called by the RPC runtime.
275 void __RPC_USER
CLIPFORMAT_UserFree(ULONG
*pFlags
, CLIPFORMAT
*pCF
)
277 /* there is no inverse of the RegisterClipboardFormat function,
278 * so nothing to do */
281 static ULONG
handle_UserSize(ULONG
*pFlags
, ULONG StartingSize
, HANDLE
*handle
)
283 if (LOWORD(*pFlags
) == MSHCTX_DIFFERENTMACHINE
)
285 ERR("can't remote a local handle\n");
286 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
290 ALIGN_LENGTH(StartingSize
, 3);
291 return StartingSize
+ sizeof(RemotableHandle
);
294 static unsigned char * handle_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HANDLE
*handle
)
296 RemotableHandle
*remhandle
;
297 if (LOWORD(*pFlags
) == MSHCTX_DIFFERENTMACHINE
)
299 ERR("can't remote a local handle\n");
300 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
304 ALIGN_POINTER(pBuffer
, 3);
305 remhandle
= (RemotableHandle
*)pBuffer
;
306 remhandle
->fContext
= WDT_INPROC_CALL
;
307 remhandle
->u
.hInproc
= (LONG_PTR
)*handle
;
308 return pBuffer
+ sizeof(RemotableHandle
);
311 static unsigned char * handle_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HANDLE
*handle
)
313 RemotableHandle
*remhandle
;
315 ALIGN_POINTER(pBuffer
, 3);
316 remhandle
= (RemotableHandle
*)pBuffer
;
317 if (remhandle
->fContext
!= WDT_INPROC_CALL
)
318 RaiseException(RPC_X_BAD_STUB_DATA
, 0, 0, NULL
);
319 *handle
= (HANDLE
)(LONG_PTR
)remhandle
->u
.hInproc
;
320 return pBuffer
+ sizeof(RemotableHandle
);
323 static void handle_UserFree(ULONG
*pFlags
, HANDLE
*handle
)
328 #define IMPL_WIREM_HANDLE(type) \
329 ULONG __RPC_USER type##_UserSize(ULONG *pFlags, ULONG StartingSize, type *handle) \
331 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, handle); \
332 return handle_UserSize(pFlags, StartingSize, (HANDLE *)handle); \
335 unsigned char * __RPC_USER type##_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
337 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *handle); \
338 return handle_UserMarshal(pFlags, pBuffer, (HANDLE *)handle); \
341 unsigned char * __RPC_USER type##_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
343 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, handle); \
344 return handle_UserUnmarshal(pFlags, pBuffer, (HANDLE *)handle); \
347 void __RPC_USER type##_UserFree(ULONG *pFlags, type *handle) \
349 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *handle); \
350 handle_UserFree(pFlags, (HANDLE *)handle); \
353 IMPL_WIREM_HANDLE(HACCEL
)
354 IMPL_WIREM_HANDLE(HMENU
)
355 IMPL_WIREM_HANDLE(HWND
)
356 IMPL_WIREM_HANDLE(HDC
)
357 IMPL_WIREM_HANDLE(HICON
)
358 IMPL_WIREM_HANDLE(HBRUSH
)
360 /******************************************************************************
361 * HGLOBAL_UserSize [OLE32.@]
363 * Calculates the buffer size required to marshal an HGLOBAL.
366 * pFlags [I] Flags. See notes.
367 * StartingSize [I] Starting size of the buffer. This value is added on to
368 * the buffer size required for the clip format.
369 * phGlobal [I] HGLOBAL to size.
372 * The buffer size required to marshal an HGLOBAL plus the starting size.
375 * Even though the function is documented to take a pointer to a ULONG in
376 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
377 * the first parameter is a ULONG.
378 * This function is only intended to be called by the RPC runtime.
380 ULONG __RPC_USER
HGLOBAL_UserSize(ULONG
*pFlags
, ULONG StartingSize
, HGLOBAL
*phGlobal
)
382 ULONG size
= StartingSize
;
384 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags
), StartingSize
, phGlobal
);
386 ALIGN_LENGTH(size
, 3);
388 size
+= sizeof(ULONG
);
390 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
391 size
+= sizeof(HGLOBAL
);
394 size
+= sizeof(ULONG
);
398 size
+= 3 * sizeof(ULONG
);
399 ret
= GlobalSize(*phGlobal
);
407 /******************************************************************************
408 * HGLOBAL_UserMarshal [OLE32.@]
410 * Marshals an HGLOBAL into a buffer.
413 * pFlags [I] Flags. See notes.
414 * pBuffer [I] Buffer to marshal the clip format into.
415 * phGlobal [I] HGLOBAL to marshal.
418 * The end of the marshaled data in the buffer.
421 * Even though the function is documented to take a pointer to a ULONG in
422 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
423 * the first parameter is a ULONG.
424 * This function is only intended to be called by the RPC runtime.
426 unsigned char * __RPC_USER
HGLOBAL_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HGLOBAL
*phGlobal
)
428 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags
), pBuffer
, *phGlobal
);
430 ALIGN_POINTER(pBuffer
, 3);
432 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
434 if (sizeof(*phGlobal
) == 8)
435 *(ULONG
*)pBuffer
= WDT_INPROC64_CALL
;
437 *(ULONG
*)pBuffer
= WDT_INPROC_CALL
;
438 pBuffer
+= sizeof(ULONG
);
439 *(HGLOBAL
*)pBuffer
= *phGlobal
;
440 pBuffer
+= sizeof(HGLOBAL
);
444 *(ULONG
*)pBuffer
= WDT_REMOTE_CALL
;
445 pBuffer
+= sizeof(ULONG
);
446 *(ULONG
*)pBuffer
= HandleToULong(*phGlobal
);
447 pBuffer
+= sizeof(ULONG
);
450 const unsigned char *memory
;
451 SIZE_T size
= GlobalSize(*phGlobal
);
452 *(ULONG
*)pBuffer
= (ULONG
)size
;
453 pBuffer
+= sizeof(ULONG
);
454 *(ULONG
*)pBuffer
= HandleToULong(*phGlobal
);
455 pBuffer
+= sizeof(ULONG
);
456 *(ULONG
*)pBuffer
= (ULONG
)size
;
457 pBuffer
+= sizeof(ULONG
);
459 memory
= GlobalLock(*phGlobal
);
460 memcpy(pBuffer
, memory
, size
);
462 GlobalUnlock(*phGlobal
);
469 /******************************************************************************
470 * HGLOBAL_UserUnmarshal [OLE32.@]
472 * Unmarshals an HGLOBAL from a buffer.
475 * pFlags [I] Flags. See notes.
476 * pBuffer [I] Buffer to marshal the clip format from.
477 * phGlobal [O] Address that receive the unmarshaled HGLOBAL.
480 * The end of the marshaled data in the buffer.
483 * Even though the function is documented to take a pointer to an ULONG in
484 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
485 * the first parameter is an ULONG.
486 * This function is only intended to be called by the RPC runtime.
488 unsigned char * __RPC_USER
HGLOBAL_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HGLOBAL
*phGlobal
)
492 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags
), pBuffer
, *phGlobal
);
494 ALIGN_POINTER(pBuffer
, 3);
496 fContext
= *(ULONG
*)pBuffer
;
497 pBuffer
+= sizeof(ULONG
);
499 if (((fContext
== WDT_INPROC_CALL
) && (sizeof(*phGlobal
) < 8)) ||
500 ((fContext
== WDT_INPROC64_CALL
) && (sizeof(*phGlobal
) == 8)))
502 *phGlobal
= *(HGLOBAL
*)pBuffer
;
503 pBuffer
+= sizeof(*phGlobal
);
505 else if (fContext
== WDT_REMOTE_CALL
)
509 handle
= *(ULONG
*)pBuffer
;
510 pBuffer
+= sizeof(ULONG
);
517 size
= *(ULONG
*)pBuffer
;
518 pBuffer
+= sizeof(ULONG
);
519 /* redundancy is bad - it means you have to check consistency like
521 if (*(ULONG
*)pBuffer
!= handle
)
523 RaiseException(RPC_X_BAD_STUB_DATA
, 0, 0, NULL
);
526 pBuffer
+= sizeof(ULONG
);
527 /* redundancy is bad - it means you have to check consistency like
529 if (*(ULONG
*)pBuffer
!= size
)
531 RaiseException(RPC_X_BAD_STUB_DATA
, 0, 0, NULL
);
534 pBuffer
+= sizeof(ULONG
);
536 /* FIXME: check size is not too big */
538 *phGlobal
= GlobalAlloc(GMEM_MOVEABLE
, size
);
539 memory
= GlobalLock(*phGlobal
);
540 memcpy(memory
, pBuffer
, size
);
542 GlobalUnlock(*phGlobal
);
548 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
553 /******************************************************************************
554 * HGLOBAL_UserFree [OLE32.@]
556 * Frees an unmarshaled HGLOBAL.
559 * pFlags [I] Flags. See notes.
560 * phGlobal [I] HGLOBAL to free.
563 * The end of the marshaled data in the buffer.
566 * Even though the function is documented to take a pointer to a ULONG in
567 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
568 * which the first parameter is a ULONG.
569 * This function is only intended to be called by the RPC runtime.
571 void __RPC_USER
HGLOBAL_UserFree(ULONG
*pFlags
, HGLOBAL
*phGlobal
)
573 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags
), *phGlobal
);
575 if (LOWORD(*pFlags
) != MSHCTX_INPROC
&& *phGlobal
)
576 GlobalFree(*phGlobal
);
579 /******************************************************************************
580 * HBITMAP_UserSize [OLE32.@]
582 * Calculates the buffer size required to marshal a bitmap.
585 * pFlags [I] Flags. See notes.
586 * StartingSize [I] Starting size of the buffer. This value is added on to
587 * the buffer size required for the clip format.
588 * phBmp [I] Bitmap to size.
591 * The buffer size required to marshal an bitmap plus the starting size.
594 * Even though the function is documented to take a pointer to a ULONG in
595 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
596 * the first parameter is a ULONG.
597 * This function is only intended to be called by the RPC runtime.
599 ULONG __RPC_USER
HBITMAP_UserSize(ULONG
*flags
, ULONG size
, HBITMAP
*bmp
)
601 TRACE("(%s, %d, %p)\n", debugstr_user_flags(flags
), size
, *bmp
);
603 ALIGN_LENGTH(size
, 3);
605 size
+= sizeof(ULONG
);
606 if (LOWORD(*flags
) == MSHCTX_INPROC
)
607 size
+= sizeof(ULONG
);
610 size
+= sizeof(ULONG
);
614 size
+= sizeof(ULONG
);
615 size
+= FIELD_OFFSET(userBITMAP
, cbSize
);
616 size
+= GetBitmapBits(*bmp
, 0, NULL
);
623 /******************************************************************************
624 * HBITMAP_UserMarshal [OLE32.@]
626 * Marshals a bitmap into a buffer.
629 * pFlags [I] Flags. See notes.
630 * pBuffer [I] Buffer to marshal the clip format into.
631 * phBmp [I] Bitmap to marshal.
634 * The end of the marshaled data in the buffer.
637 * Even though the function is documented to take a pointer to a ULONG in
638 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
639 * the first parameter is a ULONG.
640 * This function is only intended to be called by the RPC runtime.
642 unsigned char * __RPC_USER
HBITMAP_UserMarshal(ULONG
*flags
, unsigned char *buffer
, HBITMAP
*bmp
)
644 TRACE("(%s, %p, %p)\n", debugstr_user_flags(flags
), buffer
, *bmp
);
646 ALIGN_POINTER(buffer
, 3);
648 if (LOWORD(*flags
) == MSHCTX_INPROC
)
650 *(ULONG
*)buffer
= WDT_INPROC_CALL
;
651 buffer
+= sizeof(ULONG
);
652 *(ULONG
*)buffer
= (ULONG
)(ULONG_PTR
)*bmp
;
653 buffer
+= sizeof(ULONG
);
657 *(ULONG
*)buffer
= WDT_REMOTE_CALL
;
658 buffer
+= sizeof(ULONG
);
659 *(ULONG
*)buffer
= (ULONG
)(ULONG_PTR
)*bmp
;
660 buffer
+= sizeof(ULONG
);
664 static const ULONG header_size
= FIELD_OFFSET(userBITMAP
, cbSize
);
668 bitmap_size
= GetBitmapBits(*bmp
, 0, NULL
);
669 *(ULONG
*)buffer
= bitmap_size
;
670 buffer
+= sizeof(ULONG
);
672 GetObjectW(*bmp
, sizeof(BITMAP
), &bitmap
);
673 memcpy(buffer
, &bitmap
, header_size
);
674 buffer
+= header_size
;
676 GetBitmapBits(*bmp
, bitmap_size
, buffer
);
677 buffer
+= bitmap_size
;
683 /******************************************************************************
684 * HBITMAP_UserUnmarshal [OLE32.@]
686 * Unmarshals a bitmap from a buffer.
689 * pFlags [I] Flags. See notes.
690 * pBuffer [I] Buffer to marshal the clip format from.
691 * phBmp [O] Address that receive the unmarshaled bitmap.
694 * The end of the marshaled data in the buffer.
697 * Even though the function is documented to take a pointer to an ULONG in
698 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
699 * the first parameter is an ULONG.
700 * This function is only intended to be called by the RPC runtime.
702 unsigned char * __RPC_USER
HBITMAP_UserUnmarshal(ULONG
*flags
, unsigned char *buffer
, HBITMAP
*bmp
)
706 TRACE("(%s, %p, %p)\n", debugstr_user_flags(flags
), buffer
, bmp
);
708 ALIGN_POINTER(buffer
, 3);
710 context
= *(ULONG
*)buffer
;
711 buffer
+= sizeof(ULONG
);
713 if (context
== WDT_INPROC_CALL
)
715 *bmp
= *(HBITMAP
*)buffer
;
716 buffer
+= sizeof(*bmp
);
718 else if (context
== WDT_REMOTE_CALL
)
720 ULONG handle
= *(ULONG
*)buffer
;
721 buffer
+= sizeof(ULONG
);
725 static const ULONG header_size
= FIELD_OFFSET(userBITMAP
, cbSize
);
730 bitmap_size
= *(ULONG
*)buffer
;
731 buffer
+= sizeof(ULONG
);
732 bits
= HeapAlloc(GetProcessHeap(), 0, bitmap_size
);
734 memcpy(&bitmap
, buffer
, header_size
);
735 buffer
+= header_size
;
737 memcpy(bits
, buffer
, bitmap_size
);
738 buffer
+= bitmap_size
;
740 bitmap
.bmBits
= bits
;
741 *bmp
= CreateBitmapIndirect(&bitmap
);
743 HeapFree(GetProcessHeap(), 0, bits
);
749 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
754 /******************************************************************************
755 * HBITMAP_UserFree [OLE32.@]
757 * Frees an unmarshaled bitmap.
760 * pFlags [I] Flags. See notes.
761 * phBmp [I] Bitmap to free.
764 * The end of the marshaled data in the buffer.
767 * Even though the function is documented to take a pointer to a ULONG in
768 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
769 * which the first parameter is a ULONG.
770 * This function is only intended to be called by the RPC runtime.
772 void __RPC_USER
HBITMAP_UserFree(ULONG
*flags
, HBITMAP
*bmp
)
774 TRACE("(%s, %p)\n", debugstr_user_flags(flags
), *bmp
);
776 if (LOWORD(*flags
) != MSHCTX_INPROC
)
780 /******************************************************************************
781 * HPALETTE_UserSize [OLE32.@]
783 * Calculates the buffer size required to marshal a palette.
786 * pFlags [I] Flags. See notes.
787 * StartingSize [I] Starting size of the buffer. This value is added on to
788 * the buffer size required for the clip format.
789 * phPal [I] Palette to size.
792 * The buffer size required to marshal a palette plus the starting size.
795 * Even though the function is documented to take a pointer to a ULONG in
796 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
797 * the first parameter is a ULONG.
798 * This function is only intended to be called by the RPC runtime.
800 ULONG __RPC_USER
HPALETTE_UserSize(ULONG
*pFlags
, ULONG StartingSize
, HPALETTE
*phPal
)
806 /******************************************************************************
807 * HPALETTE_UserMarshal [OLE32.@]
809 * Marshals a palette into a buffer.
812 * pFlags [I] Flags. See notes.
813 * pBuffer [I] Buffer to marshal the clip format into.
814 * phPal [I] Palette to marshal.
817 * The end of the marshaled data in the buffer.
820 * Even though the function is documented to take a pointer to a ULONG in
821 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
822 * the first parameter is a ULONG.
823 * This function is only intended to be called by the RPC runtime.
825 unsigned char * __RPC_USER
HPALETTE_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HPALETTE
*phPal
)
831 /******************************************************************************
832 * HPALETTE_UserUnmarshal [OLE32.@]
834 * Unmarshals a palette from a buffer.
837 * pFlags [I] Flags. See notes.
838 * pBuffer [I] Buffer to marshal the clip format from.
839 * phPal [O] Address that receive the unmarshaled palette.
842 * The end of the marshaled data in the buffer.
845 * Even though the function is documented to take a pointer to an ULONG in
846 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
847 * the first parameter is an ULONG.
848 * This function is only intended to be called by the RPC runtime.
850 unsigned char * __RPC_USER
HPALETTE_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HPALETTE
*phPal
)
856 /******************************************************************************
857 * HPALETTE_UserFree [OLE32.@]
859 * Frees an unmarshaled palette.
862 * pFlags [I] Flags. See notes.
863 * phPal [I] Palette to free.
866 * The end of the marshaled data in the buffer.
869 * Even though the function is documented to take a pointer to a ULONG in
870 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
871 * which the first parameter is a ULONG.
872 * This function is only intended to be called by the RPC runtime.
874 void __RPC_USER
HPALETTE_UserFree(ULONG
*pFlags
, HPALETTE
*phPal
)
880 /******************************************************************************
881 * HMETAFILE_UserSize [OLE32.@]
883 * Calculates the buffer size required to marshal a metafile.
886 * pFlags [I] Flags. See notes.
887 * StartingSize [I] Starting size of the buffer. This value is added on to
888 * the buffer size required for the clip format.
889 * phmf [I] Metafile to size.
892 * The buffer size required to marshal a metafile plus the starting size.
895 * Even though the function is documented to take a pointer to a ULONG in
896 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
897 * the first parameter is a ULONG.
898 * This function is only intended to be called by the RPC runtime.
900 ULONG __RPC_USER
HMETAFILE_UserSize(ULONG
*pFlags
, ULONG StartingSize
, HMETAFILE
*phmf
)
902 ULONG size
= StartingSize
;
904 TRACE("(%s, %d, &%p\n", debugstr_user_flags(pFlags
), StartingSize
, *phmf
);
906 ALIGN_LENGTH(size
, 3);
908 size
+= sizeof(ULONG
);
909 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
910 size
+= sizeof(ULONG_PTR
);
913 size
+= sizeof(ULONG
);
919 size
+= 2 * sizeof(ULONG
);
920 mfsize
= GetMetaFileBitsEx(*phmf
, 0, NULL
);
928 /******************************************************************************
929 * HMETAFILE_UserMarshal [OLE32.@]
931 * Marshals a metafile into a buffer.
934 * pFlags [I] Flags. See notes.
935 * pBuffer [I] Buffer to marshal the clip format into.
936 * phEmf [I] Metafile to marshal.
939 * The end of the marshaled data in the buffer.
942 * Even though the function is documented to take a pointer to a ULONG in
943 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
944 * the first parameter is a ULONG.
945 * This function is only intended to be called by the RPC runtime.
947 unsigned char * __RPC_USER
HMETAFILE_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HMETAFILE
*phmf
)
949 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags
), pBuffer
, *phmf
);
951 ALIGN_POINTER(pBuffer
, 3);
953 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
955 if (sizeof(*phmf
) == 8)
956 *(ULONG
*)pBuffer
= WDT_INPROC64_CALL
;
958 *(ULONG
*)pBuffer
= WDT_INPROC_CALL
;
959 pBuffer
+= sizeof(ULONG
);
960 *(HMETAFILE
*)pBuffer
= *phmf
;
961 pBuffer
+= sizeof(HMETAFILE
);
965 *(ULONG
*)pBuffer
= WDT_REMOTE_CALL
;
966 pBuffer
+= sizeof(ULONG
);
967 *(ULONG
*)pBuffer
= (ULONG
)(ULONG_PTR
)*phmf
;
968 pBuffer
+= sizeof(ULONG
);
972 UINT mfsize
= GetMetaFileBitsEx(*phmf
, 0, NULL
);
974 *(ULONG
*)pBuffer
= mfsize
;
975 pBuffer
+= sizeof(ULONG
);
976 *(ULONG
*)pBuffer
= mfsize
;
977 pBuffer
+= sizeof(ULONG
);
978 GetMetaFileBitsEx(*phmf
, mfsize
, pBuffer
);
986 /******************************************************************************
987 * HMETAFILE_UserUnmarshal [OLE32.@]
989 * Unmarshals a metafile from a buffer.
992 * pFlags [I] Flags. See notes.
993 * pBuffer [I] Buffer to marshal the clip format from.
994 * phmf [O] Address that receive the unmarshaled metafile.
997 * The end of the marshaled data in the buffer.
1000 * Even though the function is documented to take a pointer to an ULONG in
1001 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1002 * the first parameter is an ULONG.
1003 * This function is only intended to be called by the RPC runtime.
1005 unsigned char * __RPC_USER
HMETAFILE_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HMETAFILE
*phmf
)
1009 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags
), pBuffer
, phmf
);
1011 ALIGN_POINTER(pBuffer
, 3);
1013 fContext
= *(ULONG
*)pBuffer
;
1014 pBuffer
+= sizeof(ULONG
);
1016 if (((fContext
== WDT_INPROC_CALL
) && (sizeof(*phmf
) < 8)) ||
1017 ((fContext
== WDT_INPROC64_CALL
) && (sizeof(*phmf
) == 8)))
1019 *phmf
= *(HMETAFILE
*)pBuffer
;
1020 pBuffer
+= sizeof(*phmf
);
1022 else if (fContext
== WDT_REMOTE_CALL
)
1026 handle
= *(ULONG
*)pBuffer
;
1027 pBuffer
+= sizeof(ULONG
);
1032 size
= *(ULONG
*)pBuffer
;
1033 pBuffer
+= sizeof(ULONG
);
1034 if (size
!= *(ULONG
*)pBuffer
)
1036 RaiseException(RPC_X_BAD_STUB_DATA
, 0, 0, NULL
);
1039 pBuffer
+= sizeof(ULONG
);
1040 *phmf
= SetMetaFileBitsEx(size
, pBuffer
);
1047 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
1052 /******************************************************************************
1053 * HMETAFILE_UserFree [OLE32.@]
1055 * Frees an unmarshaled metafile.
1058 * pFlags [I] Flags. See notes.
1059 * phmf [I] Metafile to free.
1062 * The end of the marshaled data in the buffer.
1065 * Even though the function is documented to take a pointer to a ULONG in
1066 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1067 * which the first parameter is a ULONG.
1068 * This function is only intended to be called by the RPC runtime.
1070 void __RPC_USER
HMETAFILE_UserFree(ULONG
*pFlags
, HMETAFILE
*phmf
)
1072 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags
), *phmf
);
1074 if (LOWORD(*pFlags
) != MSHCTX_INPROC
)
1075 DeleteMetaFile(*phmf
);
1078 /******************************************************************************
1079 * HENHMETAFILE_UserSize [OLE32.@]
1081 * Calculates the buffer size required to marshal an enhanced metafile.
1084 * pFlags [I] Flags. See notes.
1085 * StartingSize [I] Starting size of the buffer. This value is added on to
1086 * the buffer size required for the clip format.
1087 * phEmf [I] Enhanced metafile to size.
1090 * The buffer size required to marshal an enhanced metafile plus the starting size.
1093 * Even though the function is documented to take a pointer to a ULONG in
1094 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1095 * the first parameter is a ULONG.
1096 * This function is only intended to be called by the RPC runtime.
1098 ULONG __RPC_USER
HENHMETAFILE_UserSize(ULONG
*pFlags
, ULONG size
, HENHMETAFILE
*phEmf
)
1100 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags
), size
, *phEmf
);
1102 ALIGN_LENGTH(size
, 3);
1104 size
+= sizeof(ULONG
);
1105 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
1106 size
+= sizeof(ULONG_PTR
);
1109 size
+= sizeof(ULONG
);
1115 size
+= 2 * sizeof(ULONG
);
1116 emfsize
= GetEnhMetaFileBits(*phEmf
, 0, NULL
);
1124 /******************************************************************************
1125 * HENHMETAFILE_UserMarshal [OLE32.@]
1127 * Marshals an enhance metafile into a buffer.
1130 * pFlags [I] Flags. See notes.
1131 * pBuffer [I] Buffer to marshal the clip format into.
1132 * phEmf [I] Enhanced metafile to marshal.
1135 * The end of the marshaled data in the buffer.
1138 * Even though the function is documented to take a pointer to a ULONG in
1139 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1140 * the first parameter is a ULONG.
1141 * This function is only intended to be called by the RPC runtime.
1143 unsigned char * __RPC_USER
HENHMETAFILE_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HENHMETAFILE
*phEmf
)
1145 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags
), pBuffer
, *phEmf
);
1147 ALIGN_POINTER(pBuffer
, 3);
1149 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
1151 if (sizeof(*phEmf
) == 8)
1152 *(ULONG
*)pBuffer
= WDT_INPROC64_CALL
;
1154 *(ULONG
*)pBuffer
= WDT_INPROC_CALL
;
1155 pBuffer
+= sizeof(ULONG
);
1156 *(HENHMETAFILE
*)pBuffer
= *phEmf
;
1157 pBuffer
+= sizeof(HENHMETAFILE
);
1161 *(ULONG
*)pBuffer
= WDT_REMOTE_CALL
;
1162 pBuffer
+= sizeof(ULONG
);
1163 *(ULONG
*)pBuffer
= (ULONG
)(ULONG_PTR
)*phEmf
;
1164 pBuffer
+= sizeof(ULONG
);
1168 UINT emfsize
= GetEnhMetaFileBits(*phEmf
, 0, NULL
);
1170 *(ULONG
*)pBuffer
= emfsize
;
1171 pBuffer
+= sizeof(ULONG
);
1172 *(ULONG
*)pBuffer
= emfsize
;
1173 pBuffer
+= sizeof(ULONG
);
1174 GetEnhMetaFileBits(*phEmf
, emfsize
, pBuffer
);
1182 /******************************************************************************
1183 * HENHMETAFILE_UserUnmarshal [OLE32.@]
1185 * Unmarshals an enhanced metafile from a buffer.
1188 * pFlags [I] Flags. See notes.
1189 * pBuffer [I] Buffer to marshal the clip format from.
1190 * phEmf [O] Address that receive the unmarshaled enhanced metafile.
1193 * The end of the marshaled data in the buffer.
1196 * Even though the function is documented to take a pointer to an ULONG in
1197 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1198 * the first parameter is an ULONG.
1199 * This function is only intended to be called by the RPC runtime.
1201 unsigned char * __RPC_USER
HENHMETAFILE_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HENHMETAFILE
*phEmf
)
1205 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags
), pBuffer
, phEmf
);
1207 ALIGN_POINTER(pBuffer
, 3);
1209 fContext
= *(ULONG
*)pBuffer
;
1210 pBuffer
+= sizeof(ULONG
);
1212 if (((fContext
== WDT_INPROC_CALL
) && (sizeof(*phEmf
) < 8)) ||
1213 ((fContext
== WDT_INPROC64_CALL
) && (sizeof(*phEmf
) == 8)))
1215 *phEmf
= *(HENHMETAFILE
*)pBuffer
;
1216 pBuffer
+= sizeof(*phEmf
);
1218 else if (fContext
== WDT_REMOTE_CALL
)
1222 handle
= *(ULONG
*)pBuffer
;
1223 pBuffer
+= sizeof(ULONG
);
1228 size
= *(ULONG
*)pBuffer
;
1229 pBuffer
+= sizeof(ULONG
);
1230 if (size
!= *(ULONG
*)pBuffer
)
1232 RaiseException(RPC_X_BAD_STUB_DATA
, 0, 0, NULL
);
1235 pBuffer
+= sizeof(ULONG
);
1236 *phEmf
= SetEnhMetaFileBits(size
, pBuffer
);
1243 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
1248 /******************************************************************************
1249 * HENHMETAFILE_UserFree [OLE32.@]
1251 * Frees an unmarshaled enhanced metafile.
1254 * pFlags [I] Flags. See notes.
1255 * phEmf [I] Enhanced metafile to free.
1258 * The end of the marshaled data in the buffer.
1261 * Even though the function is documented to take a pointer to a ULONG in
1262 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1263 * which the first parameter is a ULONG.
1264 * This function is only intended to be called by the RPC runtime.
1266 void __RPC_USER
HENHMETAFILE_UserFree(ULONG
*pFlags
, HENHMETAFILE
*phEmf
)
1268 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags
), *phEmf
);
1270 if (LOWORD(*pFlags
) != MSHCTX_INPROC
)
1271 DeleteEnhMetaFile(*phEmf
);
1274 /******************************************************************************
1275 * HMETAFILEPICT_UserSize [OLE32.@]
1277 * Calculates the buffer size required to marshal an metafile pict.
1280 * pFlags [I] Flags. See notes.
1281 * StartingSize [I] Starting size of the buffer. This value is added on to
1282 * the buffer size required for the clip format.
1283 * phMfp [I] Metafile pict to size.
1286 * The buffer size required to marshal a metafile pict plus the starting size.
1289 * Even though the function is documented to take a pointer to a ULONG in
1290 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1291 * the first parameter is a ULONG.
1292 * This function is only intended to be called by the RPC runtime.
1294 ULONG __RPC_USER
HMETAFILEPICT_UserSize(ULONG
*pFlags
, ULONG size
, HMETAFILEPICT
*phMfp
)
1296 TRACE("(%s, %d, &%p)\n", debugstr_user_flags(pFlags
), size
, *phMfp
);
1298 ALIGN_LENGTH(size
, 3);
1300 size
+= sizeof(ULONG
);
1302 if(LOWORD(*pFlags
) == MSHCTX_INPROC
)
1303 size
+= sizeof(HMETAFILEPICT
);
1306 size
+= sizeof(ULONG
);
1310 METAFILEPICT
*mfpict
= GlobalLock(*phMfp
);
1312 /* FIXME: raise an exception if mfpict is NULL? */
1313 size
+= 3 * sizeof(ULONG
);
1314 size
+= sizeof(ULONG
);
1316 size
= HMETAFILE_UserSize(pFlags
, size
, &mfpict
->hMF
);
1318 GlobalUnlock(*phMfp
);
1325 /******************************************************************************
1326 * HMETAFILEPICT_UserMarshal [OLE32.@]
1328 * Marshals a metafile pict into a buffer.
1331 * pFlags [I] Flags. See notes.
1332 * pBuffer [I] Buffer to marshal the clip format into.
1333 * phMfp [I] Metafile pict to marshal.
1336 * The end of the marshaled data in the buffer.
1339 * Even though the function is documented to take a pointer to a ULONG in
1340 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1341 * the first parameter is a ULONG.
1342 * This function is only intended to be called by the RPC runtime.
1344 unsigned char * __RPC_USER
HMETAFILEPICT_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HMETAFILEPICT
*phMfp
)
1346 TRACE("(%s, %p, &%p)\n", debugstr_user_flags(pFlags
), pBuffer
, *phMfp
);
1348 ALIGN_POINTER(pBuffer
, 3);
1350 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
1352 if (sizeof(HMETAFILEPICT
) == 8)
1353 *(ULONG
*)pBuffer
= WDT_INPROC64_CALL
;
1355 *(ULONG
*)pBuffer
= WDT_INPROC_CALL
;
1356 pBuffer
+= sizeof(ULONG
);
1357 *(HMETAFILEPICT
*)pBuffer
= *phMfp
;
1358 pBuffer
+= sizeof(HMETAFILEPICT
);
1362 *(ULONG
*)pBuffer
= WDT_REMOTE_CALL
;
1363 pBuffer
+= sizeof(ULONG
);
1364 *(ULONG
*)pBuffer
= (ULONG
)(ULONG_PTR
)*phMfp
;
1365 pBuffer
+= sizeof(ULONG
);
1369 METAFILEPICT
*mfpict
= GlobalLock(*phMfp
);
1370 remoteMETAFILEPICT
* remmfpict
= (remoteMETAFILEPICT
*)pBuffer
;
1372 /* FIXME: raise an exception if mfpict is NULL? */
1373 remmfpict
->mm
= mfpict
->mm
;
1374 remmfpict
->xExt
= mfpict
->xExt
;
1375 remmfpict
->yExt
= mfpict
->yExt
;
1376 pBuffer
+= 3 * sizeof(ULONG
);
1377 *(ULONG
*)pBuffer
= USER_MARSHAL_PTR_PREFIX
;
1378 pBuffer
+= sizeof(ULONG
);
1380 pBuffer
= HMETAFILE_UserMarshal(pFlags
, pBuffer
, &mfpict
->hMF
);
1382 GlobalUnlock(*phMfp
);
1388 /******************************************************************************
1389 * HMETAFILEPICT_UserUnmarshal [OLE32.@]
1391 * Unmarshals an metafile pict from a buffer.
1394 * pFlags [I] Flags. See notes.
1395 * pBuffer [I] Buffer to marshal the clip format from.
1396 * phMfp [O] Address that receive the unmarshaled metafile pict.
1399 * The end of the marshaled data in the buffer.
1402 * Even though the function is documented to take a pointer to an ULONG in
1403 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1404 * the first parameter is an ULONG.
1405 * This function is only intended to be called by the RPC runtime.
1407 unsigned char * __RPC_USER
HMETAFILEPICT_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HMETAFILEPICT
*phMfp
)
1411 TRACE("(%s, %p, %p)\n", debugstr_user_flags(pFlags
), pBuffer
, phMfp
);
1413 ALIGN_POINTER(pBuffer
, 3);
1415 fContext
= *(ULONG
*)pBuffer
;
1416 pBuffer
+= sizeof(ULONG
);
1418 if ((fContext
== WDT_INPROC_CALL
) || fContext
== WDT_INPROC64_CALL
)
1420 *phMfp
= *(HMETAFILEPICT
*)pBuffer
;
1421 pBuffer
+= sizeof(HMETAFILEPICT
);
1425 ULONG handle
= *(ULONG
*)pBuffer
;
1426 pBuffer
+= sizeof(ULONG
);
1431 METAFILEPICT
*mfpict
;
1432 const remoteMETAFILEPICT
*remmfpict
;
1433 ULONG user_marshal_prefix
;
1435 remmfpict
= (const remoteMETAFILEPICT
*)pBuffer
;
1437 *phMfp
= GlobalAlloc(GMEM_MOVEABLE
, sizeof(METAFILEPICT
));
1439 RpcRaiseException(E_OUTOFMEMORY
);
1441 mfpict
= GlobalLock(*phMfp
);
1442 mfpict
->mm
= remmfpict
->mm
;
1443 mfpict
->xExt
= remmfpict
->xExt
;
1444 mfpict
->yExt
= remmfpict
->yExt
;
1445 pBuffer
+= 3 * sizeof(ULONG
);
1446 user_marshal_prefix
= *(ULONG
*)pBuffer
;
1447 pBuffer
+= sizeof(ULONG
);
1449 if (user_marshal_prefix
!= USER_MARSHAL_PTR_PREFIX
)
1450 RpcRaiseException(RPC_X_INVALID_TAG
);
1452 pBuffer
= HMETAFILE_UserUnmarshal(pFlags
, pBuffer
, &mfpict
->hMF
);
1454 GlobalUnlock(*phMfp
);
1460 /******************************************************************************
1461 * HMETAFILEPICT_UserFree [OLE32.@]
1463 * Frees an unmarshaled metafile pict.
1466 * pFlags [I] Flags. See notes.
1467 * phMfp [I] Metafile pict to free.
1470 * The end of the marshaled data in the buffer.
1473 * Even though the function is documented to take a pointer to a ULONG in
1474 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1475 * which the first parameter is a ULONG.
1476 * This function is only intended to be called by the RPC runtime.
1478 void __RPC_USER
HMETAFILEPICT_UserFree(ULONG
*pFlags
, HMETAFILEPICT
*phMfp
)
1480 TRACE("(%s, &%p)\n", debugstr_user_flags(pFlags
), *phMfp
);
1482 if ((LOWORD(*pFlags
) != MSHCTX_INPROC
) && *phMfp
)
1484 METAFILEPICT
*mfpict
;
1486 mfpict
= GlobalLock(*phMfp
);
1487 /* FIXME: raise an exception if mfpict is NULL? */
1488 HMETAFILE_UserFree(pFlags
, &mfpict
->hMF
);
1489 GlobalUnlock(*phMfp
);
1495 /******************************************************************************
1496 * WdtpInterfacePointer_UserSize [OLE32.@]
1498 * Calculates the buffer size required to marshal an interface pointer.
1501 * pFlags [I] Flags. See notes.
1502 * RealFlags [I] The MSHCTX to use when marshaling the interface.
1503 * punk [I] Interface pointer to size.
1504 * StartingSize [I] Starting size of the buffer. This value is added on to
1505 * the buffer size required for the clip format.
1506 * riid [I] ID of interface to size.
1509 * The buffer size required to marshal an interface pointer plus the starting size.
1512 * Even though the function is documented to take a pointer to a ULONG in
1513 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1514 * the first parameter is a ULONG.
1516 ULONG __RPC_USER
WdtpInterfacePointer_UserSize(ULONG
*pFlags
, ULONG RealFlags
, ULONG StartingSize
, IUnknown
*punk
, REFIID riid
)
1518 DWORD marshal_size
= 0;
1521 TRACE("(%s, 0%x, %d, %p, %s)\n", debugstr_user_flags(pFlags
), RealFlags
, StartingSize
, punk
, debugstr_guid(riid
));
1523 hr
= CoGetMarshalSizeMax(&marshal_size
, riid
, punk
, LOWORD(RealFlags
), NULL
, MSHLFLAGS_NORMAL
);
1524 if(FAILED(hr
)) return StartingSize
;
1526 ALIGN_LENGTH(StartingSize
, 3);
1527 StartingSize
+= 2 * sizeof(DWORD
);
1528 return StartingSize
+ marshal_size
;
1531 /******************************************************************************
1532 * WdtpInterfacePointer_UserMarshal [OLE32.@]
1534 * Marshals an interface pointer into a buffer.
1537 * pFlags [I] Flags. See notes.
1538 * RealFlags [I] The MSHCTX to use when marshaling the interface.
1539 * pBuffer [I] Buffer to marshal the clip format into.
1540 * punk [I] Interface pointer to marshal.
1541 * riid [I] ID of interface to marshal.
1544 * The end of the marshaled data in the buffer.
1547 * Even though the function is documented to take a pointer to a ULONG in
1548 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1549 * the first parameter is a ULONG.
1551 unsigned char * WINAPI
WdtpInterfacePointer_UserMarshal(ULONG
*pFlags
, ULONG RealFlags
, unsigned char *pBuffer
, IUnknown
*punk
, REFIID riid
)
1553 HGLOBAL h
= GlobalAlloc(GMEM_MOVEABLE
, 0);
1558 TRACE("(%s, 0x%x, %p, &%p, %s)\n", debugstr_user_flags(pFlags
), RealFlags
, pBuffer
, punk
, debugstr_guid(riid
));
1561 if(CreateStreamOnHGlobal(h
, TRUE
, &stm
) != S_OK
)
1567 if(CoMarshalInterface(stm
, riid
, punk
, LOWORD(RealFlags
), NULL
, MSHLFLAGS_NORMAL
) != S_OK
)
1569 IStream_Release(stm
);
1573 ALIGN_POINTER(pBuffer
, 3);
1574 size
= GlobalSize(h
);
1576 *(DWORD
*)pBuffer
= size
;
1577 pBuffer
+= sizeof(DWORD
);
1578 *(DWORD
*)pBuffer
= size
;
1579 pBuffer
+= sizeof(DWORD
);
1581 ptr
= GlobalLock(h
);
1582 memcpy(pBuffer
, ptr
, size
);
1585 IStream_Release(stm
);
1586 return pBuffer
+ size
;
1589 /******************************************************************************
1590 * WdtpInterfacePointer_UserUnmarshal [OLE32.@]
1592 * Unmarshals an interface pointer from a buffer.
1595 * pFlags [I] Flags. See notes.
1596 * pBuffer [I] Buffer to marshal the clip format from.
1597 * ppunk [I/O] Address that receives the unmarshaled interface pointer.
1598 * riid [I] ID of interface to unmarshal.
1601 * The end of the marshaled data in the buffer.
1604 * Even though the function is documented to take a pointer to an ULONG in
1605 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1606 * the first parameter is an ULONG.
1608 unsigned char * WINAPI
WdtpInterfacePointer_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, IUnknown
**ppunk
, REFIID riid
)
1617 TRACE("(%s, %p, %p, %s)\n", debugstr_user_flags(pFlags
), pBuffer
, ppunk
, debugstr_guid(riid
));
1619 ALIGN_POINTER(pBuffer
, 3);
1621 size
= *(DWORD
*)pBuffer
;
1622 pBuffer
+= sizeof(DWORD
);
1623 if(size
!= *(DWORD
*)pBuffer
)
1624 RaiseException(RPC_X_BAD_STUB_DATA
, 0, 0, NULL
);
1626 pBuffer
+= sizeof(DWORD
);
1628 /* FIXME: sanity check on size */
1630 h
= GlobalAlloc(GMEM_MOVEABLE
, size
);
1631 if(!h
) RaiseException(RPC_X_NO_MEMORY
, 0, 0, NULL
);
1633 if(CreateStreamOnHGlobal(h
, TRUE
, &stm
) != S_OK
)
1636 RaiseException(RPC_X_NO_MEMORY
, 0, 0, NULL
);
1639 ptr
= GlobalLock(h
);
1640 memcpy(ptr
, pBuffer
, size
);
1644 hr
= CoUnmarshalInterface(stm
, riid
, (void**)ppunk
);
1645 IStream_Release(stm
);
1647 if(hr
!= S_OK
) RaiseException(hr
, 0, 0, NULL
);
1649 if(orig
) IUnknown_Release(orig
);
1651 return pBuffer
+ size
;
1654 /******************************************************************************
1655 * WdtpInterfacePointer_UserFree [OLE32.@]
1657 * Releases an unmarshaled interface pointer.
1660 * punk [I] Interface pointer to release.
1665 void WINAPI
WdtpInterfacePointer_UserFree(IUnknown
*punk
)
1667 TRACE("(%p)\n", punk
);
1668 if(punk
) IUnknown_Release(punk
);
1671 /******************************************************************************
1672 * STGMEDIUM_UserSize [OLE32.@]
1674 * Calculates the buffer size required to marshal an STGMEDIUM.
1677 * pFlags [I] Flags. See notes.
1678 * StartingSize [I] Starting size of the buffer. This value is added on to
1679 * the buffer size required for the clip format.
1680 * pStgMedium [I] STGMEDIUM to size.
1683 * The buffer size required to marshal an STGMEDIUM plus the starting size.
1686 * Even though the function is documented to take a pointer to a ULONG in
1687 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1688 * the first parameter is a ULONG.
1689 * This function is only intended to be called by the RPC runtime.
1691 ULONG __RPC_USER
STGMEDIUM_UserSize(ULONG
*pFlags
, ULONG StartingSize
, STGMEDIUM
*pStgMedium
)
1693 ULONG size
= StartingSize
;
1695 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags
), StartingSize
, pStgMedium
);
1697 ALIGN_LENGTH(size
, 3);
1699 size
+= 2 * sizeof(DWORD
);
1700 if (pStgMedium
->tymed
!= TYMED_NULL
)
1701 size
+= sizeof(DWORD
);
1703 switch (pStgMedium
->tymed
)
1706 TRACE("TYMED_NULL\n");
1709 TRACE("TYMED_HGLOBAL\n");
1710 if (pStgMedium
->u
.hGlobal
)
1711 size
= HGLOBAL_UserSize(pFlags
, size
, &pStgMedium
->u
.hGlobal
);
1714 TRACE("TYMED_FILE\n");
1715 if (pStgMedium
->u
.lpszFileName
)
1717 TRACE("file name is %s\n", debugstr_w(pStgMedium
->u
.lpszFileName
));
1718 size
+= 3 * sizeof(DWORD
) +
1719 (strlenW(pStgMedium
->u
.lpszFileName
) + 1) * sizeof(WCHAR
);
1723 TRACE("TYMED_ISTREAM\n");
1724 if (pStgMedium
->u
.pstm
)
1727 IStream_QueryInterface(pStgMedium
->u
.pstm
, &IID_IUnknown
, (void**)&unk
);
1728 size
= WdtpInterfacePointer_UserSize(pFlags
, LOWORD(*pFlags
), size
, unk
, &IID_IStream
);
1729 IUnknown_Release(unk
);
1732 case TYMED_ISTORAGE
:
1733 TRACE("TYMED_ISTORAGE\n");
1734 if (pStgMedium
->u
.pstg
)
1737 IStorage_QueryInterface(pStgMedium
->u
.pstg
, &IID_IUnknown
, (void**)&unk
);
1738 size
= WdtpInterfacePointer_UserSize(pFlags
, LOWORD(*pFlags
), size
, unk
, &IID_IStorage
);
1739 IUnknown_Release(unk
);
1743 TRACE("TYMED_GDI\n");
1744 if (pStgMedium
->u
.hBitmap
)
1745 size
= HBITMAP_UserSize(pFlags
, size
, &pStgMedium
->u
.hBitmap
);
1748 TRACE("TYMED_MFPICT\n");
1749 if (pStgMedium
->u
.hMetaFilePict
)
1750 size
= HMETAFILEPICT_UserSize(pFlags
, size
, &pStgMedium
->u
.hMetaFilePict
);
1753 TRACE("TYMED_ENHMF\n");
1754 if (pStgMedium
->u
.hEnhMetaFile
)
1755 size
= HENHMETAFILE_UserSize(pFlags
, size
, &pStgMedium
->u
.hEnhMetaFile
);
1758 RaiseException(DV_E_TYMED
, 0, 0, NULL
);
1761 if (pStgMedium
->pUnkForRelease
)
1762 size
= WdtpInterfacePointer_UserSize(pFlags
, LOWORD(*pFlags
), size
, pStgMedium
->pUnkForRelease
, &IID_IUnknown
);
1767 /******************************************************************************
1768 * STGMEDIUM_UserMarshal [OLE32.@]
1770 * Marshals a STGMEDIUM into a buffer.
1773 * pFlags [I] Flags. See notes.
1774 * pBuffer [I] Buffer to marshal the clip format into.
1775 * pCF [I] STGMEDIUM to marshal.
1778 * The end of the marshaled data in the buffer.
1781 * Even though the function is documented to take a pointer to a ULONG in
1782 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1783 * the first parameter is a ULONG.
1784 * This function is only intended to be called by the RPC runtime.
1786 unsigned char * __RPC_USER
STGMEDIUM_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, STGMEDIUM
*pStgMedium
)
1788 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags
), pBuffer
, pStgMedium
);
1790 ALIGN_POINTER(pBuffer
, 3);
1792 *(DWORD
*)pBuffer
= pStgMedium
->tymed
;
1793 pBuffer
+= sizeof(DWORD
);
1794 if (pStgMedium
->tymed
!= TYMED_NULL
)
1796 *(DWORD
*)pBuffer
= (DWORD
)(DWORD_PTR
)pStgMedium
->u
.pstg
;
1797 pBuffer
+= sizeof(DWORD
);
1799 *(DWORD
*)pBuffer
= (DWORD
)(DWORD_PTR
)pStgMedium
->pUnkForRelease
;
1800 pBuffer
+= sizeof(DWORD
);
1802 switch (pStgMedium
->tymed
)
1805 TRACE("TYMED_NULL\n");
1808 TRACE("TYMED_HGLOBAL\n");
1809 if (pStgMedium
->u
.hGlobal
)
1810 pBuffer
= HGLOBAL_UserMarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hGlobal
);
1813 TRACE("TYMED_FILE\n");
1814 if (pStgMedium
->u
.lpszFileName
)
1817 len
= strlenW(pStgMedium
->u
.lpszFileName
);
1819 *(DWORD
*)pBuffer
= len
+ 1;
1820 pBuffer
+= sizeof(DWORD
);
1822 *(DWORD
*)pBuffer
= 0;
1823 pBuffer
+= sizeof(DWORD
);
1825 *(DWORD
*)pBuffer
= len
+ 1;
1826 pBuffer
+= sizeof(DWORD
);
1828 TRACE("file name is %s\n", debugstr_w(pStgMedium
->u
.lpszFileName
));
1829 memcpy(pBuffer
, pStgMedium
->u
.lpszFileName
, (len
+ 1) * sizeof(WCHAR
));
1833 TRACE("TYMED_ISTREAM\n");
1834 if (pStgMedium
->u
.pstm
)
1837 IStream_QueryInterface(pStgMedium
->u
.pstm
, &IID_IUnknown
, (void**)&unk
);
1838 pBuffer
= WdtpInterfacePointer_UserMarshal(pFlags
, LOWORD(*pFlags
), pBuffer
, unk
, &IID_IStream
);
1839 IUnknown_Release(unk
);
1842 case TYMED_ISTORAGE
:
1843 TRACE("TYMED_ISTORAGE\n");
1844 if (pStgMedium
->u
.pstg
)
1847 IStorage_QueryInterface(pStgMedium
->u
.pstg
, &IID_IUnknown
, (void**)&unk
);
1848 pBuffer
= WdtpInterfacePointer_UserMarshal(pFlags
, LOWORD(*pFlags
), pBuffer
, unk
, &IID_IStorage
);
1849 IUnknown_Release(unk
);
1853 TRACE("TYMED_GDI\n");
1854 if (pStgMedium
->u
.hBitmap
)
1855 pBuffer
= HBITMAP_UserMarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hBitmap
);
1858 TRACE("TYMED_MFPICT\n");
1859 if (pStgMedium
->u
.hMetaFilePict
)
1860 pBuffer
= HMETAFILEPICT_UserMarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hMetaFilePict
);
1863 TRACE("TYMED_ENHMF\n");
1864 if (pStgMedium
->u
.hEnhMetaFile
)
1865 pBuffer
= HENHMETAFILE_UserMarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hEnhMetaFile
);
1868 RaiseException(DV_E_TYMED
, 0, 0, NULL
);
1871 if (pStgMedium
->pUnkForRelease
)
1872 pBuffer
= WdtpInterfacePointer_UserMarshal(pFlags
, LOWORD(*pFlags
), pBuffer
, pStgMedium
->pUnkForRelease
, &IID_IUnknown
);
1877 /******************************************************************************
1878 * STGMEDIUM_UserUnmarshal [OLE32.@]
1880 * Unmarshals a STGMEDIUM from a buffer.
1883 * pFlags [I] Flags. See notes.
1884 * pBuffer [I] Buffer to marshal the clip format from.
1885 * pStgMedium [O] Address that receive the unmarshaled STGMEDIUM.
1888 * The end of the marshaled data in the buffer.
1891 * Even though the function is documented to take a pointer to an ULONG in
1892 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1893 * the first parameter is an ULONG.
1894 * This function is only intended to be called by the RPC runtime.
1896 unsigned char * __RPC_USER
STGMEDIUM_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, STGMEDIUM
*pStgMedium
)
1901 ALIGN_POINTER(pBuffer
, 3);
1903 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags
), pBuffer
, pStgMedium
);
1905 pStgMedium
->tymed
= *(DWORD
*)pBuffer
;
1906 pBuffer
+= sizeof(DWORD
);
1907 if (pStgMedium
->tymed
!= TYMED_NULL
)
1909 content
= *(DWORD
*)pBuffer
;
1910 pBuffer
+= sizeof(DWORD
);
1912 releaseunk
= *(DWORD
*)pBuffer
;
1913 pBuffer
+= sizeof(DWORD
);
1915 switch (pStgMedium
->tymed
)
1918 TRACE("TYMED_NULL\n");
1921 TRACE("TYMED_HGLOBAL\n");
1923 pBuffer
= HGLOBAL_UserUnmarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hGlobal
);
1926 TRACE("TYMED_FILE\n");
1931 conformance
= *(DWORD
*)pBuffer
;
1932 pBuffer
+= sizeof(DWORD
);
1933 if (*(DWORD
*)pBuffer
!= 0)
1935 ERR("invalid offset %d\n", *(DWORD
*)pBuffer
);
1936 RpcRaiseException(RPC_S_INVALID_BOUND
);
1939 pBuffer
+= sizeof(DWORD
);
1940 variance
= *(DWORD
*)pBuffer
;
1941 pBuffer
+= sizeof(DWORD
);
1942 if (conformance
!= variance
)
1944 ERR("conformance (%d) and variance (%d) should be equal\n",
1945 conformance
, variance
);
1946 RpcRaiseException(RPC_S_INVALID_BOUND
);
1949 if (conformance
> 0x7fffffff)
1951 ERR("conformance 0x%x too large\n", conformance
);
1952 RpcRaiseException(RPC_S_INVALID_BOUND
);
1955 pStgMedium
->u
.lpszFileName
= CoTaskMemAlloc(conformance
* sizeof(WCHAR
));
1956 if (!pStgMedium
->u
.lpszFileName
) RpcRaiseException(ERROR_OUTOFMEMORY
);
1957 TRACE("unmarshalled file name is %s\n", debugstr_wn((const WCHAR
*)pBuffer
, variance
));
1958 memcpy(pStgMedium
->u
.lpszFileName
, pBuffer
, variance
* sizeof(WCHAR
));
1959 pBuffer
+= variance
* sizeof(WCHAR
);
1962 pStgMedium
->u
.lpszFileName
= NULL
;
1965 TRACE("TYMED_ISTREAM\n");
1968 pBuffer
= WdtpInterfacePointer_UserUnmarshal(pFlags
, pBuffer
, (IUnknown
**)&pStgMedium
->u
.pstm
, &IID_IStream
);
1972 if (pStgMedium
->u
.pstm
) IStream_Release( pStgMedium
->u
.pstm
);
1973 pStgMedium
->u
.pstm
= NULL
;
1976 case TYMED_ISTORAGE
:
1977 TRACE("TYMED_ISTORAGE\n");
1980 pBuffer
= WdtpInterfacePointer_UserUnmarshal(pFlags
, pBuffer
, (IUnknown
**)&pStgMedium
->u
.pstg
, &IID_IStorage
);
1984 if (pStgMedium
->u
.pstg
) IStorage_Release( pStgMedium
->u
.pstg
);
1985 pStgMedium
->u
.pstg
= NULL
;
1989 TRACE("TYMED_GDI\n");
1991 pBuffer
= HBITMAP_UserUnmarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hBitmap
);
1993 pStgMedium
->u
.hBitmap
= NULL
;
1996 TRACE("TYMED_MFPICT\n");
1998 pBuffer
= HMETAFILEPICT_UserUnmarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hMetaFilePict
);
2000 pStgMedium
->u
.hMetaFilePict
= NULL
;
2003 TRACE("TYMED_ENHMF\n");
2005 pBuffer
= HENHMETAFILE_UserUnmarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hEnhMetaFile
);
2007 pStgMedium
->u
.hEnhMetaFile
= NULL
;
2010 RaiseException(DV_E_TYMED
, 0, 0, NULL
);
2014 pBuffer
= WdtpInterfacePointer_UserUnmarshal(pFlags
, pBuffer
, &pStgMedium
->pUnkForRelease
, &IID_IUnknown
);
2015 /* Unlike the IStream / IStorage ifaces, the existing pUnkForRelease
2016 is left intact if a NULL ptr is unmarshalled - see the tests. */
2021 /******************************************************************************
2022 * STGMEDIUM_UserFree [OLE32.@]
2024 * Frees an unmarshaled STGMEDIUM.
2027 * pFlags [I] Flags. See notes.
2028 * pStgmedium [I] STGMEDIUM to free.
2031 * The end of the marshaled data in the buffer.
2034 * Even though the function is documented to take a pointer to a ULONG in
2035 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
2036 * which the first parameter is a ULONG.
2037 * This function is only intended to be called by the RPC runtime.
2039 void __RPC_USER
STGMEDIUM_UserFree(ULONG
*flags
, STGMEDIUM
*med
)
2041 TRACE("(%s, %p)\n", debugstr_user_flags(flags
), med
);
2048 case TYMED_ISTORAGE
:
2049 ReleaseStgMedium(med
);
2055 if (LOWORD(*flags
) == MSHCTX_INPROC
)
2056 med
->tymed
= TYMED_NULL
;
2057 ReleaseStgMedium(med
);
2060 RaiseException(DV_E_TYMED
, 0, 0, NULL
);
2064 ULONG __RPC_USER
ASYNC_STGMEDIUM_UserSize(ULONG
*pFlags
, ULONG StartingSize
, ASYNC_STGMEDIUM
*pStgMedium
)
2067 return STGMEDIUM_UserSize(pFlags
, StartingSize
, pStgMedium
);
2070 unsigned char * __RPC_USER
ASYNC_STGMEDIUM_UserMarshal( ULONG
*pFlags
, unsigned char *pBuffer
, ASYNC_STGMEDIUM
*pStgMedium
)
2073 return STGMEDIUM_UserMarshal(pFlags
, pBuffer
, pStgMedium
);
2076 unsigned char * __RPC_USER
ASYNC_STGMEDIUM_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, ASYNC_STGMEDIUM
*pStgMedium
)
2079 return STGMEDIUM_UserUnmarshal(pFlags
, pBuffer
, pStgMedium
);
2082 void __RPC_USER
ASYNC_STGMEDIUM_UserFree(ULONG
*pFlags
, ASYNC_STGMEDIUM
*pStgMedium
)
2085 STGMEDIUM_UserFree(pFlags
, pStgMedium
);
2088 ULONG __RPC_USER
FLAG_STGMEDIUM_UserSize(ULONG
*pFlags
, ULONG StartingSize
, FLAG_STGMEDIUM
*pStgMedium
)
2091 return StartingSize
;
2094 unsigned char * __RPC_USER
FLAG_STGMEDIUM_UserMarshal( ULONG
*pFlags
, unsigned char *pBuffer
, FLAG_STGMEDIUM
*pStgMedium
)
2100 unsigned char * __RPC_USER
FLAG_STGMEDIUM_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, FLAG_STGMEDIUM
*pStgMedium
)
2106 void __RPC_USER
FLAG_STGMEDIUM_UserFree(ULONG
*pFlags
, FLAG_STGMEDIUM
*pStgMedium
)
2111 ULONG __RPC_USER
SNB_UserSize(ULONG
*pFlags
, ULONG StartingSize
, SNB
*pSnb
)
2113 ULONG size
= StartingSize
;
2115 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags
), StartingSize
, pSnb
);
2117 ALIGN_LENGTH(size
, 3);
2119 /* two counters from RemSNB header, plus one more ULONG */
2120 size
+= 3*sizeof(ULONG
);
2122 /* now actual data length */
2125 WCHAR
**ptrW
= *pSnb
;
2129 size
+= (strlenW(*ptrW
) + 1)*sizeof(WCHAR
);
2144 unsigned char * __RPC_USER
SNB_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, SNB
*pSnb
)
2146 struct SNB_wire
*wire
;
2149 TRACE("(%s, %p, %p)\n", debugstr_user_flags(pFlags
), pBuffer
, pSnb
);
2151 ALIGN_POINTER(pBuffer
, 3);
2153 wire
= (struct SNB_wire
*)pBuffer
;
2154 wire
->charcnt
= wire
->strcnt
= 0;
2155 size
= 3*sizeof(ULONG
);
2159 WCHAR
**ptrW
= *pSnb
;
2160 WCHAR
*dataW
= wire
->data
;
2164 ULONG len
= strlenW(*ptrW
) + 1;
2167 wire
->charcnt
+= len
;
2168 memcpy(dataW
, *ptrW
, len
*sizeof(WCHAR
));
2171 size
+= len
*sizeof(WCHAR
);
2176 wire
->datalen
= wire
->charcnt
;
2177 return pBuffer
+ size
;
2180 unsigned char * __RPC_USER
SNB_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, SNB
*pSnb
)
2182 USER_MARSHAL_CB
*umcb
= (USER_MARSHAL_CB
*)pFlags
;
2183 struct SNB_wire
*wire
;
2185 TRACE("(%s, %p, %p)\n", debugstr_user_flags(pFlags
), pBuffer
, pSnb
);
2187 wire
= (struct SNB_wire
*)pBuffer
;
2190 umcb
->pStubMsg
->pfnFree(*pSnb
);
2192 if (wire
->datalen
== 0)
2196 WCHAR
*src
= wire
->data
, *dest
;
2200 ptrW
= *pSnb
= umcb
->pStubMsg
->pfnAllocate((wire
->strcnt
+1)*sizeof(WCHAR
*) + wire
->datalen
*sizeof(WCHAR
));
2201 dest
= (WCHAR
*)(*pSnb
+ wire
->strcnt
+ 1);
2203 for (i
= 0; i
< wire
->strcnt
; i
++)
2205 ULONG len
= strlenW(src
);
2206 memcpy(dest
, src
, (len
+ 1)*sizeof(WCHAR
));
2215 return pBuffer
+ 3*sizeof(ULONG
) + wire
->datalen
*sizeof(WCHAR
);
2218 void __RPC_USER
SNB_UserFree(ULONG
*pFlags
, SNB
*pSnb
)
2220 USER_MARSHAL_CB
*umcb
= (USER_MARSHAL_CB
*)pFlags
;
2221 TRACE("(%p)\n", pSnb
);
2223 umcb
->pStubMsg
->pfnFree(*pSnb
);
2226 /* call_as/local stubs for unknwn.idl */
2228 HRESULT CALLBACK
IClassFactory_CreateInstance_Proxy(
2229 IClassFactory
* This
,
2230 IUnknown
*pUnkOuter
,
2234 TRACE("(%p, %s, %p)\n", pUnkOuter
, debugstr_guid(riid
), ppvObject
);
2238 ERR("aggregation is not allowed on remote objects\n");
2239 return CLASS_E_NOAGGREGATION
;
2241 return IClassFactory_RemoteCreateInstance_Proxy(This
, riid
,
2242 (IUnknown
**) ppvObject
);
2245 HRESULT __RPC_STUB
IClassFactory_CreateInstance_Stub(
2246 IClassFactory
* This
,
2248 IUnknown
**ppvObject
)
2250 TRACE("(%s, %p)\n", debugstr_guid(riid
), ppvObject
);
2251 return IClassFactory_CreateInstance(This
, NULL
, riid
, (void **) ppvObject
);
2254 HRESULT CALLBACK
IClassFactory_LockServer_Proxy(
2255 IClassFactory
* This
,
2262 HRESULT __RPC_STUB
IClassFactory_LockServer_Stub(
2263 IClassFactory
* This
,
2270 /* call_as/local stubs for objidl.idl */
2272 HRESULT CALLBACK
IEnumUnknown_Next_Proxy(
2276 ULONG
*pceltFetched
)
2279 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2280 if (!pceltFetched
) pceltFetched
= &fetched
;
2281 return IEnumUnknown_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
2284 HRESULT __RPC_STUB
IEnumUnknown_Next_Stub(
2288 ULONG
*pceltFetched
)
2291 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2293 hr
= IEnumUnknown_Next(This
, celt
, rgelt
, pceltFetched
);
2294 if (hr
== S_OK
) *pceltFetched
= celt
;
2298 HRESULT CALLBACK
IBindCtx_SetBindOptions_Proxy(
2300 BIND_OPTS
*pbindopts
)
2306 HRESULT __RPC_STUB
IBindCtx_SetBindOptions_Stub(
2308 BIND_OPTS2
*pbindopts
)
2314 HRESULT CALLBACK
IBindCtx_GetBindOptions_Proxy(
2316 BIND_OPTS
*pbindopts
)
2322 HRESULT __RPC_STUB
IBindCtx_GetBindOptions_Stub(
2324 BIND_OPTS2
*pbindopts
)
2330 HRESULT CALLBACK
IEnumMoniker_Next_Proxy(
2334 ULONG
*pceltFetched
)
2337 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2338 if (!pceltFetched
) pceltFetched
= &fetched
;
2339 return IEnumMoniker_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
2342 HRESULT __RPC_STUB
IEnumMoniker_Next_Stub(
2346 ULONG
*pceltFetched
)
2349 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2351 hr
= IEnumMoniker_Next(This
, celt
, rgelt
, pceltFetched
);
2352 if (hr
== S_OK
) *pceltFetched
= celt
;
2356 BOOL CALLBACK
IRunnableObject_IsRunning_Proxy(
2357 IRunnableObject
* This
)
2361 memset(&rv
, 0, sizeof rv
);
2365 HRESULT __RPC_STUB
IRunnableObject_IsRunning_Stub(
2366 IRunnableObject
* This
)
2372 HRESULT CALLBACK
IMoniker_BindToObject_Proxy(
2375 IMoniker
*pmkToLeft
,
2383 HRESULT __RPC_STUB
IMoniker_BindToObject_Stub(
2386 IMoniker
*pmkToLeft
,
2388 IUnknown
**ppvResult
)
2394 HRESULT CALLBACK
IMoniker_BindToStorage_Proxy(
2397 IMoniker
*pmkToLeft
,
2401 TRACE("(%p)->(%p %p %s %p)\n", This
, pbc
, pmkToLeft
, debugstr_guid(riid
), ppvObj
);
2402 return IMoniker_RemoteBindToStorage_Proxy(This
, pbc
, pmkToLeft
, riid
, (IUnknown
**)ppvObj
);
2405 HRESULT __RPC_STUB
IMoniker_BindToStorage_Stub(
2408 IMoniker
*pmkToLeft
,
2412 TRACE("(%p)->(%p %p %s %p)\n", This
, pbc
, pmkToLeft
, debugstr_guid(riid
), ppvObj
);
2413 return IMoniker_BindToStorage(This
, pbc
, pmkToLeft
, riid
, (void**)ppvObj
);
2416 HRESULT CALLBACK
IEnumString_Next_Proxy(
2420 ULONG
*pceltFetched
)
2423 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2424 if (!pceltFetched
) pceltFetched
= &fetched
;
2425 return IEnumString_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
2428 HRESULT __RPC_STUB
IEnumString_Next_Stub(
2432 ULONG
*pceltFetched
)
2435 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2437 hr
= IEnumString_Next(This
, celt
, rgelt
, pceltFetched
);
2438 if (hr
== S_OK
) *pceltFetched
= celt
;
2442 HRESULT CALLBACK
ISequentialStream_Read_Proxy(
2443 ISequentialStream
* This
,
2451 TRACE("(%p)->(%p, %d, %p)\n", This
, pv
, cb
, pcbRead
);
2453 hr
= ISequentialStream_RemoteRead_Proxy(This
, pv
, cb
, &read
);
2454 if(pcbRead
) *pcbRead
= read
;
2459 HRESULT __RPC_STUB
ISequentialStream_Read_Stub(
2460 ISequentialStream
* This
,
2465 TRACE("(%p)->(%p, %d, %p)\n", This
, pv
, cb
, pcbRead
);
2466 return ISequentialStream_Read(This
, pv
, cb
, pcbRead
);
2469 HRESULT CALLBACK
ISequentialStream_Write_Proxy(
2470 ISequentialStream
* This
,
2478 TRACE("(%p)->(%p, %d, %p)\n", This
, pv
, cb
, pcbWritten
);
2480 hr
= ISequentialStream_RemoteWrite_Proxy(This
, pv
, cb
, &written
);
2481 if(pcbWritten
) *pcbWritten
= written
;
2486 HRESULT __RPC_STUB
ISequentialStream_Write_Stub(
2487 ISequentialStream
* This
,
2492 TRACE("(%p)->(%p, %d, %p)\n", This
, pv
, cb
, pcbWritten
);
2493 return ISequentialStream_Write(This
, pv
, cb
, pcbWritten
);
2496 HRESULT CALLBACK
IStream_Seek_Proxy(
2498 LARGE_INTEGER dlibMove
,
2500 ULARGE_INTEGER
*plibNewPosition
)
2502 ULARGE_INTEGER newpos
;
2505 TRACE("(%p)->(%s, %d, %p)\n", This
, wine_dbgstr_longlong(dlibMove
.QuadPart
), dwOrigin
, plibNewPosition
);
2507 hr
= IStream_RemoteSeek_Proxy(This
, dlibMove
, dwOrigin
, &newpos
);
2508 if(plibNewPosition
) *plibNewPosition
= newpos
;
2513 HRESULT __RPC_STUB
IStream_Seek_Stub(
2515 LARGE_INTEGER dlibMove
,
2517 ULARGE_INTEGER
*plibNewPosition
)
2519 TRACE("(%p)->(%s, %d, %p)\n", This
, wine_dbgstr_longlong(dlibMove
.QuadPart
), dwOrigin
, plibNewPosition
);
2520 return IStream_Seek(This
, dlibMove
, dwOrigin
, plibNewPosition
);
2523 HRESULT CALLBACK
IStream_CopyTo_Proxy(
2527 ULARGE_INTEGER
*pcbRead
,
2528 ULARGE_INTEGER
*pcbWritten
)
2530 ULARGE_INTEGER read
, written
;
2533 TRACE("(%p)->(%p, %s, %p, %p)\n", This
, pstm
, wine_dbgstr_longlong(cb
.QuadPart
), pcbRead
, pcbWritten
);
2535 hr
= IStream_RemoteCopyTo_Proxy(This
, pstm
, cb
, &read
, &written
);
2536 if(pcbRead
) *pcbRead
= read
;
2537 if(pcbWritten
) *pcbWritten
= written
;
2542 HRESULT __RPC_STUB
IStream_CopyTo_Stub(
2546 ULARGE_INTEGER
*pcbRead
,
2547 ULARGE_INTEGER
*pcbWritten
)
2549 TRACE("(%p)->(%p, %s, %p, %p)\n", This
, pstm
, wine_dbgstr_longlong(cb
.QuadPart
), pcbRead
, pcbWritten
);
2551 return IStream_CopyTo(This
, pstm
, cb
, pcbRead
, pcbWritten
);
2554 HRESULT CALLBACK
IEnumSTATSTG_Next_Proxy(
2558 ULONG
*pceltFetched
)
2561 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2562 if (!pceltFetched
) pceltFetched
= &fetched
;
2563 return IEnumSTATSTG_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
2566 HRESULT __RPC_STUB
IEnumSTATSTG_Next_Stub(
2570 ULONG
*pceltFetched
)
2573 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2575 hr
= IEnumSTATSTG_Next(This
, celt
, rgelt
, pceltFetched
);
2576 if (hr
== S_OK
) *pceltFetched
= celt
;
2580 HRESULT CALLBACK
IStorage_OpenStream_Proxy(
2588 TRACE("(%p)->(%s, %p, %08x, %d %p)\n", This
, debugstr_w(pwcsName
), reserved1
, grfMode
, reserved2
, ppstm
);
2589 if(reserved1
) WARN("reserved1 %p\n", reserved1
);
2591 return IStorage_RemoteOpenStream_Proxy(This
, pwcsName
, 0, NULL
, grfMode
, reserved2
, ppstm
);
2594 HRESULT __RPC_STUB
IStorage_OpenStream_Stub(
2603 TRACE("(%p)->(%s, %d, %p, %08x, %d %p)\n", This
, debugstr_w(pwcsName
), cbReserved1
, reserved1
, grfMode
, reserved2
, ppstm
);
2604 if(cbReserved1
|| reserved1
) WARN("cbReserved1 %d reserved1 %p\n", cbReserved1
, reserved1
);
2606 return IStorage_OpenStream(This
, pwcsName
, NULL
, grfMode
, reserved2
, ppstm
);
2609 HRESULT CALLBACK
IStorage_EnumElements_Proxy(
2614 IEnumSTATSTG
**ppenum
)
2616 TRACE("(%p)->(%d, %p, %d, %p)\n", This
, reserved1
, reserved2
, reserved3
, ppenum
);
2617 if(reserved2
) WARN("reserved2 %p\n", reserved2
);
2619 return IStorage_RemoteEnumElements_Proxy(This
, reserved1
, 0, NULL
, reserved3
, ppenum
);
2622 HRESULT __RPC_STUB
IStorage_EnumElements_Stub(
2628 IEnumSTATSTG
**ppenum
)
2630 TRACE("(%p)->(%d, %d, %p, %d, %p)\n", This
, reserved1
, cbReserved2
, reserved2
, reserved3
, ppenum
);
2631 if(cbReserved2
|| reserved2
) WARN("cbReserved2 %d reserved2 %p\n", cbReserved2
, reserved2
);
2633 return IStorage_EnumElements(This
, reserved1
, NULL
, reserved3
, ppenum
);
2636 HRESULT CALLBACK
ILockBytes_ReadAt_Proxy(
2638 ULARGE_INTEGER ulOffset
,
2646 TRACE("(%p)->(%s, %p, %d, %p)\n", This
, wine_dbgstr_longlong(ulOffset
.QuadPart
), pv
, cb
, pcbRead
);
2648 hr
= ILockBytes_RemoteReadAt_Proxy(This
, ulOffset
, pv
, cb
, &read
);
2649 if(pcbRead
) *pcbRead
= read
;
2654 HRESULT __RPC_STUB
ILockBytes_ReadAt_Stub(
2656 ULARGE_INTEGER ulOffset
,
2661 TRACE("(%p)->(%s, %p, %d, %p)\n", This
, wine_dbgstr_longlong(ulOffset
.QuadPart
), pv
, cb
, pcbRead
);
2662 return ILockBytes_ReadAt(This
, ulOffset
, pv
, cb
, pcbRead
);
2665 HRESULT CALLBACK
ILockBytes_WriteAt_Proxy(
2667 ULARGE_INTEGER ulOffset
,
2675 TRACE("(%p)->(%s, %p, %d, %p)\n", This
, wine_dbgstr_longlong(ulOffset
.QuadPart
), pv
, cb
, pcbWritten
);
2677 hr
= ILockBytes_RemoteWriteAt_Proxy(This
, ulOffset
, pv
, cb
, &written
);
2678 if(pcbWritten
) *pcbWritten
= written
;
2683 HRESULT __RPC_STUB
ILockBytes_WriteAt_Stub(
2685 ULARGE_INTEGER ulOffset
,
2690 TRACE("(%p)->(%s, %p, %d, %p)\n", This
, wine_dbgstr_longlong(ulOffset
.QuadPart
), pv
, cb
, pcbWritten
);
2691 return ILockBytes_WriteAt(This
, ulOffset
, pv
, cb
, pcbWritten
);
2694 HRESULT CALLBACK
IFillLockBytes_FillAppend_Proxy(
2695 IFillLockBytes
* This
,
2703 TRACE("(%p)->(%p, %d, %p)\n", This
, pv
, cb
, pcbWritten
);
2705 hr
= IFillLockBytes_RemoteFillAppend_Proxy(This
, pv
, cb
, &written
);
2706 if(pcbWritten
) *pcbWritten
= written
;
2711 HRESULT __RPC_STUB
IFillLockBytes_FillAppend_Stub(
2712 IFillLockBytes
* This
,
2717 TRACE("(%p)->(%p, %d, %p)\n", This
, pv
, cb
, pcbWritten
);
2718 return IFillLockBytes_FillAppend(This
, pv
, cb
, pcbWritten
);
2721 HRESULT CALLBACK
IFillLockBytes_FillAt_Proxy(
2722 IFillLockBytes
* This
,
2723 ULARGE_INTEGER ulOffset
,
2731 TRACE("(%p)->(%s, %p, %d, %p)\n", This
, wine_dbgstr_longlong(ulOffset
.QuadPart
), pv
, cb
, pcbWritten
);
2733 hr
= IFillLockBytes_RemoteFillAt_Proxy(This
, ulOffset
, pv
, cb
, &written
);
2734 if(pcbWritten
) *pcbWritten
= written
;
2739 HRESULT __RPC_STUB
IFillLockBytes_FillAt_Stub(
2740 IFillLockBytes
* This
,
2741 ULARGE_INTEGER ulOffset
,
2746 TRACE("(%p)->(%s, %p, %d, %p)\n", This
, wine_dbgstr_longlong(ulOffset
.QuadPart
), pv
, cb
, pcbWritten
);
2747 return IFillLockBytes_FillAt(This
, ulOffset
, pv
, cb
, pcbWritten
);
2750 HRESULT CALLBACK
IEnumFORMATETC_Next_Proxy(
2751 IEnumFORMATETC
* This
,
2754 ULONG
*pceltFetched
)
2757 if (!pceltFetched
) pceltFetched
= &fetched
;
2758 return IEnumFORMATETC_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
2761 HRESULT __RPC_STUB
IEnumFORMATETC_Next_Stub(
2762 IEnumFORMATETC
* This
,
2765 ULONG
*pceltFetched
)
2769 hr
= IEnumFORMATETC_Next(This
, celt
, rgelt
, pceltFetched
);
2770 if (hr
== S_OK
) *pceltFetched
= celt
;
2774 HRESULT CALLBACK
IEnumSTATDATA_Next_Proxy(
2775 IEnumSTATDATA
* This
,
2778 ULONG
*pceltFetched
)
2781 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2782 if (!pceltFetched
) pceltFetched
= &fetched
;
2783 return IEnumSTATDATA_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
2786 HRESULT __RPC_STUB
IEnumSTATDATA_Next_Stub(
2787 IEnumSTATDATA
* This
,
2790 ULONG
*pceltFetched
)
2793 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2795 hr
= IEnumSTATDATA_Next(This
, celt
, rgelt
, pceltFetched
);
2796 if (hr
== S_OK
) *pceltFetched
= celt
;
2800 void CALLBACK
IAdviseSink_OnDataChange_Proxy(
2802 FORMATETC
*pFormatetc
,
2805 TRACE("(%p)->(%p, %p)\n", This
, pFormatetc
, pStgmed
);
2806 IAdviseSink_RemoteOnDataChange_Proxy(This
, pFormatetc
, pStgmed
);
2809 HRESULT __RPC_STUB
IAdviseSink_OnDataChange_Stub(
2811 FORMATETC
*pFormatetc
,
2812 ASYNC_STGMEDIUM
*pStgmed
)
2814 TRACE("(%p)->(%p, %p)\n", This
, pFormatetc
, pStgmed
);
2815 IAdviseSink_OnDataChange(This
, pFormatetc
, pStgmed
);
2819 void CALLBACK
IAdviseSink_OnViewChange_Proxy(
2824 TRACE("(%p)->(%d, %d)\n", This
, dwAspect
, lindex
);
2825 IAdviseSink_RemoteOnViewChange_Proxy(This
, dwAspect
, lindex
);
2828 HRESULT __RPC_STUB
IAdviseSink_OnViewChange_Stub(
2833 TRACE("(%p)->(%d, %d)\n", This
, dwAspect
, lindex
);
2834 IAdviseSink_OnViewChange(This
, dwAspect
, lindex
);
2838 void CALLBACK
IAdviseSink_OnRename_Proxy(
2842 TRACE("(%p)->(%p)\n", This
, pmk
);
2843 IAdviseSink_RemoteOnRename_Proxy(This
, pmk
);
2846 HRESULT __RPC_STUB
IAdviseSink_OnRename_Stub(
2850 TRACE("(%p)->(%p)\n", This
, pmk
);
2851 IAdviseSink_OnRename(This
, pmk
);
2855 void CALLBACK
IAdviseSink_OnSave_Proxy(
2858 TRACE("(%p)\n", This
);
2859 IAdviseSink_RemoteOnSave_Proxy(This
);
2862 HRESULT __RPC_STUB
IAdviseSink_OnSave_Stub(
2865 TRACE("(%p)\n", This
);
2866 IAdviseSink_OnSave(This
);
2870 void CALLBACK
IAdviseSink_OnClose_Proxy(
2873 TRACE("(%p)\n", This
);
2874 IAdviseSink_RemoteOnClose_Proxy(This
);
2877 HRESULT __RPC_STUB
IAdviseSink_OnClose_Stub(
2880 TRACE("(%p)\n", This
);
2881 IAdviseSink_OnClose(This
);
2885 void CALLBACK
IAdviseSink2_OnLinkSrcChange_Proxy(
2889 TRACE("(%p)->(%p)\n", This
, pmk
);
2890 IAdviseSink2_RemoteOnLinkSrcChange_Proxy(This
, pmk
);
2893 HRESULT __RPC_STUB
IAdviseSink2_OnLinkSrcChange_Stub(
2897 TRACE("(%p)->(%p)\n", This
, pmk
);
2898 IAdviseSink2_OnLinkSrcChange(This
, pmk
);
2902 HRESULT CALLBACK
IDataObject_GetData_Proxy(
2904 FORMATETC
*pformatetcIn
,
2907 TRACE("(%p)->(%p, %p)\n", This
, pformatetcIn
, pmedium
);
2908 return IDataObject_RemoteGetData_Proxy(This
, pformatetcIn
, pmedium
);
2911 HRESULT __RPC_STUB
IDataObject_GetData_Stub(
2913 FORMATETC
*pformatetcIn
,
2914 STGMEDIUM
*pRemoteMedium
)
2916 TRACE("(%p)->(%p, %p)\n", This
, pformatetcIn
, pRemoteMedium
);
2917 return IDataObject_GetData(This
, pformatetcIn
, pRemoteMedium
);
2920 HRESULT CALLBACK
IDataObject_GetDataHere_Proxy(IDataObject
*iface
, FORMATETC
*fmt
, STGMEDIUM
*med
)
2923 IStorage
*stg
= NULL
;
2926 TRACE("(%p)->(%p, %p)\n", iface
, fmt
, med
);
2928 if ((med
->tymed
& (TYMED_HGLOBAL
| TYMED_FILE
| TYMED_ISTREAM
| TYMED_ISTORAGE
)) == 0)
2930 if (med
->tymed
!= fmt
->tymed
)
2933 release
= med
->pUnkForRelease
;
2934 med
->pUnkForRelease
= NULL
;
2936 if (med
->tymed
== TYMED_ISTREAM
|| med
->tymed
== TYMED_ISTORAGE
)
2938 stg
= med
->u
.pstg
; /* This may actually be a stream, but that's ok */
2939 if (stg
) IStorage_AddRef( stg
);
2942 hr
= IDataObject_RemoteGetDataHere_Proxy(iface
, fmt
, med
);
2944 med
->pUnkForRelease
= release
;
2948 IStorage_Release( med
->u
.pstg
);
2955 HRESULT __RPC_STUB
IDataObject_GetDataHere_Stub(
2957 FORMATETC
*pformatetc
,
2958 STGMEDIUM
*pRemoteMedium
)
2960 TRACE("(%p)->(%p, %p)\n", This
, pformatetc
, pRemoteMedium
);
2961 return IDataObject_GetDataHere(This
, pformatetc
, pRemoteMedium
);
2964 HRESULT CALLBACK
IDataObject_SetData_Proxy(
2966 FORMATETC
*pformatetc
,
2974 HRESULT __RPC_STUB
IDataObject_SetData_Stub(
2976 FORMATETC
*pformatetc
,
2977 FLAG_STGMEDIUM
*pmedium
,
2984 /* call_as/local stubs for oleidl.idl */
2986 HRESULT CALLBACK
IOleInPlaceActiveObject_TranslateAccelerator_Proxy(
2987 IOleInPlaceActiveObject
* This
,
2990 TRACE("(%p %p)\n", This
, lpmsg
);
2991 return IOleInPlaceActiveObject_RemoteTranslateAccelerator_Proxy(This
);
2994 HRESULT __RPC_STUB
IOleInPlaceActiveObject_TranslateAccelerator_Stub(
2995 IOleInPlaceActiveObject
* This
)
2997 TRACE("(%p)\n", This
);
3001 HRESULT CALLBACK
IOleInPlaceActiveObject_ResizeBorder_Proxy(
3002 IOleInPlaceActiveObject
* This
,
3004 IOleInPlaceUIWindow
*pUIWindow
,
3011 HRESULT __RPC_STUB
IOleInPlaceActiveObject_ResizeBorder_Stub(
3012 IOleInPlaceActiveObject
* This
,
3015 IOleInPlaceUIWindow
*pUIWindow
,
3022 HRESULT CALLBACK
IOleCache2_UpdateCache_Proxy(
3024 LPDATAOBJECT pDataObject
,
3028 TRACE("(%p, %p, 0x%08x, %p)\n", This
, pDataObject
, grfUpdf
, pReserved
);
3029 return IOleCache2_RemoteUpdateCache_Proxy(This
, pDataObject
, grfUpdf
, (LONG_PTR
)pReserved
);
3032 HRESULT __RPC_STUB
IOleCache2_UpdateCache_Stub(
3034 LPDATAOBJECT pDataObject
,
3038 TRACE("(%p, %p, 0x%08x, %li)\n", This
, pDataObject
, grfUpdf
, pReserved
);
3039 return IOleCache2_UpdateCache(This
, pDataObject
, grfUpdf
, (void*)pReserved
);
3042 HRESULT CALLBACK
IEnumOLEVERB_Next_Proxy(
3046 ULONG
*pceltFetched
)
3049 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
3050 if (!pceltFetched
) pceltFetched
= &fetched
;
3051 return IEnumOLEVERB_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
3054 HRESULT __RPC_STUB
IEnumOLEVERB_Next_Stub(
3058 ULONG
*pceltFetched
)
3061 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
3063 hr
= IEnumOLEVERB_Next(This
, celt
, rgelt
, pceltFetched
);
3064 if (hr
== S_OK
) *pceltFetched
= celt
;
3068 HRESULT CALLBACK
IViewObject_Draw_Proxy(
3073 DVTARGETDEVICE
*ptd
,
3076 LPCRECTL lprcBounds
,
3077 LPCRECTL lprcWBounds
,
3078 BOOL (STDMETHODCALLTYPE
*pfnContinue
)(ULONG_PTR dwContinue
),
3079 ULONG_PTR dwContinue
)
3085 HRESULT __RPC_STUB
IViewObject_Draw_Stub(
3090 DVTARGETDEVICE
*ptd
,
3091 ULONG_PTR hdcTargetDev
,
3093 LPCRECTL lprcBounds
,
3094 LPCRECTL lprcWBounds
,
3095 IContinue
*pContinue
)
3101 HRESULT CALLBACK
IViewObject_GetColorSet_Proxy(
3106 DVTARGETDEVICE
*ptd
,
3108 LOGPALETTE
**ppColorSet
)
3114 HRESULT __RPC_STUB
IViewObject_GetColorSet_Stub(
3119 DVTARGETDEVICE
*ptd
,
3120 ULONG_PTR hicTargetDev
,
3121 LOGPALETTE
**ppColorSet
)
3127 HRESULT CALLBACK
IViewObject_Freeze_Proxy(
3138 HRESULT __RPC_STUB
IViewObject_Freeze_Stub(
3149 HRESULT CALLBACK
IViewObject_GetAdvise_Proxy(
3153 IAdviseSink
**ppAdvSink
)
3159 HRESULT __RPC_STUB
IViewObject_GetAdvise_Stub(
3163 IAdviseSink
**ppAdvSink
)