ReactOS 0.4.16-dev-117-g38f21f9
cstub.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include <winnt.h>
#include <winerror.h>
#include "initguid.h"
#include <ole2.h>
#include "rpc.h"
#include "rpcdce.h"
#include "rpcproxy.h"
#include "wine/heap.h"
#include "wine/test.h"
#include "cstub_p.h"
Include dependency graph for cstub.c:

Go to the source code of this file.

Classes

struct  _MIDL_PROC_FORMAT_STRING
 
struct  _MIDL_TYPE_FORMAT_STRING
 
struct  dummy_unknown
 

Macros

#define COBJMACROS
 
#define cstub_CHECK_IID(n)   IID_GENERIC_CHECK_IID( cstub, pIID, n)
 
#define VTBL_TEST_NOT_CHANGE_TO(name, i)
 
#define VTBL_TEST_CHANGE_TO(name, i)
 
#define VTBL_TEST_ZERO(name, i)
 
#define VTBL_PROXY_TEST(i, num, ptr)
 
#define VTBL_PROXY_TEST_NOT_ZERO(i, num)    ok( proxy_vtbl[i]->Vtbl[num] != NULL, "wrong proxy %u func %u is NULL\n", (i), (num))
 

Typedefs

typedef struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING
 
typedef struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING
 

Functions

static ULONG WINAPI test_CStdStubBuffer_Release (IRpcStubBuffer *This)
 
static ULONG WINAPI test_CStdStubBuffer2_Release (IRpcStubBuffer *This)
 
static void *CALLBACK my_alloc (SIZE_T size)
 
static void CALLBACK my_free (void *ptr)
 
static HRESULT WINAPI if1_fn1_Proxy (void *This)
 
static void __RPC_STUB if1_fn1_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
 
static HRESULT WINAPI if1_fn2_Proxy (void *This)
 
static void __RPC_STUB if1_fn2_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
 
static CINTERFACE_PROXY_VTABLE (5)
 
static CINTERFACE_PROXY_VTABLE (13)
 
static CINTERFACE_PROXY_VTABLE (7)
 
static int __stdcall iid_lookup (const IID *pIID, int *pIndex)
 
static BOOL check_address (void *actual, void *expected)
 
static IPSFactoryBuffertest_NdrDllGetClassObject (void)
 
static HRESULT WINAPI base_buffer_Invoke (IRpcStubBuffer *This, RPCOLEMESSAGE *msg, IRpcChannelBuffer *channel)
 
static void test_NdrStubForwardingFunction (void)
 
static IRpcStubBuffercreate_stub (IPSFactoryBuffer *ppsf, REFIID iid, IUnknown *obj, HRESULT expected_result)
 
static HRESULT WINAPI create_stub_test_QI (IUnknown *This, REFIID iid, void **ppv)
 
static HRESULT WINAPI create_stub_test_fail_QI (IUnknown *This, REFIID iid, void **ppv)
 
static struct dummy_unknownimpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI dummy_QueryInterface (IUnknown *This, REFIID iid, void **ppv)
 
static ULONG WINAPI dummy_AddRef (LPUNKNOWN iface)
 
static ULONG WINAPI dummy_Release (LPUNKNOWN iface)
 
static void create_proxy_test (IPSFactoryBuffer *ppsf, REFIID iid, const void *expected_vtbl)
 
static void test_CreateProxy (IPSFactoryBuffer *ppsf)
 
static void test_CreateStub (IPSFactoryBuffer *ppsf)
 
static HRESULT WINAPI connect_test_orig_QI (IUnknown *This, REFIID iid, void **ppv)
 
static ULONG WINAPI connect_test_orig_release (IUnknown *This)
 
static HRESULT WINAPI connect_test_new_QI (IUnknown *This, REFIID iid, void **ppv)
 
static HRESULT WINAPI connect_test_new_fail_QI (IUnknown *This, REFIID iid, void **ppv)
 
static HRESULT WINAPI connect_test_base_Connect (IRpcStubBuffer *pstub, IUnknown *obj)
 
static void test_Connect (IPSFactoryBuffer *ppsf)
 
static void test_Disconnect (IPSFactoryBuffer *ppsf)
 
static ULONG WINAPI release_test_pretend_psfacbuf_release (IUnknown *pUnk)
 
static void test_Release (IPSFactoryBuffer *ppsf)
 
static HRESULT WINAPI delegating_invoke_test_QI (ITypeLib *pUnk, REFIID iid, void **ppv)
 
static ULONG WINAPI delegating_invoke_test_addref (ITypeLib *pUnk)
 
static ULONG WINAPI delegating_invoke_test_release (ITypeLib *pUnk)
 
static UINT WINAPI delegating_invoke_test_get_type_info_count (ITypeLib *pUnk)
 
static HRESULT WINAPI delegating_invoke_chan_query_interface (IRpcChannelBuffer *pchan, REFIID iid, void **ppv)
 
static ULONG WINAPI delegating_invoke_chan_add_ref (IRpcChannelBuffer *pchan)
 
static ULONG WINAPI delegating_invoke_chan_release (IRpcChannelBuffer *pchan)
 
static HRESULT WINAPI delegating_invoke_chan_get_buffer (IRpcChannelBuffer *pchan, RPCOLEMESSAGE *msg, REFIID iid)
 
static HRESULT WINAPI delegating_invoke_chan_send_receive (IRpcChannelBuffer *pchan, RPCOLEMESSAGE *pMessage, ULONG *pStatus)
 
static HRESULT WINAPI delegating_invoke_chan_free_buffer (IRpcChannelBuffer *pchan, RPCOLEMESSAGE *pMessage)
 
static HRESULT WINAPI delegating_invoke_chan_get_dest_ctx (IRpcChannelBuffer *pchan, DWORD *pdwDestContext, void **ppvDestContext)
 
static HRESULT WINAPI delegating_invoke_chan_is_connected (IRpcChannelBuffer *pchan)
 
static void test_delegating_Invoke (IPSFactoryBuffer *ppsf)
 
static void test_NdrDllRegisterProxy (void)
 
static HANDLE create_process (const char *arg)
 
 DEFINE_GUID (CLSID_test1, 0xdeadf00d, 0x0001, 0x44c7, 0x85, 0x0f, 0x2a, 0x0f, 0x46, 0x5c, 0x0c, 0x6c)
 
static HRESULT WINAPI test1_QueryInterface (ITest1 *iface, REFIID iid, void **out)
 
static ULONG WINAPI test1_AddRef (ITest1 *iface)
 
static ULONG WINAPI test1_Release (ITest1 *iface)
 
static HRESULT WINAPI test1_GetClassID (ITest1 *iface, CLSID *clsid)
 
static int WINAPI test1_square (ITest1 *iface, int x)
 
static HRESULT WINAPI test_cf_QueryInterface (IClassFactory *iface, REFIID iid, void **out)
 
static ULONG WINAPI test_cf_AddRef (IClassFactory *iface)
 
static ULONG WINAPI test_cf_Release (IClassFactory *iface)
 
static HRESULT WINAPI test_cf_CreateInstance (IClassFactory *iface, IUnknown *outer, REFIID iid, void **out)
 
static HRESULT WINAPI test_cf_LockServer (IClassFactory *iface, BOOL lock)
 
static void local_server_proc (void)
 
static void test_delegated_methods (void)
 
 START_TEST (cstub)
 

Variables

static CStdPSFactoryBuffer PSFactoryBuffer
 
static GUID IID_if1 = {0x12345678, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}}
 
static GUID IID_if2 = {0x12345679, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}}
 
static GUID IID_if3 = {0x1234567a, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}}
 
static GUID IID_if4 = {0x1234567b, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}}
 
static CLSID CLSID_psfact = {0x1234567c, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}}
 
static int my_alloc_called
 
static int my_free_called
 
static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString
 
static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
 
static const MIDL_STUB_DESC Object_StubDesc
 
static const unsigned short if1_FormatStringOffsetTable []
 
static const MIDL_SERVER_INFO if1_server_info
 
static const PRPC_STUB_FUNCTION if1_table []
 
static CInterfaceStubVtbl if1_stub_vtbl
 
static const unsigned short if2_FormatStringOffsetTable []
 
static const MIDL_SERVER_INFO if2_server_info
 
static const PRPC_STUB_FUNCTION if2_table []
 
static CInterfaceStubVtbl if2_stub_vtbl
 
static const unsigned short if3_FormatStringOffsetTable []
 
static const MIDL_SERVER_INFO if3_server_info
 
static CInterfaceStubVtbl if3_stub_vtbl
 
static const unsigned short if4_FormatStringOffsetTable []
 
static const MIDL_SERVER_INFO if4_server_info
 
static CInterfaceStubVtbl if4_stub_vtbl
 
static const CInterfaceProxyVtblcstub_ProxyVtblList []
 
static const CInterfaceStubVtblcstub_StubVtblList []
 
static PCInterfaceName const if_name_list []
 
static const IIDbase_iid_list []
 
static const ExtendedProxyFileInfo my_proxy_file_info
 
static const ProxyFileInfoproxy_file_list []
 
static int base_buffer_invoke_called
 
static IRpcStubBufferVtbl base_buffer_vtbl
 
static IUnknownVtbl create_stub_test_vtbl
 
static IUnknownVtbl create_stub_test_fail_vtbl
 
static IUnknownVtbl dummy_unknown_vtbl
 
static struct dummy_unknown dummy_unknown = { { &dummy_unknown_vtbl }, 0 }
 
static int connect_test_orig_release_called
 
static IUnknownVtbl connect_test_orig_vtbl
 
static IUnknownVtbl connect_test_new_vtbl
 
static IUnknownVtbl connect_test_new_fail_vtbl
 
static int connect_test_base_Connect_called
 
static IRpcStubBufferVtbl connect_test_base_stub_buffer_vtbl
 
static int release_test_psfacbuf_release_called
 
static IUnknownVtbl release_test_pretend_psfacbuf_vtbl
 
static ITypeLibVtbl delegating_invoke_test_obj_vtbl
 
static IRpcChannelBufferVtbl delegating_invoke_test_rpc_chan_vtbl
 
static const CInterfaceProxyVtblcstub_ProxyVtblList2 []
 
static const CInterfaceStubVtblcstub_StubVtblList2 []
 
static PCInterfaceName const if_name_list2 []
 
static const IIDbase_iid_list2 []
 
static const ExtendedProxyFileInfo my_proxy_file_info2
 
static const ProxyFileInfoproxy_file_list2 []
 
static const ITest1Vtbl test1_vtbl
 
static const IClassFactoryVtbl test_cf_vtbl
 
static IClassFactory test_cf = { &test_cf_vtbl }
 
CStdPSFactoryBuffer gPFactory
 
const ProxyFileInfoaProxyFileList
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file cstub.c.

◆ cstub_CHECK_IID

#define cstub_CHECK_IID (   n)    IID_GENERIC_CHECK_IID( cstub, pIID, n)

