ReactOS  0.4.13-dev-100-gc8611ae
cstub.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "excpt.h"
#include "objbase.h"
#include "rpcproxy.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "cpsf.h"
Include dependency graph for cstub.c:

Go to the source code of this file.

Classes

struct  ref_counted_vtbl
 
struct  vtbl_method_t
 

Macros

#define COBJMACROS
 
#define STUB_HEADER(This)   (((const CInterfaceStubHeader*)((This)->lpVtbl))[-1])
 
#define BLOCK_SIZE   1024
 
#define MAX_BLOCKS   64 /* 64k methods should be enough for anybody */
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static LONG WINAPI stub_filter (EXCEPTION_POINTERS *eptr)
 
static cstdstubbuffer_delegating_timpl_from_delegating (IRpcStubBuffer *iface)
 
HRESULT CStdStubBuffer_Construct (REFIID riid, LPUNKNOWN pUnkServer, PCInterfaceName name, CInterfaceStubVtbl *vtbl, LPPSFACTORYBUFFER pPSFactory, LPRPCSTUBBUFFER *ppStub)
 
static HRESULT WINAPI delegating_QueryInterface (IUnknown *pUnk, REFIID iid, void **ppv)
 
static ULONG WINAPI delegating_AddRef (IUnknown *pUnk)
 
static ULONG WINAPI delegating_Release (IUnknown *pUnk)
 
static const vtbl_method_tallocate_block (unsigned int num)
 
static BOOL fill_delegated_stub_table (IUnknownVtbl *vtbl, DWORD num)
 
BOOL fill_delegated_proxy_table (IUnknownVtbl *vtbl, DWORD num)
 
IUnknownVtbl * get_delegating_vtbl (DWORD num_methods)
 
void release_delegating_vtbl (IUnknownVtbl *vtbl)
 
HRESULT CStdStubBuffer_Delegating_Construct (REFIID riid, LPUNKNOWN pUnkServer, PCInterfaceName name, CInterfaceStubVtbl *vtbl, REFIID delegating_iid, LPPSFACTORYBUFFER pPSFactory, LPRPCSTUBBUFFER *ppStub)
 
HRESULT WINAPI CStdStubBuffer_QueryInterface (LPRPCSTUBBUFFER iface, REFIID riid, LPVOID *obj)
 
ULONG WINAPI CStdStubBuffer_AddRef (LPRPCSTUBBUFFER iface)
 
ULONG WINAPI NdrCStdStubBuffer_Release (LPRPCSTUBBUFFER iface, LPPSFACTORYBUFFER pPSF)
 
ULONG WINAPI NdrCStdStubBuffer2_Release (LPRPCSTUBBUFFER iface, LPPSFACTORYBUFFER pPSF)
 
HRESULT WINAPI CStdStubBuffer_Connect (LPRPCSTUBBUFFER iface, LPUNKNOWN lpUnkServer)
 
void WINAPI CStdStubBuffer_Disconnect (LPRPCSTUBBUFFER iface)
 
HRESULT WINAPI CStdStubBuffer_Invoke (LPRPCSTUBBUFFER iface, PRPCOLEMESSAGE pMsg, LPRPCCHANNELBUFFER pChannel)
 
LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported (LPRPCSTUBBUFFER iface, REFIID riid)
 
ULONG WINAPI CStdStubBuffer_CountRefs (LPRPCSTUBBUFFER iface)
 
HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface (LPRPCSTUBBUFFER iface, LPVOID *ppv)
 
void WINAPI CStdStubBuffer_DebugServerRelease (LPRPCSTUBBUFFER iface, LPVOID pv)
 
static HRESULT WINAPI CStdStubBuffer_Delegating_Connect (LPRPCSTUBBUFFER iface, LPUNKNOWN lpUnkServer)
 
static void WINAPI CStdStubBuffer_Delegating_Disconnect (LPRPCSTUBBUFFER iface)
 
static ULONG WINAPI CStdStubBuffer_Delegating_CountRefs (LPRPCSTUBBUFFER iface)
 
const MIDL_SERVER_INFOCStdStubBuffer_GetServerInfo (IRpcStubBuffer *iface)
 
void __RPC_STUB NdrStubForwardingFunction (IRpcStubBuffer *iface, IRpcChannelBuffer *pChannel, PRPC_MESSAGE pMsg, DWORD *pdwStubPhase)
 
void WINAPI NdrStubInitialize (PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDescriptor, LPRPCCHANNELBUFFER pRpcChannelBuffer)
 
void WINAPI NdrStubGetBuffer (LPRPCSTUBBUFFER iface, LPRPCCHANNELBUFFER pRpcChannelBuffer, PMIDL_STUB_MESSAGE pStubMsg)
 

Variables

