ReactOS 0.4.15-dev-7906-g1b85a5f
cproxy.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "objbase.h"
#include "rpcproxy.h"
#include "cpsf.h"
#include "ndr_misc.h"
#include "ndr_stubless.h"
#include "wine/asm.h"
#include "wine/debug.h"
Include dependency graph for cproxy.c:

Go to the source code of this file.

Classes

struct  thunk
 

Macros

#define COBJMACROS
 
#define BLOCK_SIZE   1024
 
#define MAX_BLOCKS   64 /* 64k methods should be enough for anybody */
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static StdProxyImplimpl_from_IRpcProxyBuffer (IRpcProxyBuffer *iface)
 
static StdProxyImplimpl_from_proxy_obj (void *iface)
 
static void init_thunk (struct thunk *thunk, unsigned int index)
 
static const struct thunkallocate_block (unsigned int num)
 
BOOL fill_stubless_table (IUnknownVtbl *vtbl, DWORD num)
 
HRESULT StdProxy_Construct (REFIID riid, LPUNKNOWN pUnkOuter, const ProxyFileInfo *ProxyInfo, int Index, LPPSFACTORYBUFFER pPSFactory, LPRPCPROXYBUFFER *ppProxy, LPVOID *ppvObj)
 
HRESULT WINAPI StdProxy_QueryInterface (IRpcProxyBuffer *iface, REFIID riid, void **obj)
 
ULONG WINAPI StdProxy_AddRef (IRpcProxyBuffer *iface)
 
static ULONG WINAPI StdProxy_Release (LPRPCPROXYBUFFER iface)
 
HRESULT WINAPI StdProxy_Connect (IRpcProxyBuffer *iface, IRpcChannelBuffer *pChannel)
 
void WINAPI StdProxy_Disconnect (IRpcProxyBuffer *iface)
 
static void StdProxy_GetChannel (LPVOID iface, LPRPCCHANNELBUFFER *ppChannel)
 
static void StdProxy_GetIID (LPVOID iface, const IID **ppiid)
 
HRESULT WINAPI IUnknown_QueryInterface_Proxy (LPUNKNOWN iface, REFIID riid, LPVOID *ppvObj)
 
ULONG WINAPI IUnknown_AddRef_Proxy (LPUNKNOWN iface)
 
ULONG WINAPI IUnknown_Release_Proxy (LPUNKNOWN iface)
 
void WINAPI NdrProxyInitialize (void *This, PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDescriptor, unsigned int ProcNum)
 
void WINAPI NdrProxyGetBuffer (void *This, PMIDL_STUB_MESSAGE pStubMsg)
 
void WINAPI NdrProxySendReceive (void *This, PMIDL_STUB_MESSAGE pStubMsg)
 
void WINAPI NdrProxyFreeBuffer (void *This, PMIDL_STUB_MESSAGE pStubMsg)
 
HRESULT WINAPI NdrProxyErrorHandler (DWORD dwExceptionCode)
 

Variables

static const IRpcProxyBufferVtbl StdProxy_Vtbl
 
static const struct thunkmethod_blocks [MAX_BLOCKS]
 

Macro Definition Documentation

◆ BLOCK_SIZE

#define BLOCK_SIZE   1024

Definition at line 259 of file cproxy.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file cproxy.c.

◆ MAX_BLOCKS

#define MAX_BLOCKS   64 /* 64k methods should be enough for anybody */

Definition at line 260 of file cproxy.c.

Function Documentation

◆ allocate_block()

static const struct thunk * allocate_block ( unsigned int  num)
static

Definition at line 264 of file cproxy.c.