Definition at line 408 of file cstub.c.

◆ VTBL_PROXY_TEST

#define VTBL_PROXY_TEST (   i,
  num,
  ptr 
)
Value:
ok( check_address(proxy_vtbl[i]->Vtbl[num], (ptr)), "wrong proxy %u func %u %p/%p\n", \
(i), (num), proxy_vtbl[i]->Vtbl[num], (ptr) )
#define ok(value,...)
Definition: atltest.h:57
GLuint GLuint num
Definition: glext.h:9618
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PVOID ptr
Definition: dispmode.c:27
static BOOL check_address(void *actual, void *expected)
Definition: cstub.c:422

◆ VTBL_PROXY_TEST_NOT_ZERO

#define VTBL_PROXY_TEST_NOT_ZERO (   i,
  num 
)     ok( proxy_vtbl[i]->Vtbl[num] != NULL, "wrong proxy %u func %u is NULL\n", (i), (num))

◆ VTBL_TEST_CHANGE_TO

#define VTBL_TEST_CHANGE_TO (   name,
  i 
)
Value:
ok(check_address(stub_vtbl[i]->Vtbl.name, CStd_##name), #name "vtbl %d not updated %p %p\n", \
i, stub_vtbl[i]->Vtbl.name, CStd_##name )
Definition: name.c:39

◆ VTBL_TEST_NOT_CHANGE_TO

#define VTBL_TEST_NOT_CHANGE_TO (   name,
  i 
)
Value:
ok(stub_vtbl[i]->Vtbl.name != CStd_##name, #name "vtbl %d updated %p %p\n", \
i, stub_vtbl[i]->Vtbl.name, CStd_##name )

◆ VTBL_TEST_ZERO

#define VTBL_TEST_ZERO (   name,
  i 
)
Value:
ok(stub_vtbl[i]->Vtbl.name == NULL, #name "vtbl %d not null %p\n", \
i, stub_vtbl[i]->Vtbl.name )
#define NULL
Definition: types.h:112

Typedef Documentation

◆ MIDL_PROC_FORMAT_STRING

◆ MIDL_TYPE_FORMAT_STRING

Function Documentation

◆ base_buffer_Invoke()

static HRESULT WINAPI base_buffer_Invoke ( IRpcStubBuffer This,
RPCOLEMESSAGE *  msg,
IRpcChannelBuffer channel 
)
static

Definition at line 672 of file cstub.c.

673{
675 ok(msg == (RPCOLEMESSAGE*)0xcafebabe, "msg ptr changed\n");
676 ok(channel == (IRpcChannelBuffer*)0xdeadbeef, "channel ptr changed\n");
677 return S_OK; /* returning any failure here results in an exception */
678}
#define msg(x)
Definition: auth_time.c:54
#define S_OK
Definition: intsafe.h:52
static int base_buffer_invoke_called
Definition: cstub.c:671

◆ check_address()

static BOOL check_address ( void actual,
void expected 
)
static

Definition at line 422 of file cstub.c.

423{
424 static void *ole32_start = NULL;
425 static void *ole32_end = NULL;
426 static void *combase_start = NULL;
427 static void *combase_end = NULL;
428
429 if (actual == expected)
430 return TRUE;
431
432 /* On Win7, actual can be located inside ole32.dll */
433 if (ole32_start == NULL || ole32_end == NULL)
434 {
435 PIMAGE_NT_HEADERS nt_headers;
436 ole32_start = (void *) GetModuleHandleA("ole32.dll");
437 if (ole32_start == NULL)
438 return FALSE;
439 nt_headers = (PIMAGE_NT_HEADERS)((char *) ole32_start + ((PIMAGE_DOS_HEADER) ole32_start)->e_lfanew);
440 ole32_end = (void *)((char *) ole32_start + nt_headers->OptionalHeader.SizeOfImage);
441 }
442
443 if (ole32_start <= actual && actual < ole32_end)
444 return TRUE;
445
446 /* On Win8, actual can be located inside combase.dll */
447 if (combase_start == NULL || combase_end == NULL)
448 {
449 PIMAGE_NT_HEADERS nt_headers;
450 combase_start = (void *) GetModuleHandleA("combase.dll");
451 if (combase_start == NULL)
452 return FALSE;
453 nt_headers = (PIMAGE_NT_HEADERS)((char *) combase_start + ((PIMAGE_DOS_HEADER) combase_start)->e_lfanew);
454 combase_end = (void *)((char *) combase_start + nt_headers->OptionalHeader.SizeOfImage);
455 }
456
457 return (combase_start <= actual && actual < combase_end);
458}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
Definition: ntddk_ex.h:187
struct _IMAGE_DOS_HEADER * PIMAGE_DOS_HEADER
BOOL expected
Definition: store.c:2063
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184

◆ CINTERFACE_PROXY_VTABLE() [1/3]

static CINTERFACE_PROXY_VTABLE ( 13  )
static

Definition at line 217 of file cstub.c.

218{
219 { &IID_if2 },
223 0,
224 0,
225 0,
226 0,
227 0,
228 0,
229 0,
230 0,
231 0,
232 0
233 }
234};
ULONG WINAPI IUnknown_AddRef_Proxy(LPUNKNOWN iface)
Definition: cproxy.c:478
ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface)
Definition: cproxy.c:485
HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface, REFIID riid, LPVOID *ppvObj)
Definition: cproxy.c:469
static GUID IID_if2
Definition: cstub.c:58

◆ CINTERFACE_PROXY_VTABLE() [2/3]

static CINTERFACE_PROXY_VTABLE ( )
static

Definition at line 159 of file cstub.c.

160{
161 { &IID_if1 },
167 }
168};
static HRESULT WINAPI if1_fn2_Proxy(void *This)
Definition: cstub.c:145
static GUID IID_if1
Definition: cstub.c:57
static HRESULT WINAPI if1_fn1_Proxy(void *This)
Definition: cstub.c:131

◆ CINTERFACE_PROXY_VTABLE() [3/3]

static CINTERFACE_PROXY_VTABLE ( )
static

Definition at line 328 of file cstub.c.

329{
330 { &IID_if4 },
334 0,
335 0,
336 0,
337 0
338 }
339};
static GUID IID_if4
Definition: cstub.c:60

◆ connect_test_base_Connect()

static HRESULT WINAPI connect_test_base_Connect ( IRpcStubBuffer pstub,
IUnknown obj 
)
static

Definition at line 898 of file cstub.c.

899{
901 ok(*(void**)obj == (void*)0xbeefcafe, "unexpected obj %p\n", obj);
902 return S_OK;
903}
static int connect_test_base_Connect_called
Definition: cstub.c:897

◆ connect_test_new_fail_QI()

static HRESULT WINAPI connect_test_new_fail_QI ( IUnknown This,
REFIID  iid,
void **  ppv 
)
static

Definition at line 883 of file cstub.c.

884{
885 ok(IsEqualIID(iid, &IID_if1), "incorrect iid\n");
886 *ppv = (void*)0xdeadbeef;
887 return E_NOINTERFACE;
888}
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ connect_test_new_QI()

static HRESULT WINAPI connect_test_new_QI ( IUnknown This,
REFIID  iid,
void **  ppv 
)
static

Definition at line 868 of file cstub.c.

869{
870 ok(IsEqualIID(iid, &IID_if1) ||
871 IsEqualIID(iid, &IID_if2), "incorrect iid\n");
872 *ppv = (void*)0xcafebabe;
873 return S_OK;
874}

◆ connect_test_orig_QI()

static HRESULT WINAPI connect_test_orig_QI ( IUnknown This,
REFIID  iid,
void **  ppv 
)
static

Definition at line 846 of file cstub.c.

847{
848 ok(IsEqualIID(iid, &IID_if1) ||
849 IsEqualIID(iid, &IID_if2), "incorrect iid\n");
850 *ppv = (void*)This;
851 return S_OK;
852}

◆ connect_test_orig_release()

static ULONG WINAPI connect_test_orig_release ( IUnknown This)
static

Definition at line 855 of file cstub.c.

856{
858 return 0;
859}
static int connect_test_orig_release_called
Definition: cstub.c:854

◆ create_process()

static HANDLE create_process ( const char arg)
static

Definition at line 1222 of file cstub.c.

1223{
1225 STARTUPINFOA si = {0};
1226 char cmdline[200];
1227 char **argv;
1228 BOOL ret;
1229
1230 si.cb = sizeof(si);
1232 sprintf(cmdline, "\"%s\" %s %s", argv[0], argv[1], arg);
1233 ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
1234 ok(ret, "CreateProcess failed: %u\n", GetLastError());
1235 CloseHandle(pi.hThread);
1236 return pi.hProcess;
1237}
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4747
unsigned int BOOL
Definition: ntddk_ex.h:94
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static refpint_t pi[]
Definition: server.c:96
#define argv
Definition: mplay32.c:18
int winetest_get_mainargs(char ***pargv)
TCHAR * cmdline
Definition: stretchblt.cpp:32
DWORD cb
Definition: winbase.h:831
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ create_proxy_test()

static void create_proxy_test ( IPSFactoryBuffer ppsf,
REFIID  iid,
const void expected_vtbl 
)
static

Definition at line 787 of file cstub.c.

788{
790 IUnknown *iface = NULL;
791 HRESULT r;
792 ULONG count;
793
794 r = IPSFactoryBuffer_CreateProxy(ppsf, NULL, iid, &proxy, (void **)&iface);
795 ok( r == S_OK, "IPSFactoryBuffer_CreateProxy failed %x\n", r );
796 ok( *(void **)iface == expected_vtbl, "wrong iface pointer %p/%p\n", *(void **)iface, expected_vtbl );
797 count = IUnknown_Release( iface );
798 ok( count == 1, "wrong refcount %u\n", count );
799 count = IRpcProxyBuffer_Release( proxy );
800 ok( count == 0, "wrong refcount %u\n", count );
801
802 dummy_unknown.ref = 4;
803 r = IPSFactoryBuffer_CreateProxy(ppsf, &dummy_unknown.IUnknown_iface, iid, &proxy,
804 (void **)&iface);
805 ok( r == S_OK, "IPSFactoryBuffer_CreateProxy failed %x\n", r );
806 ok( dummy_unknown.ref == 5, "wrong refcount %u\n", dummy_unknown.ref );
807 ok( *(void **)iface == expected_vtbl, "wrong iface pointer %p/%p\n", *(void **)iface, expected_vtbl );
808 count = IUnknown_Release( iface );
809 ok( count == 4, "wrong refcount %u\n", count );
810 ok( dummy_unknown.ref == 4, "wrong refcount %u\n", dummy_unknown.ref );
811 count = IRpcProxyBuffer_Release( proxy );
812 ok( count == 0, "wrong refcount %u\n", count );
813 ok( dummy_unknown.ref == 4, "wrong refcount %u\n", dummy_unknown.ref );
814}
int proxy
Definition: main.c:67
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LONG ref
Definition: cstub.c:753
IUnknown IUnknown_iface
Definition: cstub.c:752
uint32_t ULONG
Definition: typedefs.h:59

