2 * COM stub (CStdStubBuffer) implementation
4 * Copyright 2001 Ove Kåven, TransGaming Technologies
5 * Copyright 2009 Alexandre Julliard
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.
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.
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
34 #include "wine/debug.h"
35 #include "wine/exception.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(ole
);
41 #define STUB_HEADER(This) (((const CInterfaceStubHeader*)((This)->lpVtbl))[-1])
43 static LONG WINAPI
stub_filter(EXCEPTION_POINTERS
*eptr
)
45 if (eptr
->ExceptionRecord
->ExceptionFlags
& EXCEPTION_NONCONTINUABLE
)
46 return EXCEPTION_CONTINUE_SEARCH
;
47 return EXCEPTION_EXECUTE_HANDLER
;
50 static inline cstdstubbuffer_delegating_t
*impl_from_delegating( IRpcStubBuffer
*iface
)
52 return CONTAINING_RECORD(iface
, cstdstubbuffer_delegating_t
, stub_buffer
);
55 HRESULT
CStdStubBuffer_Construct(REFIID riid
,
58 CInterfaceStubVtbl
*vtbl
,
59 LPPSFACTORYBUFFER pPSFactory
,
60 LPRPCSTUBBUFFER
*ppStub
)
65 TRACE("(%p,%p,%p,%p) %s\n", pUnkServer
, vtbl
, pPSFactory
, ppStub
, name
);
66 TRACE("iid=%s\n", debugstr_guid(vtbl
->header
.piid
));
67 TRACE("vtbl=%p\n", &vtbl
->Vtbl
);
69 if (!IsEqualGUID(vtbl
->header
.piid
, riid
)) {
70 ERR("IID mismatch during stub creation\n");
71 return RPC_E_UNEXPECTED
;
74 r
= IUnknown_QueryInterface(pUnkServer
, riid
, (void**)&pvServer
);
78 This
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(CStdStubBuffer
));
80 IUnknown_Release(pvServer
);
84 This
->lpVtbl
= &vtbl
->Vtbl
;
86 This
->pvServerObject
= pvServer
;
87 This
->pPSFactory
= pPSFactory
;
88 *ppStub
= (LPRPCSTUBBUFFER
)This
;
90 IPSFactoryBuffer_AddRef(pPSFactory
);
94 static CRITICAL_SECTION delegating_vtbl_section
;
95 static CRITICAL_SECTION_DEBUG critsect_debug
=
97 0, 0, &delegating_vtbl_section
,
98 { &critsect_debug
.ProcessLocksList
, &critsect_debug
.ProcessLocksList
},
99 0, 0, { (DWORD_PTR
)(__FILE__
": delegating_vtbl_section") }
101 static CRITICAL_SECTION delegating_vtbl_section
= { &critsect_debug
, -1, 0, 0, 0, 0 };
108 /* remaining entries in vtbl */
111 static ref_counted_vtbl
*current_vtbl
;
114 static HRESULT WINAPI
delegating_QueryInterface(IUnknown
*pUnk
, REFIID iid
, void **ppv
)
120 static ULONG WINAPI
delegating_AddRef(IUnknown
*pUnk
)
125 static ULONG WINAPI
delegating_Release(IUnknown
*pUnk
)
130 /* The idea here is to replace the first param on the stack
131 ie. This (which will point to cstdstubbuffer_delegating_t)
132 with This->stub_buffer.pvServerObject and then jump to the
133 relevant offset in This->stub_buffer.pvServerObject's vtbl.
137 #include "pshpack1.h"
139 BYTE mov1
[4]; /* mov 0x4(%esp),%eax 8b 44 24 04 */
140 BYTE mov2
[3]; /* mov 0x10(%eax),%eax 8b 40 10 */
141 BYTE mov3
[4]; /* mov %eax,0x4(%esp) 89 44 24 04 */
142 BYTE mov4
[2]; /* mov (%eax),%eax 8b 00 */
143 BYTE mov5
[2]; /* jmp *offset(%eax) ff a0 offset */
145 BYTE pad
[1]; /* nop 90 */
149 static const BYTE opcodes
[20] = { 0x8b, 0x44, 0x24, 0x04, 0x8b, 0x40, 0x10, 0x89, 0x44, 0x24, 0x04,
150 0x8b, 0x00, 0xff, 0xa0, 0, 0, 0, 0, 0x90 };
152 #elif defined(__x86_64__)
154 #include "pshpack1.h"
157 BYTE mov1
[4]; /* movq 0x20(%rcx),%rcx 48 8b 49 20 */
158 BYTE mov2
[3]; /* movq (%rcx),%rax 48 8b 01 */
159 BYTE jmp
[2]; /* jmp *offset(%rax) ff a0 offset */
161 BYTE pad
[3]; /* lea 0x0(%rsi),%rsi 48 8d 36 */
165 static const BYTE opcodes
[16] = { 0x48, 0x8b, 0x49, 0x20, 0x48, 0x8b, 0x01,
166 0xff, 0xa0, 0, 0, 0, 0, 0x48, 0x8d, 0x36 };
167 #elif defined(__arm__)
169 static const DWORD opcodes
[] =
171 0xe52d4004, /* push {r4} */
172 0xe5900010, /* ldr r0, [r0, #16] */
173 0xe5904000, /* ldr r4, [r0] */
174 0xe59fc008, /* ldr ip, [pc, #8] */
175 0xe08cc004, /* add ip, ip, r4 */
176 0xe49d4004, /* pop {r4} */
177 0xe59cf000 /* ldr pc, [ip] */
182 DWORD opcodes
[ARRAY_SIZE(opcodes
)];
186 #elif defined(__aarch64__)
188 static const DWORD opcodes
[] =
190 0xf9401000, /* ldr x0, [x0,#32] */
191 0xf9400010, /* ldr x16, [x0] */
192 0x18000071, /* ldr w17, offset */
193 0xf8716a10, /* ldr x16, [x16,x17] */
194 0xd61f0200 /* br x16 */
199 DWORD opcodes
[ARRAY_SIZE(opcodes
)];
205 #warning You must implement delegated proxies/stubs for your CPU
210 static const BYTE opcodes
[1];
214 #define BLOCK_SIZE 1024
215 #define MAX_BLOCKS 64 /* 64k methods should be enough for anybody */
217 static const vtbl_method_t
*method_blocks
[MAX_BLOCKS
];
219 static const vtbl_method_t
*allocate_block( unsigned int num
)
222 vtbl_method_t
*prev
, *block
;
225 block
= VirtualAlloc( NULL
, BLOCK_SIZE
* sizeof(*block
),
226 MEM_COMMIT
| MEM_RESERVE
, PAGE_EXECUTE_READWRITE
);
227 if (!block
) return NULL
;
229 for (i
= 0; i
< BLOCK_SIZE
; i
++)
231 memcpy( &block
[i
], opcodes
, sizeof(opcodes
) );
232 block
[i
].offset
= (BLOCK_SIZE
* num
+ i
+ 3) * sizeof(void *);
234 VirtualProtect( block
, BLOCK_SIZE
* sizeof(*block
), PAGE_EXECUTE_READ
, &oldprot
);
235 prev
= InterlockedCompareExchangePointer( (void **)&method_blocks
[num
], block
, NULL
);
236 if (prev
) /* someone beat us to it */
238 VirtualFree( block
, 0, MEM_RELEASE
);
244 static BOOL
fill_delegated_stub_table(IUnknownVtbl
*vtbl
, DWORD num
)
246 const void **entry
= (const void **)(vtbl
+ 1);
249 if (num
- 3 > BLOCK_SIZE
* MAX_BLOCKS
)
251 FIXME( "%u methods not supported\n", num
);
254 vtbl
->QueryInterface
= delegating_QueryInterface
;
255 vtbl
->AddRef
= delegating_AddRef
;
256 vtbl
->Release
= delegating_Release
;
257 for (i
= 0; i
< (num
- 3 + BLOCK_SIZE
- 1) / BLOCK_SIZE
; i
++)
259 const vtbl_method_t
*block
= method_blocks
[i
];
260 if (!block
&& !(block
= allocate_block( i
))) return FALSE
;
261 for (j
= 0; j
< BLOCK_SIZE
&& j
< num
- 3 - i
* BLOCK_SIZE
; j
++) *entry
++ = &block
[j
];
266 BOOL
fill_delegated_proxy_table(IUnknownVtbl
*vtbl
, DWORD num
)
268 const void **entry
= (const void **)(vtbl
+ 1);
271 if (num
- 3 > BLOCK_SIZE
* MAX_BLOCKS
)
273 FIXME( "%u methods not supported\n", num
);
276 vtbl
->QueryInterface
= IUnknown_QueryInterface_Proxy
;
277 vtbl
->AddRef
= IUnknown_AddRef_Proxy
;
278 vtbl
->Release
= IUnknown_Release_Proxy
;
279 for (i
= 0; i
< (num
- 3 + BLOCK_SIZE
- 1) / BLOCK_SIZE
; i
++)
281 const vtbl_method_t
*block
= method_blocks
[i
];
282 if (!block
&& !(block
= allocate_block( i
))) return FALSE
;
283 for (j
= 0; j
< BLOCK_SIZE
&& j
< num
- 3 - i
* BLOCK_SIZE
; j
++, entry
++)
284 if (!*entry
) *entry
= &block
[j
];
289 IUnknownVtbl
*get_delegating_vtbl(DWORD num_methods
)
293 if (num_methods
< 256) num_methods
= 256; /* avoid frequent reallocations */
295 EnterCriticalSection(&delegating_vtbl_section
);
297 if(!current_vtbl
|| num_methods
> current_vtbl
->size
)
299 ref_counted_vtbl
*table
= HeapAlloc(GetProcessHeap(), 0,
300 FIELD_OFFSET(ref_counted_vtbl
, vtbl
) + num_methods
* sizeof(void*));
303 LeaveCriticalSection(&delegating_vtbl_section
);
308 table
->size
= num_methods
;
309 fill_delegated_stub_table(&table
->vtbl
, num_methods
);
311 if (current_vtbl
&& current_vtbl
->ref
== 0)
313 TRACE("freeing old table\n");
314 HeapFree(GetProcessHeap(), 0, current_vtbl
);
316 current_vtbl
= table
;
320 ret
= ¤t_vtbl
->vtbl
;
321 LeaveCriticalSection(&delegating_vtbl_section
);
325 void release_delegating_vtbl(IUnknownVtbl
*vtbl
)
327 ref_counted_vtbl
*table
= (ref_counted_vtbl
*)((DWORD
*)vtbl
- 1);
329 EnterCriticalSection(&delegating_vtbl_section
);
331 TRACE("ref now %d\n", table
->ref
);
332 if(table
->ref
== 0 && table
!= current_vtbl
)
334 TRACE("... and we're not current so free'ing\n");
335 HeapFree(GetProcessHeap(), 0, table
);
337 LeaveCriticalSection(&delegating_vtbl_section
);
340 HRESULT
CStdStubBuffer_Delegating_Construct(REFIID riid
,
341 LPUNKNOWN pUnkServer
,
342 PCInterfaceName name
,
343 CInterfaceStubVtbl
*vtbl
,
344 REFIID delegating_iid
,
345 LPPSFACTORYBUFFER pPSFactory
,
346 LPRPCSTUBBUFFER
*ppStub
)
348 cstdstubbuffer_delegating_t
*This
;
352 TRACE("(%p,%p,%p,%p) %s\n", pUnkServer
, vtbl
, pPSFactory
, ppStub
, name
);
353 TRACE("iid=%s delegating to %s\n", debugstr_guid(vtbl
->header
.piid
), debugstr_guid(delegating_iid
));
354 TRACE("vtbl=%p\n", &vtbl
->Vtbl
);
356 if (!IsEqualGUID(vtbl
->header
.piid
, riid
))
358 ERR("IID mismatch during stub creation\n");
359 return RPC_E_UNEXPECTED
;
362 r
= IUnknown_QueryInterface(pUnkServer
, riid
, (void**)&pvServer
);
363 if(FAILED(r
)) return r
;
365 This
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*This
));
368 IUnknown_Release(pvServer
);
369 return E_OUTOFMEMORY
;
372 This
->base_obj
= get_delegating_vtbl( vtbl
->header
.DispatchTableCount
);
373 r
= create_stub(delegating_iid
, (IUnknown
*)&This
->base_obj
, &This
->base_stub
);
376 release_delegating_vtbl(This
->base_obj
);
377 HeapFree(GetProcessHeap(), 0, This
);
378 IUnknown_Release(pvServer
);
382 This
->stub_buffer
.lpVtbl
= &vtbl
->Vtbl
;
383 This
->stub_buffer
.RefCount
= 1;
384 This
->stub_buffer
.pvServerObject
= pvServer
;
385 This
->stub_buffer
.pPSFactory
= pPSFactory
;
386 *ppStub
= (LPRPCSTUBBUFFER
)&This
->stub_buffer
;
388 IPSFactoryBuffer_AddRef(pPSFactory
);
392 HRESULT WINAPI
CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface
,
396 CStdStubBuffer
*This
= (CStdStubBuffer
*)iface
;
397 TRACE("(%p)->QueryInterface(%s,%p)\n",This
,debugstr_guid(riid
),obj
);
399 if (IsEqualIID(&IID_IUnknown
, riid
) ||
400 IsEqualIID(&IID_IRpcStubBuffer
, riid
))
402 IRpcStubBuffer_AddRef(iface
);
407 return E_NOINTERFACE
;
410 ULONG WINAPI
CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface
)
412 CStdStubBuffer
*This
= (CStdStubBuffer
*)iface
;
413 TRACE("(%p)->AddRef()\n",This
);
414 return InterlockedIncrement(&This
->RefCount
);
417 ULONG WINAPI
NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface
,
418 LPPSFACTORYBUFFER pPSF
)
420 CStdStubBuffer
*This
= (CStdStubBuffer
*)iface
;
423 TRACE("(%p)->Release()\n",This
);
425 refs
= InterlockedDecrement(&This
->RefCount
);
428 /* test_Release shows that native doesn't call Disconnect here.
429 We'll leave it in for the time being. */
430 IRpcStubBuffer_Disconnect(iface
);
432 IPSFactoryBuffer_Release(pPSF
);
433 HeapFree(GetProcessHeap(),0,This
);
438 ULONG WINAPI
NdrCStdStubBuffer2_Release(LPRPCSTUBBUFFER iface
,
439 LPPSFACTORYBUFFER pPSF
)
441 cstdstubbuffer_delegating_t
*This
= impl_from_delegating( iface
);
444 TRACE("(%p)->Release()\n", This
);
446 refs
= InterlockedDecrement(&This
->stub_buffer
.RefCount
);
449 /* Just like NdrCStdStubBuffer_Release, we shouldn't call
451 IRpcStubBuffer_Disconnect((IRpcStubBuffer
*)&This
->stub_buffer
);
453 IRpcStubBuffer_Release(This
->base_stub
);
454 release_delegating_vtbl(This
->base_obj
);
456 IPSFactoryBuffer_Release(pPSF
);
457 HeapFree(GetProcessHeap(), 0, This
);
463 HRESULT WINAPI
CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface
,
464 LPUNKNOWN lpUnkServer
)
466 CStdStubBuffer
*This
= (CStdStubBuffer
*)iface
;
468 IUnknown
*new = NULL
;
470 TRACE("(%p)->Connect(%p)\n",This
,lpUnkServer
);
472 r
= IUnknown_QueryInterface(lpUnkServer
, STUB_HEADER(This
).piid
, (void**)&new);
473 new = InterlockedExchangePointer((void**)&This
->pvServerObject
, new);
475 IUnknown_Release(new);
479 void WINAPI
CStdStubBuffer_Disconnect(LPRPCSTUBBUFFER iface
)
481 CStdStubBuffer
*This
= (CStdStubBuffer
*)iface
;
483 TRACE("(%p)->Disconnect()\n",This
);
485 old
= InterlockedExchangePointer((void**)&This
->pvServerObject
, NULL
);
488 IUnknown_Release(old
);
491 HRESULT WINAPI
CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface
,
493 LPRPCCHANNELBUFFER pChannel
)
495 CStdStubBuffer
*This
= (CStdStubBuffer
*)iface
;
496 DWORD dwPhase
= STUB_UNMARSHAL
;
499 TRACE("(%p)->Invoke(%p,%p)\n",This
,pMsg
,pChannel
);
503 if (STUB_HEADER(This
).pDispatchTable
)
504 STUB_HEADER(This
).pDispatchTable
[pMsg
->iMethod
](iface
, pChannel
, (PRPC_MESSAGE
)pMsg
, &dwPhase
);
505 else /* pure interpreted */
506 NdrStubCall2(iface
, pChannel
, (PRPC_MESSAGE
)pMsg
, &dwPhase
);
508 __EXCEPT(stub_filter
)
510 DWORD dwExceptionCode
= GetExceptionCode();
511 WARN("a stub call failed with exception 0x%08x (%d)\n", dwExceptionCode
, dwExceptionCode
);
512 if (FAILED(dwExceptionCode
))
513 hr
= dwExceptionCode
;
515 hr
= HRESULT_FROM_WIN32(dwExceptionCode
);
522 LPRPCSTUBBUFFER WINAPI
CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface
,
525 CStdStubBuffer
*This
= (CStdStubBuffer
*)iface
;
526 TRACE("(%p)->IsIIDSupported(%s)\n",This
,debugstr_guid(riid
));
527 return IsEqualGUID(STUB_HEADER(This
).piid
, riid
) ? iface
: NULL
;
530 ULONG WINAPI
CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface
)
532 CStdStubBuffer
*This
= (CStdStubBuffer
*)iface
;
533 TRACE("(%p)->CountRefs()\n",This
);
534 return This
->RefCount
;
537 HRESULT WINAPI
CStdStubBuffer_DebugServerQueryInterface(LPRPCSTUBBUFFER iface
,
540 CStdStubBuffer
*This
= (CStdStubBuffer
*)iface
;
541 TRACE("(%p)->DebugServerQueryInterface(%p)\n",This
,ppv
);
545 void WINAPI
CStdStubBuffer_DebugServerRelease(LPRPCSTUBBUFFER iface
,
548 CStdStubBuffer
*This
= (CStdStubBuffer
*)iface
;
549 TRACE("(%p)->DebugServerRelease(%p)\n",This
,pv
);
552 const IRpcStubBufferVtbl CStdStubBuffer_Vtbl
=
554 CStdStubBuffer_QueryInterface
,
555 CStdStubBuffer_AddRef
,
557 CStdStubBuffer_Connect
,
558 CStdStubBuffer_Disconnect
,
559 CStdStubBuffer_Invoke
,
560 CStdStubBuffer_IsIIDSupported
,
561 CStdStubBuffer_CountRefs
,
562 CStdStubBuffer_DebugServerQueryInterface
,
563 CStdStubBuffer_DebugServerRelease
566 static HRESULT WINAPI
CStdStubBuffer_Delegating_Connect(LPRPCSTUBBUFFER iface
,
567 LPUNKNOWN lpUnkServer
)
569 cstdstubbuffer_delegating_t
*This
= impl_from_delegating(iface
);
571 TRACE("(%p)->Connect(%p)\n", This
, lpUnkServer
);
573 r
= CStdStubBuffer_Connect(iface
, lpUnkServer
);
575 r
= IRpcStubBuffer_Connect(This
->base_stub
, (IUnknown
*)&This
->base_obj
);
580 static void WINAPI
CStdStubBuffer_Delegating_Disconnect(LPRPCSTUBBUFFER iface
)
582 cstdstubbuffer_delegating_t
*This
= impl_from_delegating(iface
);
583 TRACE("(%p)->Disconnect()\n", This
);
585 IRpcStubBuffer_Disconnect(This
->base_stub
);
586 CStdStubBuffer_Disconnect(iface
);
589 static ULONG WINAPI
CStdStubBuffer_Delegating_CountRefs(LPRPCSTUBBUFFER iface
)
591 cstdstubbuffer_delegating_t
*This
= impl_from_delegating(iface
);
593 TRACE("(%p)->CountRefs()\n", This
);
595 ret
= CStdStubBuffer_CountRefs(iface
);
596 ret
+= IRpcStubBuffer_CountRefs(This
->base_stub
);
601 const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl
=
603 CStdStubBuffer_QueryInterface
,
604 CStdStubBuffer_AddRef
,
606 CStdStubBuffer_Delegating_Connect
,
607 CStdStubBuffer_Delegating_Disconnect
,
608 CStdStubBuffer_Invoke
,
609 CStdStubBuffer_IsIIDSupported
,
610 CStdStubBuffer_Delegating_CountRefs
,
611 CStdStubBuffer_DebugServerQueryInterface
,
612 CStdStubBuffer_DebugServerRelease
615 const MIDL_SERVER_INFO
*CStdStubBuffer_GetServerInfo(IRpcStubBuffer
*iface
)
617 CStdStubBuffer
*This
= (CStdStubBuffer
*)iface
;
618 return STUB_HEADER(This
).pServerInfo
;
621 /************************************************************************
622 * NdrStubForwardingFunction [RPCRT4.@]
624 void __RPC_STUB
NdrStubForwardingFunction( IRpcStubBuffer
*iface
, IRpcChannelBuffer
*pChannel
,
625 PRPC_MESSAGE pMsg
, DWORD
*pdwStubPhase
)
627 /* Note pMsg is passed intact since RPCOLEMESSAGE is basically a RPC_MESSAGE. */
629 cstdstubbuffer_delegating_t
*This
= impl_from_delegating(iface
);
630 HRESULT r
= IRpcStubBuffer_Invoke(This
->base_stub
, (RPCOLEMESSAGE
*)pMsg
, pChannel
);
631 if(FAILED(r
)) RpcRaiseException(r
);
635 /***********************************************************************
636 * NdrStubInitialize [RPCRT4.@]
638 void WINAPI
NdrStubInitialize(PRPC_MESSAGE pRpcMsg
,
639 PMIDL_STUB_MESSAGE pStubMsg
,
640 PMIDL_STUB_DESC pStubDescriptor
,
641 LPRPCCHANNELBUFFER pRpcChannelBuffer
)
643 TRACE("(%p,%p,%p,%p)\n", pRpcMsg
, pStubMsg
, pStubDescriptor
, pRpcChannelBuffer
);
644 NdrServerInitializeNew(pRpcMsg
, pStubMsg
, pStubDescriptor
);
645 pStubMsg
->pRpcChannelBuffer
= pRpcChannelBuffer
;
646 IRpcChannelBuffer_GetDestCtx(pStubMsg
->pRpcChannelBuffer
,
647 &pStubMsg
->dwDestContext
,
648 &pStubMsg
->pvDestContext
);
651 /***********************************************************************
652 * NdrStubGetBuffer [RPCRT4.@]
654 void WINAPI
NdrStubGetBuffer(LPRPCSTUBBUFFER iface
,
655 LPRPCCHANNELBUFFER pRpcChannelBuffer
,
656 PMIDL_STUB_MESSAGE pStubMsg
)
658 CStdStubBuffer
*This
= (CStdStubBuffer
*)iface
;
661 TRACE("(%p, %p, %p)\n", This
, pRpcChannelBuffer
, pStubMsg
);
663 pStubMsg
->RpcMsg
->BufferLength
= pStubMsg
->BufferLength
;
664 hr
= IRpcChannelBuffer_GetBuffer(pRpcChannelBuffer
,
665 (RPCOLEMESSAGE
*)pStubMsg
->RpcMsg
, STUB_HEADER(This
).piid
);
668 RpcRaiseException(hr
);
672 pStubMsg
->Buffer
= pStubMsg
->RpcMsg
->Buffer
;