265{
266 unsigned int i;
267 struct thunk *prev, *block;
268 DWORD oldprot;
269
270 block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
272 if (!block) return NULL;
273
274 for (i = 0; i < BLOCK_SIZE; i++) init_thunk( &block[i], BLOCK_SIZE * num + i + 3 );
275 VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, &oldprot );
277 if (prev) /* someone beat us to it */
278 {
280 block = prev;
281 }
282 return block;
283}
static const struct thunk * method_blocks[MAX_BLOCKS]
Definition: cproxy.c:262
static void init_thunk(struct thunk *thunk, unsigned int index)
Definition: cproxy.c:252
#define BLOCK_SIZE
Definition: cproxy.c:259
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
#define PAGE_EXECUTE_READ
Definition: nt_native.h:1307
#define MEM_RESERVE
Definition: nt_native.h:1314
#define MEM_RELEASE
Definition: nt_native.h:1316
#define MEM_COMMIT
Definition: nt_native.h:1313
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
Definition: cproxy.c:248
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:65
BOOL NTAPI VirtualProtect(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flNewProtect, OUT PDWORD lpflOldProtect)
Definition: virtmem.c:135
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:119
static unsigned int block
Definition: xmlmemory.c:101

Referenced by fill_stubless_table().

◆ fill_stubless_table()

BOOL fill_stubless_table ( IUnknownVtbl *  vtbl,
DWORD  num 
)

Definition at line 285 of file cproxy.c.

286{
287 const void **entry = (const void **)(vtbl + 1);
288 DWORD i, j;
289
290 if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
291 {
292 FIXME( "%u methods not supported\n", num );
293 return FALSE;
294 }
295 for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
296 {
297 const struct thunk *block = method_blocks[i];
298 if (!block && !(block = allocate_block( i ))) return FALSE;
299 for (j = 0; j < BLOCK_SIZE && j < num - 3 - i * BLOCK_SIZE; j++, entry++)
300 if (*entry == (LPVOID)-1) *entry = &block[j];
301 }
302 return TRUE;
303}
#define FIXME(fmt,...)
Definition: debug.h:111
static const struct thunk * allocate_block(unsigned int num)
Definition: cproxy.c:264
#define MAX_BLOCKS
Definition: cproxy.c:260
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
uint32_t entry
Definition: isohybrid.c:63

Referenced by StdProxy_Construct(), and typelib_proxy_init().

◆ impl_from_IRpcProxyBuffer()

static StdProxyImpl * impl_from_IRpcProxyBuffer ( IRpcProxyBuffer iface)
inlinestatic

Definition at line 43 of file cproxy.c.

44{
45 return CONTAINING_RECORD(iface, StdProxyImpl, IRpcProxyBuffer_iface);
46}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by StdProxy_AddRef(), StdProxy_Connect(), StdProxy_Disconnect(), StdProxy_QueryInterface(), and StdProxy_Release().

◆ impl_from_proxy_obj()

static StdProxyImpl * impl_from_proxy_obj ( void iface)
inlinestatic

◆ init_thunk()

static void init_thunk ( struct thunk thunk,
unsigned int  index 
)
inlinestatic

Definition at line 252 of file cproxy.c.

253{
254 thunk->index = index;
255}
#define index(s, c)
Definition: various.h:29
DWORD index
Definition: cproxy.c:249

Referenced by allocate_block().

◆ IUnknown_AddRef_Proxy()

ULONG WINAPI IUnknown_AddRef_Proxy ( LPUNKNOWN  iface)

Definition at line 478 of file cproxy.c.

479{
481 TRACE("(%p)->AddRef() %s\n",This,This->name);
482 return IUnknown_AddRef(This->pUnkOuter);
483}
static StdProxyImpl * impl_from_proxy_obj(void *iface)
Definition: cproxy.c:48
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by CINTERFACE_PROXY_VTABLE(), fill_delegated_proxy_table(), and test_NdrDllGetClassObject().

◆ IUnknown_QueryInterface_Proxy()

HRESULT WINAPI IUnknown_QueryInterface_Proxy ( LPUNKNOWN  iface,
REFIID  riid,
LPVOID ppvObj 
)

Definition at line 469 of file cproxy.c.