Referenced by test_CreateProxy().

◆ create_stub()

static IRpcStubBuffer * create_stub ( IPSFactoryBuffer ppsf,
REFIID  iid,
IUnknown obj,
HRESULT  expected_result 
)
static

Definition at line 712 of file cstub.c.

713{
714 IRpcStubBuffer *pstub = NULL;
715 HRESULT r;
716
717 r = IPSFactoryBuffer_CreateStub(ppsf, iid, obj, &pstub);
718 ok(r == expected_result, "CreateStub returned %08x expected %08x\n", r, expected_result);
719 return pstub;
720}
const char * expected_result
Definition: mimeole.c:1468

◆ create_stub_test_fail_QI()

static HRESULT WINAPI create_stub_test_fail_QI ( IUnknown This,
REFIID  iid,
void **  ppv 
)
static

Definition at line 736 of file cstub.c.

737{
738 ok(IsEqualIID(iid, &IID_if1), "incorrect iid\n");
739 *ppv = NULL;
740 return E_NOINTERFACE;
741}

◆ create_stub_test_QI()

static HRESULT WINAPI create_stub_test_QI ( IUnknown This,
REFIID  iid,
void **  ppv 
)
static

Definition at line 722 of file cstub.c.

723{
724 ok(IsEqualIID(iid, &IID_if1), "incorrect iid\n");
725 *ppv = (void*)0xdeadbeef;
726 return S_OK;
727}

◆ DEFINE_GUID()

DEFINE_GUID ( CLSID_test1  ,
0xdeadf00d  ,
0x0001  ,
0x44c7  ,
0x85  ,
0x0f  ,
0x2a  ,
0x0f  ,
0x46  ,
0x5c  ,
0x0c  ,
0x6c   
)

◆ delegating_invoke_chan_add_ref()

static ULONG WINAPI delegating_invoke_chan_add_ref ( IRpcChannelBuffer pchan)
static

Definition at line 1074 of file cstub.c.

1075{
1076 return 2;
1077}

◆ delegating_invoke_chan_free_buffer()

static HRESULT WINAPI delegating_invoke_chan_free_buffer ( IRpcChannelBuffer pchan,
RPCOLEMESSAGE *  pMessage 
)
static

Definition at line 1100 of file cstub.c.

1102{
1103 ok(0, "call to FreeBuffer not expected\n");
1104 return E_NOTIMPL;
1105}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ delegating_invoke_chan_get_buffer()

static HRESULT WINAPI delegating_invoke_chan_get_buffer ( IRpcChannelBuffer pchan,
RPCOLEMESSAGE *  msg,
REFIID  iid 
)
static

Definition at line 1084 of file cstub.c.

1087{
1088 msg->Buffer = HeapAlloc(GetProcessHeap(), 0, msg->cbBuffer);
1089 return S_OK;
1090}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733

◆ delegating_invoke_chan_get_dest_ctx()

static HRESULT WINAPI delegating_invoke_chan_get_dest_ctx ( IRpcChannelBuffer pchan,
DWORD pdwDestContext,
void **  ppvDestContext 
)
static

Definition at line 1107 of file cstub.c.

1110{
1111 *pdwDestContext = MSHCTX_LOCAL;
1112 *ppvDestContext = NULL;
1113 return S_OK;
1114}

◆ delegating_invoke_chan_is_connected()

static HRESULT WINAPI delegating_invoke_chan_is_connected ( IRpcChannelBuffer pchan)
static

Definition at line 1116 of file cstub.c.

1117{
1118 ok(0, "call to IsConnected not expected\n");
1119 return E_NOTIMPL;
1120}

◆ delegating_invoke_chan_query_interface()

static HRESULT WINAPI delegating_invoke_chan_query_interface ( IRpcChannelBuffer pchan,
REFIID  iid,
void **  ppv 
)
static

Definition at line 1066 of file cstub.c.

1069{
1070 ok(0, "call to QueryInterface not expected\n");
1071 return E_NOINTERFACE;
1072}

◆ delegating_invoke_chan_release()

static ULONG WINAPI delegating_invoke_chan_release ( IRpcChannelBuffer pchan)
static

Definition at line 1079 of file cstub.c.

1080{
1081 return 1;
1082}

◆ delegating_invoke_chan_send_receive()

static HRESULT WINAPI delegating_invoke_chan_send_receive ( IRpcChannelBuffer pchan,
RPCOLEMESSAGE *  pMessage,
ULONG pStatus 
)
static

Definition at line 1092 of file cstub.c.

1095{
1096 ok(0, "call to SendReceive not expected\n");
1097 return E_NOTIMPL;
1098}

◆ delegating_invoke_test_addref()

static ULONG WINAPI delegating_invoke_test_addref ( ITypeLib pUnk)
static

Definition at line 1034 of file cstub.c.

1035{
1036 return 1;
1037}

◆ delegating_invoke_test_get_type_info_count()

static UINT WINAPI delegating_invoke_test_get_type_info_count ( ITypeLib pUnk)
static

Definition at line 1044 of file cstub.c.

1045{
1046 return 0xabcdef;
1047}

◆ delegating_invoke_test_QI()

static HRESULT WINAPI delegating_invoke_test_QI ( ITypeLib pUnk,
REFIID  iid,
void **  ppv 
)
static

Definition at line 1027 of file cstub.c.

1028{
1029
1030 *ppv = pUnk;
1031 return S_OK;
1032}
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

◆ delegating_invoke_test_release()

static ULONG WINAPI delegating_invoke_test_release ( ITypeLib pUnk)
static

Definition at line 1039 of file cstub.c.

1040{
1041 return 1;
1042}

◆ dummy_AddRef()

static ULONG WINAPI dummy_AddRef ( LPUNKNOWN  iface)
static

Definition at line 767 of file cstub.c.

768{
769 struct dummy_unknown *this = impl_from_IUnknown(iface);
770 return InterlockedIncrement( &this->ref );
771}
#define InterlockedIncrement
Definition: armddk.h:53
static struct dummy_unknown * impl_from_IUnknown(IUnknown *iface)
Definition: cstub.c:756
Definition: send.c:48

◆ dummy_QueryInterface()

static HRESULT WINAPI dummy_QueryInterface ( IUnknown This,
REFIID  iid,
void **  ppv 
)
static

Definition at line 761 of file cstub.c.

762{
763 *ppv = NULL;
764 return E_NOINTERFACE;
765}

◆ dummy_Release()

static ULONG WINAPI dummy_Release ( LPUNKNOWN  iface)
static

Definition at line 773 of file cstub.c.

774{
775 struct dummy_unknown *this = impl_from_IUnknown(iface);
776 return InterlockedDecrement( &this->ref );
777}
#define InterlockedDecrement
Definition: armddk.h:52

◆ if1_fn1_Proxy()

static HRESULT WINAPI if1_fn1_Proxy ( void This)
static

Definition at line 131 of file cstub.c.

132{
133 return S_OK;
134}

Referenced by CINTERFACE_PROXY_VTABLE(), and test_NdrDllGetClassObject().

◆ if1_fn1_Stub()

static void __RPC_STUB if1_fn1_Stub ( IRpcStubBuffer This,
IRpcChannelBuffer _pRpcChannelBuffer,
PRPC_MESSAGE  _pRpcMessage,
DWORD _pdwStubPhase 
)
static

Definition at line 136 of file cstub.c.

141{
142 trace("fn1 stub\n");
143}
#define trace
Definition: atltest.h:70

◆ if1_fn2_Proxy()

static HRESULT WINAPI if1_fn2_Proxy ( void This)
static

Definition at line 145 of file cstub.c.

146{
147 return S_OK;
148}

Referenced by CINTERFACE_PROXY_VTABLE(), and test_NdrDllGetClassObject().

◆ if1_fn2_Stub()

static void __RPC_STUB if1_fn2_Stub ( IRpcStubBuffer This,
IRpcChannelBuffer _pRpcChannelBuffer,
PRPC_MESSAGE  _pRpcMessage,
DWORD _pdwStubPhase 
)
static

Definition at line 150 of file cstub.c.

155{
156 trace("fn2 stub\n");
157}

◆ iid_lookup()

static int __stdcall iid_lookup ( const IID pIID,
int pIndex 
)
static

Definition at line 410 of file cstub.c.

411{
413
414 IID_BS_LOOKUP_INITIAL_TEST( cstub, 4, 4 )
415 IID_BS_LOOKUP_NEXT_TEST( cstub, 2 )
416 IID_BS_LOOKUP_NEXT_TEST( cstub, 1 )
418
419}
_Out_ PULONG _Out_ PULONG pIndex
Definition: ndis.h:4565
#define IID_BS_LOOKUP_RETURN_RESULT(name, sz, index)
Definition: rpcproxy.h:233
#define IID_BS_LOOKUP_INITIAL_TEST(name, sz, split)
Definition: rpcproxy.h:231
#define IID_BS_LOOKUP_SETUP
Definition: rpcproxy.h:229
#define IID_BS_LOOKUP_NEXT_TEST(name, split)
Definition: rpcproxy.h:232

◆ impl_from_IUnknown()

static struct dummy_unknown * impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 756 of file cstub.c.

757{
758 return CONTAINING_RECORD(iface, struct dummy_unknown, IUnknown_iface);
759}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by dummy_AddRef(), and dummy_Release().

◆ local_server_proc()

static void local_server_proc ( void  )
static

Definition at line 1332 of file cstub.c.

