rpcrt4: Implement stubless proxy entry thunks for x86_64.
[wine] / dlls / rpcrt4 / cproxy.c
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 $0x28,%rsp\n\t"
135                   __ASM_CFI(".cfi_adjust_cfa_offset 0x28\n\t")
136                   "call " __ASM_NAME("ndr_client_call") "\n\t"
137                   "addq $0x28,%rsp\n\t"
138                   __ASM_CFI(".cfi_adjust_cfa_offset -0x28\n\t")
139                   "ret" );
140
141 #include "pshpack1.h"
142 struct thunk
143 {
144     BYTE mov_r10[3];
145     DWORD index;
146     BYTE mov_rax[2];
147     void *call_stubless;
148     BYTE jmp_rax[2];
149 };
150 #include "poppack.h"
151
152 static const struct thunk thunk_template =
153 {
154     { 0x49, 0xc7, 0xc2 }, 0,  /* movq $index,%r10 */
155     { 0x48, 0xb8 }, 0,        /* movq $call_stubless_func,%rax */
156     { 0xff, 0xe0 }            /* jmp *%rax */
157 };
158
159 static inline void init_thunk( struct thunk *thunk, unsigned int index )
160 {
161     *thunk = thunk_template;
162     thunk->index = index;
163     thunk->call_stubless = call_stubless_func;
164 }
165
166 #else  /* __i386__ */
167
168 #warning You must implement stubless proxies for your CPU
169
170 struct thunk
171 {
172   DWORD index;
173 };
174
175 static inline void init_thunk( struct thunk *thunk, unsigned int index )
176 {
177     thunk->index = index;
178 }
179
180 #endif  /* __i386__ */
181
182 #define BLOCK_SIZE 1024
183 #define MAX_BLOCKS 64  /* 64k methods should be enough for anybody */
184
185 static const struct thunk *method_blocks[MAX_BLOCKS];
186
187 static const struct thunk *allocate_block( unsigned int num )
188 {
189     unsigned int i;
190     struct thunk *prev, *block;
191
192     block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
193                           MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE );
194     if (!block) return NULL;
195
196     for (i = 0; i < BLOCK_SIZE; i++) init_thunk( &block[i], BLOCK_SIZE * num + i + 3 );
197     VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, NULL );
198     prev = InterlockedCompareExchangePointer( (void **)&method_blocks[num], block, NULL );
199     if (prev) /* someone beat us to it */
200     {
201         VirtualFree( block, 0, MEM_RELEASE );
202         block = prev;
203     }
204     return block;
205 }
206
207 static BOOL fill_stubless_table( IUnknownVtbl *vtbl, DWORD num )
208 {
209     const void **entry = (const void **)(vtbl + 1);
210     DWORD i, j;
211
212     if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
213     {
214         FIXME( "%u methods not supported\n", num );
215         return FALSE;
216     }
217     for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
218     {
219         const struct thunk *block = method_blocks[i];
220         if (!block && !(block = allocate_block( i ))) return FALSE;
221         for (j = 0; j < BLOCK_SIZE && j < num - 3 - i * BLOCK_SIZE; j++, entry++)
222             if (*entry == (LPVOID)-1) *entry = &block[j];
223     }
224     return TRUE;
225 }
226
227 HRESULT StdProxy_Construct(REFIID riid,
228                            LPUNKNOWN pUnkOuter,
229                            const ProxyFileInfo *ProxyInfo,
230                            int Index,
231                            LPPSFACTORYBUFFER pPSFactory,
232                            LPRPCPROXYBUFFER *ppProxy,
233                            LPVOID *ppvObj)
234 {
235   StdProxyImpl *This;
236   PCInterfaceName name = ProxyInfo->pNamesArray[Index];
237   CInterfaceProxyVtbl *vtbl = ProxyInfo->pProxyVtblList[Index];
238
239   TRACE("(%p,%p,%p,%p,%p) %s\n", pUnkOuter, vtbl, pPSFactory, ppProxy, ppvObj, name);
240
241   /* TableVersion = 2 means it is the stubless version of CInterfaceProxyVtbl */
242   if (ProxyInfo->TableVersion > 1) {
243     ULONG count = ProxyInfo->pStubVtblList[Index]->header.DispatchTableCount;
244     vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
245     TRACE("stubless vtbl %p: count=%d\n", vtbl->Vtbl, count );
246     fill_stubless_table( (IUnknownVtbl *)vtbl->Vtbl, count );
247   }
248
249   if (!IsEqualGUID(vtbl->header.piid, riid)) {
250     ERR("IID mismatch during proxy creation\n");
251     return RPC_E_UNEXPECTED;
252   }
253
254   This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(StdProxyImpl));
255   if (!This) return E_OUTOFMEMORY;
256
257   if (!pUnkOuter) pUnkOuter = (IUnknown *)This;
258   This->IRpcProxyBuffer_iface.lpVtbl = &StdProxy_Vtbl;
259   This->PVtbl = vtbl->Vtbl;
260   /* one reference for the proxy */
261   This->RefCount = 1;
262   This->piid = vtbl->header.piid;
263   This->base_object = NULL;
264   This->base_proxy = NULL;
265   This->pUnkOuter = pUnkOuter;
266   This->name = name;
267   This->pPSFactory = pPSFactory;
268   This->pChannel = NULL;
269
270   if(ProxyInfo->pDelegatedIIDs && ProxyInfo->pDelegatedIIDs[Index])
271   {
272       HRESULT r = create_proxy( ProxyInfo->pDelegatedIIDs[Index], NULL,
273                                 &This->base_proxy, (void **)&This->base_object );
274       if (FAILED(r))
275       {
276           HeapFree( GetProcessHeap(), 0, This );
277           return r;
278       }
279   }
280
281   *ppProxy = &This->IRpcProxyBuffer_iface;
282   *ppvObj = &This->PVtbl;
283   IUnknown_AddRef((IUnknown *)*ppvObj);
284   IPSFactoryBuffer_AddRef(pPSFactory);
285
286   TRACE( "iid=%s this %p proxy %p obj %p vtbl %p base proxy %p base obj %p\n",
287          debugstr_guid(riid), This, *ppProxy, *ppvObj, This->PVtbl, This->base_proxy, This->base_object );
288   return S_OK;
289 }
290
291 static HRESULT WINAPI StdProxy_QueryInterface(LPRPCPROXYBUFFER iface,
292                                              REFIID riid,
293                                              LPVOID *obj)
294 {
295   StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
296   TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);
297
298   if (IsEqualGUID(&IID_IUnknown,riid) ||
299       IsEqualGUID(This->piid,riid)) {
300     *obj = &This->PVtbl;
301     InterlockedIncrement(&This->RefCount);
302     return S_OK;
303   }
304
305   if (IsEqualGUID(&IID_IRpcProxyBuffer,riid)) {
306     *obj = &This->IRpcProxyBuffer_iface;
307     InterlockedIncrement(&This->RefCount);
308     return S_OK;
309   }
310
311   return E_NOINTERFACE;
312 }
313
314 static ULONG WINAPI StdProxy_AddRef(LPRPCPROXYBUFFER iface)
315 {
316   StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
317   TRACE("(%p)->AddRef()\n",This);
318
319   return InterlockedIncrement(&This->RefCount);
320 }
321
322 static ULONG WINAPI StdProxy_Release(LPRPCPROXYBUFFER iface)
323 {
324   ULONG refs;
325   StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
326   TRACE("(%p)->Release()\n",This);
327
328   refs = InterlockedDecrement(&This->RefCount);
329   if (!refs)
330   {
331     if (This->pChannel)
332       IRpcProxyBuffer_Disconnect(&This->IRpcProxyBuffer_iface);
333
334     if (This->base_object) IUnknown_Release( This->base_object );
335     if (This->base_proxy) IRpcProxyBuffer_Release( This->base_proxy );
336
337     IPSFactoryBuffer_Release(This->pPSFactory);
338     HeapFree(GetProcessHeap(),0,This);
339   }
340
341   return refs;
342 }
343
344 static HRESULT WINAPI StdProxy_Connect(LPRPCPROXYBUFFER iface,
345                                       LPRPCCHANNELBUFFER pChannel)
346 {
347   StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
348   TRACE("(%p)->Connect(%p)\n",This,pChannel);
349
350   This->pChannel = pChannel;
351   IRpcChannelBuffer_AddRef(pChannel);
352   if (This->base_proxy) IRpcProxyBuffer_Connect( This->base_proxy, pChannel );
353   return S_OK;
354 }
355
356 static VOID WINAPI StdProxy_Disconnect(LPRPCPROXYBUFFER iface)
357 {
358   StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
359   TRACE("(%p)->Disconnect()\n",This);
360
361   if (This->base_proxy) IRpcProxyBuffer_Disconnect( This->base_proxy );
362
363   IRpcChannelBuffer_Release(This->pChannel);
364   This->pChannel = NULL;
365 }
366
367 static const IRpcProxyBufferVtbl StdProxy_Vtbl =
368 {
369   StdProxy_QueryInterface,
370   StdProxy_AddRef,
371   StdProxy_Release,
372   StdProxy_Connect,
373   StdProxy_Disconnect
374 };
375
376 static void StdProxy_GetChannel(LPVOID iface,
377                                    LPRPCCHANNELBUFFER *ppChannel)
378 {
379   StdProxyImpl *This = impl_from_proxy_obj( iface );
380   TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name);
381
382   *ppChannel = This->pChannel;
383 }
384
385 static void StdProxy_GetIID(LPVOID iface,
386                                const IID **ppiid)
387 {
388   StdProxyImpl *This = impl_from_proxy_obj( iface );
389   TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name);
390
391   *ppiid = This->piid;
392 }
393
394 HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface,
395                                             REFIID riid,
396                                             LPVOID *ppvObj)
397 {
398   StdProxyImpl *This = impl_from_proxy_obj( iface );
399   TRACE("(%p)->QueryInterface(%s,%p) %s\n",This,debugstr_guid(riid),ppvObj,This->name);
400   return IUnknown_QueryInterface(This->pUnkOuter,riid,ppvObj);
401 }
402
403 ULONG WINAPI IUnknown_AddRef_Proxy(LPUNKNOWN iface)
404 {
405   StdProxyImpl *This = impl_from_proxy_obj( iface );
406   TRACE("(%p)->AddRef() %s\n",This,This->name);
407   return IUnknown_AddRef(This->pUnkOuter);
408 }
409
410 ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface)
411 {
412   StdProxyImpl *This = impl_from_proxy_obj( iface );
413   TRACE("(%p)->Release() %s\n",This,This->name);
414   return IUnknown_Release(This->pUnkOuter);
415 }
416
417 /***********************************************************************
418  *           NdrProxyInitialize [RPCRT4.@]
419  */
420 void WINAPI NdrProxyInitialize(void *This,
421                               PRPC_MESSAGE pRpcMsg,
422                               PMIDL_STUB_MESSAGE pStubMsg,
423                               PMIDL_STUB_DESC pStubDescriptor,
424                               unsigned int ProcNum)
425 {
426   TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
427   NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
428   StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer);
429   IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
430                                &pStubMsg->dwDestContext,
431                                &pStubMsg->pvDestContext);
432   TRACE("channel=%p\n", pStubMsg->pRpcChannelBuffer);
433 }
434
435 /***********************************************************************
436  *           NdrProxyGetBuffer [RPCRT4.@]
437  */
438 void WINAPI NdrProxyGetBuffer(void *This,
439                              PMIDL_STUB_MESSAGE pStubMsg)
440 {
441   HRESULT hr;
442   const IID *riid = NULL;
443
444   TRACE("(%p,%p)\n", This, pStubMsg);
445   pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
446   pStubMsg->dwStubPhase = PROXY_GETBUFFER;
447   StdProxy_GetIID(This, &riid);
448   hr = IRpcChannelBuffer_GetBuffer(pStubMsg->pRpcChannelBuffer,
449                                   (RPCOLEMESSAGE*)pStubMsg->RpcMsg,
450                                   riid);
451   if (FAILED(hr))
452   {
453     RpcRaiseException(hr);
454     return;
455   }
456   pStubMsg->fBufferValid = TRUE;
457   pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
458   pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
459   pStubMsg->Buffer = pStubMsg->BufferStart;
460   pStubMsg->dwStubPhase = PROXY_MARSHAL;
461 }
462
463 /***********************************************************************
464  *           NdrProxySendReceive [RPCRT4.@]
465  */
466 void WINAPI NdrProxySendReceive(void *This,
467                                PMIDL_STUB_MESSAGE pStubMsg)
468 {
469   ULONG Status = 0;
470   HRESULT hr;
471
472   TRACE("(%p,%p)\n", This, pStubMsg);
473
474   if (!pStubMsg->pRpcChannelBuffer)
475   {
476     WARN("Trying to use disconnected proxy %p\n", This);
477     RpcRaiseException(RPC_E_DISCONNECTED);
478   }
479
480   pStubMsg->dwStubPhase = PROXY_SENDRECEIVE;
481   /* avoid sending uninitialised parts of the buffer on the wire */
482   pStubMsg->RpcMsg->BufferLength = pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer;
483   hr = IRpcChannelBuffer_SendReceive(pStubMsg->pRpcChannelBuffer,
484                                     (RPCOLEMESSAGE*)pStubMsg->RpcMsg,
485                                     &Status);
486   pStubMsg->dwStubPhase = PROXY_UNMARSHAL;
487   pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength;
488   pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
489   pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
490   pStubMsg->Buffer = pStubMsg->BufferStart;
491
492   /* raise exception if call failed */
493   if (hr == RPC_S_CALL_FAILED) RpcRaiseException(*(DWORD*)pStubMsg->Buffer);
494   else if (FAILED(hr)) RpcRaiseException(hr);
495 }
496
497 /***********************************************************************
498  *           NdrProxyFreeBuffer [RPCRT4.@]
499  */
500 void WINAPI NdrProxyFreeBuffer(void *This,
501                               PMIDL_STUB_MESSAGE pStubMsg)
502 {
503   TRACE("(%p,%p)\n", This, pStubMsg);
504
505   if (pStubMsg->fBufferValid)
506   {
507     IRpcChannelBuffer_FreeBuffer(pStubMsg->pRpcChannelBuffer,
508                                  (RPCOLEMESSAGE*)pStubMsg->RpcMsg);
509     pStubMsg->fBufferValid = TRUE;
510   }
511 }
512
513 /***********************************************************************
514  *           NdrProxyErrorHandler [RPCRT4.@]
515  */
516 HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode)
517 {
518   WARN("(0x%08x): a proxy call failed\n", dwExceptionCode);
519
520   if (FAILED(dwExceptionCode))
521     return dwExceptionCode;
522   else
523     return HRESULT_FROM_WIN32(dwExceptionCode);
524 }
525
526 HRESULT WINAPI
527 CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
528                          LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv )
529 {
530     typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT);
531     HMODULE hUser32 = LoadLibraryA("user32");
532     MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA");
533
534     FIXME("%p %p %s %p %p\n", pTypeInfo, pUnkOuter, debugstr_guid(riid), ppProxy, ppv);
535     if (pMessageBoxA)
536     {
537         pMessageBoxA(NULL,
538             "The native implementation of OLEAUT32.DLL cannot be used "
539             "with Wine's RPCRT4.DLL. Remove OLEAUT32.DLL and try again.\n",
540             "Wine: Unimplemented CreateProxyFromTypeInfo",
541             0x10);
542         ExitProcess(1);
543     }
544     return E_NOTIMPL;
545 }
546
547 HRESULT WINAPI
548 CreateStubFromTypeInfo(ITypeInfo *pTypeInfo, REFIID riid, IUnknown *pUnkServer,
549                        IRpcStubBuffer **ppStub )
550 {
551     typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT);
552     HMODULE hUser32 = LoadLibraryA("user32");
553     MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA");
554
555     FIXME("%p %s %p %p\n", pTypeInfo, debugstr_guid(riid), pUnkServer, ppStub);
556     if (pMessageBoxA)
557     {
558         pMessageBoxA(NULL,
559             "The native implementation of OLEAUT32.DLL cannot be used "
560             "with Wine's RPCRT4.DLL. Remove OLEAUT32.DLL and try again.\n",
561             "Wine: Unimplemented CreateProxyFromTypeInfo",
562             0x10);
563         ExitProcess(1);
564     }
565     return E_NOTIMPL;
566 }