ReactOS  0.4.14-dev-1036-g3c5b10f
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 unsigned int block
Definition: xmlmemory.c:118
Definition: cproxy.c:247
#define MEM_COMMIT
Definition: nt_native.h:1313
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
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:74
#define MEM_RESERVE
Definition: nt_native.h:1314
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
smooth NULL
Definition: ftsmooth.c:416
#define BLOCK_SIZE
Definition: cproxy.c:259
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
BOOL NTAPI VirtualProtect(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flNewProtect, OUT PDWORD lpflOldProtect)
Definition: virtmem.c:144
static const struct thunk * method_blocks[MAX_BLOCKS]
Definition: cproxy.c:262
#define MEM_RELEASE
Definition: nt_native.h:1316
#define PAGE_EXECUTE_READ
Definition: nt_native.h:1307
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:128
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
static void init_thunk(struct thunk *thunk, unsigned int index)
Definition: cproxy.c:252

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 }
static unsigned int block
Definition: xmlmemory.c:118
#define TRUE
Definition: types.h:120
Definition: cproxy.c:247
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 FIXME(fmt,...)
Definition: debug.h:110
static const struct thunk * allocate_block(unsigned int num)
Definition: cproxy.c:264
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
#define BLOCK_SIZE
Definition: cproxy.c:259
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
uint32_t entry
Definition: isohybrid.c:63
static const struct thunk * method_blocks[MAX_BLOCKS]
Definition: cproxy.c:262
#define MAX_BLOCKS
Definition: cproxy.c:260

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 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

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

Definition at line 48 of file cproxy.c.

49 {
50  return CONTAINING_RECORD(iface, StdProxyImpl, PVtbl);
51 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by IUnknown_AddRef_Proxy(), IUnknown_QueryInterface_Proxy(), IUnknown_Release_Proxy(), StdProxy_GetChannel(), and StdProxy_GetIID().

◆ 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 }
DWORD index
Definition: cproxy.c:249
Definition: cproxy.c:247
#define index(s, c)
Definition: various.h:29

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 }
static StdProxyImpl * impl_from_proxy_obj(void *iface)
Definition: cproxy.c:48
REFIID riid
Definition: precomp.h:44
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4

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 }
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().

◆ 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 HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define WARN(fmt,...)
Definition: debug.h:111

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 }
#define TRUE
Definition: types.h:120
PRPC_MESSAGE RpcMsg
Definition: rpcndr.h:202
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int fBufferValid
Definition: rpcndr.h:243
struct IRpcChannelBuffer * pRpcChannelBuffer
Definition: rpcndr.h:253

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 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
unsigned char * Buffer
Definition: rpcndr.h:203
static void StdProxy_GetIID(LPVOID iface, const IID **ppiid)
Definition: cproxy.c:460
PRPC_MESSAGE RpcMsg
Definition: rpcndr.h:202
unsigned int BufferLength
Definition: rpcdcep.h:41
void * Buffer
Definition: rpcdcep.h:40
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwStubPhase
Definition: rpcndr.h:259
LONG HRESULT
Definition: typedefs.h:78
unsigned char * BufferStart
Definition: rpcndr.h:204
ULONG BufferLength
Definition: rpcndr.h:207
unsigned char * BufferEnd
Definition: rpcndr.h:205
unsigned int fBufferValid
Definition: rpcndr.h:243
struct IRpcChannelBuffer * pRpcChannelBuffer
Definition: rpcndr.h:253

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 }
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
#define CO_E_OBJNOTCONNECTED
Definition: winerror.h:2816
DWORD dwDestContext
Definition: rpcndr.h:249
#define TRACE(s)
Definition: solgame.cpp:4
void * pvDestContext
Definition: rpcndr.h:250
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)
struct IRpcChannelBuffer * pRpcChannelBuffer
Definition: rpcndr.h:253

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 }
HRESULT hr
Definition: shlfolder.c:183
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
#define WARN(fmt,...)
Definition: debug.h:111
unsigned char * Buffer
Definition: rpcndr.h:203
PRPC_MESSAGE RpcMsg
Definition: rpcndr.h:202
unsigned int BufferLength
Definition: rpcdcep.h:41
void * Buffer
Definition: rpcdcep.h:40
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwStubPhase
Definition: rpcndr.h:259
LONG HRESULT
Definition: typedefs.h:78
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RPC_E_DISCONNECTED
Definition: winerror.h:2484
unsigned char * BufferStart
Definition: rpcndr.h:204
ULONG BufferLength
Definition: rpcndr.h:207
unsigned char * BufferEnd
Definition: rpcndr.h:205
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
#define RPC_S_CALL_FAILED
Definition: winerror.h:1037
struct IRpcChannelBuffer * pRpcChannelBuffer
Definition: rpcndr.h:253

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 TRACE(s)
Definition: solgame.cpp:4
static StdProxyImpl * impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface)
Definition: cproxy.c:43
#define InterlockedIncrement
Definition: armddk.h:53