1333{
1334 DWORD obj_cookie, ps_cookie, index;
1335 HANDLE stop_event, ready_event;
1336 IPSFactoryBuffer *ps;
1337 HRESULT hr;
1338
1339 stop_event = OpenEventA(EVENT_ALL_ACCESS, FALSE, "wine_cstub_test_server_stop");
1340 ready_event = OpenEventA(EVENT_ALL_ACCESS, FALSE, "wine_cstub_test_server_ready");
1341
1343
1344 hr = CoRegisterClassObject(&CLSID_test1, (IUnknown *)&test_cf,
1345 CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &obj_cookie);
1346 ok(hr == S_OK, "got %#x\n", hr);
1347
1348 hr = NdrDllGetClassObject(&CLSID_test_ps, &IID_IPSFactoryBuffer, (void **)&ps,
1349 &aProxyFileList, &CLSID_test_ps, &gPFactory);
1350 ok(hr == S_OK, "got %#x\n", hr);
1351
1352 hr = CoRegisterClassObject(&CLSID_test_ps, (IUnknown *)ps,
1353 CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &ps_cookie);
1354 ok(hr == S_OK, "got %#x\n", hr);
1355
1356 hr = CoRegisterPSClsid(&IID_ITest1, &CLSID_test_ps);
1357 ok(hr == S_OK, "got %#x\n", hr);
1358
1359 SetEvent(ready_event);
1360
1361 hr = CoWaitForMultipleHandles(0, 1000, 1, &stop_event, &index);
1362 ok(hr == S_OK, "got %#x\n", hr);
1363 ok(!index, "got %u\n", index);
1364
1365 hr = CoRevokeClassObject(ps_cookie);
1366 ok(hr == S_OK, "got %#x\n", hr);
1367
1368 hr = CoRevokeClassObject(obj_cookie);
1369 ok(hr == S_OK, "got %#x\n", hr);
1370
1372 ExitProcess(0);
1373}
#define index(s, c)
Definition: various.h:29
HRESULT WINAPI NdrDllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid, CStdPSFactoryBuffer *pPSFactoryBuffer)
Definition: cpsf.c:182
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1487
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2897
HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags, DWORD dwTimeout, ULONG cHandles, LPHANDLE pHandles, LPDWORD lpdwindex)
Definition: compobj.c:4578
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1086
HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
Definition: compobj.c:2778
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint index
Definition: glext.h:6031
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
const ProxyFileInfo * aProxyFileList
static IClassFactory test_cf
Definition: cstub.c:1327
CStdPSFactoryBuffer gPFactory
HANDLE stop_event
Definition: nfs41_daemon.c:55
@ REGCLS_MULTIPLEUSE
Definition: objbase.h:393
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName)
Definition: synch.c:669

Referenced by START_TEST().

◆ my_alloc()

static void *CALLBACK my_alloc ( SIZE_T  size)
static

Definition at line 66 of file cstub.c.

67{
69 return NdrOleAllocate(size);
70}
GLsizeiptr size
Definition: glext.h:5919
static int my_alloc_called
Definition: cstub.c:63
void *WINAPI NdrOleAllocate(SIZE_T Size)
Definition: ndr_ole.c:423

◆ my_free()

static void CALLBACK my_free ( void ptr)
static

Definition at line 72 of file cstub.c.

73{
76}
static int my_free_called
Definition: cstub.c:64
void WINAPI NdrOleFree(void *NodeToFree)
Definition: ndr_ole.c:432

◆ release_test_pretend_psfacbuf_release()

static ULONG WINAPI release_test_pretend_psfacbuf_release ( IUnknown pUnk)
static

Definition at line 984 of file cstub.c.

985{
987 return 1;
988}
static int release_test_psfacbuf_release_called
Definition: cstub.c:983

◆ START_TEST()

START_TEST ( cstub  )

Definition at line 1421 of file cstub.c.

1422{
1423 IPSFactoryBuffer *ppsf;
1424 int argc;
1425 char **argv;
1426
1428 if (argc > 2 && !strcmp(argv[2], "server"))
1429 {
1431 return;
1432 }
1433
1435
1438 test_CreateProxy(ppsf);
1439 test_CreateStub(ppsf);
1440 test_Connect(ppsf);
1441 test_Disconnect(ppsf);
1442 test_Release(ppsf);
1446
1448}
static int argc
Definition: ServiceArgs.c:12
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
static void test_delegated_methods(void)
Definition: cstub.c:1375
static void test_CreateProxy(IPSFactoryBuffer *ppsf)
Definition: cstub.c:816
static void test_NdrDllRegisterProxy(void)
Definition: cstub.c:1198
static void test_delegating_Invoke(IPSFactoryBuffer *ppsf)
Definition: cstub.c:1134
static void test_Connect(IPSFactoryBuffer *ppsf)
Definition: cstub.c:919
static void test_Release(IPSFactoryBuffer *ppsf)
Definition: cstub.c:997
static void local_server_proc(void)
Definition: cstub.c:1332
static void test_CreateStub(IPSFactoryBuffer *ppsf)
Definition: cstub.c:824
static IPSFactoryBuffer * test_NdrDllGetClassObject(void)
Definition: cstub.c:481
static void test_Disconnect(IPSFactoryBuffer *ppsf)
Definition: cstub.c:968
static void test_NdrStubForwardingFunction(void)
Definition: cstub.c:693

◆ test1_AddRef()

static ULONG WINAPI test1_AddRef ( ITest1 iface)
static

Definition at line 1253 of file cstub.c.

1254{
1255 return 2;
1256}

◆ test1_GetClassID()

static HRESULT WINAPI test1_GetClassID ( ITest1 iface,
CLSID clsid 
)
static

Definition at line 1263 of file cstub.c.

1264{
1265 *clsid = CLSID_test1;
1266 return S_OK;
1267}
REFCLSID clsid
Definition: msctf.c:82

◆ test1_QueryInterface()

static HRESULT WINAPI test1_QueryInterface ( ITest1 iface,
REFIID  iid,
void **  out 
)
static

Definition at line 1241 of file cstub.c.

1242{
1243 if (winetest_debug > 1) trace("%s\n", wine_dbgstr_guid(iid));
1244 if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_ITest1))
1245 {
1246 *out = iface;
1247 return S_OK;
1248 }
1249 *out = NULL;
1250 return E_NOINTERFACE;
1251}
const GUID IID_IUnknown
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static FILE * out
Definition: regtests2xml.c:44
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
int winetest_debug

◆ test1_Release()

static ULONG WINAPI test1_Release ( ITest1 iface)
static

Definition at line 1258 of file cstub.c.

1259{
1260 return 1;
1261}

◆ test1_square()

static int WINAPI test1_square ( ITest1 iface,
int  x 
)
static

Definition at line 1269 of file cstub.c.

1270{
1271 return x * x;
1272}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548

◆ test_cf_AddRef()

static ULONG WINAPI test_cf_AddRef ( IClassFactory iface)
static

Definition at line 1294 of file cstub.c.

1295{
1296 return 2;
1297}

◆ test_cf_CreateInstance()

static HRESULT WINAPI test_cf_CreateInstance ( IClassFactory iface,
IUnknown outer,
REFIID  iid,
void **  out 
)
static

Definition at line 1304 of file cstub.c.

1305{
1306 ITest1 *obj = heap_alloc(sizeof(*obj));
1307
1308 obj->lpVtbl = &test1_vtbl;
1309
1310 return ITest1_QueryInterface(obj, iid, out);
1311}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
Definition: cstub.idl:30
static const ITest1Vtbl test1_vtbl
Definition: cstub.c:1274

◆ test_cf_LockServer()

static HRESULT WINAPI test_cf_LockServer ( IClassFactory iface,
BOOL  lock 
)
static

Definition at line 1313 of file cstub.c.

1314{
1315 return S_OK;
1316}

◆ test_cf_QueryInterface()

static HRESULT WINAPI test_cf_QueryInterface ( IClassFactory iface,
REFIID  iid,
void **  out 
)
static

Definition at line 1283 of file cstub.c.

1284{
1286 {
1287 *out = iface;
1288 return S_OK;
1289 }
1290 *out = NULL;
1291 return E_NOINTERFACE;
1292}
const GUID IID_IClassFactory

◆ test_cf_Release()

static ULONG WINAPI test_cf_Release ( IClassFactory iface)
static

Definition at line 1299 of file cstub.c.

1300{
1301 return 1;
1302}

◆ test_Connect()

static void test_Connect ( IPSFactoryBuffer ppsf)
static

Definition at line 919 of file cstub.c.

920{
921 IUnknownVtbl *orig_vtbl = &connect_test_orig_vtbl;
922 IUnknownVtbl *new_vtbl = &connect_test_new_vtbl;
923 IUnknownVtbl *new_fail_vtbl = &connect_test_new_fail_vtbl;
924 IUnknown *obj = (IUnknown*)&orig_vtbl;
925 IRpcStubBuffer *pstub = create_stub(ppsf, &IID_if1, obj, S_OK);
926 CStdStubBuffer *cstd_stub = (CStdStubBuffer*)pstub;
927 IRpcStubBufferVtbl *base_stub_buf_vtbl = &connect_test_base_stub_buffer_vtbl;
928 HRESULT r;
929
930 obj = (IUnknown*)&new_vtbl;
931 r = IRpcStubBuffer_Connect(pstub, obj);
932 ok(r == S_OK, "r %08x\n", r);
934 ok(cstd_stub->pvServerObject == (void*)0xcafebabe, "pvServerObject %p\n", cstd_stub->pvServerObject);
935
936 cstd_stub->pvServerObject = (IUnknown*)&orig_vtbl;
937 obj = (IUnknown*)&new_fail_vtbl;
938 r = IRpcStubBuffer_Connect(pstub, obj);
939 ok(r == E_NOINTERFACE, "r %08x\n", r);
940 ok(cstd_stub->pvServerObject == (void*)0xdeadbeef, "pvServerObject %p\n", cstd_stub->pvServerObject);
942
943 /* Now use a delegated stub.
944
945 We know from the NdrStubForwardFunction test that
946 (void**)pstub-1 is the base interface stub buffer. This shows
947 that (void**)pstub-2 contains the address of a vtable that gets
948 passed to the base interface's Connect method. Note that
949 (void**)pstub-2 itself gets passed to Connect and not
950 *((void**)pstub-2), so it should contain the vtable ptr and not
951 an interface ptr. */
952
953 obj = (IUnknown*)&orig_vtbl;
954 pstub = create_stub(ppsf, &IID_if2, obj, S_OK);
955 *((void**)pstub-1) = &base_stub_buf_vtbl;
956 *((void**)pstub-2) = (void*)0xbeefcafe;
957
958 obj = (IUnknown*)&new_vtbl;
959 r = IRpcStubBuffer_Connect(pstub, obj);
960 ok(r == S_OK, "r %08x\n", r);
961 ok(connect_test_base_Connect_called == 1, "connect_test_bsae_Connect called %d times\n",
964 cstd_stub = (CStdStubBuffer*)pstub;
965 ok(cstd_stub->pvServerObject == (void*)0xcafebabe, "pvServerObject %p\n", cstd_stub->pvServerObject);
966}
HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub) DECLSPEC_HIDDEN
Definition: ndr_ole.c:466
static IUnknownVtbl connect_test_orig_vtbl
Definition: cstub.c:861
static IUnknownVtbl connect_test_new_vtbl
Definition: cstub.c:876
static IRpcStubBufferVtbl connect_test_base_stub_buffer_vtbl
Definition: cstub.c:905
static IUnknownVtbl connect_test_new_fail_vtbl
Definition: cstub.c:890
struct IUnknown * pvServerObject
Definition: rpcproxy.h:112

Referenced by START_TEST().

◆ test_CreateProxy()

static void test_CreateProxy ( IPSFactoryBuffer ppsf)
static

Definition at line 816 of file cstub.c.

