cproxy.c 18.4 KB
Newer Older
1 2 3
/*
 * COM proxy implementation
 *
4
 * Copyright 2001 Ove Kåven, TransGaming Technologies
5
 * Copyright 2009 Alexandre Julliard
6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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 22 23
 * 
 * TODO: Handle non-i386 architectures
 */

24 25 26
#include "config.h"
#include "wine/port.h"

27 28
#include <stdarg.h>

29 30
#define COBJMACROS

31 32 33 34
#include "windef.h"
#include "winbase.h"
#include "winerror.h"

35
#include "objbase.h"
36 37 38 39
#include "rpcproxy.h"

#include "cpsf.h"
#include "ndr_misc.h"
40
#include "ndr_stubless.h"
41 42 43 44 45 46 47
#include "wine/debug.h"

WINE_DEFAULT_DEBUG_CHANNEL(ole);

/* I don't know what MS's std proxy structure looks like,
   so this probably doesn't match, but that shouldn't matter */
typedef struct {
48
  IRpcProxyBuffer IRpcProxyBuffer_iface;
49
  LPVOID *PVtbl;
50
  LONG RefCount;
51 52
  const IID* piid;
  LPUNKNOWN pUnkOuter;
53 54
  IUnknown *base_object;  /* must be at offset 0x10 from PVtbl */
  IRpcProxyBuffer *base_proxy;
55
  PCInterfaceName name;
56 57 58 59
  LPPSFACTORYBUFFER pPSFactory;
  LPRPCCHANNELBUFFER pChannel;
} StdProxyImpl;

60
static const IRpcProxyBufferVtbl StdProxy_Vtbl;
61

62 63 64 65 66
static inline StdProxyImpl *impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface)
{
    return CONTAINING_RECORD(iface, StdProxyImpl, IRpcProxyBuffer_iface);
}

67 68
static inline StdProxyImpl *impl_from_proxy_obj( void *iface )
{
69
    return CONTAINING_RECORD(iface, StdProxyImpl, PVtbl);
70
}
71

72
#ifdef __i386__
73

74 75
extern void call_stubless_func(void);
__ASM_GLOBAL_FUNC(call_stubless_func,
76 77 78 79 80 81 82 83
                  "movl 4(%esp),%ecx\n\t"         /* This pointer */
                  "movl (%ecx),%ecx\n\t"          /* This->lpVtbl */
                  "movl -8(%ecx),%ecx\n\t"        /* MIDL_STUBLESS_PROXY_INFO */
                  "movl 8(%ecx),%edx\n\t"         /* info->FormatStringOffset */
                  "movzwl (%edx,%eax,2),%edx\n\t" /* FormatStringOffset[index] */
                  "addl 4(%ecx),%edx\n\t"         /* info->ProcFormatString + offset */
                  "movzwl 8(%edx),%eax\n\t"       /* arguments size */
                  "pushl %eax\n\t"
84
                  __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
85 86
                  "leal 8(%esp),%eax\n\t"         /* &This */
                  "pushl %eax\n\t"
87
                  __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
88 89 90 91 92 93 94 95
                  "pushl %edx\n\t"                /* format string */
                  __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
                  "pushl (%ecx)\n\t"              /* info->pStubDesc */
                  __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
                  "call " __ASM_NAME("ndr_client_call") "\n\t"
                  "leal 12(%esp),%esp\n\t"
                  __ASM_CFI(".cfi_adjust_cfa_offset -12\n\t")
                  "popl %edx\n\t"                 /* arguments size */
96
                  __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
97 98 99 100
                  "movl (%esp),%ecx\n\t"  /* return address */
                  "addl %edx,%esp\n\t"
                  "jmp *%ecx" );

101 102
#include "pshpack1.h"
struct thunk
103
{
104 105 106 107 108 109
  BYTE mov_eax;
  DWORD index;
  BYTE jmp;
  LONG handler;
};
#include "poppack.h"
110

111 112 113 114 115 116 117 118
static inline void init_thunk( struct thunk *thunk, unsigned int index )
{
    thunk->mov_eax = 0xb8; /* movl $n,%eax */
    thunk->index   = index;
    thunk->jmp     = 0xe9; /* jmp */
    thunk->handler = (char *)call_stubless_func - (char *)(&thunk->handler + 1);
}

119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
#elif defined(__x86_64__)