◆ 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 TRACE(s)
Definition: solgame.cpp:4
static StdProxyImpl * impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface)
Definition: cproxy.c:43
#define S_OK
Definition: intsafe.h:59

◆ 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 {
314  PCInterfaceName name = ProxyInfo->pNamesArray[Index];
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  {
350  HRESULT r = create_proxy( ProxyInfo->pDelegatedIIDs[Index], NULL,
351  &This->base_proxy, (void **)&This->base_object );
352  if (FAILED(r))
353  {
354  HeapFree( GetProcessHeap(), 0, This );
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 }
REFIID riid
Definition: precomp.h:44
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei count
Definition: gl.h:1545
static const IRpcProxyBufferVtbl StdProxy_Vtbl
Definition: cproxy.c:41
unsigned short TableVersion
Definition: rpcproxy.h:54
const PCInterfaceName * pNamesArray
Definition: rpcproxy.h:50
CInterfaceStubHeader header
Definition: rpcproxy.h:104
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
BOOL fill_stubless_table(IUnknownVtbl *vtbl, DWORD num)
Definition: cproxy.c:285
#define RPC_E_UNEXPECTED
Definition: winerror.h:2509
const PCInterfaceStubVtblList * pStubVtblList
Definition: rpcproxy.h:49
#define debugstr_guid
Definition: kernel32.h:35
CInterfaceProxyHeader header
Definition: rpcproxy.h:80
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:78
static const UCHAR Index[8]
Definition: usbohci.c:18
#define ERR(fmt,...)
Definition: debug.h:109
const PCInterfaceProxyVtblList * pProxyVtblList
Definition: rpcproxy.h:48
#define S_OK
Definition: intsafe.h:59
const char * PCInterfaceName
Definition: rpcproxy.h:42
HRESULT create_proxy(REFIID iid, IUnknown *pUnkOuter, IRpcProxyBuffer **pproxy, void **ppv) DECLSPEC_HIDDEN
Definition: ndr_ole.c:442
const IID ** pDelegatedIIDs
Definition: rpcproxy.h:51
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
Definition: name.c:38
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402
GLuint const GLchar * name
Definition: glext.h:6031

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 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static StdProxyImpl * impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface)
Definition: cproxy.c:43

◆ 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 }
static StdProxyImpl * impl_from_proxy_obj(void *iface)
Definition: cproxy.c:48
#define TRACE(s)
Definition: solgame.cpp:4

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 }
static StdProxyImpl * impl_from_proxy_obj(void *iface)
Definition: cproxy.c:48
#define TRACE(s)
Definition: solgame.cpp:4

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 
374  if (IsEqualGUID(&IID_IUnknown,riid) ||
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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static StdProxyImpl * impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface)
Definition: cproxy.c:43
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ 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 TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
static StdProxyImpl * impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface)
Definition: cproxy.c:43
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ 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:
=
{
}
void WINAPI StdProxy_Disconnect(IRpcProxyBuffer *iface)
Definition: cproxy.c:431
static ULONG WINAPI StdProxy_Release(LPRPCPROXYBUFFER iface)
Definition: cproxy.c:398
ULONG WINAPI StdProxy_AddRef(IRpcProxyBuffer *iface)
Definition: cproxy.c:390
HRESULT WINAPI StdProxy_Connect(IRpcProxyBuffer *iface, IRpcChannelBuffer *pChannel)
Definition: cproxy.c:420
HRESULT WINAPI StdProxy_QueryInterface(IRpcProxyBuffer *iface, REFIID riid, void **obj)
Definition: cproxy.c:369

Definition at line 41 of file cproxy.c.

Referenced by StdProxy_Construct().