817{
818 create_proxy_test( ppsf, &IID_if1, if1_proxy_vtbl.Vtbl );
819 create_proxy_test( ppsf, &IID_if2, if2_proxy_vtbl.Vtbl );
820 create_proxy_test( ppsf, &IID_if3, if3_proxy_vtbl.Vtbl );
821 create_proxy_test( ppsf, &IID_if4, if4_proxy_vtbl.Vtbl );
822}
static void create_proxy_test(IPSFactoryBuffer *ppsf, REFIID iid, const void *expected_vtbl)
Definition: cstub.c:787
static GUID IID_if3
Definition: cstub.c:59

Referenced by START_TEST().

◆ test_CreateStub()

static void test_CreateStub ( IPSFactoryBuffer ppsf)
static

Definition at line 824 of file cstub.c.

825{
826 IUnknownVtbl *vtbl = &create_stub_test_vtbl;
827 IUnknown *obj = (IUnknown*)&vtbl;
828 IRpcStubBuffer *pstub = create_stub(ppsf, &IID_if1, obj, S_OK);
829 CStdStubBuffer *cstd_stub = (CStdStubBuffer*)pstub;
830 const CInterfaceStubHeader *header = &CONTAINING_RECORD(cstd_stub->lpVtbl, const CInterfaceStubVtbl, Vtbl)->header;
831
832 ok(IsEqualIID(header->piid, &IID_if1), "header iid differs\n");
833 ok(cstd_stub->RefCount == 1, "ref count %d\n", cstd_stub->RefCount);
834 /* 0xdeadbeef returned from create_stub_test_QI */
835 ok(cstd_stub->pvServerObject == (void*)0xdeadbeef, "pvServerObject %p\n", cstd_stub->pvServerObject);
836 ok(cstd_stub->pPSFactory != NULL, "pPSFactory was NULL\n");
837 cstd_stub->pvServerObject = NULL;
838 IRpcStubBuffer_Release(pstub);
839
841 pstub = create_stub(ppsf, &IID_if1, obj, E_NOINTERFACE);
842 ok(pstub == S_OK, "create_stub failed: %u\n", GetLastError());
843
844}
static IUnknownVtbl create_stub_test_fail_vtbl
Definition: cstub.c:743
static IUnknownVtbl create_stub_test_vtbl
Definition: cstub.c:729
const IRpcStubBufferVtbl * lpVtbl
Definition: rpcproxy.h:110
struct IPSFactoryBuffer * pPSFactory
Definition: rpcproxy.h:115

Referenced by START_TEST().

◆ test_CStdStubBuffer2_Release()

static ULONG WINAPI test_CStdStubBuffer2_Release ( IRpcStubBuffer This)
static

Definition at line 52 of file cstub.c.

53{
55}
ULONG WINAPI NdrCStdStubBuffer2_Release(LPRPCSTUBBUFFER iface, LPPSFACTORYBUFFER pPSF)
Definition: cstub.c:438

◆ test_CStdStubBuffer_Release()

static ULONG WINAPI test_CStdStubBuffer_Release ( IRpcStubBuffer This)
static

Definition at line 47 of file cstub.c.

48{
50}
ULONG WINAPI NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface, LPPSFACTORYBUFFER pPSF)
Definition: cstub.c:417

◆ test_delegated_methods()

static void test_delegated_methods ( void  )
static

Definition at line 1375 of file cstub.c.

1376{
1377 HANDLE process, stop_event, ready_event;
1378 IPSFactoryBuffer *ps;
1379 ITest1 *test_obj;
1380 DWORD ps_cookie;
1381 CLSID clsid;
1382 HRESULT hr;
1383 int ret;
1384
1385 stop_event = CreateEventA(NULL, TRUE, FALSE, "wine_cstub_test_server_stop");
1386 ready_event = CreateEventA(NULL, TRUE, FALSE, "wine_cstub_test_server_ready");
1387
1388 process = create_process("server");
1389 ok(!WaitForSingleObject(ready_event, 1000), "wait failed\n");
1390
1391 hr = NdrDllGetClassObject(&CLSID_test_ps, &IID_IPSFactoryBuffer, (void **)&ps,
1392 &aProxyFileList, &CLSID_test_ps, &gPFactory);
1393 ok(hr == S_OK, "got %#x\n", hr);
1394
1395 hr = CoRegisterClassObject(&CLSID_test_ps, (IUnknown *)ps,
1396 CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &ps_cookie);
1397 ok(hr == S_OK, "got %#x\n", hr);
1398
1399 hr = CoRegisterPSClsid(&IID_ITest1, &CLSID_test_ps);
1400 ok(hr == S_OK, "got %#x\n", hr);
1401
1402 hr = CoCreateInstance(&CLSID_test1, NULL, CLSCTX_LOCAL_SERVER, &IID_ITest1, (void **)&test_obj);
1403 ok(hr == S_OK, "got %#x\n", hr);
1404
1405 ret = ITest1_square(test_obj, 3);
1406 ok(ret == 9, "got %d\n", ret);
1407
1408 hr = ITest1_GetClassID(test_obj, &clsid);
1409 ok(hr == S_OK, "got %#x\n", hr);
1410 ok(IsEqualGUID(&clsid, &CLSID_test1), "got %s\n", wine_dbgstr_guid(&clsid));
1411
1412 ITest1_Release(test_obj);
1413
1415 ok(!WaitForSingleObject(process, 1000), "wait failed\n");
1416
1417 hr = CoRevokeClassObject(ps_cookie);
1418 ok(hr == S_OK, "got %#x\n", hr);
1419}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define create_process(cmd, pi)
Definition: process.c:2408
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:637

Referenced by START_TEST().

◆ test_delegating_Invoke()

static void test_delegating_Invoke ( IPSFactoryBuffer ppsf)
static

Definition at line 1134 of file cstub.c.

1135{
1136 ITypeLibVtbl *obj_vtbl = &delegating_invoke_test_obj_vtbl;
1137 IUnknown *obj = (IUnknown*)&obj_vtbl;
1138 IRpcStubBuffer *pstub = create_stub(ppsf, &IID_if2, obj, S_OK);
1139 IRpcChannelBufferVtbl *pchan_vtbl = &delegating_invoke_test_rpc_chan_vtbl;
1140 IRpcChannelBuffer *pchan = (IRpcChannelBuffer *)&pchan_vtbl;
1141 HRESULT r = E_FAIL;
1142 RPCOLEMESSAGE msg;
1143
1144 memset(&msg, 0, sizeof(msg));
1145 msg.dataRepresentation = NDR_LOCAL_DATA_REPRESENTATION;
1146 msg.iMethod = 3;
1147 r = IRpcStubBuffer_Invoke(pstub, &msg, pchan);
1148 ok(r == S_OK, "ret %08x\n", r);
1149 if(r == S_OK)
1150 {
1151 ok(*(DWORD*)msg.Buffer == 0xabcdef, "buf[0] %08x\n", *(DWORD*)msg.Buffer);
1152 ok(*((DWORD*)msg.Buffer + 1) == S_OK, "buf[1] %08x\n", *((DWORD*)msg.Buffer + 1));
1153 }
1154 /* free the buffer allocated by delegating_invoke_chan_get_buffer */
1155 HeapFree(GetProcessHeap(), 0, msg.Buffer);
1156 IRpcStubBuffer_Release(pstub);
1157}
#define E_FAIL
Definition: ddrawi.h:102
#define HeapFree(x, y, z)
Definition: compat.h:735
static IRpcChannelBufferVtbl delegating_invoke_test_rpc_chan_vtbl
Definition: cstub.c:1122
static ITypeLibVtbl delegating_invoke_test_obj_vtbl
Definition: cstub.c:1049
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:107
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_Disconnect()

static void test_Disconnect ( IPSFactoryBuffer ppsf)
static

Definition at line 968 of file cstub.c.

969{
970 IUnknownVtbl *orig_vtbl = &connect_test_orig_vtbl;
971 IUnknown *obj = (IUnknown*)&orig_vtbl;
972 IRpcStubBuffer *pstub = create_stub(ppsf, &IID_if1, obj, S_OK);
973 CStdStubBuffer *cstd_stub = (CStdStubBuffer*)pstub;
974
976 IRpcStubBuffer_Disconnect(pstub);
978 ok(cstd_stub->pvServerObject == NULL, "pvServerObject %p\n", cstd_stub->pvServerObject);
979 IRpcStubBuffer_Release(pstub);
980}

Referenced by START_TEST().

◆ test_NdrDllGetClassObject()

static IPSFactoryBuffer * test_NdrDllGetClassObject ( void  )
static

Definition at line 481 of file cstub.c.