static CRITICAL_SECTION delegating_vtbl_section = { &critsect_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG critsect_debug
 
static ref_counted_vtblcurrent_vtbl
 
static const BYTE opcodes [1]
 
static const vtbl_method_tmethod_blocks [MAX_BLOCKS]
 
const IRpcStubBufferVtbl CStdStubBuffer_Vtbl
 
const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl
 

Macro Definition Documentation

◆ BLOCK_SIZE

#define BLOCK_SIZE   1024

Definition at line 200 of file cstub.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 27 of file cstub.c.

◆ MAX_BLOCKS

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

Definition at line 201 of file cstub.c.

◆ STUB_HEADER

#define STUB_HEADER (   This)    (((const CInterfaceStubHeader*)((This)->lpVtbl))[-1])

Definition at line 44 of file cstub.c.

Function Documentation

◆ allocate_block()

static const vtbl_method_t* allocate_block ( unsigned int  num)
static

Definition at line 205 of file cstub.c.

206 {
207  unsigned int i;
208  vtbl_method_t *prev, *block;
209  DWORD oldprot;
210 
211  block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
213  if (!block) return NULL;
214 
215  for (i = 0; i < BLOCK_SIZE; i++)
216  {
217  memcpy( &block[i], opcodes, sizeof(opcodes) );
218  block[i].offset = (BLOCK_SIZE * num + i + 3) * sizeof(void *);
219  }
220  VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, &oldprot );
222  if (prev) /* someone beat us to it */
223  {
225  block = prev;
226  }
227  return block;
228 }
static unsigned int block
Definition: xmlmemory.c:118
#define BLOCK_SIZE
Definition: cstub.c:200
#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
static const BYTE opcodes[1]
Definition: cstub.c:196
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 vtbl_method_t * method_blocks[MAX_BLOCKS]
Definition: cstub.c:203
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#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

Referenced by fill_delegated_proxy_table(), and fill_delegated_stub_table().

◆ CStdStubBuffer_AddRef()

ULONG WINAPI CStdStubBuffer_AddRef ( LPRPCSTUBBUFFER  iface)

Definition at line 396 of file cstub.c.

397 {
398  CStdStubBuffer *This = (CStdStubBuffer *)iface;
399  TRACE("(%p)->AddRef()\n",This);
400  return InterlockedIncrement(&This->RefCount);
401 }
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53

◆ CStdStubBuffer_Connect()

HRESULT WINAPI CStdStubBuffer_Connect ( LPRPCSTUBBUFFER  iface,
LPUNKNOWN  lpUnkServer 
)

Definition at line 449 of file cstub.c.

