ReactOS  0.4.14-dev-614-gbfd8a84
cstub.c
Go to the documentation of this file.
1 /*
2  * COM stub (CStdStubBuffer) implementation
3  *
4  * Copyright 2001 Ove K√•ven, TransGaming Technologies
5  * Copyright 2009 Alexandre Julliard
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #include <stdarg.h>
23 
24 #define COBJMACROS
25 
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winerror.h"
29 #include "excpt.h"
30 
31 #include "objbase.h"
32 #include "rpcproxy.h"
33 
34 #include "wine/debug.h"
35 #include "wine/exception.h"
36 
37 #include "cpsf.h"
38 
40 
41 #define STUB_HEADER(This) (((const CInterfaceStubHeader*)((This)->lpVtbl))[-1])
42 
44 {
48 }
49 
51 {
52  return CONTAINING_RECORD((void *)iface, cstdstubbuffer_delegating_t, stub_buffer);
53 }
54 
56  LPUNKNOWN pUnkServer,
58  CInterfaceStubVtbl *vtbl,
59  LPPSFACTORYBUFFER pPSFactory,
60  LPRPCSTUBBUFFER *ppStub)
61 {
63  IUnknown *pvServer;
64  HRESULT r;
65  TRACE("(%p,%p,%p,%p) %s\n", pUnkServer, vtbl, pPSFactory, ppStub, name);
66  TRACE("iid=%s\n", debugstr_guid(vtbl->header.piid));
67  TRACE("vtbl=%p\n", &vtbl->Vtbl);
68 
69  if (!IsEqualGUID(vtbl->header.piid, riid)) {
70  ERR("IID mismatch during stub creation\n");
71  return RPC_E_UNEXPECTED;
72  }
73 
74  r = IUnknown_QueryInterface(pUnkServer, riid, (void**)&pvServer);
75  if(FAILED(r))
76  return r;
77 
79  if (!This) {
80  IUnknown_Release(pvServer);
81  return E_OUTOFMEMORY;
82  }
83 
84  This->lpVtbl = &vtbl->Vtbl;
85  This->RefCount = 1;
86  This->pvServerObject = pvServer;
87  This->pPSFactory = pPSFactory;
88  *ppStub = (LPRPCSTUBBUFFER)This;
89 
90  IPSFactoryBuffer_AddRef(pPSFactory);
91  return S_OK;
92 }
93 
96 {
99  0, 0, { (DWORD_PTR)(__FILE__ ": delegating_vtbl_section") }
100 };
101 static CRITICAL_SECTION delegating_vtbl_section = { &critsect_debug, -1, 0, 0, 0, 0 };
102 
103 typedef struct
104 {
107  IUnknownVtbl vtbl;
108  /* remaining entries in vtbl */
110 
112 
113 
115 {
116  *ppv = pUnk;
117  return S_OK;
118 }
119 
121 {
122  return 1;
123 }
124 
126 {
127  return 1;
128 }
129 
130 /* The idea here is to replace the first param on the stack
131  ie. This (which will point to cstdstubbuffer_delegating_t)
132  with This->stub_buffer.pvServerObject and then jump to the
133  relevant offset in This->stub_buffer.pvServerObject's vtbl.
134 */
135 #ifdef __i386__
136 
137 #include "pshpack1.h"
138 typedef struct {
139  BYTE mov1[4]; /* mov 0x4(%esp),%eax 8b 44 24 04 */
140  BYTE mov2[3]; /* mov 0x10(%eax),%eax 8b 40 10 */
141  BYTE mov3[4]; /* mov %eax,0x4(%esp) 89 44 24 04 */
142  BYTE mov4[2]; /* mov (%eax),%eax 8b 00 */
143  BYTE mov5[2]; /* jmp *offset(%eax) ff a0 offset */
144  DWORD offset;
145  BYTE pad[1]; /* nop 90 */
146 } vtbl_method_t;
147 #include "poppack.h"
148 
149 static const BYTE opcodes[20] = { 0x8b, 0x44, 0x24, 0x04, 0x8b, 0x40, 0x10, 0x89, 0x44, 0x24, 0x04,
150  0x8b, 0x00, 0xff, 0xa0, 0, 0, 0, 0, 0x90 };
151 
152 #elif defined(__x86_64__)
153 
154 #include "pshpack1.h"
155 typedef struct
156 {
157  BYTE mov1[4]; /* movq 0x20(%rcx),%rcx 48 8b 49 20 */
158  BYTE mov2[3]; /* movq (%rcx),%rax 48 8b 01 */
159  BYTE jmp[2]; /* jmp *offset(%rax) ff a0 offset */
160  DWORD offset;
161  BYTE pad[3]; /* lea 0x0(%rsi),%rsi 48 8d 36 */
162 } vtbl_method_t;
163 #include "poppack.h"
164 
165 static const BYTE opcodes[16] = { 0x48, 0x8b, 0x49, 0x20, 0x48, 0x8b, 0x01,
166  0xff, 0xa0, 0, 0, 0, 0, 0x48, 0x8d, 0x36 };
167 #elif defined(__arm__)
168 
169 static const DWORD opcodes[] =
170 {
171  0xe52d4004, /* push {r4} */
172  0xe5900010, /* ldr r0, [r0, #16] */
173  0xe5904000, /* ldr r4, [r0] */
174  0xe59fc008, /* ldr ip, [pc, #8] */
175  0xe08cc004, /* add ip, ip, r4 */
176  0xe49d4004, /* pop {r4} */
177  0xe59cf000 /* ldr pc, [ip] */
178 };
179 
180 typedef struct
181 {
183  DWORD offset;
184 } vtbl_method_t;
185 
186 #elif defined(__aarch64__)
187 
188 static const DWORD opcodes[] =
189 {
190  0xf9401000, /* ldr x0, [x0,#32] */
191  0xf9400010, /* ldr x16, [x0] */
192  0x18000071, /* ldr w17, offset */
193  0xf8716a10, /* ldr x16, [x16,x17] */
194  0xd61f0200 /* br x16 */
195 };
196 
197 typedef struct
198 {
200  DWORD offset;
201 } vtbl_method_t;
202 
203 #else
204 
205 #warning You must implement delegated proxies/stubs for your CPU
206 typedef struct
207 {
209 } vtbl_method_t;
210 static const BYTE opcodes[1];
211 
212 #endif
213 
214 #define BLOCK_SIZE 1024
215 #define MAX_BLOCKS 64 /* 64k methods should be enough for anybody */
216 
218 
219 static const vtbl_method_t *allocate_block( unsigned int num )
220 {
221  unsigned int i;
222  vtbl_method_t *prev, *block;
223  DWORD oldprot;
224 
225  block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
227  if (!block) return NULL;
228 
229  for (i = 0; i < BLOCK_SIZE; i++)
230  {
231  memcpy( &block[i], opcodes, sizeof(opcodes) );
232  block[i].offset = (BLOCK_SIZE * num + i + 3) * sizeof(void *);
233  }
234  VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, &oldprot );
236  if (prev) /* someone beat us to it */
237  {
239  block = prev;
240  }
241  return block;
242 }
243 
244 static BOOL fill_delegated_stub_table(IUnknownVtbl *vtbl, DWORD num)
245 {
246  const void **entry = (const void **)(vtbl + 1);
247  DWORD i, j;
248 
249  if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
250  {
251  FIXME( "%u methods not supported\n", num );
252  return FALSE;
253  }
254  vtbl->QueryInterface = delegating_QueryInterface;
255  vtbl->AddRef = delegating_AddRef;
256  vtbl->Release = delegating_Release;
257  for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
258  {
260  if (!block && !(block = allocate_block( i ))) return FALSE;
261  for (j = 0; j < BLOCK_SIZE && j < num - 3 - i * BLOCK_SIZE; j++) *entry++ = &block[j];
262  }
263  return TRUE;
264 }
265 
267 {
268  const void **entry = (const void **)(vtbl + 1);
269  DWORD i, j;
270 
271  if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
272  {
273  FIXME( "%u methods not supported\n", num );
274  return FALSE;
275  }
276  vtbl->QueryInterface = IUnknown_QueryInterface_Proxy;
277  vtbl->AddRef = IUnknown_AddRef_Proxy;
278  vtbl->Release = IUnknown_Release_Proxy;
279  for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
280  {
282  if (!block && !(block = allocate_block( i ))) return FALSE;
283  for (j = 0; j < BLOCK_SIZE && j < num - 3 - i * BLOCK_SIZE; j++, entry++)
284  if (!*entry) *entry = &block[j];
285  }
286  return TRUE;
287 }
288 
289 IUnknownVtbl *get_delegating_vtbl(DWORD num_methods)
290 {
291  IUnknownVtbl *ret;
292 
293  if (num_methods < 256) num_methods = 256; /* avoid frequent reallocations */
294 
296 
297  if(!current_vtbl || num_methods > current_vtbl->size)
298  {
300  FIELD_OFFSET(ref_counted_vtbl, vtbl) + num_methods * sizeof(void*));
301  if (!table)
302  {
304  return NULL;
305  }
306 
307  table->ref = 0;
308  table->size = num_methods;
309  fill_delegated_stub_table(&table->vtbl, num_methods);
310 
311  if (current_vtbl && current_vtbl->ref == 0)
312  {
313  TRACE("freeing old table\n");
315  }
317  }
318 
319  current_vtbl->ref++;
320  ret = &current_vtbl->vtbl;
322  return ret;
323 }
324 
325 void release_delegating_vtbl(IUnknownVtbl *vtbl)
326 {
327  ref_counted_vtbl *table = (ref_counted_vtbl*)((DWORD *)vtbl - 1);
328 
330  table->ref--;
331  TRACE("ref now %d\n", table->ref);
332  if(table->ref == 0 && table != current_vtbl)
333  {
334  TRACE("... and we're not current so free'ing\n");
336  }
338 }
339 
341  LPUNKNOWN pUnkServer,
343  CInterfaceStubVtbl *vtbl,
344  REFIID delegating_iid,
345  LPPSFACTORYBUFFER pPSFactory,
346  LPRPCSTUBBUFFER *ppStub)
347 {
349  IUnknown *pvServer;
350  HRESULT r;
351 
352  TRACE("(%p,%p,%p,%p) %s\n", pUnkServer, vtbl, pPSFactory, ppStub, name);
353  TRACE("iid=%s delegating to %s\n", debugstr_guid(vtbl->header.piid), debugstr_guid(delegating_iid));
354  TRACE("vtbl=%p\n", &vtbl->Vtbl);
355 
356  if (!IsEqualGUID(vtbl->header.piid, riid))
357  {
358  ERR("IID mismatch during stub creation\n");
359  return RPC_E_UNEXPECTED;
360  }
361 
362  r = IUnknown_QueryInterface(pUnkServer, riid, (void**)&pvServer);
363  if(FAILED(r)) return r;
364 
366  if (!This)
367  {
368  IUnknown_Release(pvServer);
369  return E_OUTOFMEMORY;
370  }
371 
372  This->base_obj = get_delegating_vtbl( vtbl->header.DispatchTableCount );
373  r = create_stub(delegating_iid, (IUnknown*)&This->base_obj, &This->base_stub);
374  if(FAILED(r))
375  {
376  release_delegating_vtbl(This->base_obj);
378  IUnknown_Release(pvServer);
379  return r;
380  }
381 
382  This->stub_buffer.lpVtbl = &vtbl->Vtbl;
383  This->stub_buffer.RefCount = 1;
384  This->stub_buffer.pvServerObject = pvServer;
385  This->stub_buffer.pPSFactory = pPSFactory;
386  *ppStub = (LPRPCSTUBBUFFER)&This->stub_buffer;
387 
388  IPSFactoryBuffer_AddRef(pPSFactory);
389  return S_OK;
390 }
391 
393  REFIID riid,
394  LPVOID *obj)
395 {
396  CStdStubBuffer *This = (CStdStubBuffer *)iface;
397  TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);
398 
399  if (IsEqualIID(&IID_IUnknown, riid) ||
400  IsEqualIID(&IID_IRpcStubBuffer, riid))
401  {
402  IRpcStubBuffer_AddRef(iface);
403  *obj = iface;
404  return S_OK;
405  }
406  *obj = NULL;
407  return E_NOINTERFACE;
408 }
409 
411 {
412  CStdStubBuffer *This = (CStdStubBuffer *)iface;
413  TRACE("(%p)->AddRef()\n",This);
414  return InterlockedIncrement(&This->RefCount);
415 }
416 
418  LPPSFACTORYBUFFER pPSF)
419 {
420  CStdStubBuffer *This = (CStdStubBuffer *)iface;
421  ULONG refs;
422 
423  TRACE("(%p)->Release()\n",This);
424 
425  refs = InterlockedDecrement(&This->RefCount);
426  if (!refs)
427  {
428  /* test_Release shows that native doesn't call Disconnect here.
429  We'll leave it in for the time being. */
430  IRpcStubBuffer_Disconnect(iface);
431 
432  IPSFactoryBuffer_Release(pPSF);
434  }
435  return refs;
436 }
437 
439  LPPSFACTORYBUFFER pPSF)
440 {
442  ULONG refs;
443 
444  TRACE("(%p)->Release()\n", This);
445 
446  refs = InterlockedDecrement(&This->stub_buffer.RefCount);
447  if (!refs)
448  {
449  /* Just like NdrCStdStubBuffer_Release, we shouldn't call
450  Disconnect here */
451  IRpcStubBuffer_Disconnect((IRpcStubBuffer *)&This->stub_buffer);
452 
453  IRpcStubBuffer_Release(This->base_stub);
454  release_delegating_vtbl(This->base_obj);
455 
456  IPSFactoryBuffer_Release(pPSF);
458  }
459 
460  return refs;
461 }
462 
464  LPUNKNOWN lpUnkServer)
465 {
466  CStdStubBuffer *This = (CStdStubBuffer *)iface;
467  HRESULT r;
468  IUnknown *new = NULL;
469 
470  TRACE("(%p)->Connect(%p)\n",This,lpUnkServer);
471 
472  r = IUnknown_QueryInterface(lpUnkServer, STUB_HEADER(This).piid, (void**)&new);
473  new = InterlockedExchangePointer((void**)&This->pvServerObject, new);
474  if(new)
475  IUnknown_Release(new);
476  return r;
477 }
478 
480 {
481  CStdStubBuffer *This = (CStdStubBuffer *)iface;
482  IUnknown *old;
483  TRACE("(%p)->Disconnect()\n",This);
484 
485  old = InterlockedExchangePointer((void**)&This->pvServerObject, NULL);
486 
487  if(old)
488  IUnknown_Release(old);
489 }
490 
492  PRPCOLEMESSAGE pMsg,
493  LPRPCCHANNELBUFFER pChannel)
494 {
495  CStdStubBuffer *This = (CStdStubBuffer *)iface;
496  DWORD dwPhase = STUB_UNMARSHAL;
497  HRESULT hr = S_OK;
498 
499  TRACE("(%p)->Invoke(%p,%p)\n",This,pMsg,pChannel);
500 
501  __TRY
502  {
503  if (STUB_HEADER(This).pDispatchTable)
504  STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
505  else /* pure interpreted */
506  NdrStubCall2(iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
507  }
509  {
510  DWORD dwExceptionCode = GetExceptionCode();
511  WARN("a stub call failed with exception 0x%08x (%d)\n", dwExceptionCode, dwExceptionCode);
512  if (FAILED(dwExceptionCode))
513  hr = dwExceptionCode;
514  else
515  hr = HRESULT_FROM_WIN32(dwExceptionCode);
516  }
517  __ENDTRY
518 
519  return hr;
520 }
521 
523  REFIID riid)
524 {
525  CStdStubBuffer *This = (CStdStubBuffer *)iface;
526  TRACE("(%p)->IsIIDSupported(%s)\n",This,debugstr_guid(riid));
527  return IsEqualGUID(STUB_HEADER(This).piid, riid) ? iface : NULL;
528 }
529 
531 {
532  CStdStubBuffer *This = (CStdStubBuffer *)iface;
533  TRACE("(%p)->CountRefs()\n",This);
534  return This->RefCount;
535 }
536 
538  LPVOID *ppv)
539 {
540  CStdStubBuffer *This = (CStdStubBuffer *)iface;
541  TRACE("(%p)->DebugServerQueryInterface(%p)\n",This,ppv);
542  return S_OK;
543 }
544 
546  LPVOID pv)
547 {
548  CStdStubBuffer *This = (CStdStubBuffer *)iface;
549  TRACE("(%p)->DebugServerRelease(%p)\n",This,pv);
550 }
551 
552 const IRpcStubBufferVtbl CStdStubBuffer_Vtbl =
553 {
556  NULL,
564 };
565 
567  LPUNKNOWN lpUnkServer)
568 {
570  HRESULT r;
571  TRACE("(%p)->Connect(%p)\n", This, lpUnkServer);
572 
573  r = CStdStubBuffer_Connect(iface, lpUnkServer);
574  if(SUCCEEDED(r))
575  r = IRpcStubBuffer_Connect(This->base_stub, (IUnknown*)&This->base_obj);
576 
577  return r;
578 }
579 
581 {
583  TRACE("(%p)->Disconnect()\n", This);
584 
585  IRpcStubBuffer_Disconnect(This->base_stub);
587 }
588 
590 {
592  ULONG ret;
593  TRACE("(%p)->CountRefs()\n", This);
594 
595  ret = CStdStubBuffer_CountRefs(iface);
596  ret += IRpcStubBuffer_CountRefs(This->base_stub);
597 
598  return ret;
599 }
600 
601 const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl =
602 {
605  NULL,
613 };
614 
616 {
617  CStdStubBuffer *This = (CStdStubBuffer *)iface;
618  return STUB_HEADER(This).pServerInfo;
619 }
620 
621 /************************************************************************
622  * NdrStubForwardingFunction [RPCRT4.@]
623  */
625  PRPC_MESSAGE pMsg, DWORD *pdwStubPhase )
626 {
627  /* Note pMsg is passed intact since RPCOLEMESSAGE is basically a RPC_MESSAGE. */
628 
630  HRESULT r = IRpcStubBuffer_Invoke(This->base_stub, (RPCOLEMESSAGE*)pMsg, pChannel);
631  if(FAILED(r)) RpcRaiseException(r);
632  return;
633 }
634 
635 /***********************************************************************
636  * NdrStubInitialize [RPCRT4.@]
637  */
639  PMIDL_STUB_MESSAGE pStubMsg,
640  PMIDL_STUB_DESC pStubDescriptor,
641  LPRPCCHANNELBUFFER pRpcChannelBuffer)
642 {
643  TRACE("(%p,%p,%p,%p)\n", pRpcMsg, pStubMsg, pStubDescriptor, pRpcChannelBuffer);
644  NdrServerInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor);
645  pStubMsg->pRpcChannelBuffer = pRpcChannelBuffer;
646  IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
647  &pStubMsg->dwDestContext,
648  &pStubMsg->pvDestContext);
649 }
650 
651 /***********************************************************************
652  * NdrStubGetBuffer [RPCRT4.@]
653  */
655  LPRPCCHANNELBUFFER pRpcChannelBuffer,
656  PMIDL_STUB_MESSAGE pStubMsg)
657 {
658  CStdStubBuffer *This = (CStdStubBuffer *)iface;
659  HRESULT hr;
660 
661  TRACE("(%p, %p, %p)\n", This, pRpcChannelBuffer, pStubMsg);
662 
663  pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
664  hr = IRpcChannelBuffer_GetBuffer(pRpcChannelBuffer,
665  (RPCOLEMESSAGE *)pStubMsg->RpcMsg, STUB_HEADER(This).piid);
666  if (FAILED(hr))
667  {
669  return;
670  }
671 
672  pStubMsg->Buffer = pStubMsg->RpcMsg->Buffer;
673 }
static unsigned int block
Definition: xmlmemory.c:118
#define __EXCEPT(func)
Definition: exception.h:58
HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface, REFIID riid, LPVOID *obj)
Definition: cstub.c:392
static HRESULT WINAPI CStdStubBuffer_Delegating_Connect(LPRPCSTUBBUFFER iface, LPUNKNOWN lpUnkServer)
Definition: cstub.c:566
LONG WINAPI NdrStubCall2(struct IRpcStubBuffer *pThis, struct IRpcChannelBuffer *pChannel, PRPC_MESSAGE pRpcMsg, DWORD *pdwStubPhase)
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define DWORD_PTR
Definition: treelist.c:76
ULONG WINAPI IUnknown_AddRef_Proxy(LPUNKNOWN iface)
Definition: cproxy.c:478
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static ULONG WINAPI CStdStubBuffer_Delegating_CountRefs(LPRPCSTUBBUFFER iface)
Definition: cstub.c:589
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
#define WARN(fmt,...)
Definition: debug.h:111
unsigned char *WINAPI NdrServerInitializeNew(PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc)
unsigned char * Buffer
Definition: rpcndr.h:203
static ULONG WINAPI delegating_Release(IUnknown *pUnk)
Definition: cstub.c:125
GLintptr offset
Definition: glext.h:5920
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define EXCEPTION_NONCONTINUABLE
Definition: rtltypes.h:150
static ref_counted_vtbl * current_vtbl
Definition: cstub.c:111
static const vtbl_method_t * allocate_block(unsigned int num)
Definition: cstub.c:219
HRESULT CStdStubBuffer_Delegating_Construct(REFIID riid, LPUNKNOWN pUnkServer, PCInterfaceName name, CInterfaceStubVtbl *vtbl, REFIID delegating_iid, LPPSFACTORYBUFFER pPSFactory, LPRPCSTUBBUFFER *ppStub)
Definition: cstub.c:340
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
#define BLOCK_SIZE
Definition: cstub.c:214
static void WINAPI CStdStubBuffer_Delegating_Disconnect(LPRPCSTUBBUFFER iface)
Definition: cstub.c:580
BOOL fill_delegated_proxy_table(IUnknownVtbl *vtbl, DWORD num)
Definition: cstub.c:266
PRPC_MESSAGE RpcMsg
Definition: rpcndr.h:202
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define MEM_COMMIT
Definition: nt_native.h:1313
void release_delegating_vtbl(IUnknownVtbl *vtbl)
Definition: cstub.c:325
IUnknownVtbl * get_delegating_vtbl(DWORD num_methods)
Definition: cstub.c:289
unsigned int BufferLength
Definition: rpcdcep.h:41
CInterfaceStubHeader header
Definition: rpcproxy.h:104
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
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
void * Buffer
Definition: rpcdcep.h:40
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:74
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static CRITICAL_SECTION delegating_vtbl_section
Definition: cstub.c:94
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
struct _RPC_MESSAGE * PRPC_MESSAGE
static CRITICAL_SECTION_DEBUG critsect_debug
Definition: cstub.c:95
static LPUNKNOWN
Definition: ndr_ole.c:49
ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface)
Definition: cproxy.c:485
static HRESULT WINAPI delegating_QueryInterface(IUnknown *pUnk, REFIID iid, void **ppv)
Definition: cstub.c:114
DWORD dwDestContext
Definition: rpcndr.h:249
#define MEM_RESERVE
Definition: nt_native.h:1314
#define FIXME(fmt,...)
Definition: debug.h:110
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
void WINAPI NdrStubInitialize(PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDescriptor, LPRPCCHANNELBUFFER pRpcChannelBuffer)
Definition: cstub.c:638
smooth NULL
Definition: ftsmooth.c:416
ULONG WINAPI CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface)
Definition: cstub.c:530
static BOOL fill_delegated_stub_table(IUnknownVtbl *vtbl, DWORD num)
Definition: cstub.c:244
const IID * piid
Definition: rpcproxy.h:96
void WINAPI NdrStubGetBuffer(LPRPCSTUBBUFFER iface, LPRPCCHANNELBUFFER pRpcChannelBuffer, PMIDL_STUB_MESSAGE pStubMsg)
Definition: cstub.c:654
#define RPC_E_UNEXPECTED
Definition: winerror.h:2509
#define __TRY
Definition: compat.h:70
#define __RPC_STUB
Definition: rpc.h:66
#define debugstr_guid
Definition: kernel32.h:35
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
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
void WINAPI CStdStubBuffer_DebugServerRelease(LPRPCSTUBBUFFER iface, LPVOID pv)
Definition: cstub.c:545
#define GetExceptionCode()
Definition: exception.h:66
void WINAPI CStdStubBuffer_Disconnect(LPRPCSTUBBUFFER iface)
Definition: cstub.c:479
HRESULT CStdStubBuffer_Construct(REFIID riid, LPUNKNOWN pUnkServer, PCInterfaceName name, CInterfaceStubVtbl *vtbl, LPPSFACTORYBUFFER pPSFactory, LPRPCSTUBBUFFER *ppStub)
Definition: cstub.c:55
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static const BYTE opcodes[1]
Definition: cstub.c:210
void * pvDestContext
Definition: rpcndr.h:250
DWORD offset
Definition: cstub.c:208
LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface, REFIID riid)
Definition: cstub.c:522
const IRpcStubBufferVtbl CStdStubBuffer_Vtbl
Definition: cstub.c:552
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:6
WINE_DEFAULT_DEBUG_CHANNEL(ole)
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
ULONG WINAPI NdrCStdStubBuffer2_Release(LPRPCSTUBBUFFER iface, LPPSFACTORYBUFFER pPSF)
Definition: cstub.c:438
HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface, REFIID riid, LPVOID *ppvObj)
Definition: cproxy.c:469
static const vtbl_method_t * method_blocks[MAX_BLOCKS]
Definition: cstub.c:217
const MIDL_SERVER_INFO * CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface)
Definition: cstub.c:615
ULONG BufferLength
Definition: rpcndr.h:207
#define __ENDTRY
Definition: compat.h:72
int ret
void __RPC_STUB NdrStubForwardingFunction(IRpcStubBuffer *iface, IRpcChannelBuffer *pChannel, PRPC_MESSAGE pMsg, DWORD *pdwStubPhase)
Definition: cstub.c:624
#define InterlockedDecrement
Definition: armddk.h:52
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
static IRpcStubBuffer * create_stub(IPSFactoryBuffer *ppsf, REFIID iid, IUnknown *obj, HRESULT expected_result)
Definition: cstub.c:712
LIST_ENTRY ProcessLocksList
Definition: winbase.h:855
ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface)
Definition: cstub.c:410
#define ERR(fmt,...)
Definition: debug.h:109
DWORD size
Definition: cstub.c:106
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
const char * PCInterfaceName
Definition: rpcproxy.h:42
#define ARRAY_SIZE(a)
Definition: main.h:24
HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface(LPRPCSTUBBUFFER iface, LPVOID *ppv)
Definition: cstub.c:537
#define MAX_BLOCKS
Definition: cstub.c:215
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
static ULONG WINAPI delegating_AddRef(IUnknown *pUnk)
Definition: cstub.c:120
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface, PRPCOLEMESSAGE pMsg, LPRPCCHANNELBUFFER pChannel)
Definition: cstub.c:491
static cstdstubbuffer_delegating_t * impl_from_delegating(IRpcStubBuffer *iface)
Definition: cstub.c:50
#define MEM_RELEASE
Definition: nt_native.h:1316
Definition: name.c:38
unsigned int ULONG
Definition: retypes.h:1
DWORD ExceptionFlags
Definition: compat.h:197
#define PAGE_EXECUTE_READ
Definition: nt_native.h:1307
interface IRpcChannelBuffer * LPRPCCHANNELBUFFER
Definition: objfwd.h:39
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:128
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:196
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
static LONG WINAPI stub_filter(EXCEPTION_POINTERS *eptr)
Definition: cstub.c:43
interface IRpcStubBuffer * LPRPCSTUBBUFFER
Definition: objfwd.h:41
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define STUB_HEADER(This)
Definition: cstub.c:41
IUnknownVtbl vtbl
Definition: cstub.c:107
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define HeapFree(x, y, z)
Definition: compat.h:402
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
struct IRpcChannelBuffer * pRpcChannelBuffer
Definition: rpcndr.h:253
#define SUCCEEDED(hr)
Definition: intsafe.h:57
IRpcStubBufferVtbl Vtbl
Definition: rpcproxy.h:105
HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface, LPUNKNOWN lpUnkServer)
Definition: cstub.c:463
ULONG WINAPI NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface, LPPSFACTORYBUFFER pPSF)
Definition: cstub.c:417
const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl
Definition: cstub.c:601
jmp_buf jmp
Definition: mach.c:35