482{
483 HMODULE rpcrt4 = GetModuleHandleA("rpcrt4.dll");
484 IPSFactoryBuffer *ppsf = NULL;
485 const PCInterfaceProxyVtblList* proxy_vtbl;
486 const PCInterfaceStubVtblList* stub_vtbl;
487 const CLSID CLSID_Unknown = {0x45678, 0x1234, 0x6666, {0xff, 0x67, 0x45, 0x98, 0x76, 0x12, 0x34, 0x56}};
488 static const GUID * const interfaces[] = { &IID_if1, &IID_if2, &IID_if3, &IID_if4 };
489 UINT i;
490 HRESULT r;
491 HMODULE hmod = GetModuleHandleA("rpcrt4.dll");
492 void *CStd_QueryInterface = GetProcAddress(hmod, "CStdStubBuffer_QueryInterface");
493 void *CStd_AddRef = GetProcAddress(hmod, "CStdStubBuffer_AddRef");
494 void *CStd_Release = GetProcAddress(hmod, "NdrCStdStubBuffer_Release");
495 void *CStd_Connect = GetProcAddress(hmod, "CStdStubBuffer_Connect");
496 void *CStd_Disconnect = GetProcAddress(hmod, "CStdStubBuffer_Disconnect");
497 void *CStd_Invoke = GetProcAddress(hmod, "CStdStubBuffer_Invoke");
498 void *CStd_IsIIDSupported = GetProcAddress(hmod, "CStdStubBuffer_IsIIDSupported");
499 void *CStd_CountRefs = GetProcAddress(hmod, "CStdStubBuffer_CountRefs");
500 void *CStd_DebugServerQueryInterface = GetProcAddress(hmod, "CStdStubBuffer_DebugServerQueryInterface");
501 void *CStd_DebugServerRelease = GetProcAddress(hmod, "CStdStubBuffer_DebugServerRelease");
502
503 r = NdrDllGetClassObject(&CLSID_Unknown, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
505 ok(r == CLASS_E_CLASSNOTAVAILABLE, "NdrDllGetClassObject with unknown clsid should have returned CLASS_E_CLASSNOTAVAILABLE instead of 0x%x\n", r);
506 ok(ppsf == NULL, "NdrDllGetClassObject should have set ppsf to NULL on failure\n");
507
508 r = NdrDllGetClassObject(&CLSID_psfact, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
510
511 ok(r == S_OK, "ret %08x\n", r);
512 ok(ppsf != NULL, "ppsf == NULL\n");
513
514 proxy_vtbl = PSFactoryBuffer.pProxyFileList[0]->pProxyVtblList;
515 stub_vtbl = PSFactoryBuffer.pProxyFileList[0]->pStubVtblList;
516 ok(PSFactoryBuffer.pProxyFileList == proxy_file_list, "pfl not the same\n");
517 ok(proxy_vtbl == (PCInterfaceProxyVtblList *) &cstub_ProxyVtblList, "proxy vtbllist not the same\n");
518 ok(stub_vtbl == (PCInterfaceStubVtblList *) &cstub_StubVtblList, "stub vtbllist not the same\n");
519
520 /* if1 is non-delegating, if2 is delegating, if3 is non-delegating
521 but I've zero'ed the vtbl entries, similarly if4 is delegating
522 with zero'ed vtbl entries */
523
524#define VTBL_TEST_NOT_CHANGE_TO(name, i) \
525 ok(stub_vtbl[i]->Vtbl.name != CStd_##name, #name "vtbl %d updated %p %p\n", \
526 i, stub_vtbl[i]->Vtbl.name, CStd_##name )
527#define VTBL_TEST_CHANGE_TO(name, i) \
528 ok(check_address(stub_vtbl[i]->Vtbl.name, CStd_##name), #name "vtbl %d not updated %p %p\n", \
529 i, stub_vtbl[i]->Vtbl.name, CStd_##name )
530#define VTBL_TEST_ZERO(name, i) \
531 ok(stub_vtbl[i]->Vtbl.name == NULL, #name "vtbl %d not null %p\n", \
532 i, stub_vtbl[i]->Vtbl.name )
533
538 VTBL_TEST_NOT_CHANGE_TO(Disconnect, 0);
539 VTBL_TEST_NOT_CHANGE_TO(Invoke, 0);
540 VTBL_TEST_NOT_CHANGE_TO(IsIIDSupported, 0);
541 VTBL_TEST_NOT_CHANGE_TO(CountRefs, 0);
542 VTBL_TEST_NOT_CHANGE_TO(DebugServerQueryInterface, 0);
543 VTBL_TEST_NOT_CHANGE_TO(DebugServerRelease, 0);
544
549 VTBL_TEST_NOT_CHANGE_TO(Disconnect, 1);
550 VTBL_TEST_CHANGE_TO(Invoke, 1);
551 VTBL_TEST_CHANGE_TO(IsIIDSupported, 1);
552 VTBL_TEST_NOT_CHANGE_TO(CountRefs, 1);
553 VTBL_TEST_CHANGE_TO(DebugServerQueryInterface, 1);
554 VTBL_TEST_CHANGE_TO(DebugServerRelease, 1);
555
560 VTBL_TEST_CHANGE_TO(Disconnect, 2);
561 VTBL_TEST_CHANGE_TO(Invoke, 2);
562 VTBL_TEST_CHANGE_TO(IsIIDSupported, 2);
563 VTBL_TEST_CHANGE_TO(CountRefs, 2);
564 VTBL_TEST_CHANGE_TO(DebugServerQueryInterface, 2);
565 VTBL_TEST_CHANGE_TO(DebugServerRelease, 2);
566
571 VTBL_TEST_NOT_CHANGE_TO(Disconnect, 3);
572 VTBL_TEST_CHANGE_TO(Invoke, 3);
573 VTBL_TEST_CHANGE_TO(IsIIDSupported, 3);
574 VTBL_TEST_NOT_CHANGE_TO(CountRefs, 3);
575 VTBL_TEST_CHANGE_TO(DebugServerQueryInterface, 3);
576 VTBL_TEST_CHANGE_TO(DebugServerRelease, 3);
577
578#define VTBL_PROXY_TEST(i,num,ptr) \
579 ok( check_address(proxy_vtbl[i]->Vtbl[num], (ptr)), "wrong proxy %u func %u %p/%p\n", \
580 (i), (num), proxy_vtbl[i]->Vtbl[num], (ptr) )
581#define VTBL_PROXY_TEST_NOT_ZERO(i,num) \
582 ok( proxy_vtbl[i]->Vtbl[num] != NULL, "wrong proxy %u func %u is NULL\n", (i), (num))
583
589
590 VTBL_PROXY_TEST(1, 0, GetProcAddress(rpcrt4,"IUnknown_QueryInterface_Proxy"));
591 VTBL_PROXY_TEST(1, 1, GetProcAddress(rpcrt4,"IUnknown_AddRef_Proxy"));
592 VTBL_PROXY_TEST(1, 2, GetProcAddress(rpcrt4,"IUnknown_Release_Proxy"));
603
609
610 VTBL_PROXY_TEST(3, 0, GetProcAddress(rpcrt4,"IUnknown_QueryInterface_Proxy"));
611 VTBL_PROXY_TEST(3, 1, GetProcAddress(rpcrt4,"IUnknown_AddRef_Proxy"));
612 VTBL_PROXY_TEST(3, 2, GetProcAddress(rpcrt4,"IUnknown_Release_Proxy"));
617
618#undef VTBL_TEST_NOT_CHANGE_TO
619#undef VTBL_TEST_CHANGE_TO
620#undef VTBL_TEST_ZERO
621#undef VTBL_PROXY_TEST
622#undef VTBL_PROXY_TEST_NOT_ZERO
623
624 for (i = 0; i < ARRAY_SIZE(interfaces); i++)
625 ok( proxy_vtbl[i]->header.piid == interfaces[i],
626 "wrong proxy %u iid %p/%p\n", i, proxy_vtbl[i]->header.piid, interfaces[i] );
627
628 ok(PSFactoryBuffer.RefCount == 1, "ref count %d\n", PSFactoryBuffer.RefCount);
629 IPSFactoryBuffer_Release(ppsf);
630
631 /* One can also search by IID */
632 r = NdrDllGetClassObject(&IID_if3, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
634 ok(r == S_OK, "ret %08x\n", r);
635 ok(ppsf != NULL, "ppsf == NULL\n");
636 IPSFactoryBuffer_Release(ppsf);
637
638 r = NdrDllGetClassObject(&IID_if3, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
640 ok(r == S_OK, "ret %08x\n", r);
641 ok(ppsf != NULL, "ppsf == NULL\n");
642 IPSFactoryBuffer_Release(ppsf);
643
644 /* but only if the PS factory implements it */
645 r = NdrDllGetClassObject(&IID_IDispatch, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
647 ok(r == CLASS_E_CLASSNOTAVAILABLE, "ret %08x\n", r);
648
649 /* Create it again to return */
650 r = NdrDllGetClassObject(&CLSID_psfact, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
652 ok(r == S_OK, "ret %08x\n", r);
653 ok(ppsf != NULL, "ppsf == NULL\n");
654
655 /* Because this PS factory is not loaded as a dll in the normal way, Windows 8 / 10
656 get confused and will crash when one of the proxies for the delegated ifaces is created.
657 Registering the ifaces fixes this (in fact calling CoRegisterPSClsid() with any IID / CLSID is enough). */
658
660 ok(r == S_OK, "ret %08x\n", r);
662 ok(r == S_OK, "ret %08x\n", r);
664 ok(r == S_OK, "ret %08x\n", r);
666 ok(r == S_OK, "ret %08x\n", r);
667
668 return ppsf;
669}
#define ARRAY_SIZE(A)
Definition: main.h:20
_In_ BOOLEAN Release
Definition: cdrom.h:920
#define GetProcAddress(x, y)
Definition: compat.h:753
_In_ PKSPIN_CONNECT Connect
Definition: ks.h:4536
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
static HRESULT QueryInterface(REFIID, void **)
Definition: events.c:2587
#define todo_wine
Definition: custom.c:89
#define VTBL_TEST_CHANGE_TO(name, i)
static const CInterfaceStubVtbl * cstub_StubVtblList[]
Definition: cstub.c:381
static CLSID CLSID_psfact
Definition: cstub.c:61
#define VTBL_TEST_NOT_CHANGE_TO(name, i)
#define VTBL_TEST_ZERO(name, i)
#define VTBL_PROXY_TEST(i, num, ptr)
#define VTBL_PROXY_TEST_NOT_ZERO(i, num)
static const ProxyFileInfo * proxy_file_list[]
Definition: cstub.c:475
static const CInterfaceProxyVtbl * cstub_ProxyVtblList[]
Definition: cstub.c:372
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
unsigned int UINT
Definition: ndis.h:50
const GUID IID_IDispatch
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663

Referenced by START_TEST().

◆ test_NdrDllRegisterProxy()

static void test_NdrDllRegisterProxy ( void  )
static

Definition at line 1198 of file cstub.c.

1199{
1200 HRESULT res;
1201 const ExtendedProxyFileInfo *pf;
1203
1204
1206 ok(res == E_HANDLE, "Incorrect return code %x\n",res);
1207 pf = NULL;
1209 ok(res == E_NOINTERFACE, "Incorrect return code %x\n",res);
1211 ok(res == E_NOINTERFACE, "Incorrect return code %x\n",res);
1212 /* This fails on Vista and Windows 7 due to permissions */
1214 ok(res == S_OK || res == E_ACCESSDENIED, "NdrDllRegisterProxy failed %x\n",res);
1215 if (res == S_OK)
1216 {
1218 ok(res == S_OK, "NdrDllUnregisterProxy failed %x\n",res);
1219 }
1220}
HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid)
Definition: cpsf.c:221
HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid)
Definition: cpsf.c:298
GLuint res
Definition: glext.h:9613
static const ProxyFileInfo * proxy_file_list2[]
Definition: cstub.c:1193
#define E_HANDLE
Definition: winerror.h:2850
#define E_ACCESSDENIED
Definition: winerror.h:2849

Referenced by START_TEST().

◆ test_NdrStubForwardingFunction()

static void test_NdrStubForwardingFunction ( void  )
static

Definition at line 693 of file cstub.c.

694{
695 void *This[5];
696 void *real_this;
697 IRpcChannelBuffer *channel = (IRpcChannelBuffer*)0xdeadbeef;
698 RPC_MESSAGE *msg = (RPC_MESSAGE*)0xcafebabe;
699 DWORD *phase = (DWORD*)0x12345678;
700 IRpcStubBufferVtbl *base_buffer_vtbl_ptr = &base_buffer_vtbl;
701 IRpcStubBuffer *base_stub_buffer = (IRpcStubBuffer*)&base_buffer_vtbl_ptr;
702
703 memset(This, 0xcc, sizeof(This));
704 This[0] = base_stub_buffer;
705 real_this = &This[1];
706
707 NdrStubForwardingFunction( real_this, channel, msg, phase );
708 ok(base_buffer_invoke_called == 1, "base_buffer_invoke called %d times\n", base_buffer_invoke_called);
709
710}
void __RPC_STUB NdrStubForwardingFunction(IRpcStubBuffer *iface, IRpcChannelBuffer *pChannel, PRPC_MESSAGE pMsg, DWORD *pdwStubPhase)
Definition: cstub.c:624
static IRpcStubBufferVtbl base_buffer_vtbl
Definition: cstub.c:680

Referenced by START_TEST().

◆ test_Release()

static void test_Release ( IPSFactoryBuffer ppsf)
static

Definition at line 997 of file cstub.c.

998{
999 LONG facbuf_refs;
1000 IUnknownVtbl *orig_vtbl = &connect_test_orig_vtbl;
1001 IUnknown *obj = (IUnknown*)&orig_vtbl;
1002 IUnknownVtbl *pretend_psfacbuf_vtbl = &release_test_pretend_psfacbuf_vtbl;
1003 IUnknown *pretend_psfacbuf = (IUnknown *)&pretend_psfacbuf_vtbl;
1004 IRpcStubBuffer *pstub = create_stub(ppsf, &IID_if1, obj, S_OK);
1005 CStdStubBuffer *cstd_stub = (CStdStubBuffer*)pstub;
1006
1007 facbuf_refs = PSFactoryBuffer.RefCount;
1008
1009 /* This shows that NdrCStdStubBuffer_Release doesn't call Disconnect */
1010 ok(cstd_stub->RefCount == 1, "ref count %d\n", cstd_stub->RefCount);
1012 IRpcStubBuffer_Release(pstub);
1013todo_wine {
1015}
1016 ok(PSFactoryBuffer.RefCount == facbuf_refs - 1, "factory buffer refs %d orig %d\n", PSFactoryBuffer.RefCount, facbuf_refs);
1017
1018 /* This shows that NdrCStdStubBuffer_Release calls Release on its 2nd arg, rather than on This->pPSFactory
1019 (which are usually the same and indeed it's odd that _Release requires this 2nd arg). */
1020 pstub = create_stub(ppsf, &IID_if1, obj, S_OK);
1021 ok(PSFactoryBuffer.RefCount == facbuf_refs, "factory buffer refs %d orig %d\n", PSFactoryBuffer.RefCount, facbuf_refs);
1022 NdrCStdStubBuffer_Release(pstub, (IPSFactoryBuffer*)pretend_psfacbuf);
1023 ok(release_test_psfacbuf_release_called == 1, "pretend_psfacbuf_release called %d\n", release_test_psfacbuf_release_called);
1024 ok(PSFactoryBuffer.RefCount == facbuf_refs, "factory buffer refs %d orig %d\n", PSFactoryBuffer.RefCount, facbuf_refs);
1025}
static IUnknownVtbl release_test_pretend_psfacbuf_vtbl
Definition: cstub.c:990
long LONG
Definition: pedump.c:60

Referenced by START_TEST().

Variable Documentation

◆ __MIDL_ProcFormatString

const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString
static
Initial value:
=
{
0,
{
0, 0
}
}

Definition at line 91 of file cstub.c.

◆ __MIDL_TypeFormatString

const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
static
Initial value:
=
{
0,
{
0, 0
}
}

Definition at line 99 of file cstub.c.

◆ aProxyFileList

const ProxyFileInfo* aProxyFileList
extern

◆ base_buffer_invoke_called

int base_buffer_invoke_called
static

Definition at line 671 of file cstub.c.

Referenced by base_buffer_Invoke(), and test_NdrStubForwardingFunction().

◆ base_buffer_vtbl

IRpcStubBufferVtbl base_buffer_vtbl
static
Initial value:
= {
(void*)0xcafebab0,
(void*)0xcafebab1,
(void*)0xcafebab2,
(void*)0xcafebab3,
(void*)0xcafebab4,
(void*)0xcafebab6,
(void*)0xcafebab7,
(void*)0xcafebab8,
(void*)0xcafebab9
}
static HRESULT WINAPI base_buffer_Invoke(IRpcStubBuffer *This, RPCOLEMESSAGE *msg, IRpcChannelBuffer *channel)
Definition: cstub.c:672

Definition at line 680 of file cstub.c.

Referenced by test_NdrStubForwardingFunction().

◆ base_iid_list

const IID* base_iid_list[]
static
Initial value:
=
{
&IID_ITypeLib,
}

Definition at line 399 of file cstub.c.

◆ base_iid_list2

const IID* base_iid_list2[]
static
Initial value:
=
{
}

Definition at line 1173 of file cstub.c.

◆ CLSID_psfact

CLSID CLSID_psfact = {0x1234567c, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}}
static

Definition at line 61 of file cstub.c.

Referenced by test_NdrDllGetClassObject().

◆ connect_test_base_Connect_called

int connect_test_base_Connect_called
static

Definition at line 897 of file cstub.c.

Referenced by connect_test_base_Connect(), and test_Connect().

◆ connect_test_base_stub_buffer_vtbl

IRpcStubBufferVtbl connect_test_base_stub_buffer_vtbl
static
Initial value:
=
{
(void*)0xcafebab0,
(void*)0xcafebab1,
(void*)0xcafebab2,
(void*)0xcafebab4,
(void*)0xcafebab5,
(void*)0xcafebab6,
(void*)0xcafebab7,
(void*)0xcafebab8,
(void*)0xcafebab9
}
static HRESULT WINAPI connect_test_base_Connect(IRpcStubBuffer *pstub, IUnknown *obj)
Definition: cstub.c:898

Definition at line 905 of file cstub.c.

Referenced by test_Connect().

◆ connect_test_new_fail_vtbl

IUnknownVtbl connect_test_new_fail_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI connect_test_new_fail_QI(IUnknown *This, REFIID iid, void **ppv)
Definition: cstub.c:883

Definition at line 890 of file cstub.c.

Referenced by test_Connect().

◆ connect_test_new_vtbl

IUnknownVtbl connect_test_new_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI connect_test_new_QI(IUnknown *This, REFIID iid, void **ppv)
Definition: cstub.c:868

Definition at line 876 of file cstub.c.

Referenced by test_Connect().

◆ connect_test_orig_release_called

int connect_test_orig_release_called
static

Definition at line 854 of file cstub.c.

Referenced by connect_test_orig_release(), test_Connect(), test_Disconnect(), and test_Release().

◆ connect_test_orig_vtbl

IUnknownVtbl connect_test_orig_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI connect_test_orig_QI(IUnknown *This, REFIID iid, void **ppv)
Definition: cstub.c:846
static ULONG WINAPI connect_test_orig_release(IUnknown *This)
Definition: cstub.c:855

Definition at line 861 of file cstub.c.

Referenced by test_Connect(), test_Disconnect(), and test_Release().

◆ create_stub_test_fail_vtbl

IUnknownVtbl create_stub_test_fail_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI create_stub_test_fail_QI(IUnknown *This, REFIID iid, void **ppv)
Definition: cstub.c:736

Definition at line 743 of file cstub.c.

Referenced by test_CreateStub().

◆ create_stub_test_vtbl

IUnknownVtbl create_stub_test_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI create_stub_test_QI(IUnknown *This, REFIID iid, void **ppv)
Definition: cstub.c:722

Definition at line 729 of file cstub.c.

Referenced by test_CreateStub().

◆ cstub_ProxyVtblList

const CInterfaceProxyVtbl* cstub_ProxyVtblList[]
static
Initial value:
=
{
(const CInterfaceProxyVtbl *) &if1_proxy_vtbl,
(const CInterfaceProxyVtbl *) &if2_proxy_vtbl,
(const CInterfaceProxyVtbl *) &if3_proxy_vtbl,
(const CInterfaceProxyVtbl *) &if4_proxy_vtbl,
}

Definition at line 372 of file cstub.c.

Referenced by test_NdrDllGetClassObject().

◆ cstub_ProxyVtblList2

const CInterfaceProxyVtbl* cstub_ProxyVtblList2[]
static
Initial value:
=
{
}

Definition at line 1158 of file cstub.c.

◆ cstub_StubVtblList

const CInterfaceStubVtbl* cstub_StubVtblList[]
static
Initial value:
=
{
}
static CInterfaceStubVtbl if2_stub_vtbl
Definition: cstub.c:277
static CInterfaceStubVtbl if3_stub_vtbl
Definition: cstub.c:317
static CInterfaceStubVtbl if1_stub_vtbl
Definition: cstub.c:195
static CInterfaceStubVtbl if4_stub_vtbl
Definition: cstub.c:361

Definition at line 381 of file cstub.c.

Referenced by test_NdrDllGetClassObject().

◆ cstub_StubVtblList2

const CInterfaceStubVtbl* cstub_StubVtblList2[]
static
Initial value:
=
{
}

Definition at line 1163 of file cstub.c.

◆ delegating_invoke_test_obj_vtbl

ITypeLibVtbl delegating_invoke_test_obj_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI delegating_invoke_test_addref(ITypeLib *pUnk)
Definition: cstub.c:1034
static UINT WINAPI delegating_invoke_test_get_type_info_count(ITypeLib *pUnk)
Definition: cstub.c:1044
static ULONG WINAPI delegating_invoke_test_release(ITypeLib *pUnk)
Definition: cstub.c:1039
static HRESULT WINAPI delegating_invoke_test_QI(ITypeLib *pUnk, REFIID iid, void **ppv)
Definition: cstub.c:1027

Definition at line 1049 of file cstub.c.

Referenced by test_delegating_Invoke().

◆ delegating_invoke_test_rpc_chan_vtbl

IRpcChannelBufferVtbl delegating_invoke_test_rpc_chan_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI delegating_invoke_chan_release(IRpcChannelBuffer *pchan)
Definition: cstub.c:1079
static ULONG WINAPI delegating_invoke_chan_add_ref(IRpcChannelBuffer *pchan)
Definition: cstub.c:1074
static HRESULT WINAPI delegating_invoke_chan_is_connected(IRpcChannelBuffer *pchan)
Definition: cstub.c:1116
static HRESULT WINAPI delegating_invoke_chan_free_buffer(IRpcChannelBuffer *pchan, RPCOLEMESSAGE *pMessage)
Definition: cstub.c:1100
static HRESULT WINAPI delegating_invoke_chan_get_dest_ctx(IRpcChannelBuffer *pchan, DWORD *pdwDestContext, void **ppvDestContext)
Definition: cstub.c:1107
static HRESULT WINAPI delegating_invoke_chan_get_buffer(IRpcChannelBuffer *pchan, RPCOLEMESSAGE *msg, REFIID iid)
Definition: cstub.c:1084
static HRESULT WINAPI delegating_invoke_chan_query_interface(IRpcChannelBuffer *pchan, REFIID iid, void **ppv)
Definition: cstub.c:1066
static HRESULT WINAPI delegating_invoke_chan_send_receive(IRpcChannelBuffer *pchan, RPCOLEMESSAGE *pMessage, ULONG *pStatus)
Definition: cstub.c:1092

Definition at line 1122 of file cstub.c.

Referenced by test_delegating_Invoke().

◆ dummy_unknown

Definition at line 785 of file cstub.c.

◆ dummy_unknown_vtbl

IUnknownVtbl dummy_unknown_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI dummy_QueryInterface(IUnknown *This, REFIID iid, void **ppv)
Definition: cstub.c:761
static ULONG WINAPI dummy_AddRef(LPUNKNOWN iface)
Definition: cstub.c:767
static ULONG WINAPI dummy_Release(LPUNKNOWN iface)
Definition: cstub.c:773

Definition at line 779 of file cstub.c.

◆ gPFactory

◆ if1_FormatStringOffsetTable

const unsigned short if1_FormatStringOffsetTable[]
static
Initial value:
=
{
0,
0
}

Definition at line 171 of file cstub.c.

◆ if1_server_info

const MIDL_SERVER_INFO if1_server_info
static
Initial value:
=
{
0,
0,
0,
0,
0}
static const unsigned short if1_FormatStringOffsetTable[]
Definition: cstub.c:171
static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString
Definition: cstub.c:91
static const MIDL_STUB_DESC Object_StubDesc
Definition: cstub.c:107
unsigned char Format[PROC_FORMAT_STRING_SIZE]
Definition: client.c:20

Definition at line 177 of file cstub.c.

◆ if1_stub_vtbl

CInterfaceStubVtbl if1_stub_vtbl
static
Initial value:
=
{
{
5,
&if1_table[-3]
},
{
}
}
ULONG WINAPI CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface)
Definition: cstub.c:530
void WINAPI CStdStubBuffer_DebugServerRelease(LPRPCSTUBBUFFER iface, LPVOID pv)
Definition: cstub.c:545
HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface, REFIID riid, LPVOID *obj)
Definition: cstub.c:392
ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface)
Definition: cstub.c:410
void WINAPI CStdStubBuffer_Disconnect(LPRPCSTUBBUFFER iface)
Definition: cstub.c:479
LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface, REFIID riid)
Definition: cstub.c:522
HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface, PRPCOLEMESSAGE pMsg, LPRPCCHANNELBUFFER pChannel)
Definition: cstub.c:491
HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface(LPRPCSTUBBUFFER iface, LPVOID *ppv)
Definition: cstub.c:537
HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface, LPUNKNOWN lpUnkServer)
Definition: cstub.c:463
static const PRPC_STUB_FUNCTION if1_table[]
Definition: cstub.c:189
static const MIDL_SERVER_INFO if1_server_info
Definition: cstub.c:177
static ULONG WINAPI test_CStdStubBuffer_Release(IRpcStubBuffer *This)
Definition: cstub.c:47