extern void call_stubless_func(void);
__ASM_GLOBAL_FUNC(call_stubless_func,
                  "movq %rcx,0x8(%rsp)\n\t"
                  "movq %rdx,0x10(%rsp)\n\t"
                  "movq %r8,0x18(%rsp)\n\t"
                  "movq %r9,0x20(%rsp)\n\t"
                  "leaq 0x8(%rsp),%r8\n\t"        /* &This */
                  "movq (%rcx),%rcx\n\t"          /* This->lpVtbl */
                  "movq -0x10(%rcx),%rcx\n\t"     /* MIDL_STUBLESS_PROXY_INFO */
                  "movq 0x10(%rcx),%rdx\n\t"      /* info->FormatStringOffset */
                  "movzwq (%rdx,%r10,2),%rdx\n\t" /* FormatStringOffset[index] */
                  "addq 8(%rcx),%rdx\n\t"         /* info->ProcFormatString + offset */
                  "movq (%rcx),%rcx\n\t"          /* info->pStubDesc */
134 135 136 137 138 139
                  "subq $0x38,%rsp\n\t"
                  __ASM_CFI(".cfi_adjust_cfa_offset 0x38\n\t")
                  "movq %xmm1,0x20(%rsp)\n\t"
                  "movq %xmm2,0x28(%rsp)\n\t"
                  "movq %xmm3,0x30(%rsp)\n\t"
                  "leaq 0x18(%rsp),%r9\n\t"       /* fpu_args */
140
                  "call " __ASM_NAME("ndr_client_call") "\n\t"
141 142
                  "addq $0x38,%rsp\n\t"
                  __ASM_CFI(".cfi_adjust_cfa_offset -0x38\n\t")
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
                  "ret" );

#include "pshpack1.h"
struct thunk
{
    BYTE mov_r10[3];
    DWORD index;
    BYTE mov_rax[2];
    void *call_stubless;
    BYTE jmp_rax[2];
};
#include "poppack.h"

static const struct thunk thunk_template =
{
    { 0x49, 0xc7, 0xc2 }, 0,  /* movq $index,%r10 */
    { 0x48, 0xb8 }, 0,        /* movq $call_stubless_func,%rax */
    { 0xff, 0xe0 }            /* jmp *%rax */
};

static inline void init_thunk( struct thunk *thunk, unsigned int index )
{
    *thunk = thunk_template;
    thunk->index = index;
    thunk->call_stubless = call_stubless_func;
}

170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
#else  /* __i386__ */

#warning You must implement stubless proxies for your CPU

struct thunk
{
  DWORD index;
};

static inline void init_thunk( struct thunk *thunk, unsigned int index )
{
    thunk->index = index;
}

#endif  /* __i386__ */

186 187 188 189 190 191 192 193 194
#define BLOCK_SIZE 1024
#define MAX_BLOCKS 64  /* 64k methods should be enough for anybody */

static const struct thunk *method_blocks[MAX_BLOCKS];

static const struct thunk *allocate_block( unsigned int num )
{
    unsigned int i;
    struct thunk *prev, *block;
195
    DWORD oldprot;
196 197 198 199 200

    block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
                          MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE );
    if (!block) return NULL;

201
    for (i = 0; i < BLOCK_SIZE; i++) init_thunk( &block[i], BLOCK_SIZE * num + i + 3 );
202
    VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, &oldprot );
203 204 205 206 207 208 209 210 211 212 213 214 215 216
    prev = InterlockedCompareExchangePointer( (void **)&method_blocks[num], block, NULL );
    if (prev) /* someone beat us to it */
    {
        VirtualFree( block, 0, MEM_RELEASE );
        block = prev;
    }
    return block;
}

static BOOL fill_stubless_table( IUnknownVtbl *vtbl, DWORD num )
{
    const void **entry = (const void **)(vtbl + 1);
    DWORD i, j;

217 218 219 220 221
    if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
    {
        FIXME( "%u methods not supported\n", num );
        return FALSE;
    }
222 223 224 225 226 227 228 229 230 231
    for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
    {
        const struct thunk *block = method_blocks[i];
        if (!block && !(block = allocate_block( i ))) return FALSE;
        for (j = 0; j < BLOCK_SIZE && j < num - 3 - i * BLOCK_SIZE; j++, entry++)
            if (*entry == (LPVOID)-1) *entry = &block[j];
    }
    return TRUE;
}

232 233 234 235 236 237 238
HRESULT StdProxy_Construct(REFIID riid,
                           LPUNKNOWN pUnkOuter,
                           const ProxyFileInfo *ProxyInfo,
                           int Index,
                           LPPSFACTORYBUFFER pPSFactory,
                           LPRPCPROXYBUFFER *ppProxy,
                           LPVOID *ppvObj)