451 {
452  CStdStubBuffer *This = (CStdStubBuffer *)iface;
453  HRESULT r;
454  IUnknown *new = NULL;
455 
456  TRACE("(%p)->Connect(%p)\n",This,lpUnkServer);
457 
458  r = IUnknown_QueryInterface(lpUnkServer, STUB_HEADER(This).piid, (void**)&new);
459  new = InterlockedExchangePointer((void**)&This->pvServerObject, new);
460  if(new)
461  IUnknown_Release(new);
462  return r;
463 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
LONG HRESULT
Definition: typedefs.h:77
#define STUB_HEADER(This)
Definition: cstub.c:44

Referenced by CStdStubBuffer_Delegating_Connect().

◆ CStdStubBuffer_Construct()

HRESULT CStdStubBuffer_Construct ( REFIID  riid,
LPUNKNOWN  pUnkServer,
PCInterfaceName  name,
CInterfaceStubVtbl vtbl,
LPPSFACTORYBUFFER  pPSFactory,
LPRPCSTUBBUFFER ppStub 
)

Definition at line 58 of file cstub.c.

64 {
66  IUnknown *pvServer;
67  HRESULT r;
68  TRACE("(%p,%p,%p,%p) %s\n", pUnkServer, vtbl, pPSFactory, ppStub, name);
69  TRACE("iid=%s\n", debugstr_guid(vtbl->header.piid));
70  TRACE("vtbl=%p\n", &vtbl->Vtbl);
71 
72  if (!IsEqualGUID(vtbl->header.piid, riid)) {
73  ERR("IID mismatch during stub creation\n");
74  return RPC_E_UNEXPECTED;
75  }
76 
77  r = IUnknown_QueryInterface(pUnkServer, riid, (void**)&pvServer);
78  if(FAILED(r))
79  return r;
80 
82  if (!This) {
83  IUnknown_Release(pvServer);
84  return E_OUTOFMEMORY;
85  }
86 
87  This->lpVtbl = &vtbl->Vtbl;
88  This->RefCount = 1;
89  This->pvServerObject = pvServer;
90  This->pPSFactory = pPSFactory;
91  *ppStub = (LPRPCSTUBBUFFER)This;
92 
93  IPSFactoryBuffer_AddRef(pPSFactory);
94  return S_OK;
95 }
REFIID riid
Definition: precomp.h:44
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
CInterfaceStubHeader header
Definition: rpcproxy.h:104
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
const IID * piid
Definition: rpcproxy.h:96
#define RPC_E_UNEXPECTED
Definition: winerror.h:2509
#define debugstr_guid
Definition: kernel32.h:35
#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
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
Definition: name.c:36
interface IRpcStubBuffer * LPRPCSTUBBUFFER
Definition: objfwd.h:41
IRpcStubBufferVtbl Vtbl
Definition: rpcproxy.h:105

Referenced by CStdPSFactory_CreateStub().

◆ CStdStubBuffer_CountRefs()

ULONG WINAPI CStdStubBuffer_CountRefs ( LPRPCSTUBBUFFER  iface)

Definition at line 516 of file cstub.c.

517 {
518  CStdStubBuffer *This = (CStdStubBuffer *)iface;
519  TRACE("(%p)->CountRefs()\n",This);
520  return This->RefCount;
521 }
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by CStdStubBuffer_Delegating_CountRefs().

◆ CStdStubBuffer_DebugServerQueryInterface()

HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface ( LPRPCSTUBBUFFER  iface,
LPVOID ppv 
)

Definition at line 523 of file cstub.c.

525 {
526  CStdStubBuffer *This = (CStdStubBuffer *)iface;
527  TRACE("(%p)->DebugServerQueryInterface(%p)\n",This,ppv);
528  return S_OK;
529 }
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ CStdStubBuffer_DebugServerRelease()

void WINAPI CStdStubBuffer_DebugServerRelease ( LPRPCSTUBBUFFER  iface,
LPVOID  pv 
)

Definition at line 531 of file cstub.c.

533 {
534  CStdStubBuffer *This = (CStdStubBuffer *)iface;
535  TRACE("(%p)->DebugServerRelease(%p)\n",This,pv);
536 }
#define TRACE(s)
Definition: solgame.cpp:4

◆ CStdStubBuffer_Delegating_Connect()

static HRESULT WINAPI CStdStubBuffer_Delegating_Connect ( LPRPCSTUBBUFFER  iface,
LPUNKNOWN  lpUnkServer 
)
static

Definition at line 552 of file cstub.c.

554 {
556  HRESULT r;
557  TRACE("(%p)->Connect(%p)\n", This, lpUnkServer);
558 
559  r = CStdStubBuffer_Connect(iface, lpUnkServer);
560  if(SUCCEEDED(r))
561  r = IRpcStubBuffer_Connect(This->base_stub, (IUnknown*)&This->base_obj);
562 
563  return r;
564 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static cstdstubbuffer_delegating_t * impl_from_delegating(IRpcStubBuffer *iface)
Definition: cstub.c:53
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface, LPUNKNOWN lpUnkServer)
Definition: cstub.c:449

◆ CStdStubBuffer_Delegating_Construct()

HRESULT CStdStubBuffer_Delegating_Construct ( REFIID  riid,
LPUNKNOWN  pUnkServer,
PCInterfaceName  name,
CInterfaceStubVtbl vtbl,
REFIID  delegating_iid,
LPPSFACTORYBUFFER  pPSFactory,
LPRPCSTUBBUFFER ppStub 
)

Definition at line 326 of file cstub.c.

333 {
335  IUnknown *pvServer;
336  HRESULT r;
337 
338  TRACE("(%p,%p,%p,%p) %s\n", pUnkServer, vtbl, pPSFactory, ppStub, name);
339  TRACE("iid=%s delegating to %s\n", debugstr_guid(vtbl->header.piid), debugstr_guid(delegating_iid));
340  TRACE("vtbl=%p\n", &vtbl->Vtbl);
341 
342  if (!IsEqualGUID(vtbl->header.piid, riid))
343  {
344  ERR("IID mismatch during stub creation\n");
345  return RPC_E_UNEXPECTED;
346  }
347 
348  r = IUnknown_QueryInterface(pUnkServer, riid, (void**)&pvServer);
349  if(FAILED(r)) return r;
350 
352  if (!This)
353  {
354  IUnknown_Release(pvServer);
355  return E_OUTOFMEMORY;
356  }
357 
358  This->base_obj = get_delegating_vtbl( vtbl->header.DispatchTableCount );
359  r = create_stub(delegating_iid, (IUnknown*)&This->base_obj, &This->base_stub);
360  if(FAILED(r))
361  {
362  release_delegating_vtbl(This->base_obj);
364  IUnknown_Release(pvServer);
365  return r;
366  }
367 
368  This->stub_buffer.lpVtbl = &vtbl->Vtbl;
369  This->stub_buffer.RefCount = 1;
370  This->stub_buffer.pvServerObject = pvServer;
371  This->stub_buffer.pPSFactory = pPSFactory;
372  *ppStub = (LPRPCSTUBBUFFER)&This->stub_buffer;
373 
374  IPSFactoryBuffer_AddRef(pPSFactory);
375  return S_OK;
376 }
REFIID riid
Definition: precomp.h:44
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
void release_delegating_vtbl(IUnknownVtbl *vtbl)
Definition: cstub.c:311
IUnknownVtbl * get_delegating_vtbl(DWORD num_methods)
Definition: cstub.c:275
CInterfaceStubHeader header
Definition: rpcproxy.h:104
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
const IID * piid
Definition: rpcproxy.h:96
#define RPC_E_UNEXPECTED
Definition: winerror.h:2509
#define debugstr_guid
Definition: kernel32.h:35
#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 IRpcStubBuffer * create_stub(IPSFactoryBuffer *ppsf, REFIID iid, IUnknown *obj, HRESULT expected_result)
Definition: cstub.c:712
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
Definition: name.c:36
interface IRpcStubBuffer * LPRPCSTUBBUFFER
Definition: objfwd.h:41
#define HeapFree(x, y, z)
Definition: compat.h:394
IRpcStubBufferVtbl Vtbl
Definition: rpcproxy.h:105

Referenced by CStdPSFactory_CreateStub().

◆ CStdStubBuffer_Delegating_CountRefs()

static ULONG WINAPI CStdStubBuffer_Delegating_CountRefs ( LPRPCSTUBBUFFER  iface)
static

Definition at line 575 of file cstub.c.

576 {
578  ULONG ret;
579  TRACE("(%p)->CountRefs()\n", This);
580 
581  ret = CStdStubBuffer_CountRefs(iface);
582  ret += IRpcStubBuffer_CountRefs(This->base_stub);
583 
584  return ret;
585 }
ULONG WINAPI CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface)
Definition: cstub.c:516
#define TRACE(s)
Definition: solgame.cpp:4
int ret
static cstdstubbuffer_delegating_t * impl_from_delegating(IRpcStubBuffer *iface)
Definition: cstub.c:53
unsigned int ULONG
Definition: retypes.h:1