Definition at line 195 of file cstub.c.

◆ if1_table

const PRPC_STUB_FUNCTION if1_table[]
static
Initial value:
=
{
}
static void __RPC_STUB if1_fn2_Stub(IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
Definition: cstub.c:150
static void __RPC_STUB if1_fn1_Stub(IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
Definition: cstub.c:136

Definition at line 189 of file cstub.c.

◆ if2_FormatStringOffsetTable

const unsigned short if2_FormatStringOffsetTable[]
static
Initial value:
=
{
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
0
}
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94

Definition at line 236 of file cstub.c.

◆ if2_server_info

const MIDL_SERVER_INFO if2_server_info
static
Initial value:
=
{
0,
0,
0,
0,
0}
static const unsigned short if2_FormatStringOffsetTable[]
Definition: cstub.c:236

Definition at line 251 of file cstub.c.

◆ if2_stub_vtbl

CInterfaceStubVtbl if2_stub_vtbl
static
Initial value:
=
{
{
13,
&if2_table[-3]
},
{ 0, 0, test_CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0 }
}
static const PRPC_STUB_FUNCTION if2_table[]
Definition: cstub.c:263
static const MIDL_SERVER_INFO if2_server_info
Definition: cstub.c:251
static ULONG WINAPI test_CStdStubBuffer2_Release(IRpcStubBuffer *This)
Definition: cstub.c:52

Definition at line 277 of file cstub.c.

◆ if2_table

◆ if3_FormatStringOffsetTable

const unsigned short if3_FormatStringOffsetTable[]
static
Initial value:
=
{
0,
0
}

Definition at line 300 of file cstub.c.

◆ if3_server_info

const MIDL_SERVER_INFO if3_server_info
static
Initial value:
=
{
0,
0,
0,
0,
0}
static const unsigned short if3_FormatStringOffsetTable[]
Definition: cstub.c:300

Definition at line 306 of file cstub.c.

◆ if3_stub_vtbl

CInterfaceStubVtbl if3_stub_vtbl
static
Initial value:
=
{
{
5,
&if1_table[-3]
},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
}
static const MIDL_SERVER_INFO if3_server_info
Definition: cstub.c:306

Definition at line 317 of file cstub.c.

◆ if4_FormatStringOffsetTable

const unsigned short if4_FormatStringOffsetTable[]
static
Initial value:
=
{
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
0
}

Definition at line 341 of file cstub.c.

◆ if4_server_info

const MIDL_SERVER_INFO if4_server_info
static
Initial value:
=
{
0,
0,
0,
0,
0}
static const unsigned short if4_FormatStringOffsetTable[]
Definition: cstub.c:341

Definition at line 350 of file cstub.c.

◆ if4_stub_vtbl

CInterfaceStubVtbl if4_stub_vtbl
static
Initial value:
=
{
{
7,
&if2_table[-3]
},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
}
static const MIDL_SERVER_INFO if4_server_info
Definition: cstub.c:350

Definition at line 361 of file cstub.c.

◆ if_name_list

PCInterfaceName const if_name_list[]
static
Initial value:
=
{
"if1",
"if2",
"if3",
"if4",
}

Definition at line 390 of file cstub.c.

◆ if_name_list2

PCInterfaceName const if_name_list2[]
static
Initial value:
=
{
}

Definition at line 1168 of file cstub.c.

◆ IID_if1

◆ IID_if2

GUID IID_if2 = {0x12345679, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}}
static

◆ IID_if3

GUID IID_if3 = {0x1234567a, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}}
static