472{
474 TRACE("(%p)->QueryInterface(%s,%p) %s\n",This,debugstr_guid(riid),ppvObj,This->name);
475 return IUnknown_QueryInterface(This->pUnkOuter,riid,ppvObj);
476}
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35

Referenced by CINTERFACE_PROXY_VTABLE(), fill_delegated_proxy_table(), and test_NdrDllGetClassObject().

◆ IUnknown_Release_Proxy()

ULONG WINAPI IUnknown_Release_Proxy ( LPUNKNOWN  iface)

Definition at line 485 of file cproxy.c.

486{
488 TRACE("(%p)->Release() %s\n",This,This->name);
489 return IUnknown_Release(This->pUnkOuter);
490}

Referenced by CINTERFACE_PROXY_VTABLE(), fill_delegated_proxy_table(), and test_NdrDllGetClassObject().

◆ NdrProxyErrorHandler()

HRESULT WINAPI NdrProxyErrorHandler ( DWORD  dwExceptionCode)

Definition at line 593 of file cproxy.c.

594{
595 WARN("(0x%08x): a proxy call failed\n", dwExceptionCode);
596
597 if (FAILED(dwExceptionCode))
598 return dwExceptionCode;
599 else
600 return HRESULT_FROM_WIN32(dwExceptionCode);
601}
#define WARN(fmt,...)
Definition: debug.h:112
#define FAILED(hr)
Definition: intsafe.h:51
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by ndr_client_call().

◆ NdrProxyFreeBuffer()

void WINAPI NdrProxyFreeBuffer ( void This,
PMIDL_STUB_MESSAGE  pStubMsg 
)

Definition at line 577 of file cproxy.c.

579{
580 TRACE("(%p,%p)\n", This, pStubMsg);
581
582 if (pStubMsg->fBufferValid)
583 {
584 IRpcChannelBuffer_FreeBuffer(pStubMsg->pRpcChannelBuffer,
585 (RPCOLEMESSAGE*)pStubMsg->RpcMsg);
586 pStubMsg->fBufferValid = TRUE;
587 }
588}
unsigned int fBufferValid
Definition: rpcndr.h:243
struct IRpcChannelBuffer * pRpcChannelBuffer
Definition: rpcndr.h:253
PRPC_MESSAGE RpcMsg
Definition: rpcndr.h:202

Referenced by ndr_client_call_finally().

◆ NdrProxyGetBuffer()

void WINAPI NdrProxyGetBuffer ( void This,
PMIDL_STUB_MESSAGE  pStubMsg 
)

Definition at line 515 of file cproxy.c.

517{
518 HRESULT hr;
519 const IID *riid = NULL;
520
521 TRACE("(%p,%p)\n", This, pStubMsg);
522 pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
523 pStubMsg->dwStubPhase = PROXY_GETBUFFER;
525 hr = IRpcChannelBuffer_GetBuffer(pStubMsg->pRpcChannelBuffer,
526 (RPCOLEMESSAGE*)pStubMsg->RpcMsg,
527 riid);
528 if (FAILED(hr))
529 {
531 return;
532 }
533 pStubMsg->fBufferValid = TRUE;
534 pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
535 pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
536 pStubMsg->Buffer = pStubMsg->BufferStart;
537 pStubMsg->dwStubPhase = PROXY_MARSHAL;
538}
static void StdProxy_GetIID(LPVOID iface, const IID **ppiid)
Definition: cproxy.c:460
@ PROXY_GETBUFFER
Definition: rpcndr.h:456
@ PROXY_MARSHAL
Definition: rpcndr.h:457
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:188
HRESULT hr
Definition: shlfolder.c:183
DWORD dwStubPhase
Definition: rpcndr.h:259
unsigned char * Buffer
Definition: rpcndr.h:203
ULONG BufferLength
Definition: rpcndr.h:207
unsigned char * BufferEnd
Definition: rpcndr.h:205
unsigned char * BufferStart
Definition: rpcndr.h:204
unsigned int BufferLength
Definition: rpcdcep.h:41
void * Buffer
Definition: rpcdcep.h:40

