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/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(ole
);
42 #define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
43 #define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
44 #define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
45 #define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
47 #define USER_MARSHAL_PTR_PREFIX \
48 ( (DWORD)'U' | ( (DWORD)'s' << 8 ) | \
49 ( (DWORD)'e' << 16 ) | ( (DWORD)'r' << 24 ) )
51 static const char* debugstr_user_flags(ULONG
*pFlags
)
55 switch (LOWORD(*pFlags
))
58 loword
="MSHCTX_LOCAL";
60 case MSHCTX_NOSHAREDMEM
:
61 loword
="MSHCTX_NOSHAREDMEM";
63 case MSHCTX_DIFFERENTMACHINE
:
64 loword
="MSHCTX_DIFFERENTMACHINE";
67 loword
="MSHCTX_INPROC";
70 sprintf(buf
, "%d", LOWORD(*pFlags
));
74 if (HIWORD(*pFlags
) == NDR_LOCAL_DATA_REPRESENTATION
)
75 return wine_dbg_sprintf("MAKELONG(%s, NDR_LOCAL_DATA_REPRESENTATION)", loword
);
77 return wine_dbg_sprintf("MAKELONG(%s, 0x%04x)", loword
, HIWORD(*pFlags
));
80 /******************************************************************************
81 * CLIPFORMAT_UserSize [OLE32.@]
83 * Calculates the buffer size required to marshal a clip format.
86 * pFlags [I] Flags. See notes.
87 * StartingSize [I] Starting size of the buffer. This value is added on to
88 * the buffer size required for the clip format.
89 * pCF [I] Clip format to size.
92 * The buffer size required to marshal a clip format plus the starting size.
95 * Even though the function is documented to take a pointer to an unsigned
96 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
97 * the first parameter is an unsigned long.
98 * This function is only intended to be called by the RPC runtime.
100 ULONG __RPC_USER
CLIPFORMAT_UserSize(ULONG
*pFlags
, ULONG size
, CLIPFORMAT
*pCF
)
102 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags
), size
, pCF
);
104 ALIGN_LENGTH(size
, 3);
108 /* only need to marshal the name if it is not a pre-defined type and
109 * we are going remote */
110 if ((*pCF
>= 0xc000) && (LOWORD(*pFlags
) == MSHCTX_DIFFERENTMACHINE
))
114 size
+= 3 * sizeof(UINT
);
115 /* urg! this function is badly designed because it won't tell us how
116 * much space is needed without doing a dummy run of storing the
117 * name into a buffer */
118 ret
= GetClipboardFormatNameW(*pCF
, format
, ARRAY_SIZE(format
)-1);
120 RaiseException(DV_E_CLIPFORMAT
, 0, 0, NULL
);
121 size
+= (ret
+ 1) * sizeof(WCHAR
);
126 /******************************************************************************
127 * CLIPFORMAT_UserMarshal [OLE32.@]
129 * Marshals a clip format into a buffer.
132 * pFlags [I] Flags. See notes.
133 * pBuffer [I] Buffer to marshal the clip format into.
134 * pCF [I] Clip format to marshal.
137 * The end of the marshaled data in the buffer.
140 * Even though the function is documented to take a pointer to an unsigned
141 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
142 * the first parameter is an unsigned long.
143 * This function is only intended to be called by the RPC runtime.
145 unsigned char * __RPC_USER
CLIPFORMAT_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, CLIPFORMAT
*pCF
)
147 TRACE("(%s, %p, &0x%04x\n", debugstr_user_flags(pFlags
), pBuffer
, *pCF
);
149 ALIGN_POINTER(pBuffer
, 3);
151 /* only need to marshal the name if it is not a pre-defined type and
152 * we are going remote */
153 if ((*pCF
>= 0xc000) && (LOWORD(*pFlags
) == MSHCTX_DIFFERENTMACHINE
))
158 *(DWORD
*)pBuffer
= WDT_REMOTE_CALL
;
160 *(DWORD
*)pBuffer
= *pCF
;
163 len
= GetClipboardFormatNameW(*pCF
, format
, ARRAY_SIZE(format
)-1);
165 RaiseException(DV_E_CLIPFORMAT
, 0, 0, NULL
);
167 *(UINT
*)pBuffer
= len
;
168 pBuffer
+= sizeof(UINT
);
169 *(UINT
*)pBuffer
= 0;
170 pBuffer
+= sizeof(UINT
);
171 *(UINT
*)pBuffer
= len
;
172 pBuffer
+= sizeof(UINT
);
173 TRACE("marshaling format name %s\n", debugstr_w(format
));
174 memcpy(pBuffer
, format
, len
* sizeof(WCHAR
));
175 pBuffer
+= len
* sizeof(WCHAR
);
179 *(DWORD
*)pBuffer
= WDT_INPROC_CALL
;
181 *(DWORD
*)pBuffer
= *pCF
;
188 /******************************************************************************
189 * CLIPFORMAT_UserUnmarshal [OLE32.@]
191 * Unmarshals a clip format from a buffer.
194 * pFlags [I] Flags. See notes.
195 * pBuffer [I] Buffer to marshal the clip format from.
196 * pCF [O] Address that receive the unmarshaled clip format.
199 * The end of the marshaled data in the buffer.
202 * Even though the function is documented to take a pointer to an unsigned
203 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
204 * the first parameter is an unsigned long.
205 * This function is only intended to be called by the RPC runtime.
207 unsigned char * __RPC_USER
CLIPFORMAT_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, CLIPFORMAT
*pCF
)
211 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags
), pBuffer
, pCF
);
213 ALIGN_POINTER(pBuffer
, 3);
215 fContext
= *(DWORD
*)pBuffer
;
218 if (fContext
== WDT_INPROC_CALL
)
220 *pCF
= *(CLIPFORMAT
*)pBuffer
;
223 else if (fContext
== WDT_REMOTE_CALL
)
228 /* pointer ID for registered clip format string */
229 if (*(DWORD
*)pBuffer
== 0)
230 RaiseException(RPC_S_INVALID_BOUND
, 0, 0, NULL
);
233 len
= *(UINT
*)pBuffer
;
234 pBuffer
+= sizeof(UINT
);
235 if (*(UINT
*)pBuffer
!= 0)
236 RaiseException(RPC_S_INVALID_BOUND
, 0, 0, NULL
);
237 pBuffer
+= sizeof(UINT
);
238 if (*(UINT
*)pBuffer
!= len
)
239 RaiseException(RPC_S_INVALID_BOUND
, 0, 0, NULL
);
240 pBuffer
+= sizeof(UINT
);
241 if (((WCHAR
*)pBuffer
)[len
- 1] != '\0')
242 RaiseException(RPC_S_INVALID_BOUND
, 0, 0, NULL
);
243 TRACE("unmarshaling clip format %s\n", debugstr_w((LPCWSTR
)pBuffer
));
244 cf
= RegisterClipboardFormatW((LPCWSTR
)pBuffer
);
245 pBuffer
+= len
* sizeof(WCHAR
);
247 RaiseException(DV_E_CLIPFORMAT
, 0, 0, NULL
);
251 /* code not really appropriate, but nearest I can find */
252 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
256 /******************************************************************************
257 * CLIPFORMAT_UserFree [OLE32.@]
259 * Frees an unmarshaled clip format.
262 * pFlags [I] Flags. See notes.
263 * pCF [I] Clip format to free.
266 * The end of the marshaled data in the buffer.
269 * Even though the function is documented to take a pointer to an unsigned
270 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB
271 * structure, of which the first parameter is an unsigned long.
272 * This function is only intended to be called by the RPC runtime.
274 void __RPC_USER
CLIPFORMAT_UserFree(ULONG
*pFlags
, CLIPFORMAT
*pCF
)
276 /* there is no inverse of the RegisterClipboardFormat function,
277 * so nothing to do */
280 static ULONG
handle_UserSize(ULONG
*pFlags
, ULONG StartingSize
, HANDLE
*handle
)
282 if (LOWORD(*pFlags
) == MSHCTX_DIFFERENTMACHINE
)
284 ERR("can't remote a local handle\n");
285 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
289 ALIGN_LENGTH(StartingSize
, 3);
290 return StartingSize
+ sizeof(RemotableHandle
);
293 static unsigned char * handle_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HANDLE
*handle
)
295 RemotableHandle
*remhandle
;
296 if (LOWORD(*pFlags
) == MSHCTX_DIFFERENTMACHINE
)
298 ERR("can't remote a local handle\n");
299 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
303 ALIGN_POINTER(pBuffer
, 3);
304 remhandle
= (RemotableHandle
*)pBuffer
;
305 remhandle
->fContext
= WDT_INPROC_CALL
;
306 remhandle
->u
.hInproc
= (LONG_PTR
)*handle
;
307 return pBuffer
+ sizeof(RemotableHandle
);
310 static unsigned char * handle_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HANDLE
*handle
)
312 RemotableHandle
*remhandle
;
314 ALIGN_POINTER(pBuffer
, 3);
315 remhandle
= (RemotableHandle
*)pBuffer
;
316 if (remhandle
->fContext
!= WDT_INPROC_CALL
)
317 RaiseException(RPC_X_BAD_STUB_DATA
, 0, 0, NULL
);
318 *handle
= (HANDLE
)(LONG_PTR
)remhandle
->u
.hInproc
;
319 return pBuffer
+ sizeof(RemotableHandle
);
322 static void handle_UserFree(ULONG
*pFlags
, HANDLE
*handle
)
327 #define IMPL_WIREM_HANDLE(type) \
328 ULONG __RPC_USER type##_UserSize(ULONG *pFlags, ULONG StartingSize, type *handle) \
330 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, handle); \
331 return handle_UserSize(pFlags, StartingSize, (HANDLE *)handle); \
334 unsigned char * __RPC_USER type##_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
336 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *handle); \
337 return handle_UserMarshal(pFlags, pBuffer, (HANDLE *)handle); \
340 unsigned char * __RPC_USER type##_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
342 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, handle); \
343 return handle_UserUnmarshal(pFlags, pBuffer, (HANDLE *)handle); \
346 void __RPC_USER type##_UserFree(ULONG *pFlags, type *handle) \
348 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *handle); \
349 handle_UserFree(pFlags, (HANDLE *)handle); \
352 IMPL_WIREM_HANDLE(HACCEL
)
353 IMPL_WIREM_HANDLE(HMENU
)
354 IMPL_WIREM_HANDLE(HWND
)
355 IMPL_WIREM_HANDLE(HDC
)
356 IMPL_WIREM_HANDLE(HICON
)
357 IMPL_WIREM_HANDLE(HBRUSH
)
359 /******************************************************************************
360 * HGLOBAL_UserSize [OLE32.@]
362 * Calculates the buffer size required to marshal an HGLOBAL.
365 * pFlags [I] Flags. See notes.
366 * StartingSize [I] Starting size of the buffer. This value is added on to
367 * the buffer size required for the clip format.
368 * phGlobal [I] HGLOBAL to size.
371 * The buffer size required to marshal an HGLOBAL plus the starting size.
374 * Even though the function is documented to take a pointer to a ULONG in
375 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
376 * the first parameter is a ULONG.
377 * This function is only intended to be called by the RPC runtime.
379 ULONG __RPC_USER
HGLOBAL_UserSize(ULONG
*pFlags
, ULONG StartingSize
, HGLOBAL
*phGlobal
)
381 ULONG size
= StartingSize
;
383 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags
), StartingSize
, phGlobal
);
385 ALIGN_LENGTH(size
, 3);
387 size
+= sizeof(ULONG
);
389 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
390 size
+= sizeof(HGLOBAL
);
393 size
+= sizeof(ULONG
);
397 size
+= 3 * sizeof(ULONG
);
398 ret
= GlobalSize(*phGlobal
);
406 /******************************************************************************
407 * HGLOBAL_UserMarshal [OLE32.@]
409 * Marshals an HGLOBAL into a buffer.
412 * pFlags [I] Flags. See notes.
413 * pBuffer [I] Buffer to marshal the clip format into.
414 * phGlobal [I] HGLOBAL to marshal.
417 * The end of the marshaled data in the buffer.
420 * Even though the function is documented to take a pointer to a ULONG in
421 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
422 * the first parameter is a ULONG.
423 * This function is only intended to be called by the RPC runtime.
425 unsigned char * __RPC_USER
HGLOBAL_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HGLOBAL
*phGlobal
)
427 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags
), pBuffer
, *phGlobal
);
429 ALIGN_POINTER(pBuffer
, 3);
431 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
433 if (sizeof(*phGlobal
) == 8)
434 *(ULONG
*)pBuffer
= WDT_INPROC64_CALL
;
436 *(ULONG
*)pBuffer
= WDT_INPROC_CALL
;
437 pBuffer
+= sizeof(ULONG
);
438 *(HGLOBAL
*)pBuffer
= *phGlobal
;
439 pBuffer
+= sizeof(HGLOBAL
);
443 *(ULONG
*)pBuffer
= WDT_REMOTE_CALL
;
444 pBuffer
+= sizeof(ULONG
);
445 *(ULONG
*)pBuffer
= HandleToULong(*phGlobal
);
446 pBuffer
+= sizeof(ULONG
);
449 const unsigned char *memory
;
450 SIZE_T size
= GlobalSize(*phGlobal
);
451 *(ULONG
*)pBuffer
= (ULONG
)size
;
452 pBuffer
+= sizeof(ULONG
);
453 *(ULONG
*)pBuffer
= HandleToULong(*phGlobal
);
454 pBuffer
+= sizeof(ULONG
);
455 *(ULONG
*)pBuffer
= (ULONG
)size
;
456 pBuffer
+= sizeof(ULONG
);
458 memory
= GlobalLock(*phGlobal
);
459 memcpy(pBuffer
, memory
, size
);
461 GlobalUnlock(*phGlobal
);
468 /******************************************************************************
469 * HGLOBAL_UserUnmarshal [OLE32.@]
471 * Unmarshals an HGLOBAL from a buffer.
474 * pFlags [I] Flags. See notes.
475 * pBuffer [I] Buffer to marshal the clip format from.
476 * phGlobal [O] Address that receive the unmarshaled HGLOBAL.
479 * The end of the marshaled data in the buffer.
482 * Even though the function is documented to take a pointer to an ULONG in
483 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
484 * the first parameter is an ULONG.
485 * This function is only intended to be called by the RPC runtime.
487 unsigned char * __RPC_USER
HGLOBAL_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HGLOBAL
*phGlobal
)
491 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags
), pBuffer
, *phGlobal
);
493 ALIGN_POINTER(pBuffer
, 3);
495 fContext
= *(ULONG
*)pBuffer
;
496 pBuffer
+= sizeof(ULONG
);
498 if (((fContext
== WDT_INPROC_CALL
) && (sizeof(*phGlobal
) < 8)) ||
499 ((fContext
== WDT_INPROC64_CALL
) && (sizeof(*phGlobal
) == 8)))
501 *phGlobal
= *(HGLOBAL
*)pBuffer
;
502 pBuffer
+= sizeof(*phGlobal
);
504 else if (fContext
== WDT_REMOTE_CALL
)
508 handle
= *(ULONG
*)pBuffer
;
509 pBuffer
+= sizeof(ULONG
);
516 size
= *(ULONG
*)pBuffer
;
517 pBuffer
+= sizeof(ULONG
);
518 /* redundancy is bad - it means you have to check consistency like
520 if (*(ULONG
*)pBuffer
!= handle
)
522 RaiseException(RPC_X_BAD_STUB_DATA
, 0, 0, NULL
);
525 pBuffer
+= sizeof(ULONG
);
526 /* redundancy is bad - it means you have to check consistency like
528 if (*(ULONG
*)pBuffer
!= size
)
530 RaiseException(RPC_X_BAD_STUB_DATA
, 0, 0, NULL
);
533 pBuffer
+= sizeof(ULONG
);
535 /* FIXME: check size is not too big */
537 *phGlobal
= GlobalAlloc(GMEM_MOVEABLE
, size
);
538 memory
= GlobalLock(*phGlobal
);
539 memcpy(memory
, pBuffer
, size
);
541 GlobalUnlock(*phGlobal
);
547 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
552 /******************************************************************************
553 * HGLOBAL_UserFree [OLE32.@]
555 * Frees an unmarshaled HGLOBAL.
558 * pFlags [I] Flags. See notes.
559 * phGlobal [I] HGLOBAL to free.
562 * The end of the marshaled data in the buffer.
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
567 * which the first parameter is a ULONG.
568 * This function is only intended to be called by the RPC runtime.
570 void __RPC_USER
HGLOBAL_UserFree(ULONG
*pFlags
, HGLOBAL
*phGlobal
)
572 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags
), *phGlobal
);
574 if (LOWORD(*pFlags
) != MSHCTX_INPROC
&& *phGlobal
)
575 GlobalFree(*phGlobal
);
578 /******************************************************************************
579 * HBITMAP_UserSize [OLE32.@]
581 * Calculates the buffer size required to marshal a bitmap.
584 * pFlags [I] Flags. See notes.
585 * StartingSize [I] Starting size of the buffer. This value is added on to
586 * the buffer size required for the clip format.
587 * phBmp [I] Bitmap to size.
590 * The buffer size required to marshal an bitmap plus the starting size.
593 * Even though the function is documented to take a pointer to a ULONG in
594 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
595 * the first parameter is a ULONG.
596 * This function is only intended to be called by the RPC runtime.
598 ULONG __RPC_USER
HBITMAP_UserSize(ULONG
*flags
, ULONG size
, HBITMAP
*bmp
)
600 TRACE("(%s, %d, %p)\n", debugstr_user_flags(flags
), size
, *bmp
);
602 ALIGN_LENGTH(size
, 3);
604 size
+= sizeof(ULONG
);
605 if (LOWORD(*flags
) == MSHCTX_INPROC
)
606 size
+= sizeof(ULONG
);
609 size
+= sizeof(ULONG
);
613 size
+= sizeof(ULONG
);
614 size
+= FIELD_OFFSET(userBITMAP
, cbSize
);
615 size
+= GetBitmapBits(*bmp
, 0, NULL
);
622 /******************************************************************************
623 * HBITMAP_UserMarshal [OLE32.@]
625 * Marshals a bitmap into a buffer.
628 * pFlags [I] Flags. See notes.
629 * pBuffer [I] Buffer to marshal the clip format into.
630 * phBmp [I] Bitmap to marshal.
633 * The end of the marshaled data in the buffer.
636 * Even though the function is documented to take a pointer to a ULONG in
637 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
638 * the first parameter is a ULONG.
639 * This function is only intended to be called by the RPC runtime.
641 unsigned char * __RPC_USER
HBITMAP_UserMarshal(ULONG
*flags
, unsigned char *buffer
, HBITMAP
*bmp
)
643 TRACE("(%s, %p, %p)\n", debugstr_user_flags(flags
), buffer
, *bmp
);
645 ALIGN_POINTER(buffer
, 3);
647 if (LOWORD(*flags
) == MSHCTX_INPROC
)
649 *(ULONG
*)buffer
= WDT_INPROC_CALL
;
650 buffer
+= sizeof(ULONG
);
651 *(ULONG
*)buffer
= (ULONG
)(ULONG_PTR
)*bmp
;
652 buffer
+= sizeof(ULONG
);
656 *(ULONG
*)buffer
= WDT_REMOTE_CALL
;
657 buffer
+= sizeof(ULONG
);
658 *(ULONG
*)buffer
= (ULONG
)(ULONG_PTR
)*bmp
;
659 buffer
+= sizeof(ULONG
);
663 static const ULONG header_size
= FIELD_OFFSET(userBITMAP
, cbSize
);
667 bitmap_size
= GetBitmapBits(*bmp
, 0, NULL
);
668 *(ULONG
*)buffer
= bitmap_size
;
669 buffer
+= sizeof(ULONG
);
671 GetObjectW(*bmp
, sizeof(BITMAP
), &bitmap
);
672 memcpy(buffer
, &bitmap
, header_size
);
673 buffer
+= header_size
;
675 GetBitmapBits(*bmp
, bitmap_size
, buffer
);
676 buffer
+= bitmap_size
;
682 /******************************************************************************
683 * HBITMAP_UserUnmarshal [OLE32.@]
685 * Unmarshals a bitmap from a buffer.
688 * pFlags [I] Flags. See notes.
689 * pBuffer [I] Buffer to marshal the clip format from.
690 * phBmp [O] Address that receive the unmarshaled bitmap.
693 * The end of the marshaled data in the buffer.
696 * Even though the function is documented to take a pointer to an ULONG in
697 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
698 * the first parameter is an ULONG.
699 * This function is only intended to be called by the RPC runtime.
701 unsigned char * __RPC_USER
HBITMAP_UserUnmarshal(ULONG
*flags
, unsigned char *buffer
, HBITMAP
*bmp
)
705 TRACE("(%s, %p, %p)\n", debugstr_user_flags(flags
), buffer
, bmp
);
707 ALIGN_POINTER(buffer
, 3);
709 context
= *(ULONG
*)buffer
;
710 buffer
+= sizeof(ULONG
);
712 if (context
== WDT_INPROC_CALL
)
714 *bmp
= *(HBITMAP
*)buffer
;
715 buffer
+= sizeof(*bmp
);
717 else if (context
== WDT_REMOTE_CALL
)
719 ULONG handle
= *(ULONG
*)buffer
;
720 buffer
+= sizeof(ULONG
);
724 static const ULONG header_size
= FIELD_OFFSET(userBITMAP
, cbSize
);
729 bitmap_size
= *(ULONG
*)buffer
;
730 buffer
+= sizeof(ULONG
);
731 bits
= HeapAlloc(GetProcessHeap(), 0, bitmap_size
);
733 memcpy(&bitmap
, buffer
, header_size
);
734 buffer
+= header_size
;
736 memcpy(bits
, buffer
, bitmap_size
);
737 buffer
+= bitmap_size
;
739 bitmap
.bmBits
= bits
;
740 *bmp
= CreateBitmapIndirect(&bitmap
);
742 HeapFree(GetProcessHeap(), 0, bits
);
748 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
753 /******************************************************************************
754 * HBITMAP_UserFree [OLE32.@]
756 * Frees an unmarshaled bitmap.
759 * pFlags [I] Flags. See notes.
760 * phBmp [I] Bitmap to free.
763 * The end of the marshaled data in the buffer.
766 * Even though the function is documented to take a pointer to a ULONG in
767 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
768 * which the first parameter is a ULONG.
769 * This function is only intended to be called by the RPC runtime.
771 void __RPC_USER
HBITMAP_UserFree(ULONG
*flags
, HBITMAP
*bmp
)
773 TRACE("(%s, %p)\n", debugstr_user_flags(flags
), *bmp
);
775 if (LOWORD(*flags
) != MSHCTX_INPROC
)
779 /******************************************************************************
780 * HPALETTE_UserSize [OLE32.@]
782 * Calculates the buffer size required to marshal a palette.
785 * pFlags [I] Flags. See notes.
786 * StartingSize [I] Starting size of the buffer. This value is added on to
787 * the buffer size required for the clip format.
788 * phPal [I] Palette to size.
791 * The buffer size required to marshal a palette plus the starting size.
794 * Even though the function is documented to take a pointer to a ULONG in
795 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
796 * the first parameter is a ULONG.
797 * This function is only intended to be called by the RPC runtime.
799 ULONG __RPC_USER
HPALETTE_UserSize(ULONG
*pFlags
, ULONG StartingSize
, HPALETTE
*phPal
)
805 /******************************************************************************
806 * HPALETTE_UserMarshal [OLE32.@]
808 * Marshals a palette into a buffer.
811 * pFlags [I] Flags. See notes.
812 * pBuffer [I] Buffer to marshal the clip format into.
813 * phPal [I] Palette to marshal.
816 * The end of the marshaled data in the buffer.
819 * Even though the function is documented to take a pointer to a ULONG in
820 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
821 * the first parameter is a ULONG.
822 * This function is only intended to be called by the RPC runtime.
824 unsigned char * __RPC_USER
HPALETTE_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HPALETTE
*phPal
)
830 /******************************************************************************
831 * HPALETTE_UserUnmarshal [OLE32.@]
833 * Unmarshals a palette from a buffer.
836 * pFlags [I] Flags. See notes.
837 * pBuffer [I] Buffer to marshal the clip format from.
838 * phPal [O] Address that receive the unmarshaled palette.
841 * The end of the marshaled data in the buffer.
844 * Even though the function is documented to take a pointer to an ULONG in
845 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
846 * the first parameter is an ULONG.
847 * This function is only intended to be called by the RPC runtime.
849 unsigned char * __RPC_USER
HPALETTE_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HPALETTE
*phPal
)
855 /******************************************************************************
856 * HPALETTE_UserFree [OLE32.@]
858 * Frees an unmarshaled palette.
861 * pFlags [I] Flags. See notes.
862 * phPal [I] Palette to free.
865 * The end of the marshaled data in the buffer.
868 * Even though the function is documented to take a pointer to a ULONG in
869 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
870 * which the first parameter is a ULONG.
871 * This function is only intended to be called by the RPC runtime.
873 void __RPC_USER
HPALETTE_UserFree(ULONG
*pFlags
, HPALETTE
*phPal
)
879 /******************************************************************************
880 * HMETAFILE_UserSize [OLE32.@]
882 * Calculates the buffer size required to marshal a metafile.
885 * pFlags [I] Flags. See notes.
886 * StartingSize [I] Starting size of the buffer. This value is added on to
887 * the buffer size required for the clip format.
888 * phmf [I] Metafile to size.
891 * The buffer size required to marshal a metafile plus the starting size.
894 * Even though the function is documented to take a pointer to a ULONG in
895 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
896 * the first parameter is a ULONG.
897 * This function is only intended to be called by the RPC runtime.
899 ULONG __RPC_USER
HMETAFILE_UserSize(ULONG
*pFlags
, ULONG StartingSize
, HMETAFILE
*phmf
)
901 ULONG size
= StartingSize
;
903 TRACE("(%s, %d, &%p\n", debugstr_user_flags(pFlags
), StartingSize
, *phmf
);
905 ALIGN_LENGTH(size
, 3);
907 size
+= sizeof(ULONG
);
908 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
909 size
+= sizeof(ULONG_PTR
);
912 size
+= sizeof(ULONG
);
918 size
+= 2 * sizeof(ULONG
);
919 mfsize
= GetMetaFileBitsEx(*phmf
, 0, NULL
);
927 /******************************************************************************
928 * HMETAFILE_UserMarshal [OLE32.@]
930 * Marshals a metafile into a buffer.
933 * pFlags [I] Flags. See notes.
934 * pBuffer [I] Buffer to marshal the clip format into.
935 * phEmf [I] Metafile to marshal.
938 * The end of the marshaled data in the buffer.
941 * Even though the function is documented to take a pointer to a ULONG in
942 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
943 * the first parameter is a ULONG.
944 * This function is only intended to be called by the RPC runtime.
946 unsigned char * __RPC_USER
HMETAFILE_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HMETAFILE
*phmf
)
948 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags
), pBuffer
, *phmf
);
950 ALIGN_POINTER(pBuffer
, 3);
952 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
954 if (sizeof(*phmf
) == 8)
955 *(ULONG
*)pBuffer
= WDT_INPROC64_CALL
;
957 *(ULONG
*)pBuffer
= WDT_INPROC_CALL
;
958 pBuffer
+= sizeof(ULONG
);
959 *(HMETAFILE
*)pBuffer
= *phmf
;
960 pBuffer
+= sizeof(HMETAFILE
);
964 *(ULONG
*)pBuffer
= WDT_REMOTE_CALL
;
965 pBuffer
+= sizeof(ULONG
);
966 *(ULONG
*)pBuffer
= (ULONG
)(ULONG_PTR
)*phmf
;
967 pBuffer
+= sizeof(ULONG
);
971 UINT mfsize
= GetMetaFileBitsEx(*phmf
, 0, NULL
);
973 *(ULONG
*)pBuffer
= mfsize
;
974 pBuffer
+= sizeof(ULONG
);
975 *(ULONG
*)pBuffer
= mfsize
;
976 pBuffer
+= sizeof(ULONG
);
977 GetMetaFileBitsEx(*phmf
, mfsize
, pBuffer
);
985 /******************************************************************************
986 * HMETAFILE_UserUnmarshal [OLE32.@]
988 * Unmarshals a metafile from a buffer.
991 * pFlags [I] Flags. See notes.
992 * pBuffer [I] Buffer to marshal the clip format from.
993 * phmf [O] Address that receive the unmarshaled metafile.
996 * The end of the marshaled data in the buffer.
999 * Even though the function is documented to take a pointer to an ULONG in
1000 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1001 * the first parameter is an ULONG.
1002 * This function is only intended to be called by the RPC runtime.
1004 unsigned char * __RPC_USER
HMETAFILE_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HMETAFILE
*phmf
)
1008 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags
), pBuffer
, phmf
);
1010 ALIGN_POINTER(pBuffer
, 3);
1012 fContext
= *(ULONG
*)pBuffer
;
1013 pBuffer
+= sizeof(ULONG
);
1015 if (((fContext
== WDT_INPROC_CALL
) && (sizeof(*phmf
) < 8)) ||
1016 ((fContext
== WDT_INPROC64_CALL
) && (sizeof(*phmf
) == 8)))
1018 *phmf
= *(HMETAFILE
*)pBuffer
;
1019 pBuffer
+= sizeof(*phmf
);
1021 else if (fContext
== WDT_REMOTE_CALL
)
1025 handle
= *(ULONG
*)pBuffer
;
1026 pBuffer
+= sizeof(ULONG
);
1031 size
= *(ULONG
*)pBuffer
;
1032 pBuffer
+= sizeof(ULONG
);
1033 if (size
!= *(ULONG
*)pBuffer
)
1035 RaiseException(RPC_X_BAD_STUB_DATA
, 0, 0, NULL
);
1038 pBuffer
+= sizeof(ULONG
);
1039 *phmf
= SetMetaFileBitsEx(size
, pBuffer
);
1046 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
1051 /******************************************************************************
1052 * HMETAFILE_UserFree [OLE32.@]
1054 * Frees an unmarshaled metafile.
1057 * pFlags [I] Flags. See notes.
1058 * phmf [I] Metafile to free.
1061 * The end of the marshaled data in the buffer.
1064 * Even though the function is documented to take a pointer to a ULONG in
1065 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1066 * which the first parameter is a ULONG.
1067 * This function is only intended to be called by the RPC runtime.
1069 void __RPC_USER
HMETAFILE_UserFree(ULONG
*pFlags
, HMETAFILE
*phmf
)
1071 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags
), *phmf
);
1073 if (LOWORD(*pFlags
) != MSHCTX_INPROC
)
1074 DeleteMetaFile(*phmf
);
1077 /******************************************************************************
1078 * HENHMETAFILE_UserSize [OLE32.@]
1080 * Calculates the buffer size required to marshal an enhanced metafile.
1083 * pFlags [I] Flags. See notes.
1084 * StartingSize [I] Starting size of the buffer. This value is added on to
1085 * the buffer size required for the clip format.
1086 * phEmf [I] Enhanced metafile to size.
1089 * The buffer size required to marshal an enhanced metafile plus the starting size.
1092 * Even though the function is documented to take a pointer to a ULONG in
1093 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1094 * the first parameter is a ULONG.
1095 * This function is only intended to be called by the RPC runtime.
1097 ULONG __RPC_USER
HENHMETAFILE_UserSize(ULONG
*pFlags
, ULONG size
, HENHMETAFILE
*phEmf
)
1099 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags
), size
, *phEmf
);
1101 ALIGN_LENGTH(size
, 3);
1103 size
+= sizeof(ULONG
);
1104 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
1105 size
+= sizeof(ULONG_PTR
);
1108 size
+= sizeof(ULONG
);
1114 size
+= 2 * sizeof(ULONG
);
1115 emfsize
= GetEnhMetaFileBits(*phEmf
, 0, NULL
);
1123 /******************************************************************************
1124 * HENHMETAFILE_UserMarshal [OLE32.@]
1126 * Marshals an enhance metafile into a buffer.
1129 * pFlags [I] Flags. See notes.
1130 * pBuffer [I] Buffer to marshal the clip format into.
1131 * phEmf [I] Enhanced metafile to marshal.
1134 * The end of the marshaled data in the buffer.
1137 * Even though the function is documented to take a pointer to a ULONG in
1138 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1139 * the first parameter is a ULONG.
1140 * This function is only intended to be called by the RPC runtime.
1142 unsigned char * __RPC_USER
HENHMETAFILE_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HENHMETAFILE
*phEmf
)
1144 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags
), pBuffer
, *phEmf
);
1146 ALIGN_POINTER(pBuffer
, 3);
1148 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
1150 if (sizeof(*phEmf
) == 8)
1151 *(ULONG
*)pBuffer
= WDT_INPROC64_CALL
;
1153 *(ULONG
*)pBuffer
= WDT_INPROC_CALL
;
1154 pBuffer
+= sizeof(ULONG
);
1155 *(HENHMETAFILE
*)pBuffer
= *phEmf
;
1156 pBuffer
+= sizeof(HENHMETAFILE
);
1160 *(ULONG
*)pBuffer
= WDT_REMOTE_CALL
;
1161 pBuffer
+= sizeof(ULONG
);
1162 *(ULONG
*)pBuffer
= (ULONG
)(ULONG_PTR
)*phEmf
;
1163 pBuffer
+= sizeof(ULONG
);
1167 UINT emfsize
= GetEnhMetaFileBits(*phEmf
, 0, NULL
);
1169 *(ULONG
*)pBuffer
= emfsize
;
1170 pBuffer
+= sizeof(ULONG
);
1171 *(ULONG
*)pBuffer
= emfsize
;
1172 pBuffer
+= sizeof(ULONG
);
1173 GetEnhMetaFileBits(*phEmf
, emfsize
, pBuffer
);
1181 /******************************************************************************
1182 * HENHMETAFILE_UserUnmarshal [OLE32.@]
1184 * Unmarshals an enhanced metafile from a buffer.
1187 * pFlags [I] Flags. See notes.
1188 * pBuffer [I] Buffer to marshal the clip format from.
1189 * phEmf [O] Address that receive the unmarshaled enhanced metafile.
1192 * The end of the marshaled data in the buffer.
1195 * Even though the function is documented to take a pointer to an ULONG in
1196 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1197 * the first parameter is an ULONG.
1198 * This function is only intended to be called by the RPC runtime.
1200 unsigned char * __RPC_USER
HENHMETAFILE_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HENHMETAFILE
*phEmf
)
1204 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags
), pBuffer
, phEmf
);
1206 ALIGN_POINTER(pBuffer
, 3);
1208 fContext
= *(ULONG
*)pBuffer
;
1209 pBuffer
+= sizeof(ULONG
);
1211 if (((fContext
== WDT_INPROC_CALL
) && (sizeof(*phEmf
) < 8)) ||
1212 ((fContext
== WDT_INPROC64_CALL
) && (sizeof(*phEmf
) == 8)))
1214 *phEmf
= *(HENHMETAFILE
*)pBuffer
;
1215 pBuffer
+= sizeof(*phEmf
);
1217 else if (fContext
== WDT_REMOTE_CALL
)
1221 handle
= *(ULONG
*)pBuffer
;
1222 pBuffer
+= sizeof(ULONG
);
1227 size
= *(ULONG
*)pBuffer
;
1228 pBuffer
+= sizeof(ULONG
);
1229 if (size
!= *(ULONG
*)pBuffer
)
1231 RaiseException(RPC_X_BAD_STUB_DATA
, 0, 0, NULL
);
1234 pBuffer
+= sizeof(ULONG
);
1235 *phEmf
= SetEnhMetaFileBits(size
, pBuffer
);
1242 RaiseException(RPC_S_INVALID_TAG
, 0, 0, NULL
);
1247 /******************************************************************************
1248 * HENHMETAFILE_UserFree [OLE32.@]
1250 * Frees an unmarshaled enhanced metafile.
1253 * pFlags [I] Flags. See notes.
1254 * phEmf [I] Enhanced metafile to free.
1257 * The end of the marshaled data in the buffer.
1260 * Even though the function is documented to take a pointer to a ULONG in
1261 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1262 * which the first parameter is a ULONG.
1263 * This function is only intended to be called by the RPC runtime.
1265 void __RPC_USER
HENHMETAFILE_UserFree(ULONG
*pFlags
, HENHMETAFILE
*phEmf
)
1267 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags
), *phEmf
);
1269 if (LOWORD(*pFlags
) != MSHCTX_INPROC
)
1270 DeleteEnhMetaFile(*phEmf
);
1273 /******************************************************************************
1274 * HMETAFILEPICT_UserSize [OLE32.@]
1276 * Calculates the buffer size required to marshal an metafile pict.
1279 * pFlags [I] Flags. See notes.
1280 * StartingSize [I] Starting size of the buffer. This value is added on to
1281 * the buffer size required for the clip format.
1282 * phMfp [I] Metafile pict to size.
1285 * The buffer size required to marshal a metafile pict plus the starting size.
1288 * Even though the function is documented to take a pointer to a ULONG in
1289 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1290 * the first parameter is a ULONG.
1291 * This function is only intended to be called by the RPC runtime.
1293 ULONG __RPC_USER
HMETAFILEPICT_UserSize(ULONG
*pFlags
, ULONG size
, HMETAFILEPICT
*phMfp
)
1295 TRACE("(%s, %d, &%p)\n", debugstr_user_flags(pFlags
), size
, *phMfp
);
1297 ALIGN_LENGTH(size
, 3);
1299 size
+= sizeof(ULONG
);
1301 if(LOWORD(*pFlags
) == MSHCTX_INPROC
)
1302 size
+= sizeof(HMETAFILEPICT
);
1305 size
+= sizeof(ULONG
);
1309 METAFILEPICT
*mfpict
= GlobalLock(*phMfp
);
1311 /* FIXME: raise an exception if mfpict is NULL? */
1312 size
+= 3 * sizeof(ULONG
);
1313 size
+= sizeof(ULONG
);
1315 size
= HMETAFILE_UserSize(pFlags
, size
, &mfpict
->hMF
);
1317 GlobalUnlock(*phMfp
);
1324 /******************************************************************************
1325 * HMETAFILEPICT_UserMarshal [OLE32.@]
1327 * Marshals a metafile pict into a buffer.
1330 * pFlags [I] Flags. See notes.
1331 * pBuffer [I] Buffer to marshal the clip format into.
1332 * phMfp [I] Metafile pict to marshal.
1335 * The end of the marshaled data in the buffer.
1338 * Even though the function is documented to take a pointer to a ULONG in
1339 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1340 * the first parameter is a ULONG.
1341 * This function is only intended to be called by the RPC runtime.
1343 unsigned char * __RPC_USER
HMETAFILEPICT_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HMETAFILEPICT
*phMfp
)
1345 TRACE("(%s, %p, &%p)\n", debugstr_user_flags(pFlags
), pBuffer
, *phMfp
);
1347 ALIGN_POINTER(pBuffer
, 3);
1349 if (LOWORD(*pFlags
) == MSHCTX_INPROC
)
1351 if (sizeof(HMETAFILEPICT
) == 8)
1352 *(ULONG
*)pBuffer
= WDT_INPROC64_CALL
;
1354 *(ULONG
*)pBuffer
= WDT_INPROC_CALL
;
1355 pBuffer
+= sizeof(ULONG
);
1356 *(HMETAFILEPICT
*)pBuffer
= *phMfp
;
1357 pBuffer
+= sizeof(HMETAFILEPICT
);
1361 *(ULONG
*)pBuffer
= WDT_REMOTE_CALL
;
1362 pBuffer
+= sizeof(ULONG
);
1363 *(ULONG
*)pBuffer
= (ULONG
)(ULONG_PTR
)*phMfp
;
1364 pBuffer
+= sizeof(ULONG
);
1368 METAFILEPICT
*mfpict
= GlobalLock(*phMfp
);
1369 remoteMETAFILEPICT
* remmfpict
= (remoteMETAFILEPICT
*)pBuffer
;
1371 /* FIXME: raise an exception if mfpict is NULL? */
1372 remmfpict
->mm
= mfpict
->mm
;
1373 remmfpict
->xExt
= mfpict
->xExt
;
1374 remmfpict
->yExt
= mfpict
->yExt
;
1375 pBuffer
+= 3 * sizeof(ULONG
);
1376 *(ULONG
*)pBuffer
= USER_MARSHAL_PTR_PREFIX
;
1377 pBuffer
+= sizeof(ULONG
);
1379 pBuffer
= HMETAFILE_UserMarshal(pFlags
, pBuffer
, &mfpict
->hMF
);
1381 GlobalUnlock(*phMfp
);
1387 /******************************************************************************
1388 * HMETAFILEPICT_UserUnmarshal [OLE32.@]
1390 * Unmarshals an metafile pict from a buffer.
1393 * pFlags [I] Flags. See notes.
1394 * pBuffer [I] Buffer to marshal the clip format from.
1395 * phMfp [O] Address that receive the unmarshaled metafile pict.
1398 * The end of the marshaled data in the buffer.
1401 * Even though the function is documented to take a pointer to an ULONG in
1402 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1403 * the first parameter is an ULONG.
1404 * This function is only intended to be called by the RPC runtime.
1406 unsigned char * __RPC_USER
HMETAFILEPICT_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, HMETAFILEPICT
*phMfp
)
1410 TRACE("(%s, %p, %p)\n", debugstr_user_flags(pFlags
), pBuffer
, phMfp
);
1412 ALIGN_POINTER(pBuffer
, 3);
1414 fContext
= *(ULONG
*)pBuffer
;
1415 pBuffer
+= sizeof(ULONG
);
1417 if ((fContext
== WDT_INPROC_CALL
) || fContext
== WDT_INPROC64_CALL
)
1419 *phMfp
= *(HMETAFILEPICT
*)pBuffer
;
1420 pBuffer
+= sizeof(HMETAFILEPICT
);
1424 ULONG handle
= *(ULONG
*)pBuffer
;
1425 pBuffer
+= sizeof(ULONG
);
1430 METAFILEPICT
*mfpict
;
1431 const remoteMETAFILEPICT
*remmfpict
;
1432 ULONG user_marshal_prefix
;
1434 remmfpict
= (const remoteMETAFILEPICT
*)pBuffer
;
1436 *phMfp
= GlobalAlloc(GMEM_MOVEABLE
, sizeof(METAFILEPICT
));
1438 RpcRaiseException(E_OUTOFMEMORY
);
1440 mfpict
= GlobalLock(*phMfp
);
1441 mfpict
->mm
= remmfpict
->mm
;
1442 mfpict
->xExt
= remmfpict
->xExt
;
1443 mfpict
->yExt
= remmfpict
->yExt
;
1444 pBuffer
+= 3 * sizeof(ULONG
);
1445 user_marshal_prefix
= *(ULONG
*)pBuffer
;
1446 pBuffer
+= sizeof(ULONG
);
1448 if (user_marshal_prefix
!= USER_MARSHAL_PTR_PREFIX
)
1449 RpcRaiseException(RPC_X_INVALID_TAG
);
1451 pBuffer
= HMETAFILE_UserUnmarshal(pFlags
, pBuffer
, &mfpict
->hMF
);
1453 GlobalUnlock(*phMfp
);
1459 /******************************************************************************
1460 * HMETAFILEPICT_UserFree [OLE32.@]
1462 * Frees an unmarshaled metafile pict.
1465 * pFlags [I] Flags. See notes.
1466 * phMfp [I] Metafile pict to free.
1469 * The end of the marshaled data in the buffer.
1472 * Even though the function is documented to take a pointer to a ULONG in
1473 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1474 * which the first parameter is a ULONG.
1475 * This function is only intended to be called by the RPC runtime.
1477 void __RPC_USER
HMETAFILEPICT_UserFree(ULONG
*pFlags
, HMETAFILEPICT
*phMfp
)
1479 TRACE("(%s, &%p)\n", debugstr_user_flags(pFlags
), *phMfp
);
1481 if ((LOWORD(*pFlags
) != MSHCTX_INPROC
) && *phMfp
)
1483 METAFILEPICT
*mfpict
;
1485 mfpict
= GlobalLock(*phMfp
);
1486 /* FIXME: raise an exception if mfpict is NULL? */
1487 HMETAFILE_UserFree(pFlags
, &mfpict
->hMF
);
1488 GlobalUnlock(*phMfp
);
1494 /******************************************************************************
1495 * WdtpInterfacePointer_UserSize [OLE32.@]
1497 * Calculates the buffer size required to marshal an interface pointer.
1500 * pFlags [I] Flags. See notes.
1501 * RealFlags [I] The MSHCTX to use when marshaling the interface.
1502 * punk [I] Interface pointer to size.
1503 * StartingSize [I] Starting size of the buffer. This value is added on to
1504 * the buffer size required for the clip format.
1505 * riid [I] ID of interface to size.
1508 * The buffer size required to marshal an interface pointer plus the starting size.
1511 * Even though the function is documented to take a pointer to a ULONG in
1512 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1513 * the first parameter is a ULONG.
1515 ULONG __RPC_USER
WdtpInterfacePointer_UserSize(ULONG
*pFlags
, ULONG RealFlags
, ULONG StartingSize
, IUnknown
*punk
, REFIID riid
)
1517 DWORD marshal_size
= 0;
1520 TRACE("(%s, 0%x, %d, %p, %s)\n", debugstr_user_flags(pFlags
), RealFlags
, StartingSize
, punk
, debugstr_guid(riid
));
1522 hr
= CoGetMarshalSizeMax(&marshal_size
, riid
, punk
, LOWORD(RealFlags
), NULL
, MSHLFLAGS_NORMAL
);
1523 if(FAILED(hr
)) return StartingSize
;
1525 ALIGN_LENGTH(StartingSize
, 3);
1526 StartingSize
+= 2 * sizeof(DWORD
);
1527 return StartingSize
+ marshal_size
;
1530 /******************************************************************************
1531 * WdtpInterfacePointer_UserMarshal [OLE32.@]
1533 * Marshals an interface pointer into a buffer.
1536 * pFlags [I] Flags. See notes.
1537 * RealFlags [I] The MSHCTX to use when marshaling the interface.
1538 * pBuffer [I] Buffer to marshal the clip format into.
1539 * punk [I] Interface pointer to marshal.
1540 * riid [I] ID of interface to marshal.
1543 * The end of the marshaled data in the buffer.
1546 * Even though the function is documented to take a pointer to a ULONG in
1547 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1548 * the first parameter is a ULONG.
1550 unsigned char * WINAPI
WdtpInterfacePointer_UserMarshal(ULONG
*pFlags
, ULONG RealFlags
, unsigned char *pBuffer
, IUnknown
*punk
, REFIID riid
)
1552 HGLOBAL h
= GlobalAlloc(GMEM_MOVEABLE
, 0);
1557 TRACE("(%s, 0x%x, %p, &%p, %s)\n", debugstr_user_flags(pFlags
), RealFlags
, pBuffer
, punk
, debugstr_guid(riid
));
1560 if(CreateStreamOnHGlobal(h
, TRUE
, &stm
) != S_OK
)
1566 if(CoMarshalInterface(stm
, riid
, punk
, LOWORD(RealFlags
), NULL
, MSHLFLAGS_NORMAL
) != S_OK
)
1568 IStream_Release(stm
);
1572 ALIGN_POINTER(pBuffer
, 3);
1573 size
= GlobalSize(h
);
1575 *(DWORD
*)pBuffer
= size
;
1576 pBuffer
+= sizeof(DWORD
);
1577 *(DWORD
*)pBuffer
= size
;
1578 pBuffer
+= sizeof(DWORD
);
1580 ptr
= GlobalLock(h
);
1581 memcpy(pBuffer
, ptr
, size
);
1584 IStream_Release(stm
);
1585 return pBuffer
+ size
;
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
)
1616 TRACE("(%s, %p, %p, %s)\n", debugstr_user_flags(pFlags
), pBuffer
, ppunk
, debugstr_guid(riid
));
1618 ALIGN_POINTER(pBuffer
, 3);
1620 size
= *(DWORD
*)pBuffer
;
1621 pBuffer
+= sizeof(DWORD
);
1622 if(size
!= *(DWORD
*)pBuffer
)
1623 RaiseException(RPC_X_BAD_STUB_DATA
, 0, 0, NULL
);
1625 pBuffer
+= sizeof(DWORD
);
1627 /* FIXME: sanity check on size */
1629 h
= GlobalAlloc(GMEM_MOVEABLE
, size
);
1630 if(!h
) RaiseException(RPC_X_NO_MEMORY
, 0, 0, NULL
);
1632 if(CreateStreamOnHGlobal(h
, TRUE
, &stm
) != S_OK
)
1635 RaiseException(RPC_X_NO_MEMORY
, 0, 0, NULL
);
1638 ptr
= GlobalLock(h
);
1639 memcpy(ptr
, pBuffer
, size
);
1643 hr
= CoUnmarshalInterface(stm
, riid
, (void**)ppunk
);
1644 IStream_Release(stm
);
1646 if(hr
!= S_OK
) RaiseException(hr
, 0, 0, NULL
);
1648 if(orig
) IUnknown_Release(orig
);
1650 return pBuffer
+ size
;
1653 /******************************************************************************
1654 * WdtpInterfacePointer_UserFree [OLE32.@]
1656 * Releases an unmarshaled interface pointer.
1659 * punk [I] Interface pointer to release.
1664 void WINAPI
WdtpInterfacePointer_UserFree(IUnknown
*punk
)
1666 TRACE("(%p)\n", punk
);
1667 if(punk
) IUnknown_Release(punk
);
1670 /******************************************************************************
1671 * STGMEDIUM_UserSize [OLE32.@]
1673 * Calculates the buffer size required to marshal an STGMEDIUM.
1676 * pFlags [I] Flags. See notes.
1677 * StartingSize [I] Starting size of the buffer. This value is added on to
1678 * the buffer size required for the clip format.
1679 * pStgMedium [I] STGMEDIUM to size.
1682 * The buffer size required to marshal an STGMEDIUM plus the starting size.
1685 * Even though the function is documented to take a pointer to a ULONG in
1686 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1687 * the first parameter is a ULONG.
1688 * This function is only intended to be called by the RPC runtime.
1690 ULONG __RPC_USER
STGMEDIUM_UserSize(ULONG
*pFlags
, ULONG StartingSize
, STGMEDIUM
*pStgMedium
)
1692 ULONG size
= StartingSize
;
1694 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags
), StartingSize
, pStgMedium
);
1696 ALIGN_LENGTH(size
, 3);
1698 size
+= 2 * sizeof(DWORD
);
1699 if (pStgMedium
->tymed
!= TYMED_NULL
)
1700 size
+= sizeof(DWORD
);
1702 switch (pStgMedium
->tymed
)
1705 TRACE("TYMED_NULL\n");
1708 TRACE("TYMED_HGLOBAL\n");
1709 if (pStgMedium
->u
.hGlobal
)
1710 size
= HGLOBAL_UserSize(pFlags
, size
, &pStgMedium
->u
.hGlobal
);
1713 TRACE("TYMED_FILE\n");
1714 if (pStgMedium
->u
.lpszFileName
)
1716 TRACE("file name is %s\n", debugstr_w(pStgMedium
->u
.lpszFileName
));
1717 size
+= 3 * sizeof(DWORD
) +
1718 (lstrlenW(pStgMedium
->u
.lpszFileName
) + 1) * sizeof(WCHAR
);
1722 TRACE("TYMED_ISTREAM\n");
1723 if (pStgMedium
->u
.pstm
)
1726 IStream_QueryInterface(pStgMedium
->u
.pstm
, &IID_IUnknown
, (void**)&unk
);
1727 size
= WdtpInterfacePointer_UserSize(pFlags
, LOWORD(*pFlags
), size
, unk
, &IID_IStream
);
1728 IUnknown_Release(unk
);
1731 case TYMED_ISTORAGE
:
1732 TRACE("TYMED_ISTORAGE\n");
1733 if (pStgMedium
->u
.pstg
)
1736 IStorage_QueryInterface(pStgMedium
->u
.pstg
, &IID_IUnknown
, (void**)&unk
);
1737 size
= WdtpInterfacePointer_UserSize(pFlags
, LOWORD(*pFlags
), size
, unk
, &IID_IStorage
);
1738 IUnknown_Release(unk
);
1742 TRACE("TYMED_GDI\n");
1743 if (pStgMedium
->u
.hBitmap
)
1744 size
= HBITMAP_UserSize(pFlags
, size
, &pStgMedium
->u
.hBitmap
);
1747 TRACE("TYMED_MFPICT\n");
1748 if (pStgMedium
->u
.hMetaFilePict
)
1749 size
= HMETAFILEPICT_UserSize(pFlags
, size
, &pStgMedium
->u
.hMetaFilePict
);
1752 TRACE("TYMED_ENHMF\n");
1753 if (pStgMedium
->u
.hEnhMetaFile
)
1754 size
= HENHMETAFILE_UserSize(pFlags
, size
, &pStgMedium
->u
.hEnhMetaFile
);
1757 RaiseException(DV_E_TYMED
, 0, 0, NULL
);
1760 if (pStgMedium
->pUnkForRelease
)
1761 size
= WdtpInterfacePointer_UserSize(pFlags
, LOWORD(*pFlags
), size
, pStgMedium
->pUnkForRelease
, &IID_IUnknown
);
1766 /******************************************************************************
1767 * STGMEDIUM_UserMarshal [OLE32.@]
1769 * Marshals a STGMEDIUM into a buffer.
1772 * pFlags [I] Flags. See notes.
1773 * pBuffer [I] Buffer to marshal the clip format into.
1774 * pCF [I] STGMEDIUM to marshal.
1777 * The end of the marshaled data in the buffer.
1780 * Even though the function is documented to take a pointer to a ULONG in
1781 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1782 * the first parameter is a ULONG.
1783 * This function is only intended to be called by the RPC runtime.
1785 unsigned char * __RPC_USER
STGMEDIUM_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, STGMEDIUM
*pStgMedium
)
1787 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags
), pBuffer
, pStgMedium
);
1789 ALIGN_POINTER(pBuffer
, 3);
1791 *(DWORD
*)pBuffer
= pStgMedium
->tymed
;
1792 pBuffer
+= sizeof(DWORD
);
1793 if (pStgMedium
->tymed
!= TYMED_NULL
)
1795 *(DWORD
*)pBuffer
= (DWORD
)(DWORD_PTR
)pStgMedium
->u
.pstg
;
1796 pBuffer
+= sizeof(DWORD
);
1798 *(DWORD
*)pBuffer
= (DWORD
)(DWORD_PTR
)pStgMedium
->pUnkForRelease
;
1799 pBuffer
+= sizeof(DWORD
);
1801 switch (pStgMedium
->tymed
)
1804 TRACE("TYMED_NULL\n");
1807 TRACE("TYMED_HGLOBAL\n");
1808 if (pStgMedium
->u
.hGlobal
)
1809 pBuffer
= HGLOBAL_UserMarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hGlobal
);
1812 TRACE("TYMED_FILE\n");
1813 if (pStgMedium
->u
.lpszFileName
)
1816 len
= lstrlenW(pStgMedium
->u
.lpszFileName
);
1818 *(DWORD
*)pBuffer
= len
+ 1;
1819 pBuffer
+= sizeof(DWORD
);
1821 *(DWORD
*)pBuffer
= 0;
1822 pBuffer
+= sizeof(DWORD
);
1824 *(DWORD
*)pBuffer
= len
+ 1;
1825 pBuffer
+= sizeof(DWORD
);
1827 TRACE("file name is %s\n", debugstr_w(pStgMedium
->u
.lpszFileName
));
1828 memcpy(pBuffer
, pStgMedium
->u
.lpszFileName
, (len
+ 1) * sizeof(WCHAR
));
1832 TRACE("TYMED_ISTREAM\n");
1833 if (pStgMedium
->u
.pstm
)
1836 IStream_QueryInterface(pStgMedium
->u
.pstm
, &IID_IUnknown
, (void**)&unk
);
1837 pBuffer
= WdtpInterfacePointer_UserMarshal(pFlags
, LOWORD(*pFlags
), pBuffer
, unk
, &IID_IStream
);
1838 IUnknown_Release(unk
);
1841 case TYMED_ISTORAGE
:
1842 TRACE("TYMED_ISTORAGE\n");
1843 if (pStgMedium
->u
.pstg
)
1846 IStorage_QueryInterface(pStgMedium
->u
.pstg
, &IID_IUnknown
, (void**)&unk
);
1847 pBuffer
= WdtpInterfacePointer_UserMarshal(pFlags
, LOWORD(*pFlags
), pBuffer
, unk
, &IID_IStorage
);
1848 IUnknown_Release(unk
);
1852 TRACE("TYMED_GDI\n");
1853 if (pStgMedium
->u
.hBitmap
)
1854 pBuffer
= HBITMAP_UserMarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hBitmap
);
1857 TRACE("TYMED_MFPICT\n");
1858 if (pStgMedium
->u
.hMetaFilePict
)
1859 pBuffer
= HMETAFILEPICT_UserMarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hMetaFilePict
);
1862 TRACE("TYMED_ENHMF\n");
1863 if (pStgMedium
->u
.hEnhMetaFile
)
1864 pBuffer
= HENHMETAFILE_UserMarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hEnhMetaFile
);
1867 RaiseException(DV_E_TYMED
, 0, 0, NULL
);
1870 if (pStgMedium
->pUnkForRelease
)
1871 pBuffer
= WdtpInterfacePointer_UserMarshal(pFlags
, LOWORD(*pFlags
), pBuffer
, pStgMedium
->pUnkForRelease
, &IID_IUnknown
);
1876 /******************************************************************************
1877 * STGMEDIUM_UserUnmarshal [OLE32.@]
1879 * Unmarshals a STGMEDIUM from a buffer.
1882 * pFlags [I] Flags. See notes.
1883 * pBuffer [I] Buffer to marshal the clip format from.
1884 * pStgMedium [O] Address that receive the unmarshaled STGMEDIUM.
1887 * The end of the marshaled data in the buffer.
1890 * Even though the function is documented to take a pointer to an ULONG in
1891 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1892 * the first parameter is an ULONG.
1893 * This function is only intended to be called by the RPC runtime.
1895 unsigned char * __RPC_USER
STGMEDIUM_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, STGMEDIUM
*pStgMedium
)
1900 ALIGN_POINTER(pBuffer
, 3);
1902 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags
), pBuffer
, pStgMedium
);
1904 pStgMedium
->tymed
= *(DWORD
*)pBuffer
;
1905 pBuffer
+= sizeof(DWORD
);
1906 if (pStgMedium
->tymed
!= TYMED_NULL
)
1908 content
= *(DWORD
*)pBuffer
;
1909 pBuffer
+= sizeof(DWORD
);
1911 releaseunk
= *(DWORD
*)pBuffer
;
1912 pBuffer
+= sizeof(DWORD
);
1914 switch (pStgMedium
->tymed
)
1917 TRACE("TYMED_NULL\n");
1920 TRACE("TYMED_HGLOBAL\n");
1922 pBuffer
= HGLOBAL_UserUnmarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hGlobal
);
1925 TRACE("TYMED_FILE\n");
1930 conformance
= *(DWORD
*)pBuffer
;
1931 pBuffer
+= sizeof(DWORD
);
1932 if (*(DWORD
*)pBuffer
!= 0)
1934 ERR("invalid offset %d\n", *(DWORD
*)pBuffer
);
1935 RpcRaiseException(RPC_S_INVALID_BOUND
);
1938 pBuffer
+= sizeof(DWORD
);
1939 variance
= *(DWORD
*)pBuffer
;
1940 pBuffer
+= sizeof(DWORD
);
1941 if (conformance
!= variance
)
1943 ERR("conformance (%d) and variance (%d) should be equal\n",
1944 conformance
, variance
);
1945 RpcRaiseException(RPC_S_INVALID_BOUND
);
1948 if (conformance
> 0x7fffffff)
1950 ERR("conformance 0x%x too large\n", conformance
);
1951 RpcRaiseException(RPC_S_INVALID_BOUND
);
1954 pStgMedium
->u
.lpszFileName
= CoTaskMemAlloc(conformance
* sizeof(WCHAR
));
1955 if (!pStgMedium
->u
.lpszFileName
) RpcRaiseException(ERROR_OUTOFMEMORY
);
1956 TRACE("unmarshalled file name is %s\n", debugstr_wn((const WCHAR
*)pBuffer
, variance
));
1957 memcpy(pStgMedium
->u
.lpszFileName
, pBuffer
, variance
* sizeof(WCHAR
));
1958 pBuffer
+= variance
* sizeof(WCHAR
);
1961 pStgMedium
->u
.lpszFileName
= NULL
;
1964 TRACE("TYMED_ISTREAM\n");
1967 pBuffer
= WdtpInterfacePointer_UserUnmarshal(pFlags
, pBuffer
, (IUnknown
**)&pStgMedium
->u
.pstm
, &IID_IStream
);
1971 if (pStgMedium
->u
.pstm
) IStream_Release( pStgMedium
->u
.pstm
);
1972 pStgMedium
->u
.pstm
= NULL
;
1975 case TYMED_ISTORAGE
:
1976 TRACE("TYMED_ISTORAGE\n");
1979 pBuffer
= WdtpInterfacePointer_UserUnmarshal(pFlags
, pBuffer
, (IUnknown
**)&pStgMedium
->u
.pstg
, &IID_IStorage
);
1983 if (pStgMedium
->u
.pstg
) IStorage_Release( pStgMedium
->u
.pstg
);
1984 pStgMedium
->u
.pstg
= NULL
;
1988 TRACE("TYMED_GDI\n");
1990 pBuffer
= HBITMAP_UserUnmarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hBitmap
);
1992 pStgMedium
->u
.hBitmap
= NULL
;
1995 TRACE("TYMED_MFPICT\n");
1997 pBuffer
= HMETAFILEPICT_UserUnmarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hMetaFilePict
);
1999 pStgMedium
->u
.hMetaFilePict
= NULL
;
2002 TRACE("TYMED_ENHMF\n");
2004 pBuffer
= HENHMETAFILE_UserUnmarshal(pFlags
, pBuffer
, &pStgMedium
->u
.hEnhMetaFile
);
2006 pStgMedium
->u
.hEnhMetaFile
= NULL
;
2009 RaiseException(DV_E_TYMED
, 0, 0, NULL
);
2013 pBuffer
= WdtpInterfacePointer_UserUnmarshal(pFlags
, pBuffer
, &pStgMedium
->pUnkForRelease
, &IID_IUnknown
);
2014 /* Unlike the IStream / IStorage ifaces, the existing pUnkForRelease
2015 is left intact if a NULL ptr is unmarshalled - see the tests. */
2020 /******************************************************************************
2021 * STGMEDIUM_UserFree [OLE32.@]
2023 * Frees an unmarshaled STGMEDIUM.
2026 * pFlags [I] Flags. See notes.
2027 * pStgmedium [I] STGMEDIUM to free.
2030 * The end of the marshaled data in the buffer.
2033 * Even though the function is documented to take a pointer to a ULONG in
2034 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
2035 * which the first parameter is a ULONG.
2036 * This function is only intended to be called by the RPC runtime.
2038 void __RPC_USER
STGMEDIUM_UserFree(ULONG
*flags
, STGMEDIUM
*med
)
2040 TRACE("(%s, %p)\n", debugstr_user_flags(flags
), med
);
2047 case TYMED_ISTORAGE
:
2048 ReleaseStgMedium(med
);
2054 if (LOWORD(*flags
) == MSHCTX_INPROC
)
2055 med
->tymed
= TYMED_NULL
;
2056 ReleaseStgMedium(med
);
2059 RaiseException(DV_E_TYMED
, 0, 0, NULL
);
2063 ULONG __RPC_USER
ASYNC_STGMEDIUM_UserSize(ULONG
*pFlags
, ULONG StartingSize
, ASYNC_STGMEDIUM
*pStgMedium
)
2066 return STGMEDIUM_UserSize(pFlags
, StartingSize
, pStgMedium
);
2069 unsigned char * __RPC_USER
ASYNC_STGMEDIUM_UserMarshal( ULONG
*pFlags
, unsigned char *pBuffer
, ASYNC_STGMEDIUM
*pStgMedium
)
2072 return STGMEDIUM_UserMarshal(pFlags
, pBuffer
, pStgMedium
);
2075 unsigned char * __RPC_USER
ASYNC_STGMEDIUM_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, ASYNC_STGMEDIUM
*pStgMedium
)
2078 return STGMEDIUM_UserUnmarshal(pFlags
, pBuffer
, pStgMedium
);
2081 void __RPC_USER
ASYNC_STGMEDIUM_UserFree(ULONG
*pFlags
, ASYNC_STGMEDIUM
*pStgMedium
)
2084 STGMEDIUM_UserFree(pFlags
, pStgMedium
);
2087 ULONG __RPC_USER
FLAG_STGMEDIUM_UserSize(ULONG
*pFlags
, ULONG StartingSize
, FLAG_STGMEDIUM
*pStgMedium
)
2090 return StartingSize
;
2093 unsigned char * __RPC_USER
FLAG_STGMEDIUM_UserMarshal( ULONG
*pFlags
, unsigned char *pBuffer
, FLAG_STGMEDIUM
*pStgMedium
)
2099 unsigned char * __RPC_USER
FLAG_STGMEDIUM_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, FLAG_STGMEDIUM
*pStgMedium
)
2105 void __RPC_USER
FLAG_STGMEDIUM_UserFree(ULONG
*pFlags
, FLAG_STGMEDIUM
*pStgMedium
)
2110 ULONG __RPC_USER
SNB_UserSize(ULONG
*pFlags
, ULONG StartingSize
, SNB
*pSnb
)
2112 ULONG size
= StartingSize
;
2114 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags
), StartingSize
, pSnb
);
2116 ALIGN_LENGTH(size
, 3);
2118 /* two counters from RemSNB header, plus one more ULONG */
2119 size
+= 3*sizeof(ULONG
);
2121 /* now actual data length */
2124 WCHAR
**ptrW
= *pSnb
;
2128 size
+= (lstrlenW(*ptrW
) + 1)*sizeof(WCHAR
);
2143 unsigned char * __RPC_USER
SNB_UserMarshal(ULONG
*pFlags
, unsigned char *pBuffer
, SNB
*pSnb
)
2145 struct SNB_wire
*wire
;
2148 TRACE("(%s, %p, %p)\n", debugstr_user_flags(pFlags
), pBuffer
, pSnb
);
2150 ALIGN_POINTER(pBuffer
, 3);
2152 wire
= (struct SNB_wire
*)pBuffer
;
2153 wire
->charcnt
= wire
->strcnt
= 0;
2154 size
= 3*sizeof(ULONG
);
2158 WCHAR
**ptrW
= *pSnb
;
2159 WCHAR
*dataW
= wire
->data
;
2163 ULONG len
= lstrlenW(*ptrW
) + 1;
2166 wire
->charcnt
+= len
;
2167 memcpy(dataW
, *ptrW
, len
*sizeof(WCHAR
));
2170 size
+= len
*sizeof(WCHAR
);
2175 wire
->datalen
= wire
->charcnt
;
2176 return pBuffer
+ size
;
2179 unsigned char * __RPC_USER
SNB_UserUnmarshal(ULONG
*pFlags
, unsigned char *pBuffer
, SNB
*pSnb
)
2181 USER_MARSHAL_CB
*umcb
= (USER_MARSHAL_CB
*)pFlags
;
2182 struct SNB_wire
*wire
;
2184 TRACE("(%s, %p, %p)\n", debugstr_user_flags(pFlags
), pBuffer
, pSnb
);
2186 wire
= (struct SNB_wire
*)pBuffer
;
2189 umcb
->pStubMsg
->pfnFree(*pSnb
);
2191 if (wire
->datalen
== 0)
2195 WCHAR
*src
= wire
->data
, *dest
;
2199 ptrW
= *pSnb
= umcb
->pStubMsg
->pfnAllocate((wire
->strcnt
+1)*sizeof(WCHAR
*) + wire
->datalen
*sizeof(WCHAR
));
2200 dest
= (WCHAR
*)(*pSnb
+ wire
->strcnt
+ 1);
2202 for (i
= 0; i
< wire
->strcnt
; i
++)
2204 ULONG len
= lstrlenW(src
);
2205 memcpy(dest
, src
, (len
+ 1)*sizeof(WCHAR
));
2214 return pBuffer
+ 3*sizeof(ULONG
) + wire
->datalen
*sizeof(WCHAR
);
2217 void __RPC_USER
SNB_UserFree(ULONG
*pFlags
, SNB
*pSnb
)
2219 USER_MARSHAL_CB
*umcb
= (USER_MARSHAL_CB
*)pFlags
;
2220 TRACE("(%p)\n", pSnb
);
2222 umcb
->pStubMsg
->pfnFree(*pSnb
);
2225 /* call_as/local stubs for unknwn.idl */
2227 HRESULT CALLBACK
IClassFactory_CreateInstance_Proxy(
2228 IClassFactory
* This
,
2229 IUnknown
*pUnkOuter
,
2233 TRACE("(%p, %s, %p)\n", pUnkOuter
, debugstr_guid(riid
), ppvObject
);
2237 ERR("aggregation is not allowed on remote objects\n");
2238 return CLASS_E_NOAGGREGATION
;
2240 return IClassFactory_RemoteCreateInstance_Proxy(This
, riid
,
2241 (IUnknown
**) ppvObject
);
2244 HRESULT __RPC_STUB
IClassFactory_CreateInstance_Stub(
2245 IClassFactory
* This
,
2247 IUnknown
**ppvObject
)
2249 TRACE("(%s, %p)\n", debugstr_guid(riid
), ppvObject
);
2250 return IClassFactory_CreateInstance(This
, NULL
, riid
, (void **) ppvObject
);
2253 HRESULT CALLBACK
IClassFactory_LockServer_Proxy(
2254 IClassFactory
* This
,
2261 HRESULT __RPC_STUB
IClassFactory_LockServer_Stub(
2262 IClassFactory
* This
,
2269 /* call_as/local stubs for objidl.idl */
2271 HRESULT CALLBACK
IEnumUnknown_Next_Proxy(
2275 ULONG
*pceltFetched
)
2278 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2279 if (!pceltFetched
) pceltFetched
= &fetched
;
2280 return IEnumUnknown_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
2283 HRESULT __RPC_STUB
IEnumUnknown_Next_Stub(
2287 ULONG
*pceltFetched
)
2290 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2292 hr
= IEnumUnknown_Next(This
, celt
, rgelt
, pceltFetched
);
2293 if (hr
== S_OK
) *pceltFetched
= celt
;
2297 HRESULT CALLBACK
IBindCtx_SetBindOptions_Proxy(
2299 BIND_OPTS
*pbindopts
)
2305 HRESULT __RPC_STUB
IBindCtx_SetBindOptions_Stub(
2307 BIND_OPTS2
*pbindopts
)
2313 HRESULT CALLBACK
IBindCtx_GetBindOptions_Proxy(
2315 BIND_OPTS
*pbindopts
)
2321 HRESULT __RPC_STUB
IBindCtx_GetBindOptions_Stub(
2323 BIND_OPTS2
*pbindopts
)
2329 HRESULT CALLBACK
IEnumMoniker_Next_Proxy(
2333 ULONG
*pceltFetched
)
2336 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2337 if (!pceltFetched
) pceltFetched
= &fetched
;
2338 return IEnumMoniker_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
2341 HRESULT __RPC_STUB
IEnumMoniker_Next_Stub(
2345 ULONG
*pceltFetched
)
2348 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2350 hr
= IEnumMoniker_Next(This
, celt
, rgelt
, pceltFetched
);
2351 if (hr
== S_OK
) *pceltFetched
= celt
;
2355 BOOL CALLBACK
IRunnableObject_IsRunning_Proxy(
2356 IRunnableObject
* This
)
2360 memset(&rv
, 0, sizeof rv
);
2364 HRESULT __RPC_STUB
IRunnableObject_IsRunning_Stub(
2365 IRunnableObject
* This
)
2371 HRESULT CALLBACK
IMoniker_BindToObject_Proxy(
2374 IMoniker
*pmkToLeft
,
2382 HRESULT __RPC_STUB
IMoniker_BindToObject_Stub(
2385 IMoniker
*pmkToLeft
,
2387 IUnknown
**ppvResult
)
2393 HRESULT CALLBACK
IMoniker_BindToStorage_Proxy(
2396 IMoniker
*pmkToLeft
,
2400 TRACE("(%p)->(%p %p %s %p)\n", This
, pbc
, pmkToLeft
, debugstr_guid(riid
), ppvObj
);
2401 return IMoniker_RemoteBindToStorage_Proxy(This
, pbc
, pmkToLeft
, riid
, (IUnknown
**)ppvObj
);
2404 HRESULT __RPC_STUB
IMoniker_BindToStorage_Stub(
2407 IMoniker
*pmkToLeft
,
2411 TRACE("(%p)->(%p %p %s %p)\n", This
, pbc
, pmkToLeft
, debugstr_guid(riid
), ppvObj
);
2412 return IMoniker_BindToStorage(This
, pbc
, pmkToLeft
, riid
, (void**)ppvObj
);
2415 HRESULT CALLBACK
IEnumString_Next_Proxy(
2419 ULONG
*pceltFetched
)
2422 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2423 if (!pceltFetched
) pceltFetched
= &fetched
;
2424 return IEnumString_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
2427 HRESULT __RPC_STUB
IEnumString_Next_Stub(
2431 ULONG
*pceltFetched
)
2434 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2436 hr
= IEnumString_Next(This
, celt
, rgelt
, pceltFetched
);
2437 if (hr
== S_OK
) *pceltFetched
= celt
;
2441 HRESULT CALLBACK
ISequentialStream_Read_Proxy(
2442 ISequentialStream
* This
,
2450 TRACE("(%p)->(%p, %d, %p)\n", This
, pv
, cb
, pcbRead
);
2452 hr
= ISequentialStream_RemoteRead_Proxy(This
, pv
, cb
, &read
);
2453 if(pcbRead
) *pcbRead
= read
;
2458 HRESULT __RPC_STUB
ISequentialStream_Read_Stub(
2459 ISequentialStream
* This
,
2464 TRACE("(%p)->(%p, %d, %p)\n", This
, pv
, cb
, pcbRead
);
2465 return ISequentialStream_Read(This
, pv
, cb
, pcbRead
);
2468 HRESULT CALLBACK
ISequentialStream_Write_Proxy(
2469 ISequentialStream
* This
,
2477 TRACE("(%p)->(%p, %d, %p)\n", This
, pv
, cb
, pcbWritten
);
2479 hr
= ISequentialStream_RemoteWrite_Proxy(This
, pv
, cb
, &written
);
2480 if(pcbWritten
) *pcbWritten
= written
;
2485 HRESULT __RPC_STUB
ISequentialStream_Write_Stub(
2486 ISequentialStream
* This
,
2491 TRACE("(%p)->(%p, %d, %p)\n", This
, pv
, cb
, pcbWritten
);
2492 return ISequentialStream_Write(This
, pv
, cb
, pcbWritten
);
2495 HRESULT CALLBACK
IStream_Seek_Proxy(
2497 LARGE_INTEGER dlibMove
,
2499 ULARGE_INTEGER
*plibNewPosition
)
2501 ULARGE_INTEGER newpos
;
2504 TRACE("(%p)->(%s, %d, %p)\n", This
, wine_dbgstr_longlong(dlibMove
.QuadPart
), dwOrigin
, plibNewPosition
);
2506 hr
= IStream_RemoteSeek_Proxy(This
, dlibMove
, dwOrigin
, &newpos
);
2507 if(plibNewPosition
) *plibNewPosition
= newpos
;
2512 HRESULT __RPC_STUB
IStream_Seek_Stub(
2514 LARGE_INTEGER dlibMove
,
2516 ULARGE_INTEGER
*plibNewPosition
)
2518 TRACE("(%p)->(%s, %d, %p)\n", This
, wine_dbgstr_longlong(dlibMove
.QuadPart
), dwOrigin
, plibNewPosition
);
2519 return IStream_Seek(This
, dlibMove
, dwOrigin
, plibNewPosition
);
2522 HRESULT CALLBACK
IStream_CopyTo_Proxy(
2526 ULARGE_INTEGER
*pcbRead
,
2527 ULARGE_INTEGER
*pcbWritten
)
2529 ULARGE_INTEGER read
, written
;
2532 TRACE("(%p)->(%p, %s, %p, %p)\n", This
, pstm
, wine_dbgstr_longlong(cb
.QuadPart
), pcbRead
, pcbWritten
);
2534 hr
= IStream_RemoteCopyTo_Proxy(This
, pstm
, cb
, &read
, &written
);
2535 if(pcbRead
) *pcbRead
= read
;
2536 if(pcbWritten
) *pcbWritten
= written
;
2541 HRESULT __RPC_STUB
IStream_CopyTo_Stub(
2545 ULARGE_INTEGER
*pcbRead
,
2546 ULARGE_INTEGER
*pcbWritten
)
2548 TRACE("(%p)->(%p, %s, %p, %p)\n", This
, pstm
, wine_dbgstr_longlong(cb
.QuadPart
), pcbRead
, pcbWritten
);
2550 return IStream_CopyTo(This
, pstm
, cb
, pcbRead
, pcbWritten
);
2553 HRESULT CALLBACK
IEnumSTATSTG_Next_Proxy(
2557 ULONG
*pceltFetched
)
2560 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2561 if (!pceltFetched
) pceltFetched
= &fetched
;
2562 return IEnumSTATSTG_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
2565 HRESULT __RPC_STUB
IEnumSTATSTG_Next_Stub(
2569 ULONG
*pceltFetched
)
2572 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2574 hr
= IEnumSTATSTG_Next(This
, celt
, rgelt
, pceltFetched
);
2575 if (hr
== S_OK
) *pceltFetched
= celt
;
2579 HRESULT CALLBACK
IStorage_OpenStream_Proxy(
2587 TRACE("(%p)->(%s, %p, %08x, %d %p)\n", This
, debugstr_w(pwcsName
), reserved1
, grfMode
, reserved2
, ppstm
);
2588 if(reserved1
) WARN("reserved1 %p\n", reserved1
);
2590 return IStorage_RemoteOpenStream_Proxy(This
, pwcsName
, 0, NULL
, grfMode
, reserved2
, ppstm
);
2593 HRESULT __RPC_STUB
IStorage_OpenStream_Stub(
2602 TRACE("(%p)->(%s, %d, %p, %08x, %d %p)\n", This
, debugstr_w(pwcsName
), cbReserved1
, reserved1
, grfMode
, reserved2
, ppstm
);
2603 if(cbReserved1
|| reserved1
) WARN("cbReserved1 %d reserved1 %p\n", cbReserved1
, reserved1
);
2605 return IStorage_OpenStream(This
, pwcsName
, NULL
, grfMode
, reserved2
, ppstm
);
2608 HRESULT CALLBACK
IStorage_EnumElements_Proxy(
2613 IEnumSTATSTG
**ppenum
)
2615 TRACE("(%p)->(%d, %p, %d, %p)\n", This
, reserved1
, reserved2
, reserved3
, ppenum
);
2616 if(reserved2
) WARN("reserved2 %p\n", reserved2
);
2618 return IStorage_RemoteEnumElements_Proxy(This
, reserved1
, 0, NULL
, reserved3
, ppenum
);
2621 HRESULT __RPC_STUB
IStorage_EnumElements_Stub(
2627 IEnumSTATSTG
**ppenum
)
2629 TRACE("(%p)->(%d, %d, %p, %d, %p)\n", This
, reserved1
, cbReserved2
, reserved2
, reserved3
, ppenum
);
2630 if(cbReserved2
|| reserved2
) WARN("cbReserved2 %d reserved2 %p\n", cbReserved2
, reserved2
);
2632 return IStorage_EnumElements(This
, reserved1
, NULL
, reserved3
, ppenum
);
2635 HRESULT CALLBACK
ILockBytes_ReadAt_Proxy(
2637 ULARGE_INTEGER ulOffset
,
2645 TRACE("(%p)->(%s, %p, %d, %p)\n", This
, wine_dbgstr_longlong(ulOffset
.QuadPart
), pv
, cb
, pcbRead
);
2647 hr
= ILockBytes_RemoteReadAt_Proxy(This
, ulOffset
, pv
, cb
, &read
);
2648 if(pcbRead
) *pcbRead
= read
;
2653 HRESULT __RPC_STUB
ILockBytes_ReadAt_Stub(
2655 ULARGE_INTEGER ulOffset
,
2660 TRACE("(%p)->(%s, %p, %d, %p)\n", This
, wine_dbgstr_longlong(ulOffset
.QuadPart
), pv
, cb
, pcbRead
);
2661 return ILockBytes_ReadAt(This
, ulOffset
, pv
, cb
, pcbRead
);
2664 HRESULT CALLBACK
ILockBytes_WriteAt_Proxy(
2666 ULARGE_INTEGER ulOffset
,
2674 TRACE("(%p)->(%s, %p, %d, %p)\n", This
, wine_dbgstr_longlong(ulOffset
.QuadPart
), pv
, cb
, pcbWritten
);
2676 hr
= ILockBytes_RemoteWriteAt_Proxy(This
, ulOffset
, pv
, cb
, &written
);
2677 if(pcbWritten
) *pcbWritten
= written
;
2682 HRESULT __RPC_STUB
ILockBytes_WriteAt_Stub(
2684 ULARGE_INTEGER ulOffset
,
2689 TRACE("(%p)->(%s, %p, %d, %p)\n", This
, wine_dbgstr_longlong(ulOffset
.QuadPart
), pv
, cb
, pcbWritten
);
2690 return ILockBytes_WriteAt(This
, ulOffset
, pv
, cb
, pcbWritten
);
2693 HRESULT CALLBACK
IFillLockBytes_FillAppend_Proxy(
2694 IFillLockBytes
* This
,
2702 TRACE("(%p)->(%p, %d, %p)\n", This
, pv
, cb
, pcbWritten
);
2704 hr
= IFillLockBytes_RemoteFillAppend_Proxy(This
, pv
, cb
, &written
);
2705 if(pcbWritten
) *pcbWritten
= written
;
2710 HRESULT __RPC_STUB
IFillLockBytes_FillAppend_Stub(
2711 IFillLockBytes
* This
,
2716 TRACE("(%p)->(%p, %d, %p)\n", This
, pv
, cb
, pcbWritten
);
2717 return IFillLockBytes_FillAppend(This
, pv
, cb
, pcbWritten
);
2720 HRESULT CALLBACK
IFillLockBytes_FillAt_Proxy(
2721 IFillLockBytes
* This
,
2722 ULARGE_INTEGER ulOffset
,
2730 TRACE("(%p)->(%s, %p, %d, %p)\n", This
, wine_dbgstr_longlong(ulOffset
.QuadPart
), pv
, cb
, pcbWritten
);
2732 hr
= IFillLockBytes_RemoteFillAt_Proxy(This
, ulOffset
, pv
, cb
, &written
);
2733 if(pcbWritten
) *pcbWritten
= written
;
2738 HRESULT __RPC_STUB
IFillLockBytes_FillAt_Stub(
2739 IFillLockBytes
* This
,
2740 ULARGE_INTEGER ulOffset
,
2745 TRACE("(%p)->(%s, %p, %d, %p)\n", This
, wine_dbgstr_longlong(ulOffset
.QuadPart
), pv
, cb
, pcbWritten
);
2746 return IFillLockBytes_FillAt(This
, ulOffset
, pv
, cb
, pcbWritten
);
2749 HRESULT CALLBACK
IEnumFORMATETC_Next_Proxy(
2750 IEnumFORMATETC
* This
,
2753 ULONG
*pceltFetched
)
2756 if (!pceltFetched
) pceltFetched
= &fetched
;
2757 return IEnumFORMATETC_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
2760 HRESULT __RPC_STUB
IEnumFORMATETC_Next_Stub(
2761 IEnumFORMATETC
* This
,
2764 ULONG
*pceltFetched
)
2768 hr
= IEnumFORMATETC_Next(This
, celt
, rgelt
, pceltFetched
);
2769 if (hr
== S_OK
) *pceltFetched
= celt
;
2773 HRESULT CALLBACK
IEnumSTATDATA_Next_Proxy(
2774 IEnumSTATDATA
* This
,
2777 ULONG
*pceltFetched
)
2780 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2781 if (!pceltFetched
) pceltFetched
= &fetched
;
2782 return IEnumSTATDATA_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
2785 HRESULT __RPC_STUB
IEnumSTATDATA_Next_Stub(
2786 IEnumSTATDATA
* This
,
2789 ULONG
*pceltFetched
)
2792 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
2794 hr
= IEnumSTATDATA_Next(This
, celt
, rgelt
, pceltFetched
);
2795 if (hr
== S_OK
) *pceltFetched
= celt
;
2799 void CALLBACK
IAdviseSink_OnDataChange_Proxy(
2801 FORMATETC
*pFormatetc
,
2804 TRACE("(%p)->(%p, %p)\n", This
, pFormatetc
, pStgmed
);
2805 IAdviseSink_RemoteOnDataChange_Proxy(This
, pFormatetc
, pStgmed
);
2808 HRESULT __RPC_STUB
IAdviseSink_OnDataChange_Stub(
2810 FORMATETC
*pFormatetc
,
2811 ASYNC_STGMEDIUM
*pStgmed
)
2813 TRACE("(%p)->(%p, %p)\n", This
, pFormatetc
, pStgmed
);
2814 IAdviseSink_OnDataChange(This
, pFormatetc
, pStgmed
);
2818 void CALLBACK
IAdviseSink_OnViewChange_Proxy(
2823 TRACE("(%p)->(%d, %d)\n", This
, dwAspect
, lindex
);
2824 IAdviseSink_RemoteOnViewChange_Proxy(This
, dwAspect
, lindex
);
2827 HRESULT __RPC_STUB
IAdviseSink_OnViewChange_Stub(
2832 TRACE("(%p)->(%d, %d)\n", This
, dwAspect
, lindex
);
2833 IAdviseSink_OnViewChange(This
, dwAspect
, lindex
);
2837 void CALLBACK
IAdviseSink_OnRename_Proxy(
2841 TRACE("(%p)->(%p)\n", This
, pmk
);
2842 IAdviseSink_RemoteOnRename_Proxy(This
, pmk
);
2845 HRESULT __RPC_STUB
IAdviseSink_OnRename_Stub(
2849 TRACE("(%p)->(%p)\n", This
, pmk
);
2850 IAdviseSink_OnRename(This
, pmk
);
2854 void CALLBACK
IAdviseSink_OnSave_Proxy(
2857 TRACE("(%p)\n", This
);
2858 IAdviseSink_RemoteOnSave_Proxy(This
);
2861 HRESULT __RPC_STUB
IAdviseSink_OnSave_Stub(
2864 TRACE("(%p)\n", This
);
2865 IAdviseSink_OnSave(This
);
2869 void CALLBACK
IAdviseSink_OnClose_Proxy(
2872 TRACE("(%p)\n", This
);
2873 IAdviseSink_RemoteOnClose_Proxy(This
);
2876 HRESULT __RPC_STUB
IAdviseSink_OnClose_Stub(
2879 TRACE("(%p)\n", This
);
2880 IAdviseSink_OnClose(This
);
2884 void CALLBACK
IAdviseSink2_OnLinkSrcChange_Proxy(
2888 TRACE("(%p)->(%p)\n", This
, pmk
);
2889 IAdviseSink2_RemoteOnLinkSrcChange_Proxy(This
, pmk
);
2892 HRESULT __RPC_STUB
IAdviseSink2_OnLinkSrcChange_Stub(
2896 TRACE("(%p)->(%p)\n", This
, pmk
);
2897 IAdviseSink2_OnLinkSrcChange(This
, pmk
);
2901 HRESULT CALLBACK
IDataObject_GetData_Proxy(
2903 FORMATETC
*pformatetcIn
,
2906 TRACE("(%p)->(%p, %p)\n", This
, pformatetcIn
, pmedium
);
2907 return IDataObject_RemoteGetData_Proxy(This
, pformatetcIn
, pmedium
);
2910 HRESULT __RPC_STUB
IDataObject_GetData_Stub(
2912 FORMATETC
*pformatetcIn
,
2913 STGMEDIUM
*pRemoteMedium
)
2915 TRACE("(%p)->(%p, %p)\n", This
, pformatetcIn
, pRemoteMedium
);
2916 return IDataObject_GetData(This
, pformatetcIn
, pRemoteMedium
);
2919 HRESULT CALLBACK
IDataObject_GetDataHere_Proxy(IDataObject
*iface
, FORMATETC
*fmt
, STGMEDIUM
*med
)
2922 IStorage
*stg
= NULL
;
2925 TRACE("(%p)->(%p, %p)\n", iface
, fmt
, med
);
2927 if ((med
->tymed
& (TYMED_HGLOBAL
| TYMED_FILE
| TYMED_ISTREAM
| TYMED_ISTORAGE
)) == 0)
2929 if (med
->tymed
!= fmt
->tymed
)
2932 release
= med
->pUnkForRelease
;
2933 med
->pUnkForRelease
= NULL
;
2935 if (med
->tymed
== TYMED_ISTREAM
|| med
->tymed
== TYMED_ISTORAGE
)
2937 stg
= med
->u
.pstg
; /* This may actually be a stream, but that's ok */
2938 if (stg
) IStorage_AddRef( stg
);
2941 hr
= IDataObject_RemoteGetDataHere_Proxy(iface
, fmt
, med
);
2943 med
->pUnkForRelease
= release
;
2947 IStorage_Release( med
->u
.pstg
);
2954 HRESULT __RPC_STUB
IDataObject_GetDataHere_Stub(
2956 FORMATETC
*pformatetc
,
2957 STGMEDIUM
*pRemoteMedium
)
2959 TRACE("(%p)->(%p, %p)\n", This
, pformatetc
, pRemoteMedium
);
2960 return IDataObject_GetDataHere(This
, pformatetc
, pRemoteMedium
);
2963 HRESULT CALLBACK
IDataObject_SetData_Proxy(
2965 FORMATETC
*pformatetc
,
2973 HRESULT __RPC_STUB
IDataObject_SetData_Stub(
2975 FORMATETC
*pformatetc
,
2976 FLAG_STGMEDIUM
*pmedium
,
2983 /* call_as/local stubs for oleidl.idl */
2985 HRESULT CALLBACK
IOleInPlaceActiveObject_TranslateAccelerator_Proxy(
2986 IOleInPlaceActiveObject
* This
,
2989 TRACE("(%p %p)\n", This
, lpmsg
);
2990 return IOleInPlaceActiveObject_RemoteTranslateAccelerator_Proxy(This
);
2993 HRESULT __RPC_STUB
IOleInPlaceActiveObject_TranslateAccelerator_Stub(
2994 IOleInPlaceActiveObject
* This
)
2996 TRACE("(%p)\n", This
);
3000 HRESULT CALLBACK
IOleInPlaceActiveObject_ResizeBorder_Proxy(
3001 IOleInPlaceActiveObject
* This
,
3003 IOleInPlaceUIWindow
*pUIWindow
,
3010 HRESULT __RPC_STUB
IOleInPlaceActiveObject_ResizeBorder_Stub(
3011 IOleInPlaceActiveObject
* This
,
3014 IOleInPlaceUIWindow
*pUIWindow
,
3021 HRESULT CALLBACK
IOleCache2_UpdateCache_Proxy(
3023 LPDATAOBJECT pDataObject
,
3027 TRACE("(%p, %p, 0x%08x, %p)\n", This
, pDataObject
, grfUpdf
, pReserved
);
3028 return IOleCache2_RemoteUpdateCache_Proxy(This
, pDataObject
, grfUpdf
, (LONG_PTR
)pReserved
);
3031 HRESULT __RPC_STUB
IOleCache2_UpdateCache_Stub(
3033 LPDATAOBJECT pDataObject
,
3037 TRACE("(%p, %p, 0x%08x, %li)\n", This
, pDataObject
, grfUpdf
, pReserved
);
3038 return IOleCache2_UpdateCache(This
, pDataObject
, grfUpdf
, (void*)pReserved
);
3041 HRESULT CALLBACK
IEnumOLEVERB_Next_Proxy(
3045 ULONG
*pceltFetched
)
3048 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
3049 if (!pceltFetched
) pceltFetched
= &fetched
;
3050 return IEnumOLEVERB_RemoteNext_Proxy(This
, celt
, rgelt
, pceltFetched
);
3053 HRESULT __RPC_STUB
IEnumOLEVERB_Next_Stub(
3057 ULONG
*pceltFetched
)
3060 TRACE("(%p)->(%d, %p, %p)\n", This
, celt
, rgelt
, pceltFetched
);
3062 hr
= IEnumOLEVERB_Next(This
, celt
, rgelt
, pceltFetched
);
3063 if (hr
== S_OK
) *pceltFetched
= celt
;
3067 HRESULT CALLBACK
IViewObject_Draw_Proxy(
3072 DVTARGETDEVICE
*ptd
,
3075 LPCRECTL lprcBounds
,
3076 LPCRECTL lprcWBounds
,
3077 BOOL (STDMETHODCALLTYPE
*pfnContinue
)(ULONG_PTR dwContinue
),
3078 ULONG_PTR dwContinue
)
3084 HRESULT __RPC_STUB
IViewObject_Draw_Stub(
3089 DVTARGETDEVICE
*ptd
,
3090 ULONG_PTR hdcTargetDev
,
3092 LPCRECTL lprcBounds
,
3093 LPCRECTL lprcWBounds
,
3094 IContinue
*pContinue
)
3100 HRESULT CALLBACK
IViewObject_GetColorSet_Proxy(
3105 DVTARGETDEVICE
*ptd
,
3107 LOGPALETTE
**ppColorSet
)
3113 HRESULT __RPC_STUB
IViewObject_GetColorSet_Stub(
3118 DVTARGETDEVICE
*ptd
,
3119 ULONG_PTR hicTargetDev
,
3120 LOGPALETTE
**ppColorSet
)
3126 HRESULT CALLBACK
IViewObject_Freeze_Proxy(
3137 HRESULT __RPC_STUB
IViewObject_Freeze_Stub(
3148 HRESULT CALLBACK
IViewObject_GetAdvise_Proxy(
3152 IAdviseSink
**ppAdvSink
)
3158 HRESULT __RPC_STUB
IViewObject_GetAdvise_Stub(
3162 IAdviseSink
**ppAdvSink
)