Definition at line 59 of file cstub.c.

Referenced by test_CreateProxy(), and test_NdrDllGetClassObject().

◆ IID_if4

GUID IID_if4 = {0x1234567b, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}}
static

Definition at line 60 of file cstub.c.

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

◆ my_alloc_called

int my_alloc_called
static

Definition at line 63 of file cstub.c.

Referenced by my_alloc().

◆ my_free_called

int my_free_called
static

Definition at line 64 of file cstub.c.

Referenced by my_free().

◆ my_proxy_file_info

const ExtendedProxyFileInfo my_proxy_file_info
static
Initial value:
=
{
(const IID **) &base_iid_list,
4,
1,
0,
0,
0
}
static const IID * base_iid_list[]
Definition: cstub.c:399
static PCInterfaceName const if_name_list[]
Definition: cstub.c:390
static int __stdcall iid_lookup(const IID *pIID, int *pIndex)
Definition: cstub.c:410
const char * PCInterfaceName
Definition: rpcproxy.h:42

Definition at line 460 of file cstub.c.

◆ my_proxy_file_info2

const ExtendedProxyFileInfo my_proxy_file_info2
static
Initial value:
=
{
(const IID **) &base_iid_list2,
0,
1,
0,
0,
0
}
static PCInterfaceName const if_name_list2[]
Definition: cstub.c:1168
static const CInterfaceStubVtbl * cstub_StubVtblList2[]
Definition: cstub.c:1163
static const IID * base_iid_list2[]
Definition: cstub.c:1173
static const CInterfaceProxyVtbl * cstub_ProxyVtblList2[]
Definition: cstub.c:1158

Definition at line 1178 of file cstub.c.

◆ Object_StubDesc

const MIDL_STUB_DESC Object_StubDesc
static
Initial value:
=
{
{ 0 },
0,
0,
0,
0,
1,
0x20000,
0,
0x50100a4,
0,
0,
1,
0,
0,
0
}
static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
Definition: cstub.c:99
static void *CALLBACK my_alloc(SIZE_T size)
Definition: cstub.c:66
static void CALLBACK my_free(void *ptr)
Definition: cstub.c:72
unsigned char Format[TYPE_FORMAT_STRING_SIZE]
Definition: client.c:14

Definition at line 107 of file cstub.c.

◆ proxy_file_list

const ProxyFileInfo* proxy_file_list[]
static
Initial value:
= {
}
static const ExtendedProxyFileInfo my_proxy_file_info
Definition: cstub.c:460

Definition at line 475 of file cstub.c.

Referenced by test_NdrDllGetClassObject(), and test_NdrDllRegisterProxy().

◆ proxy_file_list2

const ProxyFileInfo* proxy_file_list2[]
static
Initial value:
= {
}
static const ExtendedProxyFileInfo my_proxy_file_info2
Definition: cstub.c:1178

Definition at line 1193 of file cstub.c.

Referenced by test_NdrDllRegisterProxy().

◆ PSFactoryBuffer

Definition at line 45 of file cstub.c.

◆ release_test_pretend_psfacbuf_vtbl

IUnknownVtbl release_test_pretend_psfacbuf_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI release_test_pretend_psfacbuf_release(IUnknown *pUnk)
Definition: cstub.c:984

Definition at line 990 of file cstub.c.

Referenced by test_Release().

◆ release_test_psfacbuf_release_called

int release_test_psfacbuf_release_called
static

Definition at line 983 of file cstub.c.

Referenced by release_test_pretend_psfacbuf_release(), and test_Release().

◆ test1_vtbl

const ITest1Vtbl test1_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI test1_QueryInterface(ITest1 *iface, REFIID iid, void **out)
Definition: cstub.c:1241
static ULONG WINAPI test1_Release(ITest1 *iface)
Definition: cstub.c:1258
static ULONG WINAPI test1_AddRef(ITest1 *iface)
Definition: cstub.c:1253
static HRESULT WINAPI test1_GetClassID(ITest1 *iface, CLSID *clsid)
Definition: cstub.c:1263
static int WINAPI test1_square(ITest1 *iface, int x)
Definition: cstub.c:1269

Definition at line 1274 of file cstub.c.

Referenced by test_cf_CreateInstance().

◆ test_cf

IClassFactory test_cf = { &test_cf_vtbl }
static

Definition at line 1327 of file cstub.c.

Referenced by local_server_proc().

◆ test_cf_vtbl

const IClassFactoryVtbl test_cf_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI test_cf_LockServer(IClassFactory *iface, BOOL lock)
Definition: cstub.c:1313
static ULONG WINAPI test_cf_AddRef(IClassFactory *iface)
Definition: cstub.c:1294
static HRESULT WINAPI test_cf_QueryInterface(IClassFactory *iface, REFIID iid, void **out)
Definition: cstub.c:1283
static HRESULT WINAPI test_cf_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **out)
Definition: cstub.c:1304
static ULONG WINAPI test_cf_Release(IClassFactory *iface)
Definition: cstub.c:1299

Definition at line 1318 of file cstub.c.