◆ CStdStubBuffer_Delegating_Disconnect()

static void WINAPI CStdStubBuffer_Delegating_Disconnect ( LPRPCSTUBBUFFER  iface)
static

Definition at line 566 of file cstub.c.

567 {
569  TRACE("(%p)->Disconnect()\n", This);
570 
571  IRpcStubBuffer_Disconnect(This->base_stub);
573 }
void WINAPI CStdStubBuffer_Disconnect(LPRPCSTUBBUFFER iface)
Definition: cstub.c:465
#define TRACE(s)
Definition: solgame.cpp:4
static cstdstubbuffer_delegating_t * impl_from_delegating(IRpcStubBuffer *iface)
Definition: cstub.c:53

◆ CStdStubBuffer_Disconnect()

void WINAPI CStdStubBuffer_Disconnect ( LPRPCSTUBBUFFER  iface)

Definition at line 465 of file cstub.c.

466 {
467  CStdStubBuffer *This = (CStdStubBuffer *)iface;
468  IUnknown *old;
469  TRACE("(%p)->Disconnect()\n",This);
470 
471  old = InterlockedExchangePointer((void**)&This->pvServerObject, NULL);
472 
473  if(old)
474  IUnknown_Release(old);
475 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45

Referenced by CStdStubBuffer_Delegating_Disconnect().

◆ CStdStubBuffer_GetServerInfo()

const MIDL_SERVER_INFO* CStdStubBuffer_GetServerInfo ( IRpcStubBuffer iface)

Definition at line 601 of file cstub.c.

602 {
603  CStdStubBuffer *This = (CStdStubBuffer *)iface;
604  return STUB_HEADER(This).pServerInfo;
605 }
#define STUB_HEADER(This)
Definition: cstub.c:44

Referenced by NdrStubCall2().

◆ CStdStubBuffer_Invoke()

HRESULT WINAPI CStdStubBuffer_Invoke ( LPRPCSTUBBUFFER  iface,
PRPCOLEMESSAGE  pMsg,
LPRPCCHANNELBUFFER  pChannel 
)

Definition at line 477 of file cstub.c.

480 {
481  CStdStubBuffer *This = (CStdStubBuffer *)iface;
482  DWORD dwPhase = STUB_UNMARSHAL;
483  HRESULT hr = S_OK;
484 
485  TRACE("(%p)->Invoke(%p,%p)\n",This,pMsg,pChannel);
486 
487  __TRY
488  {
489  if (STUB_HEADER(This).pDispatchTable)
490  STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
491  else /* pure interpreted */
492  NdrStubCall2(iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
493  }
495  {
496  DWORD dwExceptionCode = GetExceptionCode();
497  WARN("a stub call failed with exception 0x%08x (%d)\n", dwExceptionCode, dwExceptionCode);
498  if (FAILED(dwExceptionCode))
499  hr = dwExceptionCode;
500  else
501  hr = HRESULT_FROM_WIN32(dwExceptionCode);
502  }
503  __ENDTRY
504 
505  return hr;
506 }
#define __EXCEPT(func)
Definition: exception.h:58
LONG WINAPI NdrStubCall2(struct IRpcStubBuffer *pThis, struct IRpcChannelBuffer *pChannel, PRPC_MESSAGE pRpcMsg, DWORD *pdwStubPhase)
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
struct _RPC_MESSAGE * PRPC_MESSAGE
#define __TRY
Definition: compat.h:70
#define GetExceptionCode()
Definition: exception.h:65
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
#define __ENDTRY
Definition: compat.h:72
#define S_OK
Definition: intsafe.h:59
static LONG WINAPI stub_filter(EXCEPTION_POINTERS *eptr)
Definition: cstub.c:46
#define STUB_HEADER(This)
Definition: cstub.c:44

◆ CStdStubBuffer_IsIIDSupported()

LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported ( LPRPCSTUBBUFFER  iface,
REFIID  riid 
)

Definition at line 508 of file cstub.c.

510 {
511  CStdStubBuffer *This = (CStdStubBuffer *)iface;
512  TRACE("(%p)->IsIIDSupported(%s)\n",This,debugstr_guid(riid));
513  return IsEqualGUID(STUB_HEADER(This).piid, riid) ? iface : NULL;
514 }
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define STUB_HEADER(This)
Definition: cstub.c:44

◆ CStdStubBuffer_QueryInterface()

HRESULT WINAPI CStdStubBuffer_QueryInterface ( LPRPCSTUBBUFFER  iface,
REFIID  riid,
LPVOID obj 
)

Definition at line 378 of file cstub.c.

381 {
382  CStdStubBuffer *This = (CStdStubBuffer *)iface;
383  TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);
384 
385  if (IsEqualIID(&IID_IUnknown, riid) ||
386  IsEqualIID(&IID_IRpcStubBuffer, riid))
387  {
388  IRpcStubBuffer_AddRef(iface);
389  *obj = iface;
390  return S_OK;
391  }
392  *obj = NULL;
393  return E_NOINTERFACE;
394 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90

◆ delegating_AddRef()

static ULONG WINAPI delegating_AddRef ( IUnknown pUnk)
static

Definition at line 123 of file cstub.c.

124 {
125  return 1;
126 }

Referenced by fill_delegated_stub_table().

◆ delegating_QueryInterface()

static HRESULT WINAPI delegating_QueryInterface ( IUnknown pUnk,
REFIID  iid,
void **  ppv 
)
static

Definition at line 117 of file cstub.c.

118 {
119  *ppv = pUnk;
120  return S_OK;
121 }
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:59
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

Referenced by fill_delegated_stub_table().

◆ delegating_Release()

static ULONG WINAPI delegating_Release ( IUnknown pUnk)
static

Definition at line 128 of file cstub.c.

129 {
130  return 1;
131 }

Referenced by fill_delegated_stub_table().

◆ fill_delegated_proxy_table()

BOOL fill_delegated_proxy_table ( IUnknownVtbl *  vtbl,
DWORD  num 
)

Definition at line 252 of file cstub.c.

253 {
254  const void **entry = (const void **)(vtbl + 1);
255  DWORD i, j;
256 
257  if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
258  {
259  FIXME( "%u methods not supported\n", num );
260  return FALSE;
261  }
262  vtbl->QueryInterface = IUnknown_QueryInterface_Proxy;
263  vtbl->AddRef = IUnknown_AddRef_Proxy;
264  vtbl->Release = IUnknown_Release_Proxy;
265  for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
266  {
268  if (!block && !(block = allocate_block( i ))) return FALSE;
269  for (j = 0; j < BLOCK_SIZE && j < num - 3 - i * BLOCK_SIZE; j++, entry++)
270  if (!*entry) *entry = &block[j];
271  }
272  return TRUE;
273 }
static unsigned int block
Definition: xmlmemory.c:118
#define TRUE
Definition: types.h:120
ULONG WINAPI IUnknown_AddRef_Proxy(LPUNKNOWN iface)
Definition: cproxy.c:434
uint8_t entry
Definition: isohybrid.c:63
static const vtbl_method_t * allocate_block(unsigned int num)
Definition: cstub.c:205
#define BLOCK_SIZE
Definition: cstub.c:200
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
ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface)
Definition: cproxy.c:441
#define FIXME(fmt,...)
Definition: debug.h:110
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
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface, REFIID riid, LPVOID *ppvObj)
Definition: cproxy.c:425
static const vtbl_method_t * method_blocks[MAX_BLOCKS]
Definition: cstub.c:203
#define MAX_BLOCKS
Definition: cstub.c:201