239 240
{
  StdProxyImpl *This;
241 242
  PCInterfaceName name = ProxyInfo->pNamesArray[Index];
  CInterfaceProxyVtbl *vtbl = ProxyInfo->pProxyVtblList[Index];
243

244
  TRACE("(%p,%p,%p,%p,%p) %s\n", pUnkOuter, vtbl, pPSFactory, ppProxy, ppvObj, name);
245

246 247
  /* TableVersion = 2 means it is the stubless version of CInterfaceProxyVtbl */
  if (ProxyInfo->TableVersion > 1) {
248
    ULONG count = ProxyInfo->pStubVtblList[Index]->header.DispatchTableCount;
Hans Leidekker's avatar
Hans Leidekker committed
249
    vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
250
    TRACE("stubless vtbl %p: count=%d\n", vtbl->Vtbl, count );
251
    fill_stubless_table( (IUnknownVtbl *)vtbl->Vtbl, count );
252 253 254 255 256 257 258 259 260 261
  }

  if (!IsEqualGUID(vtbl->header.piid, riid)) {
    ERR("IID mismatch during proxy creation\n");
    return RPC_E_UNEXPECTED;
  }

  This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(StdProxyImpl));
  if (!This) return E_OUTOFMEMORY;

262
  if (!pUnkOuter) pUnkOuter = (IUnknown *)This;
263
  This->IRpcProxyBuffer_iface.lpVtbl = &StdProxy_Vtbl;
264
  This->PVtbl = vtbl->Vtbl;
265 266
  /* one reference for the proxy */
  This->RefCount = 1;
267
  This->piid = vtbl->header.piid;
268 269
  This->base_object = NULL;
  This->base_proxy = NULL;
270
  This->pUnkOuter = pUnkOuter;
271
  This->name = name;
272 273
  This->pPSFactory = pPSFactory;
  This->pChannel = NULL;
274 275 276 277 278 279 280 281 282 283 284 285

  if(ProxyInfo->pDelegatedIIDs && ProxyInfo->pDelegatedIIDs[Index])
  {
      HRESULT r = create_proxy( ProxyInfo->pDelegatedIIDs[Index], NULL,
                                &This->base_proxy, (void **)&This->base_object );
      if (FAILED(r))
      {
          HeapFree( GetProcessHeap(), 0, This );
          return r;
      }
  }

286
  *ppProxy = &This->IRpcProxyBuffer_iface;
287
  *ppvObj = &This->PVtbl;
288
  IUnknown_AddRef((IUnknown *)*ppvObj);
289 290
  IPSFactoryBuffer_AddRef(pPSFactory);

291 292
  TRACE( "iid=%s this %p proxy %p obj %p vtbl %p base proxy %p base obj %p\n",
         debugstr_guid(riid), This, *ppProxy, *ppvObj, This->PVtbl, This->base_proxy, This->base_object );
293 294 295 296 297 298 299
  return S_OK;
}

static HRESULT WINAPI StdProxy_QueryInterface(LPRPCPROXYBUFFER iface,
                                             REFIID riid,
                                             LPVOID *obj)
{
300
  StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
301 302 303 304 305
  TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);

  if (IsEqualGUID(&IID_IUnknown,riid) ||
      IsEqualGUID(This->piid,riid)) {
    *obj = &This->PVtbl;
306
    InterlockedIncrement(&This->RefCount);
307 308 309 310
    return S_OK;
  }

  if (IsEqualGUID(&IID_IRpcProxyBuffer,riid)) {
311
    *obj = &This->IRpcProxyBuffer_iface;
312
    InterlockedIncrement(&This->RefCount);
313 314 315 316 317 318 319 320
    return S_OK;
  }

  return E_NOINTERFACE;
}

static ULONG WINAPI StdProxy_AddRef(LPRPCPROXYBUFFER iface)
{
321
  StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
322 323
  TRACE("(%p)->AddRef()\n",This);

324
  return InterlockedIncrement(&This->RefCount);
325 326 327 328
}

static ULONG WINAPI StdProxy_Release(LPRPCPROXYBUFFER iface)
{
329
  ULONG refs;
330
  StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
331 332
  TRACE("(%p)->Release()\n",This);

333 334
  refs = InterlockedDecrement(&This->RefCount);
  if (!refs)
335 336 337 338 339 340 341 342 343 344 345
  {
    if (This->pChannel)
      IRpcProxyBuffer_Disconnect(&This->IRpcProxyBuffer_iface);

    if (This->base_object) IUnknown_Release( This->base_object );
    if (This->base_proxy) IRpcProxyBuffer_Release( This->base_proxy );

    IPSFactoryBuffer_Release(This->pPSFactory);
    HeapFree(GetProcessHeap(),0,This);
  }

346
  return refs;
347 348 349 350 351
}