Referenced by do_ndr_client_call().

◆ NdrProxyInitialize()

void WINAPI NdrProxyInitialize ( void This,
PRPC_MESSAGE  pRpcMsg,
PMIDL_STUB_MESSAGE  pStubMsg,
PMIDL_STUB_DESC  pStubDescriptor,
unsigned int  ProcNum 
)

Definition at line 495 of file cproxy.c.

500{
501 TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
502 NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
504 if (!pStubMsg->pRpcChannelBuffer)
506 IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
507 &pStubMsg->dwDestContext,
508 &pStubMsg->pvDestContext);
509 TRACE("channel=%p\n", pStubMsg->pRpcChannelBuffer);
510}
static void StdProxy_GetChannel(LPVOID iface, LPRPCCHANNELBUFFER *ppChannel)
Definition: cproxy.c:451
void WINAPI NdrClientInitializeNew(PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc, unsigned int ProcNum)
void * pvDestContext
Definition: rpcndr.h:250
DWORD dwDestContext
Definition: rpcndr.h:249
#define CO_E_OBJNOTCONNECTED
Definition: winerror.h:2816

Referenced by do_ndr_client_call().

◆ NdrProxySendReceive()

void WINAPI NdrProxySendReceive ( void This,
PMIDL_STUB_MESSAGE  pStubMsg 
)

Definition at line 543 of file cproxy.c.

545{
546 ULONG Status = 0;
547 HRESULT hr;
548
549 TRACE("(%p,%p)\n", This, pStubMsg);
550
551 if (!pStubMsg->pRpcChannelBuffer)
552 {
553 WARN("Trying to use disconnected proxy %p\n", This);
555 }
556
557 pStubMsg->dwStubPhase = PROXY_SENDRECEIVE;
558 /* avoid sending uninitialised parts of the buffer on the wire */
559 pStubMsg->RpcMsg->BufferLength = pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer;
560 hr = IRpcChannelBuffer_SendReceive(pStubMsg->pRpcChannelBuffer,
561 (RPCOLEMESSAGE*)pStubMsg->RpcMsg,
562 &Status);
563 pStubMsg->dwStubPhase = PROXY_UNMARSHAL;
564 pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength;
565 pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
566 pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
567 pStubMsg->Buffer = pStubMsg->BufferStart;
568
569 /* raise exception if call failed */
570 if (hr == RPC_S_CALL_FAILED) RpcRaiseException(*(DWORD*)pStubMsg->Buffer);
571 else if (FAILED(hr)) RpcRaiseException(hr);
572}
Status
Definition: gdiplustypes.h:25
@ PROXY_UNMARSHAL
Definition: rpcndr.h:459
@ PROXY_SENDRECEIVE
Definition: rpcndr.h:458
uint32_t ULONG
Definition: typedefs.h:59
#define RPC_S_CALL_FAILED
Definition: winerror.h:1037
#define RPC_E_DISCONNECTED
Definition: winerror.h:2484

Referenced by do_ndr_client_call().

◆ StdProxy_AddRef()

ULONG WINAPI StdProxy_AddRef ( IRpcProxyBuffer iface)

Definition at line 390 of file cproxy.c.

391{
393 TRACE("(%p)->AddRef()\n",This);
394
395 return InterlockedIncrement(&This->RefCount);
396}
#define InterlockedIncrement
Definition: armddk.h:53
static StdProxyImpl * impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface)
Definition: cproxy.c:43

◆ StdProxy_Connect()

HRESULT WINAPI StdProxy_Connect ( IRpcProxyBuffer iface,
IRpcChannelBuffer pChannel 
)

Definition at line 420 of file cproxy.c.

421{
423 TRACE("(%p)->Connect(%p)\n",This,pChannel);
424
425 This->pChannel = pChannel;
426 IRpcChannelBuffer_AddRef(pChannel);
427 if (This->base_proxy) IRpcProxyBuffer_Connect( This->base_proxy, pChannel );
428 return S_OK;
429}
#define S_OK
Definition: intsafe.h:52

