ReactOS  0.4.14-dev-317-g96040ec
cproxy.c File Reference
#include "config.h"
#include "wine/port.h"
#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/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 215 of file cproxy.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 27 of file cproxy.c.

◆ MAX_BLOCKS

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

Definition at line 216 of file cproxy.c.

Function Documentation

◆ allocate_block()

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

Definition at line 220 of file cproxy.c.

221 {
222  unsigned int i;
223  struct thunk *prev, *block;
224  DWORD oldprot;
225 
226  block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
228  if (!block) return NULL;
229 
230  for (i = 0; i < BLOCK_SIZE; i++) init_thunk( &block[i], BLOCK_SIZE * num + i + 3 );
231  VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, &oldprot );
233  if (prev) /* someone beat us to it */
234  {
236  block = prev;
237  }
238  return block;
239 }
static unsigned int block
Definition: xmlmemory.c:118
Definition: cproxy.c:203
#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:215
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:218
#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:208

Referenced by fill_stubless_table().

◆ fill_stubless_table()

BOOL fill_stubless_table ( IUnknownVtbl *  vtbl,
DWORD  num 
)

Definition at line 241 of file cproxy.c.

242 {
243  const void **entry = (const void **)(vtbl + 1);
244  DWORD i, j;
245 
246  if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
247  {
248  FIXME( "%u methods not supported\n", num );
249  return FALSE;
250  }
251  for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
252  {
253  const struct thunk *block = method_blocks[i];
254  if (!block && !(block = allocate_block( i ))) return FALSE;
255  for (j = 0; j < BLOCK_SIZE && j < num - 3 - i * BLOCK_SIZE; j++, entry++)
256  if (*entry == (LPVOID)-1) *entry = &block[j];
257  }
258  return TRUE;
259 }
static unsigned int block
Definition: xmlmemory.c:118
#define TRUE
Definition: types.h:120
Definition: cproxy.c:203
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:220
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:215
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:218
#define MAX_BLOCKS
Definition: cproxy.c:216

Referenced by StdProxy_Construct(), and typelib_proxy_init().

◆ impl_from_IRpcProxyBuffer()

static StdProxyImpl* impl_from_IRpcProxyBuffer ( IRpcProxyBuffer iface)
inlinestatic

Definition at line 45 of file cproxy.c.

46 {
47  return CONTAINING_RECORD(iface, StdProxyImpl, IRpcProxyBuffer_iface);
48 }
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 50 of file cproxy.c.

51 {
52  return CONTAINING_RECORD(iface, StdProxyImpl, PVtbl);
53 }
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 208 of file cproxy.c.

209 {
210  thunk->index = index;
211 }
DWORD index
Definition: cproxy.c:205
Definition: cproxy.c:203
#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 434 of file cproxy.c.

435 {
437  TRACE("(%p)->AddRef() %s\n",This,This->name);
438  return IUnknown_AddRef(This->pUnkOuter);
439 }
static StdProxyImpl * impl_from_proxy_obj(void *iface)
Definition: cproxy.c:50
#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 425 of file cproxy.c.

428 {
430  TRACE("(%p)->QueryInterface(%s,%p) %s\n",This,debugstr_guid(riid),ppvObj,This->name);
431  return IUnknown_QueryInterface(This->pUnkOuter,riid,ppvObj);
432 }
static StdProxyImpl * impl_from_proxy_obj(void *iface)
Definition: cproxy.c:50
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 441 of file cproxy.c.

442 {
444  TRACE("(%p)->Release() %s\n",This,This->name);
445  return IUnknown_Release(This->pUnkOuter);
446 }
static StdProxyImpl * impl_from_proxy_obj(void *iface)
Definition: cproxy.c:50
#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 547 of file cproxy.c.

548 {
549  WARN("(0x%08x): a proxy call failed\n", dwExceptionCode);
550 
551  if (FAILED(dwExceptionCode))
552  return dwExceptionCode;
553  else
554  return HRESULT_FROM_WIN32(dwExceptionCode);
555 }
#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 531 of file cproxy.c.

533 {
534  TRACE("(%p,%p)\n", This, pStubMsg);
535 
536  if (pStubMsg->fBufferValid)
537  {
538  IRpcChannelBuffer_FreeBuffer(pStubMsg->pRpcChannelBuffer,
539  (RPCOLEMESSAGE*)pStubMsg->RpcMsg);
540  pStubMsg->fBufferValid = TRUE;
541  }
542 }
#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().

◆ NdrProxyGetBuffer()

void WINAPI NdrProxyGetBuffer ( void This,
PMIDL_STUB_MESSAGE  pStubMsg 
)

Definition at line 469 of file cproxy.c.

