xref: /reactos/dll/win32/rpcrt4/cproxy.c (revision 845faec4)
1 /*
2  * COM proxy implementation
3  *
4  * Copyright 2001 Ove Kåven, TransGaming Technologies
5  * Copyright 2009 Alexandre Julliard
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  *
21  * TODO: Handle non-i386 architectures
22  */
23 
24 #include "config.h"
25 #include "wine/port.h"
26 
27 #include <stdarg.h>
28 
29 #define COBJMACROS
30 
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winerror.h"
34 
35 #include "objbase.h"
36 #include "rpcproxy.h"
37 
38 #include "cpsf.h"
39 #include "ndr_misc.h"
40 #include "ndr_stubless.h"
41 #include "wine/debug.h"
42 
43 WINE_DEFAULT_DEBUG_CHANNEL(ole);
44 
45 /* I don't know what MS's std proxy structure looks like,
46    so this probably doesn't match, but that shouldn't matter */
47 typedef struct {
48   IRpcProxyBuffer IRpcProxyBuffer_iface;
49   LPVOID *PVtbl;
50   LONG RefCount;
51   const IID* piid;
52   LPUNKNOWN pUnkOuter;
53   IUnknown *base_object;  /* must be at offset 0x10 from PVtbl */
54   IRpcProxyBuffer *base_proxy;
55   PCInterfaceName name;
56   LPPSFACTORYBUFFER pPSFactory;
57   LPRPCCHANNELBUFFER pChannel;
58 } StdProxyImpl;
59 
60 static const IRpcProxyBufferVtbl StdProxy_Vtbl;
61 
62 static inline StdProxyImpl *impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface)
63 {
64     return CONTAINING_RECORD(iface, StdProxyImpl, IRpcProxyBuffer_iface);
65 }
66 
67 static inline StdProxyImpl *impl_from_proxy_obj( void *iface )
68 {
69     return CONTAINING_RECORD(iface, StdProxyImpl, PVtbl);
70 }
71 
72 #ifdef __i386__
73 
74 extern void call_stubless_func(void);
75 __ASM_GLOBAL_FUNC(call_stubless_func,
76                   "movl 4(%esp),%ecx\n\t"         /* This pointer */
77                   "movl (%ecx),%ecx\n\t"          /* This->lpVtbl */
78                   "movl -8(%ecx),%ecx\n\t"        /* MIDL_STUBLESS_PROXY_INFO */
79                   "movl 8(%ecx),%edx\n\t"         /* info->FormatStringOffset */
80                   "movzwl (%edx,%eax,2),%edx\n\t" /* FormatStringOffset[index] */
81                   "addl 4(%ecx),%edx\n\t"         /* info->ProcFormatString + offset */
82                   "movzwl 8(%edx),%eax\n\t"       /* arguments size */
83                   "pushl %eax\n\t"
84                   __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
85                   "leal 8(%esp),%eax\n\t"         /* &This */
86                   "pushl %eax\n\t"
87                   __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
88                   "pushl %edx\n\t"                /* format string */
89                   __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
90                   "pushl (%ecx)\n\t"              /* info->pStubDesc */
91                   __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
92                   "call " __ASM_NAME("ndr_client_call") "\n\t"
93                   "leal 12(%esp),%esp\n\t"
94                   __ASM_CFI(".cfi_adjust_cfa_offset -12\n\t")
95                   "popl %edx\n\t"                 /* arguments size */
96                   __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
97                   "movl (%esp),%ecx\n\t"  /* return address */
98                   "addl %edx,%esp\n\t"
99                   "jmp *%ecx" );
100 
101 #include "pshpack1.h"
102 struct thunk
103 {
104   BYTE mov_eax;
105   DWORD index;
106   BYTE jmp;
107   LONG handler;
108 };
109 #include "poppack.h"
110 
111 static inline void init_thunk( struct thunk *thunk, unsigned int index )
112 {
113     thunk->mov_eax = 0xb8; /* movl $n,%eax */
114     thunk->index   = index;
115     thunk->jmp     = 0xe9; /* jmp */
116     thunk->handler = (char *)call_stubless_func - (char *)(&thunk->handler + 1);
117 }
118 
119 #elif defined(__x86_64__)
120 
121 extern void call_stubless_func(void);
122 __ASM_GLOBAL_FUNC(call_stubless_func,
123                   "movq %rcx,0x8(%rsp)\n\t"
124                   "movq %rdx,0x10(%rsp)\n\t"
125                   "movq %r8,0x18(%rsp)\n\t"
126                   "movq %r9,0x20(%rsp)\n\t"
127                   "leaq 0x8(%rsp),%r8\n\t"        /* &This */
128                   "movq (%rcx),%rcx\n\t"          /* This->lpVtbl */
129                   "movq -0x10(%rcx),%rcx\n\t"     /* MIDL_STUBLESS_PROXY_INFO */
130                   "movq 0x10(%rcx),%rdx\n\t"      /* info->FormatStringOffset */
131                   "movzwq (%rdx,%r10,2),%rdx\n\t" /* FormatStringOffset[index] */
132                   "addq 8(%rcx),%rdx\n\t"         /* info->ProcFormatString + offset */
133                   "movq (%rcx),%rcx\n\t"          /* info->pStubDesc */
134                   "subq $0x38,%rsp\n\t"
135                   __ASM_CFI(".cfi_adjust_cfa_offset 0x38\n\t")
136                   "movq %xmm1,0x20(%rsp)\n\t"
137                   "movq %xmm2,0x28(%rsp)\n\t"
138                   "movq %xmm3,0x30(%rsp)\n\t"
139                   "leaq 0x18(%rsp),%r9\n\t"       /* fpu_args */
140                   "call " __ASM_NAME("ndr_client_call") "\n\t"
141                   "addq $0x38,%rsp\n\t"
142                   __ASM_CFI(".cfi_adjust_cfa_offset -0x38\n\t")
143                   "ret" );
144 
145 #include "pshpack1.h"
146 struct thunk
147 {
148     BYTE mov_r10[3];
149     DWORD index;
150     BYTE mov_rax[2];
151     void *call_stubless;
152     BYTE jmp_rax[2];
153 };
154 #include "poppack.h"
155 
156 static const struct thunk thunk_template =
157 {
158     { 0x49, 0xc7, 0xc2 }, 0,  /* movq $index,%r10 */
159     { 0x48, 0xb8 }, 0,        /* movq $call_stubless_func,%rax */
160     { 0xff, 0xe0 }            /* jmp *%rax */
161 };
162 
163 static inline void init_thunk( struct thunk *thunk, unsigned int index )
164 {
165     *thunk = thunk_template;
166     thunk->index = index;
167     thunk->call_stubless = call_stubless_func;
168 }
169 
170 #elif defined(__arm__)
171 
172 extern void call_stubless_func(void);
173 __ASM_GLOBAL_FUNC(call_stubless_func,
174                   "DCD 0xDEFC\n\t" // _assertfail
175                   "" );
176 
177 #include "pshpack1.h"
178 struct thunk
179 {
180     DWORD assertfail;
181 };
182 #include "poppack.h"
183 
184 static const struct thunk thunk_template =
185 {
186     { 0xDEFC }            /* _assertfail */
187 };
188 
189 static inline void init_thunk( struct thunk *thunk, unsigned int index )
190 {
191     *thunk = thunk_template;
192 }
193 
194 #else  /* __i386__ */
195 
196 #warning You must implement stubless proxies for your CPU
197 
198 struct thunk
199 {
200   DWORD index;
201 };
202 
203 static inline void init_thunk( struct thunk *thunk, unsigned int index )
204 {
205     thunk->index = index;
206 }
207 
208 #endif  /* __i386__ */
209 
210 #define BLOCK_SIZE 1024
211 #define MAX_BLOCKS 64  /* 64k methods should be enough for anybody */
212 
213 static const struct thunk *method_blocks[MAX_BLOCKS];
214 
215 static const struct thunk *allocate_block( unsigned int num )
216 {
217     unsigned int i;
218     struct thunk *prev, *block;
219     DWORD oldprot;
220 
221     block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
222                           MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE );
223     if (!block) return NULL;
224 
225     for (i = 0; i < BLOCK_SIZE; i++) init_thunk( &block[i], BLOCK_SIZE * num + i + 3 );
226     VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, &oldprot );
227     prev = InterlockedCompareExchangePointer( (void **)&method_blocks[num], block, NULL );
228     if (prev) /* someone beat us to it */
229     {
230         VirtualFree( block, 0, MEM_RELEASE );
231         block = prev;
232     }
233     return block;
234 }
235 
236 static BOOL fill_stubless_table( IUnknownVtbl *vtbl, DWORD num )
237 {
238     const void **entry = (const void **)(vtbl + 1);
239     DWORD i, j;
240 
241     if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
242     {
243         FIXME( "%u methods not supported\n", num );
244         return FALSE;
245     }
246     for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
247     {
248         const struct thunk *block = method_blocks[i];
249         if (!block && !(block = allocate_block( i ))) return FALSE;
250         for (j = 0; j < BLOCK_SIZE && j < num - 3 - i * BLOCK_SIZE; j++, entry++)
251             if (*entry == (LPVOID)-1) *entry = &block[j];
252     }
253     return TRUE;
254 }
255 
256 HRESULT StdProxy_Construct(REFIID riid,
257                            LPUNKNOWN pUnkOuter,
258                            const ProxyFileInfo *ProxyInfo,
259                            int Index,
260                            LPPSFACTORYBUFFER pPSFactory,
261                            LPRPCPROXYBUFFER *ppProxy,
262                            LPVOID *ppvObj)
263 {
264   StdProxyImpl *This;
265   PCInterfaceName name = ProxyInfo->pNamesArray[Index];
266   CInterfaceProxyVtbl *vtbl = ProxyInfo->pProxyVtblList[Index];
267 
268   TRACE("(%p,%p,%p,%p,%p) %s\n", pUnkOuter, vtbl, pPSFactory, ppProxy, ppvObj, name);
269 
270   /* TableVersion = 2 means it is the stubless version of CInterfaceProxyVtbl */
271   if (ProxyInfo->TableVersion > 1) {
272     ULONG count = ProxyInfo->pStubVtblList[Index]->header.DispatchTableCount;
273     vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
274     TRACE("stubless vtbl %p: count=%d\n", vtbl->Vtbl, count );
275     fill_stubless_table( (IUnknownVtbl *)vtbl->Vtbl, count );
276   }
277 
278   if (!IsEqualGUID(vtbl->header.piid, riid)) {
279     ERR("IID mismatch during proxy creation\n");
280     return RPC_E_UNEXPECTED;
281   }
282 
283   This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(StdProxyImpl));
284   if (!This) return E_OUTOFMEMORY;
285 
286   if (!pUnkOuter) pUnkOuter = (IUnknown *)This;
287   This->IRpcProxyBuffer_iface.lpVtbl = &StdProxy_Vtbl;
288   This->PVtbl = vtbl->Vtbl;
289   /* one reference for the proxy */
290   This->RefCount = 1;
291   This->piid = vtbl->header.piid;
292   This->base_object = NULL;
293   This->base_proxy = NULL;
294   This->pUnkOuter = pUnkOuter;
295   This->name = name;
296   This->pPSFactory = pPSFactory;
297   This->pChannel = NULL;
298 
299   if(ProxyInfo->pDelegatedIIDs && ProxyInfo->pDelegatedIIDs[Index])
300   {
301       HRESULT r = create_proxy( ProxyInfo->pDelegatedIIDs[Index], NULL,
302                                 &This->base_proxy, (void **)&This->base_object );
303       if (FAILED(r))
304       {
305           HeapFree( GetProcessHeap(), 0, This );
306           return r;
307       }
308   }
309 
310   *ppProxy = &This->IRpcProxyBuffer_iface;
311   *ppvObj = &This->PVtbl;
312   IUnknown_AddRef((IUnknown *)*ppvObj);
313   IPSFactoryBuffer_AddRef(pPSFactory);
314 
315   TRACE( "iid=%s this %p proxy %p obj %p vtbl %p base proxy %p base obj %p\n",
316          debugstr_guid(riid), This, *ppProxy, *ppvObj, This->PVtbl, This->base_proxy, This->base_object );
317   return S_OK;
318 }
319 
320 static HRESULT WINAPI StdProxy_QueryInterface(LPRPCPROXYBUFFER iface,
321                                              REFIID riid,
322                                              LPVOID *obj)
323 {
324   StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
325   TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);
326 
327   if (IsEqualGUID(&IID_IUnknown,riid) ||
328       IsEqualGUID(This->piid,riid)) {
329     *obj = &This->PVtbl;
330     InterlockedIncrement(&This->RefCount);
331     return S_OK;
332   }
333 
334   if (IsEqualGUID(&IID_IRpcProxyBuffer,riid)) {
335     *obj = &This->IRpcProxyBuffer_iface;
336     InterlockedIncrement(&This->RefCount);
337     return S_OK;
338   }
339 
340   return E_NOINTERFACE;
341 }
342 
343 static ULONG WINAPI StdProxy_AddRef(LPRPCPROXYBUFFER iface)
344 {
345   StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
346   TRACE("(%p)->AddRef()\n",This);
347 
348   return InterlockedIncrement(&This->RefCount);
349 }
350 
351 static ULONG WINAPI StdProxy_Release(LPRPCPROXYBUFFER iface)
352 {
353   ULONG refs;
354   StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
355   TRACE("(%p)->Release()\n",This);
356 
357   refs = InterlockedDecrement(&This->RefCount);
358   if (!refs)
359   {
360     if (This->pChannel)
361       IRpcProxyBuffer_Disconnect(&This->IRpcProxyBuffer_iface);
362 
363     if (This->base_object) IUnknown_Release( This->base_object );
364     if (This->base_proxy) IRpcProxyBuffer_Release( This->base_proxy );
365 
366     IPSFactoryBuffer_Release(This->pPSFactory);
367     HeapFree(GetProcessHeap(),0,This);
368   }
369 
370   return refs;
371 }
372 
373 static HRESULT WINAPI StdProxy_Connect(LPRPCPROXYBUFFER iface,
374                                       LPRPCCHANNELBUFFER pChannel)
375 {
376   StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
377   TRACE("(%p)->Connect(%p)\n",This,pChannel);
378 
379   This->pChannel = pChannel;
380   IRpcChannelBuffer_AddRef(pChannel);
381   if (This->base_proxy) IRpcProxyBuffer_Connect( This->base_proxy, pChannel );
382   return S_OK;
383 }
384 
385 static VOID WINAPI StdProxy_Disconnect(LPRPCPROXYBUFFER iface)
386 {
387   StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
388   TRACE("(%p)->Disconnect()\n",This);
389 
390   if (This->base_proxy) IRpcProxyBuffer_Disconnect( This->base_proxy );
391 
392   IRpcChannelBuffer_Release(This->pChannel);
393   This->pChannel = NULL;
394 }
395 
396 static const IRpcProxyBufferVtbl StdProxy_Vtbl =
397 {
398   StdProxy_QueryInterface,
399   StdProxy_AddRef,
400   StdProxy_Release,
401   StdProxy_Connect,
402   StdProxy_Disconnect
403 };
404 
405 static void StdProxy_GetChannel(LPVOID iface,
406                                    LPRPCCHANNELBUFFER *ppChannel)
407 {
408   StdProxyImpl *This = impl_from_proxy_obj( iface );
409   TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name);
410 
411   *ppChannel = This->pChannel;
412 }
413 
414 static void StdProxy_GetIID(LPVOID iface,
415                                const IID **ppiid)
416 {
417   StdProxyImpl *This = impl_from_proxy_obj( iface );
418   TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name);
419 
420   *ppiid = This->piid;
421 }
422 
423 HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface,
424                                             REFIID riid,
425                                             LPVOID *ppvObj)
426 {
427   StdProxyImpl *This = impl_from_proxy_obj( iface );
428   TRACE("(%p)->QueryInterface(%s,%p) %s\n",This,debugstr_guid(riid),ppvObj,This->name);
429   return IUnknown_QueryInterface(This->pUnkOuter,riid,ppvObj);
430 }
431 
432 ULONG WINAPI IUnknown_AddRef_Proxy(LPUNKNOWN iface)
433 {
434   StdProxyImpl *This = impl_from_proxy_obj( iface );
435   TRACE("(%p)->AddRef() %s\n",This,This->name);
436   return IUnknown_AddRef(This->pUnkOuter);
437 }
438 
439 ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface)
440 {
441   StdProxyImpl *This = impl_from_proxy_obj( iface );
442   TRACE("(%p)->Release() %s\n",This,This->name);
443   return IUnknown_Release(This->pUnkOuter);
444 }
445 
446 /***********************************************************************
447  *           NdrProxyInitialize [RPCRT4.@]
448  */
449 void WINAPI NdrProxyInitialize(void *This,
450                               PRPC_MESSAGE pRpcMsg,
451                               PMIDL_STUB_MESSAGE pStubMsg,
452                               PMIDL_STUB_DESC pStubDescriptor,
453                               unsigned int ProcNum)
454 {
455   TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
456   NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
457   StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer);
458   IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
459                                &pStubMsg->dwDestContext,
460                                &pStubMsg->pvDestContext);
461   TRACE("channel=%p\n", pStubMsg->pRpcChannelBuffer);
462 }
463 
464 /***********************************************************************
465  *           NdrProxyGetBuffer [RPCRT4.@]
466  */
467 void WINAPI NdrProxyGetBuffer(void *This,
468                              PMIDL_STUB_MESSAGE pStubMsg)
469 {
470   HRESULT hr;
471   const IID *riid = NULL;
472 
473   TRACE("(%p,%p)\n", This, pStubMsg);
474   pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
475   pStubMsg->dwStubPhase = PROXY_GETBUFFER;
476   StdProxy_GetIID(This, &riid);
477   hr = IRpcChannelBuffer_GetBuffer(pStubMsg->pRpcChannelBuffer,
478                                   (RPCOLEMESSAGE*)pStubMsg->RpcMsg,
479                                   riid);
480   if (FAILED(hr))
481   {
482     RpcRaiseException(hr);
483     return;
484   }
485   pStubMsg->fBufferValid = TRUE;
486   pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
487   pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
488   pStubMsg->Buffer = pStubMsg->BufferStart;
489   pStubMsg->dwStubPhase = PROXY_MARSHAL;
490 }
491 
492 /***********************************************************************
493  *           NdrProxySendReceive [RPCRT4.@]
494  */
495 void WINAPI NdrProxySendReceive(void *This,
496                                PMIDL_STUB_MESSAGE pStubMsg)
497 {
498   ULONG Status = 0;
499   HRESULT hr;
500 
501   TRACE("(%p,%p)\n", This, pStubMsg);
502 
503   if (!pStubMsg->pRpcChannelBuffer)
504   {
505     WARN("Trying to use disconnected proxy %p\n", This);
506     RpcRaiseException(RPC_E_DISCONNECTED);
507   }
508 
509   pStubMsg->dwStubPhase = PROXY_SENDRECEIVE;
510   /* avoid sending uninitialised parts of the buffer on the wire */
511   pStubMsg->RpcMsg->BufferLength = pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer;
512   hr = IRpcChannelBuffer_SendReceive(pStubMsg->pRpcChannelBuffer,
513                                     (RPCOLEMESSAGE*)pStubMsg->RpcMsg,
514                                     &Status);
515   pStubMsg->dwStubPhase = PROXY_UNMARSHAL;
516   pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength;
517   pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
518   pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
519   pStubMsg->Buffer = pStubMsg->BufferStart;
520 
521   /* raise exception if call failed */
522   if (hr == RPC_S_CALL_FAILED) RpcRaiseException(*(DWORD*)pStubMsg->Buffer);
523   else if (FAILED(hr)) RpcRaiseException(hr);
524 }
525 
526 /***********************************************************************
527  *           NdrProxyFreeBuffer [RPCRT4.@]
528  */
529 void WINAPI NdrProxyFreeBuffer(void *This,
530                               PMIDL_STUB_MESSAGE pStubMsg)
531 {
532   TRACE("(%p,%p)\n", This, pStubMsg);
533 
534   if (pStubMsg->fBufferValid)
535   {
536     IRpcChannelBuffer_FreeBuffer(pStubMsg->pRpcChannelBuffer,
537                                  (RPCOLEMESSAGE*)pStubMsg->RpcMsg);
538     pStubMsg->fBufferValid = TRUE;
539   }
540 }
541 
542 /***********************************************************************
543  *           NdrProxyErrorHandler [RPCRT4.@]
544  */
545 HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode)
546 {
547   WARN("(0x%08x): a proxy call failed\n", dwExceptionCode);
548 
549   if (FAILED(dwExceptionCode))
550     return dwExceptionCode;
551   else
552     return HRESULT_FROM_WIN32(dwExceptionCode);
553 }
554 
555 HRESULT WINAPI
556 CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
557                          LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv )
558 {
559     typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT);
560     HMODULE hUser32 = LoadLibraryA("user32");
561     MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA");
562 
563     FIXME("%p %p %s %p %p\n", pTypeInfo, pUnkOuter, debugstr_guid(riid), ppProxy, ppv);
564     if (pMessageBoxA)
565     {
566         pMessageBoxA(NULL,
567             "The native implementation of OLEAUT32.DLL cannot be used "
568             "with Wine's RPCRT4.DLL. Remove OLEAUT32.DLL and try again.\n",
569             "Wine: Unimplemented CreateProxyFromTypeInfo",
570             0x10);
571         ExitProcess(1);
572     }
573     return E_NOTIMPL;
574 }
575 
576 HRESULT WINAPI
577 CreateStubFromTypeInfo(ITypeInfo *pTypeInfo, REFIID riid, IUnknown *pUnkServer,
578                        IRpcStubBuffer **ppStub )
579 {
580     typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT);
581     HMODULE hUser32 = LoadLibraryA("user32");
582     MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA");
583 
584     FIXME("%p %s %p %p\n", pTypeInfo, debugstr_guid(riid), pUnkServer, ppStub);
585     if (pMessageBoxA)
586     {
587         pMessageBoxA(NULL,
588             "The native implementation of OLEAUT32.DLL cannot be used "
589             "with Wine's RPCRT4.DLL. Remove OLEAUT32.DLL and try again.\n",
590             "Wine: Unimplemented CreateProxyFromTypeInfo",
591             0x10);
592         ExitProcess(1);
593     }
594     return E_NOTIMPL;
595 }
596