Referenced by CreateProxyFromTypeInfo(), and init_psfactory().

◆ fill_delegated_stub_table()

static BOOL fill_delegated_stub_table ( IUnknownVtbl *  vtbl,
DWORD  num 
)
static

Definition at line 230 of file cstub.c.

231 {
232  const void **entry = (const void **)(vtbl + 1);
233  DWORD i, j;
234 
235  if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
236  {
237  FIXME( "%u methods not supported\n", num );
238  return FALSE;
239  }
240  vtbl->QueryInterface = delegating_QueryInterface;
241  vtbl->AddRef = delegating_AddRef;
242  vtbl->Release = delegating_Release;
243  for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
244  {
246  if (!block && !(block = allocate_block( i ))) return FALSE;
247  for (j = 0; j < BLOCK_SIZE && j < num - 3 - i * BLOCK_SIZE; j++) *entry++ = &block[j];
248  }
249  return TRUE;
250 }
static unsigned int block
Definition: xmlmemory.c:118
#define TRUE
Definition: types.h:120
uint8_t entry
Definition: isohybrid.c:63
static ULONG WINAPI delegating_Release(IUnknown *pUnk)
Definition: cstub.c:128
static const vtbl_method_t * allocate_block(unsigned int num)
Definition: cstub.c:205
#define BLOCK_SIZE
Definition: cstub.c:200
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
static HRESULT WINAPI delegating_QueryInterface(IUnknown *pUnk, REFIID iid, void **ppv)
Definition: cstub.c:117
#define FIXME(fmt,...)
Definition: debug.h:110
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
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
static const vtbl_method_t * method_blocks[MAX_BLOCKS]
Definition: cstub.c:203
#define MAX_BLOCKS
Definition: cstub.c:201
static ULONG WINAPI delegating_AddRef(IUnknown *pUnk)
Definition: cstub.c:123