471 {
472  HRESULT hr;
473  const IID *riid = NULL;
474 
475  TRACE("(%p,%p)\n", This, pStubMsg);
476  pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
477  pStubMsg->dwStubPhase = PROXY_GETBUFFER;
479  hr = IRpcChannelBuffer_GetBuffer(pStubMsg->pRpcChannelBuffer,
480  (RPCOLEMESSAGE*)pStubMsg->RpcMsg,
481  riid);
482  if (FAILED(hr))
483  {
485  return;
486  }
487  pStubMsg->fBufferValid = TRUE;
488  pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
489  pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
490  pStubMsg->Buffer = pStubMsg->BufferStart;
491  pStubMsg->dwStubPhase = PROXY_MARSHAL;
492 }
#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:189
unsigned char * Buffer
Definition: rpcndr.h:203
static void StdProxy_GetIID(LPVOID iface, const IID **ppiid)
Definition: cproxy.c:416
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:77
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 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 451 of file cproxy.c.

456 {
457  TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
458  NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
460  IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
461  &pStubMsg->dwDestContext,
462  &pStubMsg->pvDestContext);
463  TRACE("channel=%p\n", pStubMsg->pRpcChannelBuffer);
464 }
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:407
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 ndr_client_call().

◆ NdrProxySendReceive()

void WINAPI NdrProxySendReceive ( void This,
PMIDL_STUB_MESSAGE  pStubMsg 
)

Definition at line 497 of file cproxy.c.

499 {
500  ULONG Status = 0;
501  HRESULT hr;
502 
503  TRACE("(%p,%p)\n", This, pStubMsg);
504 
505  if (!pStubMsg->pRpcChannelBuffer)
506  {
507  WARN("Trying to use disconnected proxy %p\n", This);
509  }
510 
511  pStubMsg->dwStubPhase = PROXY_SENDRECEIVE;
512  /* avoid sending uninitialised parts of the buffer on the wire */
513  pStubMsg->RpcMsg->BufferLength = pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer;
514  hr = IRpcChannelBuffer_SendReceive(pStubMsg->pRpcChannelBuffer,
515  (RPCOLEMESSAGE*)pStubMsg->RpcMsg,
516  &Status);
517  pStubMsg->dwStubPhase = PROXY_UNMARSHAL;
518  pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength;
519  pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
520  pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
521  pStubMsg->Buffer = pStubMsg->BufferStart;
522 
523  /* raise exception if call failed */
524  if (hr == RPC_S_CALL_FAILED) RpcRaiseException(*(DWORD*)pStubMsg->Buffer);
525  else if (FAILED(hr)) RpcRaiseException(hr);
526 }
HRESULT hr
Definition: shlfolder.c:183
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
#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:77
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 ndr_client_call().

◆ StdProxy_AddRef()

ULONG WINAPI StdProxy_AddRef ( IRpcProxyBuffer iface)

Definition at line 346 of file cproxy.c.

347 {
349  TRACE("(%p)->AddRef()\n",This);
350 
351  return InterlockedIncrement(&This->RefCount);
352 }
#define TRACE(s)
Definition: solgame.cpp:4
static StdProxyImpl * impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface)
Definition: cproxy.c:45
#define InterlockedIncrement
Definition: armddk.h:53

◆ StdProxy_Connect()

HRESULT WINAPI StdProxy_Connect ( IRpcProxyBuffer iface,
IRpcChannelBuffer pChannel 
)

Definition at line 376 of file cproxy.c.

377 {
379  TRACE("(%p)->Connect(%p)\n",This,pChannel);
380 
381  This->pChannel = pChannel;
382  IRpcChannelBuffer_AddRef(pChannel);
383  if (This->base_proxy) IRpcProxyBuffer_Connect( This->base_proxy, pChannel );
384  return S_OK;
385 }
#define TRACE(s)
Definition: solgame.cpp:4
static StdProxyImpl * impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface)
Definition: cproxy.c:45
#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 261 of file cproxy.c.

