1 /*
2 * Miscellaneous Marshaling Routines
3 *
4 * Copyright 2005 Robert Shearman
5 *
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.
10 *
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.
15 *
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
19 */
20
21 #include <stdio.h>
22 #include <stdarg.h>
23 #include <string.h>
24
25 #define COBJMACROS
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
28
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "winuser.h"
33 #include "winerror.h"
34
35 #include "ole2.h"
36 #include "oleauto.h"
37 #include "rpcproxy.h"
38
39 #include "wine/unicode.h"
40 #include "wine/debug.h"
41
42 WINE_DEFAULT_DEBUG_CHANNEL(ole);
43
44 #define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
45 #define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
46 #define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
47 #define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
48
49 #define USER_MARSHAL_PTR_PREFIX \
50 ( (DWORD)'U' | ( (DWORD)'s' << 8 ) | \
51 ( (DWORD)'e' << 16 ) | ( (DWORD)'r' << 24 ) )
52
53 static const char* debugstr_user_flags(ULONG *pFlags)
54 {
55 char buf[12];
56 const char* loword;
57 switch (LOWORD(*pFlags))
58 {
59 case MSHCTX_LOCAL:
60 loword="MSHCTX_LOCAL";
61 break;
62 case MSHCTX_NOSHAREDMEM:
63 loword="MSHCTX_NOSHAREDMEM";
64 break;
65 case MSHCTX_DIFFERENTMACHINE:
66 loword="MSHCTX_DIFFERENTMACHINE";
67 break;
68 case MSHCTX_INPROC:
69 loword="MSHCTX_INPROC";
70 break;
71 default:
72 sprintf(buf, "%d", LOWORD(*pFlags));
73 loword=buf;
74 }
75
76 if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION)
77 return wine_dbg_sprintf("MAKELONG(NDR_LOCAL_REPRESENTATION, %s)", loword);
78 else
79 return wine_dbg_sprintf("MAKELONG(0x%04x, %s)", HIWORD(*pFlags), loword);
80 }
81
82 /******************************************************************************
83 * CLIPFORMAT_UserSize [OLE32.@]
84 *
85 * Calculates the buffer size required to marshal a clip format.
86 *
87 * PARAMS
88 * pFlags [I] Flags. See notes.
89 * StartingSize [I] Starting size of the buffer. This value is added on to
90 * the buffer size required for the clip format.
91 * pCF [I] Clip format to size.
92 *
93 * RETURNS
94 * The buffer size required to marshal a clip format plus the starting size.
95 *
96 * NOTES
97 * Even though the function is documented to take a pointer to an unsigned
98 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
99 * the first parameter is an unsigned long.
100 * This function is only intended to be called by the RPC runtime.
101 */
102 ULONG __RPC_USER CLIPFORMAT_UserSize(ULONG *pFlags, ULONG StartingSize, CLIPFORMAT *pCF)
103 {
104 ULONG size = StartingSize;
105
106 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, pCF);
107
108 size += sizeof(userCLIPFORMAT);
109
110 /* only need to marshal the name if it is not a pre-defined type and
111 * we are going remote */
112 if ((*pCF >= 0xc000) && (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE))
113 {
114 WCHAR format[255];
115 INT ret;
116 size += 3 * sizeof(INT);
117 /* urg! this function is badly designed because it won't tell us how
118 * much space is needed without doing a dummy run of storing the
119 * name into a buffer */
120 ret = GetClipboardFormatNameW(*pCF, format, sizeof(format)/sizeof(format[0])-1);
121 if (!ret)
122 RaiseException(DV_E_CLIPFORMAT, 0, 0, NULL);
123 size += (ret + 1) * sizeof(WCHAR);
124 }
125 return size;
126 }
127
128 /******************************************************************************
129 * CLIPFORMAT_UserMarshal [OLE32.@]
130 *
131 * Marshals a clip format into a buffer.
132 *
133 * PARAMS
134 * pFlags [I] Flags. See notes.
135 * pBuffer [I] Buffer to marshal the clip format into.
136 * pCF [I] Clip format to marshal.
137 *
138 * RETURNS
139 * The end of the marshaled data in the buffer.
140 *
141 * NOTES
142 * Even though the function is documented to take a pointer to an unsigned
143 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
144 * the first parameter is an unsigned long.
145 * This function is only intended to be called by the RPC runtime.
146 */
147 unsigned char * __RPC_USER CLIPFORMAT_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, CLIPFORMAT *pCF)
148 {
149 wireCLIPFORMAT wirecf = (wireCLIPFORMAT)pBuffer;
150
151 TRACE("(%s, %p, &0x%04x\n", debugstr_user_flags(pFlags), pBuffer, *pCF);
152
153 wirecf->u.dwValue = *pCF;
154 pBuffer += sizeof(*wirecf);
155
156 /* only need to marshal the name if it is not a pre-defined type and
157 * we are going remote */
158 if ((*pCF >= 0xc000) && (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE))
159 {
160 WCHAR format[255];
161 INT len;
162 wirecf->fContext = WDT_REMOTE_CALL;
163 len = GetClipboardFormatNameW(*pCF, format, sizeof(format)/sizeof(format[0])-1);
164 if (!len)
165 RaiseException(DV_E_CLIPFORMAT, 0, 0, NULL);
166 len += 1;
167 *(INT *)pBuffer = len;
168 pBuffer += sizeof(INT);
169 *(INT *)pBuffer = 0;
170 pBuffer += sizeof(INT);
171 *(INT *)pBuffer = len;
172 pBuffer += sizeof(INT);
173 TRACE("marshaling format name %s\n", debugstr_wn(format, len-1));
174 lstrcpynW((LPWSTR)pBuffer, format, len);
175 pBuffer += len * sizeof(WCHAR);
176 *(WCHAR *)pBuffer = '\0';
177 pBuffer += sizeof(WCHAR);
178 }
179 else
180 wirecf->fContext = WDT_INPROC_CALL;
181
182 return pBuffer;
183 }
184
185 /******************************************************************************
186 * CLIPFORMAT_UserUnmarshal [OLE32.@]
187 *
188 * Unmarshals a clip format from a buffer.
189 *
190 * PARAMS
191 * pFlags [I] Flags. See notes.
192 * pBuffer [I] Buffer to marshal the clip format from.
193 * pCF [O] Address that receive the unmarshaled clip format.
194 *
195 * RETURNS
196 * The end of the marshaled data in the buffer.
197 *
198 * NOTES
199 * Even though the function is documented to take a pointer to an unsigned
200 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
201 * the first parameter is an unsigned long.
202 * This function is only intended to be called by the RPC runtime.
203 */
204 unsigned char * __RPC_USER CLIPFORMAT_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, CLIPFORMAT *pCF)
205 {
206 wireCLIPFORMAT wirecf = (wireCLIPFORMAT)pBuffer;
207
208 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pCF);
209
210 pBuffer += sizeof(*wirecf);
211 if (wirecf->fContext == WDT_INPROC_CALL)
212 *pCF = (CLIPFORMAT)wirecf->u.dwValue;
213 else if (wirecf->fContext == WDT_REMOTE_CALL)
214 {
215 CLIPFORMAT cf;
216 INT len = *(INT *)pBuffer;
217 pBuffer += sizeof(INT);
218 if (*(INT *)pBuffer != 0)
219 RaiseException(RPC_S_INVALID_BOUND, 0, 0, NULL);
220 pBuffer += sizeof(INT);
221 if (*(INT *)pBuffer != len)
222 RaiseException(RPC_S_INVALID_BOUND, 0, 0, NULL);
223 pBuffer += sizeof(INT);
224 if (((WCHAR *)pBuffer)[len] != '\0')
225 RaiseException(RPC_S_INVALID_BOUND, 0, 0, NULL);
226 TRACE("unmarshaling clip format %s\n", debugstr_w((LPCWSTR)pBuffer));
227 cf = RegisterClipboardFormatW((LPCWSTR)pBuffer);
228 pBuffer += (len + 1) * sizeof(WCHAR);
229 if (!cf)
230 RaiseException(DV_E_CLIPFORMAT, 0, 0, NULL);
231 *pCF = cf;
232 }
233 else
234 /* code not really appropriate, but nearest I can find */
235 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
236 return pBuffer;
237 }
238
239 /******************************************************************************
240 * CLIPFORMAT_UserFree [OLE32.@]
241 *
242 * Frees an unmarshaled clip format.
243 *
244 * PARAMS
245 * pFlags [I] Flags. See notes.
246 * pCF [I] Clip format to free.
247 *
248 * RETURNS
249 * The end of the marshaled data in the buffer.
250 *
251 * NOTES
252 * Even though the function is documented to take a pointer to an unsigned
253 * long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB
254 * structure, of which the first parameter is an unsigned long.
255 * This function is only intended to be called by the RPC runtime.
256 */
257 void __RPC_USER CLIPFORMAT_UserFree(ULONG *pFlags, CLIPFORMAT *pCF)
258 {
259 /* there is no inverse of the RegisterClipboardFormat function,
260 * so nothing to do */
261 }
262
263 static ULONG handle_UserSize(ULONG *pFlags, ULONG StartingSize, HANDLE *handle)
264 {
265 if (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE)
266 {
267 ERR("can't remote a local handle\n");
268 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
269 return StartingSize;
270 }
271 return StartingSize + sizeof(RemotableHandle);
272 }
273
274 static unsigned char * handle_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HANDLE *handle)
275 {
276 RemotableHandle *remhandle = (RemotableHandle *)pBuffer;
277 if (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE)
278 {
279 ERR("can't remote a local handle\n");
280 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
281 return pBuffer;
282 }
283 remhandle->fContext = WDT_INPROC_CALL;
284 remhandle->u.hInproc = (LONG_PTR)*handle;
285 return pBuffer + sizeof(RemotableHandle);
286 }
287
288 static unsigned char * handle_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HANDLE *handle)
289 {
290 RemotableHandle *remhandle = (RemotableHandle *)pBuffer;
291 if (remhandle->fContext != WDT_INPROC_CALL)
292 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
293 *handle = (HANDLE)remhandle->u.hInproc;
294 return pBuffer + sizeof(RemotableHandle);
295 }
296
297 static void handle_UserFree(ULONG *pFlags, HANDLE *phMenu)
298 {
299 /* nothing to do */
300 }
301
302 #define IMPL_WIREM_HANDLE(type) \
303 ULONG __RPC_USER type##_UserSize(ULONG *pFlags, ULONG StartingSize, type *handle) \
304 { \
305 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, handle); \
306 return handle_UserSize(pFlags, StartingSize, (HANDLE *)handle); \
307 } \
308 \
309 unsigned char * __RPC_USER type##_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
310 { \
311 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *handle); \
312 return handle_UserMarshal(pFlags, pBuffer, (HANDLE *)handle); \
313 } \
314 \
315 unsigned char * __RPC_USER type##_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
316 { \
317 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, handle); \
318 return handle_UserUnmarshal(pFlags, pBuffer, (HANDLE *)handle); \
319 } \
320 \
321 void __RPC_USER type##_UserFree(ULONG *pFlags, type *handle) \
322 { \
323 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *handle); \
324 handle_UserFree(pFlags, (HANDLE *)handle); \
325 }
326
327 IMPL_WIREM_HANDLE(HACCEL)
328 IMPL_WIREM_HANDLE(HMENU)
329 IMPL_WIREM_HANDLE(HWND)
330
331 /******************************************************************************
332 * HGLOBAL_UserSize [OLE32.@]
333 *
334 * Calculates the buffer size required to marshal an HGLOBAL.
335 *
336 * PARAMS
337 * pFlags [I] Flags. See notes.
338 * StartingSize [I] Starting size of the buffer. This value is added on to
339 * the buffer size required for the clip format.
340 * phGlobal [I] HGLOBAL to size.
341 *
342 * RETURNS
343 * The buffer size required to marshal an HGLOBAL plus the starting size.
344 *
345 * NOTES
346 * Even though the function is documented to take a pointer to a ULONG in
347 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
348 * the first parameter is a ULONG.
349 * This function is only intended to be called by the RPC runtime.
350 */
351 ULONG __RPC_USER HGLOBAL_UserSize(ULONG *pFlags, ULONG StartingSize, HGLOBAL *phGlobal)
352 {
353 ULONG size = StartingSize;
354
355 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, phGlobal);
356
357 ALIGN_LENGTH(size, 3);
358
359 size += sizeof(ULONG);
360
361 if (LOWORD(*pFlags == MSHCTX_INPROC))
362 size += sizeof(HGLOBAL);
363 else
364 {
365 size += sizeof(ULONG);
366 if (*phGlobal)
367 {
368 SIZE_T ret;
369 size += 3 * sizeof(ULONG);
370 ret = GlobalSize(*phGlobal);
371 size += (ULONG)ret;
372 }
373 }
374
375 return size;
376 }
377
378 /******************************************************************************
379 * HGLOBAL_UserMarshal [OLE32.@]
380 *
381 * Marshals an HGLOBAL into a buffer.
382 *
383 * PARAMS
384 * pFlags [I] Flags. See notes.
385 * pBuffer [I] Buffer to marshal the clip format into.
386 * phGlobal [I] HGLOBAL to marshal.
387 *
388 * RETURNS
389 * The end of the marshaled data in the buffer.
390 *
391 * NOTES
392 * Even though the function is documented to take a pointer to a ULONG in
393 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
394 * the first parameter is a ULONG.
395 * This function is only intended to be called by the RPC runtime.
396 */
397 unsigned char * __RPC_USER HGLOBAL_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HGLOBAL *phGlobal)
398 {
399 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phGlobal);
400
401 ALIGN_POINTER(pBuffer, 3);
402
403 if (LOWORD(*pFlags == MSHCTX_INPROC))
404 {
405 if (sizeof(*phGlobal) == 8)
406 *(ULONG *)pBuffer = WDT_INPROC64_CALL;
407 else
408 *(ULONG *)pBuffer = WDT_INPROC_CALL;
409 pBuffer += sizeof(ULONG);
410 *(HGLOBAL *)pBuffer = *phGlobal;
411 pBuffer += sizeof(HGLOBAL);
412 }
413 else
414 {
415 *(ULONG *)pBuffer = WDT_REMOTE_CALL;
416 pBuffer += sizeof(ULONG);
417 *(ULONG *)pBuffer = (ULONG)*phGlobal;
418 pBuffer += sizeof(ULONG);
419 if (*phGlobal)
420 {
421 const unsigned char *memory;
422 SIZE_T size = GlobalSize(*phGlobal);
423 *(ULONG *)pBuffer = (ULONG)size;
424 pBuffer += sizeof(ULONG);
425 *(ULONG *)pBuffer = (ULONG)*phGlobal;
426 pBuffer += sizeof(ULONG);
427 *(ULONG *)pBuffer = (ULONG)size;
428 pBuffer += sizeof(ULONG);
429
430 memory = GlobalLock(*phGlobal);
431 memcpy(pBuffer, memory, size);
432 pBuffer += size;
433 GlobalUnlock(*phGlobal);
434 }
435 }
436
437 return pBuffer;
438 }
439
440 /******************************************************************************
441 * HGLOBAL_UserUnmarshal [OLE32.@]
442 *
443 * Unmarshals an HGLOBAL from a buffer.
444 *
445 * PARAMS
446 * pFlags [I] Flags. See notes.
447 * pBuffer [I] Buffer to marshal the clip format from.
448 * phGlobal [O] Address that receive the unmarshaled HGLOBAL.
449 *
450 * RETURNS
451 * The end of the marshaled data in the buffer.
452 *
453 * NOTES
454 * Even though the function is documented to take a pointer to an ULONG in
455 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
456 * the first parameter is an ULONG.
457 * This function is only intended to be called by the RPC runtime.
458 */
459 unsigned char * __RPC_USER HGLOBAL_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HGLOBAL *phGlobal)
460 {
461 ULONG fContext;
462
463 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phGlobal);
464
465 ALIGN_POINTER(pBuffer, 3);
466
467 fContext = *(ULONG *)pBuffer;
468 pBuffer += sizeof(ULONG);
469
470 if (((fContext == WDT_INPROC_CALL) && (sizeof(*phGlobal) < 8)) ||
471 ((fContext == WDT_INPROC64_CALL) && (sizeof(*phGlobal) == 8)))
472 {
473 *phGlobal = *(HGLOBAL *)pBuffer;
474 pBuffer += sizeof(*phGlobal);
475 }
476 else if (fContext == WDT_REMOTE_CALL)
477 {
478 ULONG handle;
479
480 handle = *(ULONG *)pBuffer;
481 pBuffer += sizeof(ULONG);
482
483 if (handle)
484 {
485 ULONG size;
486 void *memory;
487
488 size = *(ULONG *)pBuffer;
489 pBuffer += sizeof(ULONG);
490 /* redundancy is bad - it means you have to check consistency like
491 * this: */
492 if (*(ULONG *)pBuffer != handle)
493 {
494 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
495 return pBuffer;
496 }
497 pBuffer += sizeof(ULONG);
498 /* redundancy is bad - it means you have to check consistency like
499 * this: */
500 if (*(ULONG *)pBuffer != size)
501 {
502 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
503 return pBuffer;
504 }
505 pBuffer += sizeof(ULONG);
506
507 /* FIXME: check size is not too big */
508
509 *phGlobal = GlobalAlloc(GMEM_MOVEABLE, size);
510 memory = GlobalLock(*phGlobal);
511 memcpy(memory, pBuffer, size);
512 pBuffer += size;
513 GlobalUnlock(*phGlobal);
514 }
515 else
516 *phGlobal = NULL;
517 }
518 else
519 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
520
521 return pBuffer;
522 }
523
524 /******************************************************************************
525 * HGLOBAL_UserFree [OLE32.@]
526 *
527 * Frees an unmarshaled HGLOBAL.
528 *
529 * PARAMS
530 * pFlags [I] Flags. See notes.
531 * phGlobal [I] HGLOBAL to free.
532 *
533 * RETURNS
534 * The end of the marshaled data in the buffer.
535 *
536 * NOTES
537 * Even though the function is documented to take a pointer to a ULONG in
538 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
539 * which the first parameter is a ULONG.
540 * This function is only intended to be called by the RPC runtime.
541 */
542 void __RPC_USER HGLOBAL_UserFree(ULONG *pFlags, HGLOBAL *phGlobal)
543 {
544 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phGlobal);
545
546 if (LOWORD(*pFlags != MSHCTX_INPROC) && *phGlobal)
547 GlobalFree(*phGlobal);
548 }
549
550 /******************************************************************************
551 * HBITMAP_UserSize [OLE32.@]
552 *
553 * Calculates the buffer size required to marshal a bitmap.
554 *
555 * PARAMS
556 * pFlags [I] Flags. See notes.
557 * StartingSize [I] Starting size of the buffer. This value is added on to
558 * the buffer size required for the clip format.
559 * phBmp [I] Bitmap to size.
560 *
561 * RETURNS
562 * The buffer size required to marshal an bitmap plus the starting size.
563 *
564 * NOTES
565 * Even though the function is documented to take a pointer to a ULONG in
566 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
567 * the first parameter is a ULONG.
568 * This function is only intended to be called by the RPC runtime.
569 */
570 ULONG __RPC_USER HBITMAP_UserSize(ULONG *pFlags, ULONG StartingSize, HBITMAP *phBmp)
571 {
572 FIXME(":stub\n");
573 return StartingSize;
574 }
575
576 /******************************************************************************
577 * HBITMAP_UserMarshal [OLE32.@]
578 *
579 * Marshals a bitmap into a buffer.
580 *
581 * PARAMS
582 * pFlags [I] Flags. See notes.
583 * pBuffer [I] Buffer to marshal the clip format into.
584 * phBmp [I] Bitmap to marshal.
585 *
586 * RETURNS
587 * The end of the marshaled data in the buffer.
588 *
589 * NOTES
590 * Even though the function is documented to take a pointer to a ULONG in
591 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
592 * the first parameter is a ULONG.
593 * This function is only intended to be called by the RPC runtime.
594 */
595 unsigned char * __RPC_USER HBITMAP_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HBITMAP *phBmp)
596 {
597 FIXME(":stub\n");
598 return pBuffer;
599 }
600
601 /******************************************************************************
602 * HBITMAP_UserUnmarshal [OLE32.@]
603 *
604 * Unmarshals a bitmap from a buffer.
605 *
606 * PARAMS
607 * pFlags [I] Flags. See notes.
608 * pBuffer [I] Buffer to marshal the clip format from.
609 * phBmp [O] Address that receive the unmarshaled bitmap.
610 *
611 * RETURNS
612 * The end of the marshaled data in the buffer.
613 *
614 * NOTES
615 * Even though the function is documented to take a pointer to an ULONG in
616 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
617 * the first parameter is an ULONG.
618 * This function is only intended to be called by the RPC runtime.
619 */
620 unsigned char * __RPC_USER HBITMAP_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HBITMAP *phBmp)
621 {
622 FIXME(":stub\n");
623 return pBuffer;
624 }
625
626 /******************************************************************************
627 * HBITMAP_UserFree [OLE32.@]
628 *
629 * Frees an unmarshaled bitmap.
630 *
631 * PARAMS
632 * pFlags [I] Flags. See notes.
633 * phBmp [I] Bitmap to free.
634 *
635 * RETURNS
636 * The end of the marshaled data in the buffer.
637 *
638 * NOTES
639 * Even though the function is documented to take a pointer to a ULONG in
640 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
641 * which the first parameter is a ULONG.
642 * This function is only intended to be called by the RPC runtime.
643 */
644 void __RPC_USER HBITMAP_UserFree(ULONG *pFlags, HBITMAP *phBmp)
645 {
646 FIXME(":stub\n");
647 }
648
649 /******************************************************************************
650 * HICON_UserSize [OLE32.@]
651 *
652 * Calculates the buffer size required to marshal an icon.
653 *
654 * PARAMS
655 * pFlags [I] Flags. See notes.
656 * StartingSize [I] Starting size of the buffer. This value is added on to
657 * the buffer size required for the icon.
658 * phIcon [I] Icon to size.
659 *
660 * RETURNS
661 * The buffer size required to marshal an icon plus the starting size.
662 *
663 * NOTES
664 * Even though the function is documented to take a pointer to a ULONG in
665 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
666 * the first parameter is a ULONG.
667 * This function is only intended to be called by the RPC runtime.
668 */
669 ULONG __RPC_USER HICON_UserSize(ULONG *pFlags, ULONG StartingSize, HICON *phIcon)
670 {
671 FIXME(":stub\n");
672 return StartingSize;
673 }
674
675 /******************************************************************************
676 * HICON_UserMarshal [OLE32.@]
677 *
678 * Marshals an icon into a buffer.
679 *
680 * PARAMS
681 * pFlags [I] Flags. See notes.
682 * pBuffer [I] Buffer to marshal the icon into.
683 * phIcon [I] Icon to marshal.
684 *
685 * RETURNS
686 * The end of the marshaled data in the buffer.
687 *
688 * NOTES
689 * Even though the function is documented to take a pointer to a ULONG in
690 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
691 * the first parameter is a ULONG.
692 * This function is only intended to be called by the RPC runtime.
693 */
694 unsigned char * __RPC_USER HICON_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HICON *phIcon)
695 {
696 FIXME(":stub\n");
697 return pBuffer;
698 }
699
700 /******************************************************************************
701 * HICON_UserUnmarshal [OLE32.@]
702 *
703 * Unmarshals an icon from a buffer.
704 *
705 * PARAMS
706 * pFlags [I] Flags. See notes.
707 * pBuffer [I] Buffer to marshal the icon from.
708 * phIcon [O] Address that receive the unmarshaled icon.
709 *
710 * RETURNS
711 * The end of the marshaled data in the buffer.
712 *
713 * NOTES
714 * Even though the function is documented to take a pointer to an ULONG in
715 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
716 * the first parameter is an ULONG.
717 * This function is only intended to be called by the RPC runtime.
718 */
719 unsigned char * __RPC_USER HICON_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HICON *phIcon)
720 {
721 FIXME(":stub\n");
722 return pBuffer;
723 }
724
725 /******************************************************************************
726 * HICON_UserFree [OLE32.@]
727 *
728 * Frees an unmarshaled icon.
729 *
730 * PARAMS
731 * pFlags [I] Flags. See notes.
732 * phIcon [I] Icon to free.
733 *
734 * RETURNS
735 * The end of the marshaled data in the buffer.
736 *
737 * NOTES
738 * Even though the function is documented to take a pointer to a ULONG in
739 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
740 * which the first parameter is a ULONG.
741 * This function is only intended to be called by the RPC runtime.
742 */
743 void __RPC_USER HICON_UserFree(ULONG *pFlags, HICON *phIcon)
744 {
745 FIXME(":stub\n");
746 }
747
748 /******************************************************************************
749 * HDC_UserSize [OLE32.@]
750 *
751 * Calculates the buffer size required to marshal an HDC.
752 *
753 * PARAMS
754 * pFlags [I] Flags. See notes.
755 * StartingSize [I] Starting size of the buffer. This value is added on to
756 * the buffer size required for the clip format.
757 * phGlobal [I] HDC to size.
758 *
759 * RETURNS
760 * The buffer size required to marshal an HDC plus the starting size.
761 *
762 * NOTES
763 * Even though the function is documented to take a pointer to a ULONG in
764 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
765 * the first parameter is a ULONG.
766 * This function is only intended to be called by the RPC runtime.
767 */
768 ULONG __RPC_USER HDC_UserSize(ULONG *pFlags, ULONG StartingSize, HDC *phdc)
769 {
770 FIXME(":stub\n");
771 return StartingSize;
772 }
773
774 /******************************************************************************
775 * HDC_UserMarshal [OLE32.@]
776 *
777 * Marshals an HDC into a buffer.
778 *
779 * PARAMS
780 * pFlags [I] Flags. See notes.
781 * pBuffer [I] Buffer to marshal the clip format into.
782 * phdc [I] HDC to marshal.
783 *
784 * RETURNS
785 * The end of the marshaled data in the buffer.
786 *
787 * NOTES
788 * Even though the function is documented to take a pointer to a ULONG in
789 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
790 * the first parameter is a ULONG.
791 * This function is only intended to be called by the RPC runtime.
792 */
793 unsigned char * __RPC_USER HDC_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HDC *phdc)
794 {
795 FIXME(":stub\n");
796 return pBuffer;
797 }
798
799 /******************************************************************************
800 * HDC_UserUnmarshal [OLE32.@]
801 *
802 * Unmarshals an HDC from a buffer.
803 *
804 * PARAMS
805 * pFlags [I] Flags. See notes.
806 * pBuffer [I] Buffer to marshal the clip format from.
807 * phdc [O] Address that receive the unmarshaled HDC.
808 *
809 * RETURNS
810 * The end of the marshaled data in the buffer.
811 *
812 * NOTES
813 * Even though the function is documented to take a pointer to an ULONG in
814 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
815 * the first parameter is an ULONG.
816 * This function is only intended to be called by the RPC runtime.
817 */
818 unsigned char * __RPC_USER HDC_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HDC *phdc)
819 {
820 FIXME(":stub\n");
821 return pBuffer;
822 }
823
824 /******************************************************************************
825 * HDC_UserFree [OLE32.@]
826 *
827 * Frees an unmarshaled HDC.
828 *
829 * PARAMS
830 * pFlags [I] Flags. See notes.
831 * phdc [I] HDC to free.
832 *
833 * RETURNS
834 * The end of the marshaled data in the buffer.
835 *
836 * NOTES
837 * Even though the function is documented to take a pointer to a ULONG in
838 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
839 * which the first parameter is a ULONG.
840 * This function is only intended to be called by the RPC runtime.
841 */
842 void __RPC_USER HDC_UserFree(ULONG *pFlags, HDC *phdc)
843 {
844 FIXME(":stub\n");
845 }
846
847 /******************************************************************************
848 * HPALETTE_UserSize [OLE32.@]
849 *
850 * Calculates the buffer size required to marshal a palette.
851 *
852 * PARAMS
853 * pFlags [I] Flags. See notes.
854 * StartingSize [I] Starting size of the buffer. This value is added on to
855 * the buffer size required for the clip format.
856 * phPal [I] Palette to size.
857 *
858 * RETURNS
859 * The buffer size required to marshal a palette plus the starting size.
860 *
861 * NOTES
862 * Even though the function is documented to take a pointer to a ULONG in
863 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
864 * the first parameter is a ULONG.
865 * This function is only intended to be called by the RPC runtime.
866 */
867 ULONG __RPC_USER HPALETTE_UserSize(ULONG *pFlags, ULONG StartingSize, HPALETTE *phPal)
868 {
869 FIXME(":stub\n");
870 return StartingSize;
871 }
872
873 /******************************************************************************
874 * HPALETTE_UserMarshal [OLE32.@]
875 *
876 * Marshals a palette into a buffer.
877 *
878 * PARAMS
879 * pFlags [I] Flags. See notes.
880 * pBuffer [I] Buffer to marshal the clip format into.
881 * phPal [I] Palette to marshal.
882 *
883 * RETURNS
884 * The end of the marshaled data in the buffer.
885 *
886 * NOTES
887 * Even though the function is documented to take a pointer to a ULONG in
888 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
889 * the first parameter is a ULONG.
890 * This function is only intended to be called by the RPC runtime.
891 */
892 unsigned char * __RPC_USER HPALETTE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HPALETTE *phPal)
893 {
894 FIXME(":stub\n");
895 return pBuffer;
896 }
897
898 /******************************************************************************
899 * HPALETTE_UserUnmarshal [OLE32.@]
900 *
901 * Unmarshals a palette from a buffer.
902 *
903 * PARAMS
904 * pFlags [I] Flags. See notes.
905 * pBuffer [I] Buffer to marshal the clip format from.
906 * phPal [O] Address that receive the unmarshaled palette.
907 *
908 * RETURNS
909 * The end of the marshaled data in the buffer.
910 *
911 * NOTES
912 * Even though the function is documented to take a pointer to an ULONG in
913 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
914 * the first parameter is an ULONG.
915 * This function is only intended to be called by the RPC runtime.
916 */
917 unsigned char * __RPC_USER HPALETTE_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HPALETTE *phPal)
918 {
919 FIXME(":stub\n");
920 return pBuffer;
921 }
922
923 /******************************************************************************
924 * HPALETTE_UserFree [OLE32.@]
925 *
926 * Frees an unmarshaled palette.
927 *
928 * PARAMS
929 * pFlags [I] Flags. See notes.
930 * phPal [I] Palette to free.
931 *
932 * RETURNS
933 * The end of the marshaled data in the buffer.
934 *
935 * NOTES
936 * Even though the function is documented to take a pointer to a ULONG in
937 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
938 * which the first parameter is a ULONG.
939 * This function is only intended to be called by the RPC runtime.
940 */
941 void __RPC_USER HPALETTE_UserFree(ULONG *pFlags, HPALETTE *phPal)
942 {
943 FIXME(":stub\n");
944 }
945
946
947 /******************************************************************************
948 * HMETAFILE_UserSize [OLE32.@]
949 *
950 * Calculates the buffer size required to marshal a metafile.
951 *
952 * PARAMS
953 * pFlags [I] Flags. See notes.
954 * StartingSize [I] Starting size of the buffer. This value is added on to
955 * the buffer size required for the clip format.
956 * phmf [I] Metafile to size.
957 *
958 * RETURNS
959 * The buffer size required to marshal a metafile plus the starting size.
960 *
961 * NOTES
962 * Even though the function is documented to take a pointer to a ULONG in
963 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
964 * the first parameter is a ULONG.
965 * This function is only intended to be called by the RPC runtime.
966 */
967 ULONG __RPC_USER HMETAFILE_UserSize(ULONG *pFlags, ULONG StartingSize, HMETAFILE *phmf)
968 {
969 ULONG size = StartingSize;
970
971 TRACE("(%s, %d, &%p\n", debugstr_user_flags(pFlags), StartingSize, *phmf);
972
973 ALIGN_LENGTH(size, 3);
974
975 size += sizeof(ULONG);
976 if (LOWORD(*pFlags) == MSHCTX_INPROC)
977 size += sizeof(ULONG_PTR);
978 else
979 {
980 size += sizeof(ULONG);
981
982 if (*phmf)
983 {
984 UINT mfsize;
985
986 size += 2 * sizeof(ULONG);
987 mfsize = GetMetaFileBitsEx(*phmf, 0, NULL);
988 size += mfsize;
989 }
990 }
991
992 return size;
993 }
994
995 /******************************************************************************
996 * HMETAFILE_UserMarshal [OLE32.@]
997 *
998 * Marshals a metafile into a buffer.
999 *
1000 * PARAMS
1001 * pFlags [I] Flags. See notes.
1002 * pBuffer [I] Buffer to marshal the clip format into.
1003 * phEmf [I] Metafile to marshal.
1004 *
1005 * RETURNS
1006 * The end of the marshaled data in the buffer.
1007 *
1008 * NOTES
1009 * Even though the function is documented to take a pointer to a ULONG in
1010 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1011 * the first parameter is a ULONG.
1012 * This function is only intended to be called by the RPC runtime.
1013 */
1014 unsigned char * __RPC_USER HMETAFILE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILE *phmf)
1015 {
1016 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phmf);
1017
1018 ALIGN_POINTER(pBuffer, 3);
1019
1020 if (LOWORD(*pFlags) == MSHCTX_INPROC)
1021 {
1022 if (sizeof(*phmf) == 8)
1023 *(ULONG *)pBuffer = WDT_INPROC64_CALL;
1024 else
1025 *(ULONG *)pBuffer = WDT_INPROC_CALL;
1026 pBuffer += sizeof(ULONG);
1027 *(HMETAFILE *)pBuffer = *phmf;
1028 pBuffer += sizeof(HMETAFILE);
1029 }
1030 else
1031 {
1032 *(ULONG *)pBuffer = WDT_REMOTE_CALL;
1033 pBuffer += sizeof(ULONG);
1034 *(ULONG *)pBuffer = (ULONG)(ULONG_PTR)*phmf;
1035 pBuffer += sizeof(ULONG);
1036
1037 if (*phmf)
1038 {
1039 UINT mfsize = GetMetaFileBitsEx(*phmf, 0, NULL);
1040
1041 *(ULONG *)pBuffer = mfsize;
1042 pBuffer += sizeof(ULONG);
1043 *(ULONG *)pBuffer = mfsize;
1044 pBuffer += sizeof(ULONG);
1045 GetMetaFileBitsEx(*phmf, mfsize, pBuffer);
1046 pBuffer += mfsize;
1047 }
1048 }
1049
1050 return pBuffer;
1051 }
1052
1053 /******************************************************************************
1054 * HMETAFILE_UserUnmarshal [OLE32.@]
1055 *
1056 * Unmarshals a metafile from a buffer.
1057 *
1058 * PARAMS
1059 * pFlags [I] Flags. See notes.
1060 * pBuffer [I] Buffer to marshal the clip format from.
1061 * phmf [O] Address that receive the unmarshaled metafile.
1062 *
1063 * RETURNS
1064 * The end of the marshaled data in the buffer.
1065 *
1066 * NOTES
1067 * Even though the function is documented to take a pointer to an ULONG in
1068 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1069 * the first parameter is an ULONG.
1070 * This function is only intended to be called by the RPC runtime.
1071 */
1072 unsigned char * __RPC_USER HMETAFILE_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILE *phmf)
1073 {
1074 ULONG fContext;
1075
1076 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, phmf);
1077
1078 ALIGN_POINTER(pBuffer, 3);
1079
1080 fContext = *(ULONG *)pBuffer;
1081 pBuffer += sizeof(ULONG);
1082
1083 if (((fContext == WDT_INPROC_CALL) && (sizeof(*phmf) < 8)) ||
1084 ((fContext == WDT_INPROC64_CALL) && (sizeof(*phmf) == 8)))
1085 {
1086 *phmf = *(HMETAFILE *)pBuffer;
1087 pBuffer += sizeof(*phmf);
1088 }
1089 else if (fContext == WDT_REMOTE_CALL)
1090 {
1091 ULONG handle;
1092
1093 handle = *(ULONG *)pBuffer;
1094 pBuffer += sizeof(ULONG);
1095
1096 if (handle)
1097 {
1098 ULONG size;
1099 size = *(ULONG *)pBuffer;
1100 pBuffer += sizeof(ULONG);
1101 if (size != *(ULONG *)pBuffer)
1102 {
1103 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
1104 return pBuffer;
1105 }
1106 pBuffer += sizeof(ULONG);
1107 *phmf = SetMetaFileBitsEx(size, pBuffer);
1108 pBuffer += size;
1109 }
1110 else
1111 *phmf = NULL;
1112 }
1113 else
1114 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
1115
1116 return pBuffer;
1117 }
1118
1119 /******************************************************************************
1120 * HMETAFILE_UserFree [OLE32.@]
1121 *
1122 * Frees an unmarshaled metafile.
1123 *
1124 * PARAMS
1125 * pFlags [I] Flags. See notes.
1126 * phmf [I] Metafile to free.
1127 *
1128 * RETURNS
1129 * The end of the marshaled data in the buffer.
1130 *
1131 * NOTES
1132 * Even though the function is documented to take a pointer to a ULONG in
1133 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1134 * which the first parameter is a ULONG.
1135 * This function is only intended to be called by the RPC runtime.
1136 */
1137 void __RPC_USER HMETAFILE_UserFree(ULONG *pFlags, HMETAFILE *phmf)
1138 {
1139 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phmf);
1140
1141 if (LOWORD(*pFlags) != MSHCTX_INPROC)
1142 DeleteMetaFile(*phmf);
1143 }
1144
1145 /******************************************************************************
1146 * HENHMETAFILE_UserSize [OLE32.@]
1147 *
1148 * Calculates the buffer size required to marshal an enhanced metafile.
1149 *
1150 * PARAMS
1151 * pFlags [I] Flags. See notes.
1152 * StartingSize [I] Starting size of the buffer. This value is added on to
1153 * the buffer size required for the clip format.
1154 * phEmf [I] Enhanced metafile to size.
1155 *
1156 * RETURNS
1157 * The buffer size required to marshal an enhanced metafile plus the starting size.
1158 *
1159 * NOTES
1160 * Even though the function is documented to take a pointer to a ULONG in
1161 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1162 * the first parameter is a ULONG.
1163 * This function is only intended to be called by the RPC runtime.
1164 */
1165 ULONG __RPC_USER HENHMETAFILE_UserSize(ULONG *pFlags, ULONG StartingSize, HENHMETAFILE *phEmf)
1166 {
1167 ULONG size = StartingSize;
1168
1169 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, *phEmf);
1170
1171 size += sizeof(ULONG);
1172 if (LOWORD(*pFlags) == MSHCTX_INPROC)
1173 size += sizeof(ULONG_PTR);
1174 else
1175 {
1176 size += sizeof(ULONG);
1177
1178 if (*phEmf)
1179 {
1180 UINT emfsize;
1181
1182 size += 2 * sizeof(ULONG);
1183 emfsize = GetEnhMetaFileBits(*phEmf, 0, NULL);
1184 size += emfsize;
1185 }
1186 }
1187
1188 return size;
1189 }
1190
1191 /******************************************************************************
1192 * HENHMETAFILE_UserMarshal [OLE32.@]
1193 *
1194 * Marshals an enhance metafile into a buffer.
1195 *
1196 * PARAMS
1197 * pFlags [I] Flags. See notes.
1198 * pBuffer [I] Buffer to marshal the clip format into.
1199 * phEmf [I] Enhanced metafile to marshal.
1200 *
1201 * RETURNS
1202 * The end of the marshaled data in the buffer.
1203 *
1204 * NOTES
1205 * Even though the function is documented to take a pointer to a ULONG in
1206 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1207 * the first parameter is a ULONG.
1208 * This function is only intended to be called by the RPC runtime.
1209 */
1210 unsigned char * __RPC_USER HENHMETAFILE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HENHMETAFILE *phEmf)
1211 {
1212 TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phEmf);
1213
1214 if (LOWORD(*pFlags) == MSHCTX_INPROC)
1215 {
1216 if (sizeof(*phEmf) == 8)
1217 *(ULONG *)pBuffer = WDT_INPROC64_CALL;
1218 else
1219 *(ULONG *)pBuffer = WDT_INPROC_CALL;
1220 pBuffer += sizeof(ULONG);
1221 *(HENHMETAFILE *)pBuffer = *phEmf;
1222 pBuffer += sizeof(HENHMETAFILE);
1223 }
1224 else
1225 {
1226 *(ULONG *)pBuffer = WDT_REMOTE_CALL;
1227 pBuffer += sizeof(ULONG);
1228 *(ULONG *)pBuffer = (ULONG)(ULONG_PTR)*phEmf;
1229 pBuffer += sizeof(ULONG);
1230
1231 if (*phEmf)
1232 {
1233 UINT emfsize = GetEnhMetaFileBits(*phEmf, 0, NULL);
1234
1235 *(ULONG *)pBuffer = emfsize;
1236 pBuffer += sizeof(ULONG);
1237 *(ULONG *)pBuffer = emfsize;
1238 pBuffer += sizeof(ULONG);
1239 GetEnhMetaFileBits(*phEmf, emfsize, pBuffer);
1240 pBuffer += emfsize;
1241 }
1242 }
1243
1244 return pBuffer;
1245 }
1246
1247 /******************************************************************************
1248 * HENHMETAFILE_UserUnmarshal [OLE32.@]
1249 *
1250 * Unmarshals an enhanced metafile from a buffer.
1251 *
1252 * PARAMS
1253 * pFlags [I] Flags. See notes.
1254 * pBuffer [I] Buffer to marshal the clip format from.
1255 * phEmf [O] Address that receive the unmarshaled enhanced metafile.
1256 *
1257 * RETURNS
1258 * The end of the marshaled data in the buffer.
1259 *
1260 * NOTES
1261 * Even though the function is documented to take a pointer to an ULONG in
1262 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1263 * the first parameter is an ULONG.
1264 * This function is only intended to be called by the RPC runtime.
1265 */
1266 unsigned char * __RPC_USER HENHMETAFILE_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HENHMETAFILE *phEmf)
1267 {
1268 ULONG fContext;
1269
1270 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, phEmf);
1271
1272 fContext = *(ULONG *)pBuffer;
1273 pBuffer += sizeof(ULONG);
1274
1275 if (((fContext == WDT_INPROC_CALL) && (sizeof(*phEmf) < 8)) ||
1276 ((fContext == WDT_INPROC64_CALL) && (sizeof(*phEmf) == 8)))
1277 {
1278 *phEmf = *(HENHMETAFILE *)pBuffer;
1279 pBuffer += sizeof(*phEmf);
1280 }
1281 else if (fContext == WDT_REMOTE_CALL)
1282 {
1283 ULONG handle;
1284
1285 handle = *(ULONG *)pBuffer;
1286 pBuffer += sizeof(ULONG);
1287
1288 if (handle)
1289 {
1290 ULONG size;
1291 size = *(ULONG *)pBuffer;
1292 pBuffer += sizeof(ULONG);
1293 if (size != *(ULONG *)pBuffer)
1294 {
1295 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
1296 return pBuffer;
1297 }
1298 pBuffer += sizeof(ULONG);
1299 *phEmf = SetEnhMetaFileBits(size, pBuffer);
1300 pBuffer += size;
1301 }
1302 else
1303 *phEmf = NULL;
1304 }
1305 else
1306 RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
1307
1308 return pBuffer;
1309 }
1310
1311 /******************************************************************************
1312 * HENHMETAFILE_UserFree [OLE32.@]
1313 *
1314 * Frees an unmarshaled enhanced metafile.
1315 *
1316 * PARAMS
1317 * pFlags [I] Flags. See notes.
1318 * phEmf [I] Enhanced metafile to free.
1319 *
1320 * RETURNS
1321 * The end of the marshaled data in the buffer.
1322 *
1323 * NOTES
1324 * Even though the function is documented to take a pointer to a ULONG in
1325 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1326 * which the first parameter is a ULONG.
1327 * This function is only intended to be called by the RPC runtime.
1328 */
1329 void __RPC_USER HENHMETAFILE_UserFree(ULONG *pFlags, HENHMETAFILE *phEmf)
1330 {
1331 TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phEmf);
1332
1333 if (LOWORD(*pFlags) != MSHCTX_INPROC)
1334 DeleteEnhMetaFile(*phEmf);
1335 }
1336
1337 /******************************************************************************
1338 * HMETAFILEPICT_UserSize [OLE32.@]
1339 *
1340 * Calculates the buffer size required to marshal an metafile pict.
1341 *
1342 * PARAMS
1343 * pFlags [I] Flags. See notes.
1344 * StartingSize [I] Starting size of the buffer. This value is added on to
1345 * the buffer size required for the clip format.
1346 * phMfp [I] Metafile pict to size.
1347 *
1348 * RETURNS
1349 * The buffer size required to marshal a metafile pict plus the starting size.
1350 *
1351 * NOTES
1352 * Even though the function is documented to take a pointer to a ULONG in
1353 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1354 * the first parameter is a ULONG.
1355 * This function is only intended to be called by the RPC runtime.
1356 */
1357 ULONG __RPC_USER HMETAFILEPICT_UserSize(ULONG *pFlags, ULONG StartingSize, HMETAFILEPICT *phMfp)
1358 {
1359 ULONG size = StartingSize;
1360
1361 TRACE("(%s, %d, &%p)\n", debugstr_user_flags(pFlags), StartingSize, *phMfp);
1362
1363 size += sizeof(ULONG);
1364 size += sizeof(HMETAFILEPICT);
1365
1366 if ((LOWORD(*pFlags) != MSHCTX_INPROC) && *phMfp)
1367 {
1368 METAFILEPICT *mfpict = GlobalLock(*phMfp);
1369
1370 /* FIXME: raise an exception if mfpict is NULL? */
1371 size += FIELD_OFFSET(remoteMETAFILEPICT, hMF);
1372 size += sizeof(ULONG);
1373
1374 size = HMETAFILE_UserSize(pFlags, size, &mfpict->hMF);
1375
1376 GlobalUnlock(*phMfp);
1377 }
1378
1379 return size;
1380 }
1381
1382 /******************************************************************************
1383 * HMETAFILEPICT_UserMarshal [OLE32.@]
1384 *
1385 * Marshals a metafile pict into a buffer.
1386 *
1387 * PARAMS
1388 * pFlags [I] Flags. See notes.
1389 * pBuffer [I] Buffer to marshal the clip format into.
1390 * phMfp [I] Metafile pict to marshal.
1391 *
1392 * RETURNS
1393 * The end of the marshaled data in the buffer.
1394 *
1395 * NOTES
1396 * Even though the function is documented to take a pointer to a ULONG in
1397 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1398 * the first parameter is a ULONG.
1399 * This function is only intended to be called by the RPC runtime.
1400 */
1401 unsigned char * __RPC_USER HMETAFILEPICT_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILEPICT *phMfp)
1402 {
1403 TRACE("(%s, %p, &%p)\n", debugstr_user_flags(pFlags), pBuffer, *phMfp);
1404
1405 if (LOWORD(*pFlags) == MSHCTX_INPROC)
1406 *(ULONG *)pBuffer = WDT_INPROC_CALL;
1407 else
1408 *(ULONG *)pBuffer = WDT_REMOTE_CALL;
1409 pBuffer += sizeof(ULONG);
1410
1411 *(HMETAFILEPICT *)pBuffer = *phMfp;
1412 pBuffer += sizeof(HMETAFILEPICT);
1413
1414 if ((LOWORD(*pFlags) != MSHCTX_INPROC) && *phMfp)
1415 {
1416 METAFILEPICT *mfpict = GlobalLock(*phMfp);
1417 remoteMETAFILEPICT * remmfpict = (remoteMETAFILEPICT *)pBuffer;
1418
1419 /* FIXME: raise an exception if mfpict is NULL? */
1420 remmfpict->mm = mfpict->mm;
1421 remmfpict->xExt = mfpict->xExt;
1422 remmfpict->yExt = mfpict->yExt;
1423 pBuffer += FIELD_OFFSET(remoteMETAFILEPICT, hMF);
1424 *(ULONG *)pBuffer = USER_MARSHAL_PTR_PREFIX;
1425 pBuffer += sizeof(ULONG);
1426
1427 pBuffer = HMETAFILE_UserMarshal(pFlags, pBuffer, &mfpict->hMF);
1428
1429 GlobalUnlock(*phMfp);
1430 }
1431
1432 return pBuffer;
1433 }
1434
1435 /******************************************************************************
1436 * HMETAFILEPICT_UserUnmarshal [OLE32.@]
1437 *
1438 * Unmarshals an metafile pict from a buffer.
1439 *
1440 * PARAMS
1441 * pFlags [I] Flags. See notes.
1442 * pBuffer [I] Buffer to marshal the clip format from.
1443 * phMfp [O] Address that receive the unmarshaled metafile pict.
1444 *
1445 * RETURNS
1446 * The end of the marshaled data in the buffer.
1447 *
1448 * NOTES
1449 * Even though the function is documented to take a pointer to an ULONG in
1450 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1451 * the first parameter is an ULONG.
1452 * This function is only intended to be called by the RPC runtime.
1453 */
1454 unsigned char * __RPC_USER HMETAFILEPICT_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILEPICT *phMfp)
1455 {
1456 ULONG fContext;
1457
1458 TRACE("(%s, %p, %p)\n", debugstr_user_flags(pFlags), pBuffer, phMfp);
1459
1460 fContext = *(ULONG *)pBuffer;
1461 pBuffer += sizeof(ULONG);
1462
1463 if ((fContext == WDT_INPROC_CALL) || !*(HMETAFILEPICT *)pBuffer)
1464 {
1465 *phMfp = *(HMETAFILEPICT *)pBuffer;
1466 pBuffer += sizeof(HMETAFILEPICT);
1467 }
1468 else
1469 {
1470 METAFILEPICT *mfpict;
1471 const remoteMETAFILEPICT *remmfpict;
1472 ULONG user_marshal_prefix;
1473
1474 pBuffer += sizeof(HMETAFILEPICT);
1475 remmfpict = (const remoteMETAFILEPICT *)pBuffer;
1476
1477 *phMfp = GlobalAlloc(GMEM_MOVEABLE, sizeof(METAFILEPICT));
1478 if (!*phMfp)
1479 RpcRaiseException(E_OUTOFMEMORY);
1480
1481 mfpict = GlobalLock(*phMfp);
1482 mfpict->mm = remmfpict->mm;
1483 mfpict->xExt = remmfpict->xExt;
1484 mfpict->yExt = remmfpict->yExt;
1485 pBuffer += FIELD_OFFSET(remoteMETAFILEPICT, hMF);
1486 user_marshal_prefix = *(ULONG *)pBuffer;
1487 pBuffer += sizeof(ULONG);
1488
1489 if (user_marshal_prefix != USER_MARSHAL_PTR_PREFIX)
1490 RpcRaiseException(RPC_X_INVALID_TAG);
1491
1492 pBuffer = HMETAFILE_UserUnmarshal(pFlags, pBuffer, &mfpict->hMF);
1493
1494 GlobalUnlock(*phMfp);
1495 }
1496
1497 return pBuffer;
1498 }
1499
1500 /******************************************************************************
1501 * HMETAFILEPICT_UserFree [OLE32.@]
1502 *
1503 * Frees an unmarshaled metafile pict.
1504 *
1505 * PARAMS
1506 * pFlags [I] Flags. See notes.
1507 * phMfp [I] Metafile pict to free.
1508 *
1509 * RETURNS
1510 * The end of the marshaled data in the buffer.
1511 *
1512 * NOTES
1513 * Even though the function is documented to take a pointer to a ULONG in
1514 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1515 * which the first parameter is a ULONG.
1516 * This function is only intended to be called by the RPC runtime.
1517 */
1518 void __RPC_USER HMETAFILEPICT_UserFree(ULONG *pFlags, HMETAFILEPICT *phMfp)
1519 {
1520 TRACE("(%s, &%p)\n", debugstr_user_flags(pFlags), *phMfp);
1521
1522 if ((LOWORD(*pFlags) != MSHCTX_INPROC) && *phMfp)
1523 {
1524 METAFILEPICT *mfpict;
1525
1526 mfpict = GlobalLock(*phMfp);
1527 /* FIXME: raise an exception if mfpict is NULL? */
1528 HMETAFILE_UserFree(pFlags, &mfpict->hMF);
1529 GlobalUnlock(*phMfp);
1530
1531 GlobalFree(*phMfp);
1532 }
1533 }
1534
1535 /******************************************************************************
1536 * WdtpInterfacePointer_UserSize [OLE32.@]
1537 *
1538 * Calculates the buffer size required to marshal an interface pointer.
1539 *
1540 * PARAMS
1541 * pFlags [I] Flags. See notes.
1542 * RealFlags [I] The MSHCTX to use when marshaling the interface.
1543 * punk [I] Interface pointer to size.
1544 * StartingSize [I] Starting size of the buffer. This value is added on to
1545 * the buffer size required for the clip format.
1546 * riid [I] ID of interface to size.
1547 *
1548 * RETURNS
1549 * The buffer size required to marshal an interface pointer plus the starting size.
1550 *
1551 * NOTES
1552 * Even though the function is documented to take a pointer to a ULONG in
1553 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1554 * the first parameter is a ULONG.
1555 */
1556 ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG *pFlags, ULONG RealFlags, IUnknown *punk, ULONG StartingSize, REFIID riid)
1557 {
1558 FIXME("(%s, 0%x, %p, %d, %s): stub\n", debugstr_user_flags(pFlags), RealFlags, punk, StartingSize, debugstr_guid(riid));
1559 return 0;
1560 }
1561
1562 /******************************************************************************
1563 * WdtpInterfacePointer_UserMarshal [OLE32.@]
1564 *
1565 * Marshals an interface pointer into a buffer.
1566 *
1567 * PARAMS
1568 * pFlags [I] Flags. See notes.
1569 * RealFlags [I] The MSHCTX to use when marshaling the interface.
1570 * pBuffer [I] Buffer to marshal the clip format into.
1571 * punk [I] Interface pointer to marshal.
1572 * riid [I] ID of interface to marshal.
1573 *
1574 * RETURNS
1575 * The end of the marshaled data in the buffer.
1576 *
1577 * NOTES
1578 * Even though the function is documented to take a pointer to a ULONG in
1579 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1580 * the first parameter is a ULONG.
1581 */
1582 unsigned char * WINAPI WdtpInterfacePointer_UserMarshal(ULONG *pFlags, ULONG RealFlags, unsigned char *pBuffer, IUnknown *punk, REFIID riid)
1583 {
1584 FIXME("(%s, 0x%x, %p, &%p, %s): stub\n", debugstr_user_flags(pFlags), RealFlags, pBuffer, punk, debugstr_guid(riid));
1585 return NULL;
1586 }
1587
1588 /******************************************************************************
1589 * WdtpInterfacePointer_UserUnmarshal [OLE32.@]
1590 *
1591 * Unmarshals an interface pointer from a buffer.
1592 *
1593 * PARAMS
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.
1598 *
1599 * RETURNS
1600 * The end of the marshaled data in the buffer.
1601 *
1602 * NOTES
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.
1606 */
1607 unsigned char * WINAPI WdtpInterfacePointer_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, IUnknown **ppunk, REFIID riid)
1608 {
1609 FIXME("(%s, %p, %p, %s): stub\n", debugstr_user_flags(pFlags), pBuffer, ppunk, debugstr_guid(riid));
1610 return NULL;
1611 }
1612
1613 /******************************************************************************
1614 * WdtpInterfacePointer_UserFree [OLE32.@]
1615 *
1616 * Frees an unmarshaled interface pointer.
1617 *
1618 * PARAMS
1619 * punk [I] Interface pointer to free.
1620 *
1621 * RETURNS
1622 * Nothing.
1623 */
1624 void WINAPI WdtpInterfacePointer_UserFree(IUnknown *punk)
1625 {
1626 FIXME("(%p): stub\n", punk);
1627 }
1628
1629 /******************************************************************************
1630 * STGMEDIUM_UserSize [OLE32.@]
1631 *
1632 * Calculates the buffer size required to marshal an STGMEDIUM.
1633 *
1634 * PARAMS
1635 * pFlags [I] Flags. See notes.
1636 * StartingSize [I] Starting size of the buffer. This value is added on to
1637 * the buffer size required for the clip format.
1638 * pStgMedium [I] STGMEDIUM to size.
1639 *
1640 * RETURNS
1641 * The buffer size required to marshal an STGMEDIUM plus the starting size.
1642 *
1643 * NOTES
1644 * Even though the function is documented to take a pointer to a ULONG in
1645 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1646 * the first parameter is a ULONG.
1647 * This function is only intended to be called by the RPC runtime.
1648 */
1649 ULONG __RPC_USER STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, STGMEDIUM *pStgMedium)
1650 {
1651 ULONG size = StartingSize;
1652
1653 TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, pStgMedium);
1654
1655 ALIGN_LENGTH(size, 3);
1656
1657 size += 2 * sizeof(DWORD);
1658 if (pStgMedium->tymed != TYMED_NULL)
1659 size += sizeof(DWORD);
1660
1661 switch (pStgMedium->tymed)
1662 {
1663 case TYMED_NULL:
1664 TRACE("TYMED_NULL\n");
1665 break;
1666 case TYMED_HGLOBAL:
1667 TRACE("TYMED_HGLOBAL\n");
1668 if (pStgMedium->u.hGlobal)
1669 size = HGLOBAL_UserSize(pFlags, size, &pStgMedium->u.hGlobal);
1670 break;
1671 case TYMED_FILE:
1672 TRACE("TYMED_FILE\n");
1673 if (pStgMedium->u.lpszFileName)
1674 {
1675 TRACE("file name is %s\n", debugstr_w(pStgMedium->u.lpszFileName));
1676 size += 3 * sizeof(DWORD) +
1677 (strlenW(pStgMedium->u.lpszFileName) + 1) * sizeof(WCHAR);
1678 }
1679 break;
1680 case TYMED_ISTREAM:
1681 TRACE("TYMED_ISTREAM\n");
1682 if (pStgMedium->u.pstm)
1683 {
1684 FIXME("not implemented for IStream %p\n", pStgMedium->u.pstm);
1685 }
1686 break;
1687 case TYMED_ISTORAGE:
1688 TRACE("TYMED_ISTORAGE\n");
1689 if (pStgMedium->u.pstg)
1690 {
1691 FIXME("not implemented for IStorage %p\n", pStgMedium->u.pstg);
1692 }
1693 break;
1694 case TYMED_GDI:
1695 TRACE("TYMED_GDI\n");
1696 if (pStgMedium->u.hBitmap)
1697 {
1698 FIXME("not implemented for GDI object %p\n", pStgMedium->u.hBitmap);
1699 }
1700 break;
1701 case TYMED_MFPICT:
1702 TRACE("TYMED_MFPICT\n");
1703 if (pStgMedium->u.hMetaFilePict)
1704 size = HMETAFILEPICT_UserSize(pFlags, size, &pStgMedium->u.hMetaFilePict);
1705 break;
1706 case TYMED_ENHMF:
1707 TRACE("TYMED_ENHMF\n");
1708 if (pStgMedium->u.hEnhMetaFile)
1709 size = HENHMETAFILE_UserSize(pFlags, size, &pStgMedium->u.hEnhMetaFile);
1710 break;
1711 default:
1712 RaiseException(DV_E_TYMED, 0, 0, NULL);
1713 }
1714
1715 if (pStgMedium->pUnkForRelease)
1716 FIXME("buffer size pUnkForRelease\n");
1717
1718 return size;
1719 }
1720
1721 /******************************************************************************
1722 * STGMEDIUM_UserMarshal [OLE32.@]
1723 *
1724 * Marshals a STGMEDIUM into a buffer.
1725 *
1726 * PARAMS
1727 * pFlags [I] Flags. See notes.
1728 * pBuffer [I] Buffer to marshal the clip format into.
1729 * pCF [I] STGMEDIUM to marshal.
1730 *
1731 * RETURNS
1732 * The end of the marshaled data in the buffer.
1733 *
1734 * NOTES
1735 * Even though the function is documented to take a pointer to a ULONG in
1736 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1737 * the first parameter is a ULONG.
1738 * This function is only intended to be called by the RPC runtime.
1739 */
1740 unsigned char * __RPC_USER STGMEDIUM_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, STGMEDIUM *pStgMedium)
1741 {
1742 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pStgMedium);
1743
1744 ALIGN_POINTER(pBuffer, 3);
1745
1746 *(DWORD *)pBuffer = pStgMedium->tymed;
1747 pBuffer += sizeof(DWORD);
1748 if (pStgMedium->tymed != TYMED_NULL)
1749 {
1750 *(DWORD *)pBuffer = (DWORD)(DWORD_PTR)pStgMedium->u.pstg;
1751 pBuffer += sizeof(DWORD);
1752 }
1753 *(DWORD *)pBuffer = (DWORD)(DWORD_PTR)pStgMedium->pUnkForRelease;
1754 pBuffer += sizeof(DWORD);
1755
1756 switch (pStgMedium->tymed)
1757 {
1758 case TYMED_NULL:
1759 TRACE("TYMED_NULL\n");
1760 break;
1761 case TYMED_HGLOBAL:
1762 TRACE("TYMED_HGLOBAL\n");
1763 if (pStgMedium->u.hGlobal)
1764 pBuffer = HGLOBAL_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hGlobal);
1765 break;
1766 case TYMED_FILE:
1767 TRACE("TYMED_FILE\n");
1768 if (pStgMedium->u.lpszFileName)
1769 {
1770 DWORD len;
1771 len = strlenW(pStgMedium->u.lpszFileName);
1772 /* conformance */
1773 *(DWORD *)pBuffer = len + 1;
1774 pBuffer += sizeof(DWORD);
1775 /* offset */
1776 *(DWORD *)pBuffer = 0;
1777 pBuffer += sizeof(DWORD);
1778 /* variance */
1779 *(DWORD *)pBuffer = len + 1;
1780 pBuffer += sizeof(DWORD);
1781
1782 TRACE("file name is %s\n", debugstr_w(pStgMedium->u.lpszFileName));
1783 memcpy(pBuffer, pStgMedium->u.lpszFileName, (len + 1) * sizeof(WCHAR));
1784 }
1785 break;
1786 case TYMED_ISTREAM:
1787 TRACE("TYMED_ISTREAM\n");
1788 if (pStgMedium->u.pstm)
1789 {
1790 FIXME("not implemented for IStream %p\n", pStgMedium->u.pstm);
1791 }
1792 break;
1793 case TYMED_ISTORAGE:
1794 TRACE("TYMED_ISTORAGE\n");
1795 if (pStgMedium->u.pstg)
1796 {
1797 FIXME("not implemented for IStorage %p\n", pStgMedium->u.pstg);
1798 }
1799 break;
1800 case TYMED_GDI:
1801 TRACE("TYMED_GDI\n");
1802 if (pStgMedium->u.hBitmap)
1803 {
1804 FIXME("not implemented for GDI object %p\n", pStgMedium->u.hBitmap);
1805 }
1806 break;
1807 case TYMED_MFPICT:
1808 TRACE("TYMED_MFPICT\n");
1809 if (pStgMedium->u.hMetaFilePict)
1810 pBuffer = HMETAFILEPICT_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hMetaFilePict);
1811 break;
1812 case TYMED_ENHMF:
1813 TRACE("TYMED_ENHMF\n");
1814 if (pStgMedium->u.hEnhMetaFile)
1815 pBuffer = HENHMETAFILE_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hEnhMetaFile);
1816 break;
1817 default:
1818 RaiseException(DV_E_TYMED, 0, 0, NULL);
1819 }
1820
1821 if (pStgMedium->pUnkForRelease)
1822 FIXME("marshal pUnkForRelease\n");
1823
1824 return pBuffer;
1825 }
1826
1827 /******************************************************************************
1828 * STGMEDIUM_UserUnmarshal [OLE32.@]
1829 *
1830 * Unmarshals a STGMEDIUM from a buffer.
1831 *
1832 * PARAMS
1833 * pFlags [I] Flags. See notes.
1834 * pBuffer [I] Buffer to marshal the clip format from.
1835 * pStgMedium [O] Address that receive the unmarshaled STGMEDIUM.
1836 *
1837 * RETURNS
1838 * The end of the marshaled data in the buffer.
1839 *
1840 * NOTES
1841 * Even though the function is documented to take a pointer to an ULONG in
1842 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
1843 * the first parameter is an ULONG.
1844 * This function is only intended to be called by the RPC runtime.
1845 */
1846 unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, STGMEDIUM *pStgMedium)
1847 {
1848 DWORD content = 0;
1849 DWORD releaseunk;
1850
1851 ALIGN_POINTER(pBuffer, 3);
1852
1853 TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pStgMedium);
1854
1855 pStgMedium->tymed = *(DWORD *)pBuffer;
1856 pBuffer += sizeof(DWORD);
1857 if (pStgMedium->tymed != TYMED_NULL)
1858 {
1859 content = *(DWORD *)pBuffer;
1860 pBuffer += sizeof(DWORD);
1861 }
1862 releaseunk = *(DWORD *)pBuffer;
1863 pBuffer += sizeof(DWORD);
1864
1865 switch (pStgMedium->tymed)
1866 {
1867 case TYMED_NULL:
1868 TRACE("TYMED_NULL\n");
1869 break;
1870 case TYMED_HGLOBAL:
1871 TRACE("TYMED_HGLOBAL\n");
1872 if (content)
1873 pBuffer = HGLOBAL_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hGlobal);
1874 break;
1875 case TYMED_FILE:
1876 TRACE("TYMED_FILE\n");
1877 if (content)
1878 {
1879 DWORD conformance;
1880 DWORD variance;
1881 conformance = *(DWORD *)pBuffer;
1882 pBuffer += sizeof(DWORD);
1883 if (*(DWORD *)pBuffer != 0)
1884 {
1885 ERR("invalid offset %d\n", *(DWORD *)pBuffer);
1886 RpcRaiseException(RPC_S_INVALID_BOUND);
1887 return NULL;
1888 }
1889 pBuffer += sizeof(DWORD);
1890 variance = *(DWORD *)pBuffer;
1891 pBuffer += sizeof(DWORD);
1892 if (conformance != variance)
1893 {
1894 ERR("conformance (%d) and variance (%d) should be equal\n",
1895 conformance, variance);
1896 RpcRaiseException(RPC_S_INVALID_BOUND);
1897 return NULL;
1898 }
1899 if (conformance > 0x7fffffff)
1900 {
1901 ERR("conformance 0x%x too large\n", conformance);
1902 RpcRaiseException(RPC_S_INVALID_BOUND);
1903 return NULL;
1904 }
1905 pStgMedium->u.lpszFileName = CoTaskMemAlloc(conformance * sizeof(WCHAR));
1906 if (!pStgMedium->u.lpszFileName) RpcRaiseException(ERROR_OUTOFMEMORY);
1907 TRACE("unmarshalled file name is %s\n", debugstr_wn((const WCHAR *)pBuffer, variance));
1908 memcpy(pStgMedium->u.lpszFileName, pBuffer, variance * sizeof(WCHAR));
1909 pBuffer += variance * sizeof(WCHAR);
1910 }
1911 else
1912 pStgMedium->u.lpszFileName = NULL;
1913 break;
1914 case TYMED_ISTREAM:
1915 TRACE("TYMED_ISTREAM\n");
1916 if (content)
1917 {
1918 FIXME("not implemented for IStream\n");
1919 }
1920 else
1921 pStgMedium->u.pstm = NULL;
1922 break;
1923 case TYMED_ISTORAGE:
1924 TRACE("TYMED_ISTORAGE\n");
1925 if (content)
1926 {
1927 FIXME("not implemented for IStorage\n");
1928 }
1929 else
1930 pStgMedium->u.pstg = NULL;
1931 break;
1932 case TYMED_GDI:
1933 TRACE("TYMED_GDI\n");
1934 if (content)
1935 {
1936 FIXME("not implemented for GDI object\n");
1937 }
1938 else
1939 pStgMedium->u.hBitmap = NULL;
1940 break;
1941 case TYMED_MFPICT:
1942 TRACE("TYMED_MFPICT\n");
1943 if (content)
1944 pBuffer = HMETAFILEPICT_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hMetaFilePict);
1945 else
1946 pStgMedium->u.hMetaFilePict = NULL;
1947 break;
1948 case TYMED_ENHMF:
1949 TRACE("TYMED_ENHMF\n");
1950 if (content)
1951 pBuffer = HENHMETAFILE_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hEnhMetaFile);
1952 else
1953 pStgMedium->u.hEnhMetaFile = NULL;
1954 break;
1955 default:
1956 RaiseException(DV_E_TYMED, 0, 0, NULL);
1957 }
1958
1959 pStgMedium->pUnkForRelease = NULL;
1960 if (releaseunk)
1961 FIXME("unmarshal pUnkForRelease\n");
1962
1963 return pBuffer;
1964 }
1965
1966 /******************************************************************************
1967 * STGMEDIUM_UserFree [OLE32.@]
1968 *
1969 * Frees an unmarshaled STGMEDIUM.
1970 *
1971 * PARAMS
1972 * pFlags [I] Flags. See notes.
1973 * pStgmedium [I] STGMEDIUM to free.
1974 *
1975 * RETURNS
1976 * The end of the marshaled data in the buffer.
1977 *
1978 * NOTES
1979 * Even though the function is documented to take a pointer to a ULONG in
1980 * pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
1981 * which the first parameter is a ULONG.
1982 * This function is only intended to be called by the RPC runtime.
1983 */
1984 void __RPC_USER STGMEDIUM_UserFree(ULONG *pFlags, STGMEDIUM *pStgMedium)
1985 {
1986 TRACE("(%s, %p\n", debugstr_user_flags(pFlags), pStgMedium);
1987
1988 ReleaseStgMedium(pStgMedium);
1989 }
1990
1991 ULONG __RPC_USER ASYNC_STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, ASYNC_STGMEDIUM *pStgMedium)
1992 {
1993 TRACE("\n");
1994 return STGMEDIUM_UserSize(pFlags, StartingSize, pStgMedium);
1995 }
1996
1997 unsigned char * __RPC_USER ASYNC_STGMEDIUM_UserMarshal( ULONG *pFlags, unsigned char *pBuffer, ASYNC_STGMEDIUM *pStgMedium)
1998 {
1999 TRACE("\n");
2000 return STGMEDIUM_UserMarshal(pFlags, pBuffer, pStgMedium);
2001 }
2002
2003 unsigned char * __RPC_USER ASYNC_STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, ASYNC_STGMEDIUM *pStgMedium)
2004 {
2005 TRACE("\n");
2006 return STGMEDIUM_UserUnmarshal(pFlags, pBuffer, pStgMedium);
2007 }
2008
2009 void __RPC_USER ASYNC_STGMEDIUM_UserFree(ULONG *pFlags, ASYNC_STGMEDIUM *pStgMedium)
2010 {
2011 TRACE("\n");
2012 STGMEDIUM_UserFree(pFlags, pStgMedium);
2013 }
2014
2015 ULONG __RPC_USER FLAG_STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, FLAG_STGMEDIUM *pStgMedium)
2016 {
2017 FIXME(":stub\n");
2018 return StartingSize;
2019 }
2020
2021 unsigned char * __RPC_USER FLAG_STGMEDIUM_UserMarshal( ULONG *pFlags, unsigned char *pBuffer, FLAG_STGMEDIUM *pStgMedium)
2022 {
2023 FIXME(":stub\n");
2024 return pBuffer;
2025 }
2026
2027 unsigned char * __RPC_USER FLAG_STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, FLAG_STGMEDIUM *pStgMedium)
2028 {
2029 FIXME(":stub\n");
2030 return pBuffer;
2031 }
2032
2033 void __RPC_USER FLAG_STGMEDIUM_UserFree(ULONG *pFlags, FLAG_STGMEDIUM *pStgMedium)
2034 {
2035 FIXME(":stub\n");
2036 }
2037
2038 ULONG __RPC_USER SNB_UserSize(ULONG *pFlags, ULONG StartingSize, SNB *pSnb)
2039 {
2040 FIXME(":stub\n");
2041 return StartingSize;
2042 }
2043
2044 unsigned char * __RPC_USER SNB_UserMarshal( ULONG *pFlags, unsigned char *pBuffer, SNB *pSnb)
2045 {
2046 FIXME(":stub\n");
2047 return pBuffer;
2048 }
2049
2050 unsigned char * __RPC_USER SNB_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, SNB *pSnb)
2051 {
2052 FIXME(":stub\n");
2053 return pBuffer;
2054 }
2055
2056 void __RPC_USER SNB_UserFree(ULONG *pFlags, SNB *pSnb)
2057 {
2058 FIXME(":stub\n");
2059 }
2060
2061 /* call_as/local stubs for unknwn.idl */
2062
2063 HRESULT CALLBACK IClassFactory_CreateInstance_Proxy(
2064 IClassFactory* This,
2065 IUnknown *pUnkOuter,
2066 REFIID riid,
2067 void **ppvObject)
2068 {
2069 TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject);
2070 *ppvObject = NULL;
2071 if (pUnkOuter)
2072 {
2073 ERR("aggregation is not allowed on remote objects\n");
2074 return CLASS_E_NOAGGREGATION;
2075 }
2076 return IClassFactory_RemoteCreateInstance_Proxy(This, riid,
2077 (IUnknown **) ppvObject);
2078 }
2079
2080 HRESULT __RPC_STUB IClassFactory_CreateInstance_Stub(
2081 IClassFactory* This,
2082 REFIID riid,
2083 IUnknown **ppvObject)
2084 {
2085 TRACE("(%s, %p)\n", debugstr_guid(riid), ppvObject);
2086 return IClassFactory_CreateInstance(This, NULL, riid, (void **) ppvObject);
2087 }
2088
2089 HRESULT CALLBACK IClassFactory_LockServer_Proxy(
2090 IClassFactory* This,
2091 BOOL fLock)
2092 {
2093 FIXME(":stub\n");
2094 return E_NOTIMPL;
2095 }
2096
2097 HRESULT __RPC_STUB IClassFactory_LockServer_Stub(
2098 IClassFactory* This,
2099 BOOL fLock)
2100 {
2101 FIXME(":stub\n");
2102 return E_NOTIMPL;
2103 }
2104
2105 /* call_as/local stubs for objidl.idl */
2106
2107 HRESULT CALLBACK IEnumUnknown_Next_Proxy(
2108 IEnumUnknown* This,
2109 ULONG celt,
2110 IUnknown **rgelt,
2111 ULONG *pceltFetched)
2112 {
2113 ULONG fetched;
2114 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2115 if (!pceltFetched) pceltFetched = &fetched;
2116 return IEnumUnknown_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2117 }
2118
2119 HRESULT __RPC_STUB IEnumUnknown_Next_Stub(
2120 IEnumUnknown* This,
2121 ULONG celt,
2122 IUnknown **rgelt,
2123 ULONG *pceltFetched)
2124 {
2125 HRESULT hr;
2126 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2127 *pceltFetched = 0;
2128 hr = IEnumUnknown_Next(This, celt, rgelt, pceltFetched);
2129 if (hr == S_OK) *pceltFetched = celt;
2130 return hr;
2131 }
2132
2133 HRESULT CALLBACK IBindCtx_SetBindOptions_Proxy(
2134 IBindCtx* This,
2135 BIND_OPTS *pbindopts)
2136 {
2137 FIXME(":stub\n");
2138 return E_NOTIMPL;
2139 }
2140
2141 HRESULT __RPC_STUB IBindCtx_SetBindOptions_Stub(
2142 IBindCtx* This,
2143 BIND_OPTS2 *pbindopts)
2144 {
2145 FIXME(":stub\n");
2146 return E_NOTIMPL;
2147 }
2148
2149 HRESULT CALLBACK IBindCtx_GetBindOptions_Proxy(
2150 IBindCtx* This,
2151 BIND_OPTS *pbindopts)
2152 {
2153 FIXME(":stub\n");
2154 return E_NOTIMPL;
2155 }
2156
2157 HRESULT __RPC_STUB IBindCtx_GetBindOptions_Stub(
2158 IBindCtx* This,
2159 BIND_OPTS2 *pbindopts)
2160 {
2161 FIXME(":stub\n");
2162 return E_NOTIMPL;
2163 }
2164
2165 HRESULT CALLBACK IEnumMoniker_Next_Proxy(
2166 IEnumMoniker* This,
2167 ULONG celt,
2168 IMoniker **rgelt,
2169 ULONG *pceltFetched)
2170 {
2171 ULONG fetched;
2172 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2173 if (!pceltFetched) pceltFetched = &fetched;
2174 return IEnumMoniker_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2175 }
2176
2177 HRESULT __RPC_STUB IEnumMoniker_Next_Stub(
2178 IEnumMoniker* This,
2179 ULONG celt,
2180 IMoniker **rgelt,
2181 ULONG *pceltFetched)
2182 {
2183 HRESULT hr;
2184 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2185 *pceltFetched = 0;
2186 hr = IEnumMoniker_Next(This, celt, rgelt, pceltFetched);
2187 if (hr == S_OK) *pceltFetched = celt;
2188 return hr;
2189 }
2190
2191 BOOL CALLBACK IRunnableObject_IsRunning_Proxy(
2192 IRunnableObject* This)
2193 {
2194 BOOL rv;
2195 FIXME(":stub\n");
2196 memset(&rv, 0, sizeof rv);
2197 return rv;
2198 }
2199
2200 HRESULT __RPC_STUB IRunnableObject_IsRunning_Stub(
2201 IRunnableObject* This)
2202 {
2203 FIXME(":stub\n");
2204 return E_NOTIMPL;
2205 }
2206
2207 HRESULT CALLBACK IMoniker_BindToObject_Proxy(
2208 IMoniker* This,
2209 IBindCtx *pbc,
2210 IMoniker *pmkToLeft,
2211 REFIID riidResult,
2212 void **ppvResult)
2213 {
2214 FIXME(":stub\n");
2215 return E_NOTIMPL;
2216 }
2217
2218 HRESULT __RPC_STUB IMoniker_BindToObject_Stub(
2219 IMoniker* This,
2220 IBindCtx *pbc,
2221 IMoniker *pmkToLeft,
2222 REFIID riidResult,
2223 IUnknown **ppvResult)
2224 {
2225 FIXME(":stub\n");
2226 return E_NOTIMPL;
2227 }
2228
2229 HRESULT CALLBACK IMoniker_BindToStorage_Proxy(
2230 IMoniker* This,
2231 IBindCtx *pbc,
2232 IMoniker *pmkToLeft,
2233 REFIID riid,
2234 void **ppvObj)
2235 {
2236 FIXME(":stub\n");
2237 return E_NOTIMPL;
2238 }
2239
2240 HRESULT __RPC_STUB IMoniker_BindToStorage_Stub(
2241 IMoniker* This,
2242 IBindCtx *pbc,
2243 IMoniker *pmkToLeft,
2244 REFIID riid,
2245 IUnknown **ppvObj)
2246 {
2247 FIXME(":stub\n");
2248 return E_NOTIMPL;
2249 }
2250
2251 HRESULT CALLBACK IEnumString_Next_Proxy(
2252 IEnumString* This,
2253 ULONG celt,
2254 LPOLESTR *rgelt,
2255 ULONG *pceltFetched)
2256 {
2257 ULONG fetched;
2258 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2259 if (!pceltFetched) pceltFetched = &fetched;
2260 return IEnumString_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2261 }
2262
2263 HRESULT __RPC_STUB IEnumString_Next_Stub(
2264 IEnumString* This,
2265 ULONG celt,
2266 LPOLESTR *rgelt,
2267 ULONG *pceltFetched)
2268 {
2269 HRESULT hr;
2270 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2271 *pceltFetched = 0;
2272 hr = IEnumString_Next(This, celt, rgelt, pceltFetched);
2273 if (hr == S_OK) *pceltFetched = celt;
2274 return hr;
2275 }
2276
2277 HRESULT CALLBACK ISequentialStream_Read_Proxy(
2278 ISequentialStream* This,
2279 void *pv,
2280 ULONG cb,
2281 ULONG *pcbRead)
2282 {
2283 FIXME(":stub\n");
2284 return E_NOTIMPL;
2285 }
2286
2287 HRESULT __RPC_STUB ISequentialStream_Read_Stub(
2288 ISequentialStream* This,
2289 byte *pv,
2290 ULONG cb,
2291 ULONG *pcbRead)
2292 {
2293 FIXME(":stub\n");
2294 return E_NOTIMPL;
2295 }
2296
2297 HRESULT CALLBACK ISequentialStream_Write_Proxy(
2298 ISequentialStream* This,
2299 const void *pv,
2300 ULONG cb,
2301 ULONG *pcbWritten)
2302 {
2303 FIXME(":stub\n");
2304 return E_NOTIMPL;
2305 }
2306
2307 HRESULT __RPC_STUB ISequentialStream_Write_Stub(
2308 ISequentialStream* This,
2309 const byte *pv,
2310 ULONG cb,
2311 ULONG *pcbWritten)
2312 {
2313 FIXME(":stub\n");
2314 return E_NOTIMPL;
2315 }
2316
2317 HRESULT CALLBACK IStream_Seek_Proxy(
2318 IStream* This,
2319 LARGE_INTEGER dlibMove,
2320 DWORD dwOrigin,
2321 ULARGE_INTEGER *plibNewPosition)
2322 {
2323 FIXME(":stub\n");
2324 return E_NOTIMPL;
2325 }
2326
2327 HRESULT __RPC_STUB IStream_Seek_Stub(
2328 IStream* This,
2329 LARGE_INTEGER dlibMove,
2330 DWORD dwOrigin,
2331 ULARGE_INTEGER *plibNewPosition)
2332 {
2333 FIXME(":stub\n");
2334 return E_NOTIMPL;
2335 }
2336
2337 HRESULT CALLBACK IStream_CopyTo_Proxy(
2338 IStream* This,
2339 IStream *pstm,
2340 ULARGE_INTEGER cb,
2341 ULARGE_INTEGER *pcbRead,
2342 ULARGE_INTEGER *pcbWritten)
2343 {
2344 FIXME(":stub\n");
2345 return E_NOTIMPL;
2346 }
2347
2348 HRESULT __RPC_STUB IStream_CopyTo_Stub(
2349 IStream* This,
2350 IStream *pstm,
2351 ULARGE_INTEGER cb,
2352 ULARGE_INTEGER *pcbRead,
2353 ULARGE_INTEGER *pcbWritten)
2354 {
2355 FIXME(":stub\n");
2356 return E_NOTIMPL;
2357 }
2358
2359 HRESULT CALLBACK IEnumSTATSTG_Next_Proxy(
2360 IEnumSTATSTG* This,
2361 ULONG celt,
2362 STATSTG *rgelt,
2363 ULONG *pceltFetched)
2364 {
2365 ULONG fetched;
2366 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2367 if (!pceltFetched) pceltFetched = &fetched;
2368 return IEnumSTATSTG_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2369 }
2370
2371 HRESULT __RPC_STUB IEnumSTATSTG_Next_Stub(
2372 IEnumSTATSTG* This,
2373 ULONG celt,
2374 STATSTG *rgelt,
2375 ULONG *pceltFetched)
2376 {
2377 HRESULT hr;
2378 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2379 *pceltFetched = 0;
2380 hr = IEnumSTATSTG_Next(This, celt, rgelt, pceltFetched);
2381 if (hr == S_OK) *pceltFetched = celt;
2382 return hr;
2383 }
2384
2385 HRESULT CALLBACK IStorage_OpenStream_Proxy(
2386 IStorage* This,
2387 LPCOLESTR pwcsName,
2388 void *reserved1,
2389 DWORD grfMode,
2390 DWORD reserved2,
2391 IStream **ppstm)
2392 {
2393 FIXME(":stub\n");
2394 return E_NOTIMPL;
2395 }
2396
2397 HRESULT __RPC_STUB IStorage_OpenStream_Stub(
2398 IStorage* This,
2399 LPCOLESTR pwcsName,
2400 unsigned long cbReserved1,
2401 byte *reserved1,
2402 DWORD grfMode,
2403 DWORD reserved2,
2404 IStream **ppstm)
2405 {
2406 FIXME(":stub\n");
2407 return E_NOTIMPL;
2408 }
2409
2410 HRESULT CALLBACK IStorage_EnumElements_Proxy(
2411 IStorage* This,
2412 DWORD reserved1,
2413 void *reserved2,
2414 DWORD reserved3,
2415 IEnumSTATSTG **ppenum)
2416 {
2417 FIXME(":stub\n");
2418 return E_NOTIMPL;
2419 }
2420
2421 HRESULT __RPC_STUB IStorage_EnumElements_Stub(
2422 IStorage* This,
2423 DWORD reserved1,
2424 unsigned long cbReserved2,
2425 byte *reserved2,
2426 DWORD reserved3,
2427 IEnumSTATSTG **ppenum)
2428 {
2429 FIXME(":stub\n");
2430 return E_NOTIMPL;
2431 }
2432
2433 HRESULT CALLBACK ILockBytes_ReadAt_Proxy(
2434 ILockBytes* This,
2435 ULARGE_INTEGER ulOffset,
2436 void *pv,
2437 ULONG cb,
2438 ULONG *pcbRead)
2439 {
2440 FIXME(":stub\n");
2441 return E_NOTIMPL;
2442 }
2443
2444 HRESULT __RPC_STUB ILockBytes_ReadAt_Stub(
2445 ILockBytes* This,
2446 ULARGE_INTEGER ulOffset,
2447 byte *pv,
2448 ULONG cb,
2449 ULONG *pcbRead)
2450 {
2451 FIXME(":stub\n");
2452 return E_NOTIMPL;
2453 }
2454
2455 HRESULT CALLBACK ILockBytes_WriteAt_Proxy(
2456 ILockBytes* This,
2457 ULARGE_INTEGER ulOffset,
2458 const void *pv,
2459 ULONG cb,
2460 ULONG *pcbWritten)
2461 {
2462 FIXME(":stub\n");
2463 return E_NOTIMPL;
2464 }
2465
2466 HRESULT __RPC_STUB ILockBytes_WriteAt_Stub(
2467 ILockBytes* This,
2468 ULARGE_INTEGER ulOffset,
2469 const byte *pv,
2470 ULONG cb,
2471 ULONG *pcbWritten)
2472 {
2473 FIXME(":stub\n");
2474 return E_NOTIMPL;
2475 }
2476
2477 HRESULT CALLBACK IFillLockBytes_FillAppend_Proxy(
2478 IFillLockBytes* This,
2479 const void *pv,
2480 ULONG cb,
2481 ULONG *pcbWritten)
2482 {
2483 FIXME(":stub\n");
2484 return E_NOTIMPL;
2485 }
2486
2487 HRESULT __RPC_STUB IFillLockBytes_FillAppend_Stub(
2488 IFillLockBytes* This,
2489 const byte *pv,
2490 ULONG cb,
2491 ULONG *pcbWritten)
2492 {
2493 FIXME(":stub\n");
2494 return E_NOTIMPL;
2495 }
2496
2497 HRESULT CALLBACK IFillLockBytes_FillAt_Proxy(
2498 IFillLockBytes* This,
2499 ULARGE_INTEGER ulOffset,
2500 const void *pv,
2501 ULONG cb,
2502 ULONG *pcbWritten)
2503 {
2504 FIXME(":stub\n");
2505 return E_NOTIMPL;
2506 }
2507
2508 HRESULT __RPC_STUB IFillLockBytes_FillAt_Stub(
2509 IFillLockBytes* This,
2510 ULARGE_INTEGER ulOffset,
2511 const byte *pv,
2512 ULONG cb,
2513 ULONG *pcbWritten)
2514 {
2515 FIXME(":stub\n");
2516 return E_NOTIMPL;
2517 }
2518
2519 HRESULT CALLBACK IEnumFORMATETC_Next_Proxy(
2520 IEnumFORMATETC* This,
2521 ULONG celt,
2522 FORMATETC *rgelt,
2523 ULONG *pceltFetched)
2524 {
2525 ULONG fetched;
2526 if (!pceltFetched) pceltFetched = &fetched;
2527 return IEnumFORMATETC_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2528 }
2529
2530 HRESULT __RPC_STUB IEnumFORMATETC_Next_Stub(
2531 IEnumFORMATETC* This,
2532 ULONG celt,
2533 FORMATETC *rgelt,
2534 ULONG *pceltFetched)
2535 {
2536 HRESULT hr;
2537 *pceltFetched = 0;
2538 hr = IEnumFORMATETC_Next(This, celt, rgelt, pceltFetched);
2539 if (hr == S_OK) *pceltFetched = celt;
2540 return hr;
2541 }
2542
2543 HRESULT CALLBACK IEnumSTATDATA_Next_Proxy(
2544 IEnumSTATDATA* This,
2545 ULONG celt,
2546 STATDATA *rgelt,
2547 ULONG *pceltFetched)
2548 {
2549 ULONG fetched;
2550 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2551 if (!pceltFetched) pceltFetched = &fetched;
2552 return IEnumSTATDATA_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2553 }
2554
2555 HRESULT __RPC_STUB IEnumSTATDATA_Next_Stub(
2556 IEnumSTATDATA* This,
2557 ULONG celt,
2558 STATDATA *rgelt,
2559 ULONG *pceltFetched)
2560 {
2561 HRESULT hr;
2562 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2563 *pceltFetched = 0;
2564 hr = IEnumSTATDATA_Next(This, celt, rgelt, pceltFetched);
2565 if (hr == S_OK) *pceltFetched = celt;
2566 return hr;
2567 }
2568
2569 void CALLBACK IAdviseSink_OnDataChange_Proxy(
2570 IAdviseSink* This,
2571 FORMATETC *pFormatetc,
2572 STGMEDIUM *pStgmed)
2573 {
2574 FIXME(":stub\n");
2575 }
2576
2577 HRESULT __RPC_STUB IAdviseSink_OnDataChange_Stub(
2578 IAdviseSink* This,
2579 FORMATETC *pFormatetc,
2580 ASYNC_STGMEDIUM *pStgmed)
2581 {
2582 FIXME(":stub\n");
2583 return E_NOTIMPL;
2584 }
2585
2586 void CALLBACK IAdviseSink_OnViewChange_Proxy(
2587 IAdviseSink* This,
2588 DWORD dwAspect,
2589 LONG lindex)
2590 {
2591 FIXME(":stub\n");
2592 }
2593
2594 HRESULT __RPC_STUB IAdviseSink_OnViewChange_Stub(
2595 IAdviseSink* This,
2596 DWORD dwAspect,
2597 LONG lindex)
2598 {
2599 FIXME(":stub\n");
2600 return E_NOTIMPL;
2601 }
2602
2603 void CALLBACK IAdviseSink_OnRename_Proxy(
2604 IAdviseSink* This,
2605 IMoniker *pmk)
2606 {
2607 FIXME(":stub\n");
2608 }
2609
2610 HRESULT __RPC_STUB IAdviseSink_OnRename_Stub(
2611 IAdviseSink* This,
2612 IMoniker *pmk)
2613 {
2614 FIXME(":stub\n");
2615 return E_NOTIMPL;
2616 }
2617
2618 void CALLBACK IAdviseSink_OnSave_Proxy(
2619 IAdviseSink* This)
2620 {
2621 FIXME(":stub\n");
2622 }
2623
2624 HRESULT __RPC_STUB IAdviseSink_OnSave_Stub(
2625 IAdviseSink* This)
2626 {
2627 FIXME(":stub\n");
2628 return E_NOTIMPL;
2629 }
2630
2631 void CALLBACK IAdviseSink_OnClose_Proxy(
2632 IAdviseSink* This)
2633 {
2634 FIXME(":stub\n");
2635 }
2636
2637 HRESULT __RPC_STUB IAdviseSink_OnClose_Stub(
2638 IAdviseSink* This)
2639 {
2640 FIXME(":stub\n");
2641 return E_NOTIMPL;
2642 }
2643
2644 void CALLBACK IAdviseSink2_OnLinkSrcChange_Proxy(
2645 IAdviseSink2* This,
2646 IMoniker *pmk)
2647 {
2648 FIXME(":stub\n");
2649 }
2650
2651 HRESULT __RPC_STUB IAdviseSink2_OnLinkSrcChange_Stub(
2652 IAdviseSink2* This,
2653 IMoniker *pmk)
2654 {
2655 FIXME(":stub\n");
2656 return E_NOTIMPL;
2657 }
2658
2659 HRESULT CALLBACK IDataObject_GetData_Proxy(
2660 IDataObject* This,
2661 FORMATETC *pformatetcIn,
2662 STGMEDIUM *pmedium)
2663 {
2664 FIXME(":stub\n");
2665 return E_NOTIMPL;
2666 }
2667
2668 HRESULT __RPC_STUB IDataObject_GetData_Stub(
2669 IDataObject* This,
2670 FORMATETC *pformatetcIn,
2671 STGMEDIUM *pRemoteMedium)
2672 {
2673 FIXME(":stub\n");
2674 return E_NOTIMPL;
2675 }
2676
2677 HRESULT CALLBACK IDataObject_GetDataHere_Proxy(
2678 IDataObject* This,
2679 FORMATETC *pformatetc,
2680 STGMEDIUM *pmedium)
2681 {
2682 FIXME(":stub\n");
2683 return E_NOTIMPL;
2684 }
2685
2686 HRESULT __RPC_STUB IDataObject_GetDataHere_Stub(
2687 IDataObject* This,
2688 FORMATETC *pformatetc,
2689 STGMEDIUM *pRemoteMedium)
2690 {
2691 FIXME(":stub\n");
2692 return E_NOTIMPL;
2693 }
2694
2695 HRESULT CALLBACK IDataObject_SetData_Proxy(
2696 IDataObject* This,
2697 FORMATETC *pformatetc,
2698 STGMEDIUM *pmedium,
2699 BOOL fRelease)
2700 {
2701 FIXME(":stub\n");
2702 return E_NOTIMPL;
2703 }
2704
2705 HRESULT __RPC_STUB IDataObject_SetData_Stub(
2706 IDataObject* This,
2707 FORMATETC *pformatetc,
2708 FLAG_STGMEDIUM *pmedium,
2709 BOOL fRelease)
2710 {
2711 FIXME(":stub\n");
2712 return E_NOTIMPL;
2713 }
2714
2715 /* call_as/local stubs for oleidl.idl */
2716
2717 HRESULT CALLBACK IOleInPlaceActiveObject_TranslateAccelerator_Proxy(
2718 IOleInPlaceActiveObject* This,
2719 LPMSG lpmsg)
2720 {
2721 FIXME(":stub\n");
2722 return E_NOTIMPL;
2723 }
2724
2725 HRESULT __RPC_STUB IOleInPlaceActiveObject_TranslateAccelerator_Stub(
2726 IOleInPlaceActiveObject* This)
2727 {
2728 FIXME(":stub\n");
2729 return E_NOTIMPL;
2730 }
2731
2732 HRESULT CALLBACK IOleInPlaceActiveObject_ResizeBorder_Proxy(
2733 IOleInPlaceActiveObject* This,
2734 LPCRECT prcBorder,
2735 IOleInPlaceUIWindow *pUIWindow,
2736 BOOL fFrameWindow)
2737 {
2738 FIXME(":stub\n");
2739 return E_NOTIMPL;
2740 }
2741
2742 HRESULT __RPC_STUB IOleInPlaceActiveObject_ResizeBorder_Stub(
2743 IOleInPlaceActiveObject* This,
2744 LPCRECT prcBorder,
2745 REFIID riid,
2746 IOleInPlaceUIWindow *pUIWindow,
2747 BOOL fFrameWindow)
2748 {
2749 FIXME(":stub\n");
2750 return E_NOTIMPL;
2751 }
2752
2753 HRESULT CALLBACK IOleCache2_UpdateCache_Proxy(
2754 IOleCache2* This,
2755 LPDATAOBJECT pDataObject,
2756 DWORD grfUpdf,
2757 LPVOID pReserved)
2758 {
2759 FIXME(":stub\n");
2760 return E_NOTIMPL;
2761 }
2762
2763 HRESULT __RPC_STUB IOleCache2_UpdateCache_Stub(
2764 IOleCache2* This,
2765 LPDATAOBJECT pDataObject,
2766 DWORD grfUpdf,
2767 LONG_PTR pReserved)
2768 {
2769 FIXME(":stub\n");
2770 return E_NOTIMPL;
2771 }
2772
2773 HRESULT CALLBACK IEnumOLEVERB_Next_Proxy(
2774 IEnumOLEVERB* This,
2775 ULONG celt,
2776 LPOLEVERB rgelt,
2777 ULONG *pceltFetched)
2778 {
2779 ULONG fetched;
2780 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2781 if (!pceltFetched) pceltFetched = &fetched;
2782 return IEnumOLEVERB_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
2783 }
2784
2785 HRESULT __RPC_STUB IEnumOLEVERB_Next_Stub(
2786 IEnumOLEVERB* This,
2787 ULONG celt,
2788 LPOLEVERB rgelt,
2789 ULONG *pceltFetched)
2790 {
2791 HRESULT hr;
2792 TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
2793 *pceltFetched = 0;
2794 hr = IEnumOLEVERB_Next(This, celt, rgelt, pceltFetched);
2795 if (hr == S_OK) *pceltFetched = celt;
2796 return hr;
2797 }
2798
2799 HRESULT CALLBACK IViewObject_Draw_Proxy(
2800 IViewObject* This,
2801 DWORD dwDrawAspect,
2802 LONG lindex,
2803 void *pvAspect,
2804 DVTARGETDEVICE *ptd,
2805 HDC hdcTargetDev,
2806 HDC hdcDraw,
2807 LPCRECTL lprcBounds,
2808 LPCRECTL lprcWBounds,
2809 BOOL (STDMETHODCALLTYPE *pfnContinue)(ULONG_PTR dwContinue),
2810 ULONG_PTR dwContinue)
2811 {
2812 FIXME(":stub\n");
2813 return E_NOTIMPL;
2814 }
2815
2816 HRESULT __RPC_STUB IViewObject_Draw_Stub(
2817 IViewObject* This,
2818 DWORD dwDrawAspect,
2819 LONG lindex,
2820 ULONG_PTR pvAspect,
2821 DVTARGETDEVICE *ptd,
2822 ULONG_PTR hdcTargetDev,
2823 ULONG_PTR hdcDraw,
2824 LPCRECTL lprcBounds,
2825 LPCRECTL lprcWBounds,
2826 IContinue *pContinue)
2827 {
2828 FIXME(":stub\n");
2829 return E_NOTIMPL;
2830 }
2831
2832 HRESULT CALLBACK IViewObject_GetColorSet_Proxy(
2833 IViewObject* This,
2834 DWORD dwDrawAspect,
2835 LONG lindex,
2836 void *pvAspect,
2837 DVTARGETDEVICE *ptd,
2838 HDC hicTargetDev,
2839 LOGPALETTE **ppColorSet)
2840 {
2841 FIXME(":stub\n");
2842 return E_NOTIMPL;
2843 }
2844
2845 HRESULT __RPC_STUB IViewObject_GetColorSet_Stub(
2846 IViewObject* This,
2847 DWORD dwDrawAspect,
2848 LONG lindex,
2849 ULONG_PTR pvAspect,
2850 DVTARGETDEVICE *ptd,
2851 ULONG_PTR hicTargetDev,
2852 LOGPALETTE **ppColorSet)
2853 {
2854 FIXME(":stub\n");
2855 return E_NOTIMPL;
2856 }
2857
2858 HRESULT CALLBACK IViewObject_Freeze_Proxy(
2859 IViewObject* This,
2860 DWORD dwDrawAspect,
2861 LONG lindex,
2862 void *pvAspect,
2863 DWORD *pdwFreeze)
2864 {
2865 FIXME(":stub\n");
2866 return E_NOTIMPL;
2867 }
2868
2869 HRESULT __RPC_STUB IViewObject_Freeze_Stub(
2870 IViewObject* This,
2871 DWORD dwDrawAspect,
2872 LONG lindex,
2873 ULONG_PTR pvAspect,
2874 DWORD *pdwFreeze)
2875 {
2876 FIXME(":stub\n");
2877 return E_NOTIMPL;
2878 }
2879
2880 HRESULT CALLBACK IViewObject_GetAdvise_Proxy(
2881 IViewObject* This,
2882 DWORD *pAspects,
2883 DWORD *pAdvf,
2884 IAdviseSink **ppAdvSink)
2885 {
2886 FIXME(":stub\n");
2887 return E_NOTIMPL;
2888 }
2889
2890 HRESULT __RPC_STUB IViewObject_GetAdvise_Stub(
2891 IViewObject* This,
2892 DWORD *pAspects,
2893 DWORD *pAdvf,
2894 IAdviseSink **ppAdvSink)
2895 {
2896 FIXME(":stub\n");
2897 return E_NOTIMPL;
2898 }
2899
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.