Referenced by get_delegating_vtbl().

◆ get_delegating_vtbl()

IUnknownVtbl* get_delegating_vtbl ( DWORD  num_methods)

Definition at line 275 of file cstub.c.

276 {
277  IUnknownVtbl *ret;
278 
279  if (num_methods < 256) num_methods = 256; /* avoid frequent reallocations */
280 
282 
283  if(!current_vtbl || num_methods > current_vtbl->size)
284  {
286  FIELD_OFFSET(ref_counted_vtbl, vtbl) + num_methods * sizeof(void*));
287  if (!table)
288  {
290  return NULL;
291  }
292 
293  table->ref = 0;
294  table->size = num_methods;
295  fill_delegated_stub_table(&table->vtbl, num_methods);
296 
297  if (current_vtbl && current_vtbl->ref == 0)
298  {
299  TRACE("freeing old table\n");
301  }
303  }
304 
305  current_vtbl->ref++;
306  ret = &current_vtbl->vtbl;
308  return ret;
309 }
static ref_counted_vtbl * current_vtbl
Definition: cstub.c:114
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION delegating_vtbl_section
Definition: cstub.c:97
smooth NULL
Definition: ftsmooth.c:416
static BOOL fill_delegated_stub_table(IUnknownVtbl *vtbl, DWORD num)
Definition: cstub.c:230
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
DWORD size
Definition: cstub.c:109
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
IUnknownVtbl vtbl
Definition: cstub.c:110
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by CStdStubBuffer_Delegating_Construct(), and typelib_stub_init().

◆ impl_from_delegating()

static cstdstubbuffer_delegating_t* impl_from_delegating ( IRpcStubBuffer iface)
inlinestatic

Definition at line 53 of file cstub.c.

54 {
55  return CONTAINING_RECORD((void *)iface, cstdstubbuffer_delegating_t, stub_buffer);
56 }
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 CStdStubBuffer_Delegating_Connect(), CStdStubBuffer_Delegating_CountRefs(), CStdStubBuffer_Delegating_Disconnect(), NdrCStdStubBuffer2_Release(), and NdrStubForwardingFunction().

◆ NdrCStdStubBuffer2_Release()

ULONG WINAPI NdrCStdStubBuffer2_Release ( LPRPCSTUBBUFFER  iface,
LPPSFACTORYBUFFER  pPSF 
)

Definition at line 424 of file cstub.c.

426 {
428  ULONG refs;
429 
430  TRACE("(%p)->Release()\n", This);
431 
432  refs = InterlockedDecrement(&This->stub_buffer.RefCount);
433  if (!refs)
434  {
435  /* Just like NdrCStdStubBuffer_Release, we shouldn't call
436  Disconnect here */
437  IRpcStubBuffer_Disconnect((IRpcStubBuffer *)&This->stub_buffer);
438 
439  IRpcStubBuffer_Release(This->base_stub);
440  release_delegating_vtbl(This->base_obj);
441 
442  IPSFactoryBuffer_Release(pPSF);
444  }
445 
446  return refs;
447 }
void release_delegating_vtbl(IUnknownVtbl *vtbl)
Definition: cstub.c:311
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
static cstdstubbuffer_delegating_t * impl_from_delegating(IRpcStubBuffer *iface)
Definition: cstub.c:53
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_CStdStubBuffer2_Release().