static HRESULT WINAPI StdProxy_Connect(LPRPCPROXYBUFFER iface,
                                      LPRPCCHANNELBUFFER pChannel)
{
352
  StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
353 354 355
  TRACE("(%p)->Connect(%p)\n",This,pChannel);

  This->pChannel = pChannel;
356
  IRpcChannelBuffer_AddRef(pChannel);
357
  if (This->base_proxy) IRpcProxyBuffer_Connect( This->base_proxy, pChannel );
358 359 360 361 362
  return S_OK;
}

static VOID WINAPI StdProxy_Disconnect(LPRPCPROXYBUFFER iface)
{
363
  StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface);
364 365
  TRACE("(%p)->Disconnect()\n",This);

366 367
  if (This->base_proxy) IRpcProxyBuffer_Disconnect( This->base_proxy );

368
  IRpcChannelBuffer_Release(This->pChannel);
369 370 371
  This->pChannel = NULL;
}

372
static const IRpcProxyBufferVtbl StdProxy_Vtbl =
373 374 375 376 377 378 379 380
{
  StdProxy_QueryInterface,
  StdProxy_AddRef,
  StdProxy_Release,
  StdProxy_Connect,
  StdProxy_Disconnect
};

381
static void StdProxy_GetChannel(LPVOID iface,
382
                                   LPRPCCHANNELBUFFER *ppChannel)
383
{
384
  StdProxyImpl *This = impl_from_proxy_obj( iface );
385
  TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name);
386 387 388 389

  *ppChannel = This->pChannel;
}

390
static void StdProxy_GetIID(LPVOID iface,
391
                               const IID **ppiid)
392
{
393
  StdProxyImpl *This = impl_from_proxy_obj( iface );
394
  TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name);
395 396 397 398 399 400 401 402

  *ppiid = This->piid;
}

HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface,
                                            REFIID riid,
                                            LPVOID *ppvObj)
{
403
  StdProxyImpl *This = impl_from_proxy_obj( iface );
404
  TRACE("(%p)->QueryInterface(%s,%p) %s\n",This,debugstr_guid(riid),ppvObj,This->name);
405 406 407 408 409
  return IUnknown_QueryInterface(This->pUnkOuter,riid,ppvObj);
}

ULONG WINAPI IUnknown_AddRef_Proxy(LPUNKNOWN iface)
{
410
  StdProxyImpl *This = impl_from_proxy_obj( iface );
411
  TRACE("(%p)->AddRef() %s\n",This,This->name);
412 413 414 415 416
  return IUnknown_AddRef(This->pUnkOuter);
}

ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface)
{
417
  StdProxyImpl *This = impl_from_proxy_obj( iface );
418
  TRACE("(%p)->Release() %s\n",This,This->name);
419 420
  return IUnknown_Release(This->pUnkOuter);
}
421

422 423 424 425 426 427 428 429 430 431 432
/***********************************************************************
 *           NdrProxyInitialize [RPCRT4.@]
 */
void WINAPI NdrProxyInitialize(void *This,
                              PRPC_MESSAGE pRpcMsg,
                              PMIDL_STUB_MESSAGE pStubMsg,
                              PMIDL_STUB_DESC pStubDescriptor,
                              unsigned int ProcNum)
{
  TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
  NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
433 434 435 436
  StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer);
  IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
                               &pStubMsg->dwDestContext,
                               &pStubMsg->pvDestContext);
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
  TRACE("channel=%p\n", pStubMsg->pRpcChannelBuffer);
}

/***********************************************************************
 *           NdrProxyGetBuffer [RPCRT4.@]
 */
void WINAPI NdrProxyGetBuffer(void *This,
                             PMIDL_STUB_MESSAGE pStubMsg)
{
  HRESULT hr;
  const IID *riid = NULL;

  TRACE("(%p,%p)\n", This, pStubMsg);
  pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
  pStubMsg->dwStubPhase = PROXY_GETBUFFER;
452
  StdProxy_GetIID(This, &riid);
453 454 455
  hr = IRpcChannelBuffer_GetBuffer(pStubMsg->pRpcChannelBuffer,
                                  (RPCOLEMESSAGE*)pStubMsg->RpcMsg,
                                  riid);
456 457 458 459 460
  if (FAILED(hr))
  {
    RpcRaiseException(hr);
    return;
  }
461
  pStubMsg->fBufferValid = TRUE;
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485
  pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
  pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
  pStubMsg->Buffer = pStubMsg->BufferStart;
  pStubMsg->dwStubPhase = PROXY_MARSHAL;
}