◆ StdProxy_Construct()

HRESULT StdProxy_Construct ( REFIID  riid,
LPUNKNOWN  pUnkOuter,
const ProxyFileInfo ProxyInfo,
int  Index,
LPPSFACTORYBUFFER  pPSFactory,
LPRPCPROXYBUFFER ppProxy,
LPVOID ppvObj 
)

Definition at line 305 of file cproxy.c.

312{
315 CInterfaceProxyVtbl *vtbl = ProxyInfo->pProxyVtblList[Index];
316
317 TRACE("(%p,%p,%p,%p,%p) %s\n", pUnkOuter, vtbl, pPSFactory, ppProxy, ppvObj, name);
318
319 /* TableVersion = 2 means it is the stubless version of CInterfaceProxyVtbl */
320 if (ProxyInfo->TableVersion > 1) {
322 vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
323 TRACE("stubless vtbl %p: count=%d\n", vtbl->Vtbl, count );
324 fill_stubless_table( (IUnknownVtbl *)vtbl->Vtbl, count );
325 }
326
327 if (!IsEqualGUID(vtbl->header.piid, riid)) {
328 ERR("IID mismatch during proxy creation\n");
329 return RPC_E_UNEXPECTED;
330 }
331
333 if (!This) return E_OUTOFMEMORY;
334
335 if (!pUnkOuter) pUnkOuter = (IUnknown *)This;
336 This->IRpcProxyBuffer_iface.lpVtbl = &StdProxy_Vtbl;
337 This->PVtbl = vtbl->Vtbl;
338 /* one reference for the proxy */
339 This->RefCount = 1;
340 This->piid = vtbl->header.piid;
341 This->base_object = NULL;
342 This->base_proxy = NULL;
343 This->pUnkOuter = pUnkOuter;
344 This->name = name;
345 This->pPSFactory = pPSFactory;
346 This->pChannel = NULL;
347
348 if(ProxyInfo->pDelegatedIIDs && ProxyInfo->pDelegatedIIDs[Index])
349 {
351 &This->base_proxy, (void **)&This->base_object );
352 if (FAILED(r))
353 {
355 return r;
356 }
357 }
358
359 *ppProxy = &This->IRpcProxyBuffer_iface;
360 *ppvObj = &This->PVtbl;
361 IUnknown_AddRef((IUnknown *)*ppvObj);
362 IPSFactoryBuffer_AddRef(pPSFactory);
363
364 TRACE( "iid=%s this %p proxy %p obj %p vtbl %p base proxy %p base obj %p\n",
365 debugstr_guid(riid), This, *ppProxy, *ppvObj, This->PVtbl, This->base_proxy, This->base_object );
366 return S_OK;
367}
#define ERR(fmt,...)
Definition: debug.h:110
BOOL fill_stubless_table(IUnknownVtbl *vtbl, DWORD num)
Definition: cproxy.c:285
static const IRpcProxyBufferVtbl StdProxy_Vtbl
Definition: cproxy.c:41
HRESULT create_proxy(REFIID iid, IUnknown *pUnkOuter, IRpcProxyBuffer **pproxy, void **ppv) DECLSPEC_HIDDEN
Definition: ndr_ole.c:442
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
const char * PCInterfaceName
Definition: rpcproxy.h:42
Definition: name.c:39
CInterfaceProxyHeader header
Definition: rpcproxy.h:80
CInterfaceStubHeader header
Definition: rpcproxy.h:104
unsigned short TableVersion
Definition: rpcproxy.h:54
const IID ** pDelegatedIIDs
Definition: rpcproxy.h:51
const PCInterfaceStubVtblList * pStubVtblList
Definition: rpcproxy.h:49
const PCInterfaceProxyVtblList * pProxyVtblList
Definition: rpcproxy.h:48
const PCInterfaceName * pNamesArray
Definition: rpcproxy.h:50
_In_ WDFCOLLECTION _In_ ULONG Index
#define RPC_E_UNEXPECTED
Definition: winerror.h:2509