◆ NdrCStdStubBuffer_Release()

ULONG WINAPI NdrCStdStubBuffer_Release ( LPRPCSTUBBUFFER  iface,
LPPSFACTORYBUFFER  pPSF 
)

Definition at line 403 of file cstub.c.

405 {
406  CStdStubBuffer *This = (CStdStubBuffer *)iface;
407  ULONG refs;
408 
409  TRACE("(%p)->Release()\n",This);
410 
411  refs = InterlockedDecrement(&This->RefCount);
412  if (!refs)
413  {
414  /* test_Release shows that native doesn't call Disconnect here.
415  We'll leave it in for the time being. */
416  IRpcStubBuffer_Disconnect(iface);
417 
418  IPSFactoryBuffer_Release(pPSF);
420  }
421  return refs;
422 }
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_CStdStubBuffer_Release(), and test_Release().

◆ NdrStubForwardingFunction()

void __RPC_STUB NdrStubForwardingFunction ( IRpcStubBuffer iface,
IRpcChannelBuffer pChannel,
PRPC_MESSAGE  pMsg,
DWORD pdwStubPhase 
)

Definition at line 610 of file cstub.c.

612 {
613  /* Note pMsg is passed intact since RPCOLEMESSAGE is basically a RPC_MESSAGE. */
614 
616  HRESULT r = IRpcStubBuffer_Invoke(This->base_stub, (RPCOLEMESSAGE*)pMsg, pChannel);
617  if(FAILED(r)) RpcRaiseException(r);
618  return;
619 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
LONG HRESULT
Definition: typedefs.h:77
static cstdstubbuffer_delegating_t * impl_from_delegating(IRpcStubBuffer *iface)
Definition: cstub.c:53

Referenced by CreateStubFromTypeInfo(), and test_NdrStubForwardingFunction().

◆ NdrStubGetBuffer()

void WINAPI NdrStubGetBuffer ( LPRPCSTUBBUFFER  iface,
LPRPCCHANNELBUFFER  pRpcChannelBuffer,
PMIDL_STUB_MESSAGE  pStubMsg 
)

Definition at line 640 of file cstub.c.

643 {
644  CStdStubBuffer *This = (CStdStubBuffer *)iface;
645  HRESULT hr;
646 
647  TRACE("(%p, %p, %p)\n", This, pRpcChannelBuffer, pStubMsg);
648 
649  pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
650  hr = IRpcChannelBuffer_GetBuffer(pRpcChannelBuffer,
651  (RPCOLEMESSAGE *)pStubMsg->RpcMsg, STUB_HEADER(This).piid);
652  if (FAILED(hr))
653  {
655  return;
656  }
657 
658  pStubMsg->Buffer = pStubMsg->RpcMsg->Buffer;
659 }
HRESULT hr
Definition: shlfolder.c:183
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
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
LONG HRESULT
Definition: typedefs.h:77
ULONG BufferLength
Definition: rpcndr.h:207
#define STUB_HEADER(This)
Definition: cstub.c:44

Referenced by NdrStubCall2().

◆ NdrStubInitialize()

void WINAPI NdrStubInitialize ( PRPC_MESSAGE  pRpcMsg,
PMIDL_STUB_MESSAGE  pStubMsg,
PMIDL_STUB_DESC  pStubDescriptor,
LPRPCCHANNELBUFFER  pRpcChannelBuffer 
)

Definition at line 624 of file cstub.c.

628 {
629  TRACE("(%p,%p,%p,%p)\n", pRpcMsg, pStubMsg, pStubDescriptor, pRpcChannelBuffer);
630  NdrServerInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor);
631  pStubMsg->pRpcChannelBuffer = pRpcChannelBuffer;
632  IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
633  &pStubMsg->dwDestContext,
634  &pStubMsg->pvDestContext);
635 }
unsigned char *WINAPI NdrServerInitializeNew(PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc)
DWORD dwDestContext
Definition: rpcndr.h:249
#define TRACE(s)
Definition: solgame.cpp:4
void * pvDestContext
Definition: rpcndr.h:250
struct IRpcChannelBuffer * pRpcChannelBuffer
Definition: rpcndr.h:253

Referenced by NdrStubCall2().

◆ release_delegating_vtbl()

void release_delegating_vtbl ( IUnknownVtbl *  vtbl)

Definition at line 311 of file cstub.c.