/***********************************************************************
 *           NdrProxySendReceive [RPCRT4.@]
 */
void WINAPI NdrProxySendReceive(void *This,
                               PMIDL_STUB_MESSAGE pStubMsg)
{
  ULONG Status = 0;
  HRESULT hr;

  TRACE("(%p,%p)\n", This, pStubMsg);

  if (!pStubMsg->pRpcChannelBuffer)
  {
    WARN("Trying to use disconnected proxy %p\n", This);
    RpcRaiseException(RPC_E_DISCONNECTED);
  }

  pStubMsg->dwStubPhase = PROXY_SENDRECEIVE;
486 487
  /* avoid sending uninitialised parts of the buffer on the wire */
  pStubMsg->RpcMsg->BufferLength = pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer;
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508
  hr = IRpcChannelBuffer_SendReceive(pStubMsg->pRpcChannelBuffer,
                                    (RPCOLEMESSAGE*)pStubMsg->RpcMsg,
                                    &Status);
  pStubMsg->dwStubPhase = PROXY_UNMARSHAL;
  pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength;
  pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
  pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
  pStubMsg->Buffer = pStubMsg->BufferStart;

  /* raise exception if call failed */
  if (hr == RPC_S_CALL_FAILED) RpcRaiseException(*(DWORD*)pStubMsg->Buffer);
  else if (FAILED(hr)) RpcRaiseException(hr);
}

/***********************************************************************
 *           NdrProxyFreeBuffer [RPCRT4.@]
 */
void WINAPI NdrProxyFreeBuffer(void *This,
                              PMIDL_STUB_MESSAGE pStubMsg)
{
  TRACE("(%p,%p)\n", This, pStubMsg);
509 510 511 512 513 514 515

  if (pStubMsg->fBufferValid)
  {
    IRpcChannelBuffer_FreeBuffer(pStubMsg->pRpcChannelBuffer,
                                 (RPCOLEMESSAGE*)pStubMsg->RpcMsg);
    pStubMsg->fBufferValid = TRUE;
  }
516 517 518 519 520 521 522
}

/***********************************************************************
 *           NdrProxyErrorHandler [RPCRT4.@]
 */
HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode)
{
523
  WARN("(0x%08x): a proxy call failed\n", dwExceptionCode);
524 525 526 527 528 529 530

  if (FAILED(dwExceptionCode))
    return dwExceptionCode;
  else
    return HRESULT_FROM_WIN32(dwExceptionCode);
}

531 532 533 534
HRESULT WINAPI
CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
                         LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv )
{
535 536
    typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT);
    HMODULE hUser32 = LoadLibraryA("user32");
537
    MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA");
538

539
    FIXME("%p %p %s %p %p\n", pTypeInfo, pUnkOuter, debugstr_guid(riid), ppProxy, ppv);
540 541 542 543 544 545 546 547 548
    if (pMessageBoxA)
    {
        pMessageBoxA(NULL,
            "The native implementation of OLEAUT32.DLL cannot be used "
            "with Wine's RPCRT4.DLL. Remove OLEAUT32.DLL and try again.\n",
            "Wine: Unimplemented CreateProxyFromTypeInfo",
            0x10);
        ExitProcess(1);
    }
549 550
    return E_NOTIMPL;
}
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571

HRESULT WINAPI
CreateStubFromTypeInfo(ITypeInfo *pTypeInfo, REFIID riid, IUnknown *pUnkServer,
                       IRpcStubBuffer **ppStub )
{
    typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT);
    HMODULE hUser32 = LoadLibraryA("user32");
    MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA");

    FIXME("%p %s %p %p\n", pTypeInfo, debugstr_guid(riid), pUnkServer, ppStub);
    if (pMessageBoxA)
    {
        pMessageBoxA(NULL,
            "The native implementation of OLEAUT32.DLL cannot be used "
            "with Wine's RPCRT4.DLL. Remove OLEAUT32.DLL and try again.\n",
            "Wine: Unimplemented CreateProxyFromTypeInfo",
            0x10);
        ExitProcess(1);
    }
    return E_NOTIMPL;
}