Referenced by CStdPSFactory_CreateProxy().

◆ StdProxy_Disconnect()

void WINAPI StdProxy_Disconnect ( IRpcProxyBuffer iface)

Definition at line 431 of file cproxy.c.

432{
434 TRACE("(%p)->Disconnect()\n",This);
435
436 if (This->base_proxy) IRpcProxyBuffer_Disconnect( This->base_proxy );
437
438 IRpcChannelBuffer_Release(This->pChannel);
439 This->pChannel = NULL;
440}

◆ StdProxy_GetChannel()

static void StdProxy_GetChannel ( LPVOID  iface,
LPRPCCHANNELBUFFER ppChannel 
)
static

Definition at line 451 of file cproxy.c.

453{
455 TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name);
456
457 *ppChannel = This->pChannel;
458}

Referenced by NdrProxyInitialize().

◆ StdProxy_GetIID()

static void StdProxy_GetIID ( LPVOID  iface,
const IID **  ppiid 
)
static

Definition at line 460 of file cproxy.c.

462{
464 TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name);
465
466 *ppiid = This->piid;
467}

Referenced by NdrProxyGetBuffer().

◆ StdProxy_QueryInterface()

HRESULT WINAPI StdProxy_QueryInterface ( IRpcProxyBuffer iface,
REFIID  riid,
void **  obj 
)

Definition at line 369 of file cproxy.c.

370{
372 TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);
373
375 IsEqualGUID(This->piid,riid)) {
376 *obj = &This->PVtbl;
377 InterlockedIncrement(&This->RefCount);
378 return S_OK;
379 }
380
381 if (IsEqualGUID(&IID_IRpcProxyBuffer,riid)) {
382 *obj = &This->IRpcProxyBuffer_iface;
383 InterlockedIncrement(&This->RefCount);
384 return S_OK;
385 }
386
387 return E_NOINTERFACE;
388}
const GUID IID_IUnknown
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ StdProxy_Release()

static ULONG WINAPI StdProxy_Release ( LPRPCPROXYBUFFER  iface)
static

Definition at line 398 of file cproxy.c.

399{
400 ULONG refs;
402 TRACE("(%p)->Release()\n",This);
403
404 refs = InterlockedDecrement(&This->RefCount);
405 if (!refs)
406 {
407 if (This->pChannel)
408 IRpcProxyBuffer_Disconnect(&This->IRpcProxyBuffer_iface);
409
410 if (This->base_object) IUnknown_Release( This->base_object );
411 if (This->base_proxy) IRpcProxyBuffer_Release( This->base_proxy );
412
413 IPSFactoryBuffer_Release(This->pPSFactory);
415 }
416
417 return refs;
418}
#define InterlockedDecrement
Definition: armddk.h:52

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ method_blocks

const struct thunk* method_blocks[MAX_BLOCKS]
static

Definition at line 262 of file cproxy.c.

Referenced by allocate_block(), and fill_stubless_table().

◆ StdProxy_Vtbl

static const IRpcProxyBufferVtbl StdProxy_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI StdProxy_Release(LPRPCPROXYBUFFER iface)
Definition: cproxy.c:398
HRESULT WINAPI StdProxy_QueryInterface(IRpcProxyBuffer *iface, REFIID riid, void **obj)
Definition: cproxy.c:369
void WINAPI StdProxy_Disconnect(IRpcProxyBuffer *iface)
Definition: cproxy.c:431
HRESULT WINAPI StdProxy_Connect(IRpcProxyBuffer *iface, IRpcChannelBuffer *pChannel)
Definition: cproxy.c:420
ULONG WINAPI StdProxy_AddRef(IRpcProxyBuffer *iface)
Definition: cproxy.c:390

Definition at line 41 of file cproxy.c.

Referenced by StdProxy_Construct().