312 {
313  ref_counted_vtbl *table = (ref_counted_vtbl*)((DWORD *)vtbl - 1);
314 
316  table->ref--;
317  TRACE("ref now %d\n", table->ref);
318  if(table->ref == 0 && table != current_vtbl)
319  {
320  TRACE("... and we're not current so free'ing\n");
322  }
324 }
static ref_counted_vtbl * current_vtbl
Definition: cstub.c:114
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION delegating_vtbl_section
Definition: cstub.c:97
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
unsigned long DWORD
Definition: ntddk_ex.h:95
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by CStdStubBuffer_Delegating_Construct(), NdrCStdStubBuffer2_Release(), typelib_stub_init(), and typelib_stub_Release().

◆ stub_filter()

static LONG WINAPI stub_filter ( EXCEPTION_POINTERS eptr)
static

Definition at line 46 of file cstub.c.

47 {
51 }
#define EXCEPTION_NONCONTINUABLE
Definition: rtltypes.h:150
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
DWORD ExceptionFlags
Definition: compat.h:197
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:196

Referenced by CStdStubBuffer_Invoke().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ critsect_debug

CRITICAL_SECTION_DEBUG critsect_debug
static
Initial value:
=
{
0, 0, { (DWORD_PTR)(__FILE__ ": delegating_vtbl_section") }
}
#define DWORD_PTR
Definition: treelist.c:76
static CRITICAL_SECTION delegating_vtbl_section
Definition: cstub.c:97
static CRITICAL_SECTION_DEBUG critsect_debug
Definition: cstub.c:98
LIST_ENTRY ProcessLocksList
Definition: winbase.h:848

Definition at line 98 of file cstub.c.

◆ CStdStubBuffer_Delegating_Vtbl

const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl
Initial value:
=
{
}
HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface, REFIID riid, LPVOID *obj)
Definition: cstub.c:378
static HRESULT WINAPI CStdStubBuffer_Delegating_Connect(LPRPCSTUBBUFFER iface, LPUNKNOWN lpUnkServer)
Definition: cstub.c:552
static ULONG WINAPI CStdStubBuffer_Delegating_CountRefs(LPRPCSTUBBUFFER iface)
Definition: cstub.c:575
static void WINAPI CStdStubBuffer_Delegating_Disconnect(LPRPCSTUBBUFFER iface)
Definition: cstub.c:566
smooth NULL
Definition: ftsmooth.c:416
void WINAPI CStdStubBuffer_DebugServerRelease(LPRPCSTUBBUFFER iface, LPVOID pv)
Definition: cstub.c:531
LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface, REFIID riid)
Definition: cstub.c:508
ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface)
Definition: cstub.c:396
HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface(LPRPCSTUBBUFFER iface, LPVOID *ppv)
Definition: cstub.c:523
HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface, PRPCOLEMESSAGE pMsg, LPRPCCHANNELBUFFER pChannel)
Definition: cstub.c:477

Definition at line 587 of file cstub.c.

Referenced by CreateStubFromTypeInfo(), and init_psfactory().

◆ CStdStubBuffer_Vtbl

const IRpcStubBufferVtbl CStdStubBuffer_Vtbl
Initial value:
=
{
}
HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface, REFIID riid, LPVOID *obj)
Definition: cstub.c:378
smooth NULL
Definition: ftsmooth.c:416
ULONG WINAPI CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface)
Definition: cstub.c:516
void WINAPI CStdStubBuffer_DebugServerRelease(LPRPCSTUBBUFFER iface, LPVOID pv)
Definition: cstub.c:531
void WINAPI CStdStubBuffer_Disconnect(LPRPCSTUBBUFFER iface)
Definition: cstub.c:465
LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface, REFIID riid)
Definition: cstub.c:508
ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface)
Definition: cstub.c:396
HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface(LPRPCSTUBBUFFER iface, LPVOID *ppv)
Definition: cstub.c:523
HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface, PRPCOLEMESSAGE pMsg, LPRPCCHANNELBUFFER pChannel)
Definition: cstub.c:477
HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface, LPUNKNOWN lpUnkServer)
Definition: cstub.c:449

Definition at line 538 of file cstub.c.

Referenced by CreateStubFromTypeInfo(), and init_psfactory().

◆ current_vtbl

ref_counted_vtbl* current_vtbl
static

Definition at line 114 of file cstub.c.

Referenced by get_delegating_vtbl(), and release_delegating_vtbl().

◆ delegating_vtbl_section

static CRITICAL_SECTION delegating_vtbl_section = { &critsect_debug, -1, 0, 0, 0, 0 }
static

Definition at line 97 of file cstub.c.

Referenced by get_delegating_vtbl(), and release_delegating_vtbl().

◆ method_blocks

const vtbl_method_t* method_blocks[MAX_BLOCKS]
static

Definition at line 203 of file cstub.c.

Referenced by allocate_block(), fill_delegated_proxy_table(), and fill_delegated_stub_table().

◆ opcodes

const BYTE opcodes[1]
static

Definition at line 196 of file cstub.c.

Referenced by allocate_block().