268 {
270  PCInterfaceName name = ProxyInfo->pNamesArray[Index];
271  CInterfaceProxyVtbl *vtbl = ProxyInfo->pProxyVtblList[Index];
272 
273  TRACE("(%p,%p,%p,%p,%p) %s\n", pUnkOuter, vtbl, pPSFactory, ppProxy, ppvObj, name);
274 
275  /* TableVersion = 2 means it is the stubless version of CInterfaceProxyVtbl */
276  if (ProxyInfo->TableVersion > 1) {
278  vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
279  TRACE("stubless vtbl %p: count=%d\n", vtbl->Vtbl, count );
280  fill_stubless_table( (IUnknownVtbl *)vtbl->Vtbl, count );
281  }
282 
283  if (!IsEqualGUID(vtbl->header.piid, riid)) {
284  ERR("IID mismatch during proxy creation\n");
285  return RPC_E_UNEXPECTED;
286  }
287 
289  if (!This) return E_OUTOFMEMORY;
290 
291  if (!pUnkOuter) pUnkOuter = (IUnknown *)This;
292  This->IRpcProxyBuffer_iface.lpVtbl = &StdProxy_Vtbl;
293  This->PVtbl = vtbl->Vtbl;
294  /* one reference for the proxy */
295  This->RefCount = 1;
296  This->piid = vtbl->header.piid;
297  This->base_object = NULL;
298  This->base_proxy = NULL;
299  This->pUnkOuter = pUnkOuter;
300  This->name = name;
301  This->pPSFactory = pPSFactory;
302  This->pChannel = NULL;
303 
304  if(ProxyInfo->pDelegatedIIDs && ProxyInfo->pDelegatedIIDs[Index])
305  {
306  HRESULT r = create_proxy( ProxyInfo->pDelegatedIIDs[Index], NULL,
307  &This->base_proxy, (void **)&This->base_object );
308  if (FAILED(r))
309  {
310  HeapFree( GetProcessHeap(), 0, This );
311  return r;
312  }
313  }
314 
315  *ppProxy = &This->IRpcProxyBuffer_iface;
316  *ppvObj = &This->PVtbl;
317  IUnknown_AddRef((IUnknown *)*ppvObj);
318  IPSFactoryBuffer_AddRef(pPSFactory);
319 
320  TRACE( "iid=%s this %p proxy %p obj %p vtbl %p base proxy %p base obj %p\n",
321  debugstr_guid(riid), This, *ppProxy, *ppvObj, This->PVtbl, This->base_proxy, This->base_object );
322  return S_OK;
323 }
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:43
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:241
#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:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
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:36
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by CStdPSFactory_CreateProxy().

◆ StdProxy_Disconnect()

void WINAPI StdProxy_Disconnect ( IRpcProxyBuffer iface)

Definition at line 387 of file cproxy.c.

388 {
390  TRACE("(%p)->Disconnect()\n",This);
391 
392  if (This->base_proxy) IRpcProxyBuffer_Disconnect( This->base_proxy );
393 
394  IRpcChannelBuffer_Release(This->pChannel);
395  This->pChannel = NULL;
396 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static StdProxyImpl * impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface)
Definition: cproxy.c:45

◆ StdProxy_GetChannel()

static void StdProxy_GetChannel ( LPVOID  iface,
LPRPCCHANNELBUFFER ppChannel 
)
static

Definition at line 407 of file cproxy.c.

409 {
411  TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name);
412 
413  *ppChannel = This->pChannel;
414 }
static StdProxyImpl * impl_from_proxy_obj(void *iface)
Definition: cproxy.c:50
#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 416 of file cproxy.c.

418 {
420  TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name);
421 
422  *ppiid = This->piid;
423 }
static StdProxyImpl * impl_from_proxy_obj(void *iface)
Definition: cproxy.c:50
#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 325 of file cproxy.c.

326 {
328  TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);
329 
330  if (IsEqualGUID(&IID_IUnknown,riid) ||
331  IsEqualGUID(This->piid,riid)) {
332  *obj = &This->PVtbl;
333  InterlockedIncrement(&This->RefCount);
334  return S_OK;
335  }
336 
337  if (IsEqualGUID(&IID_IRpcProxyBuffer,riid)) {
338  *obj = &This->IRpcProxyBuffer_iface;
339  InterlockedIncrement(&This->RefCount);
340  return S_OK;
341  }
342 
343  return E_NOINTERFACE;
344 }
#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:45
#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 354 of file cproxy.c.

355 {
356  ULONG refs;
358  TRACE("(%p)->Release()\n",This);
359 
360  refs = InterlockedDecrement(&This->RefCount);
361  if (!refs)
362  {
363  if (This->pChannel)
364  IRpcProxyBuffer_Disconnect(&This->IRpcProxyBuffer_iface);
365 
366  if (This->base_object) IUnknown_Release( This->base_object );
367  if (This->base_proxy) IRpcProxyBuffer_Release( This->base_proxy );
368 
369  IPSFactoryBuffer_Release(This->pPSFactory);
371  }
372 
373  return refs;
374 }
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
static StdProxyImpl * impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface)
Definition: cproxy.c:45
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ method_blocks

const struct thunk* method_blocks[MAX_BLOCKS]
static

Definition at line 218 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:387
static ULONG WINAPI StdProxy_Release(LPRPCPROXYBUFFER iface)
Definition: cproxy.c:354
ULONG WINAPI StdProxy_AddRef(IRpcProxyBuffer *iface)
Definition: cproxy.c:346
HRESULT WINAPI StdProxy_Connect(IRpcProxyBuffer *iface, IRpcChannelBuffer *pChannel)
Definition: cproxy.c:376
HRESULT WINAPI StdProxy_QueryInterface(IRpcProxyBuffer *iface, REFIID riid, void **obj)
Definition: cproxy.c:325

Definition at line 43 of file cproxy.c.

Referenced by StdProxy_Construct().