ReactOS 0.4.16-dev-319-g6cf4263
cstub.c
Go to the documentation of this file.
1/*
2 * Unit test suite for cstubs
3 *
4 * Copyright 2006 Huw Davies
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include <stdarg.h>
22#include <stdio.h>
23
24#define COBJMACROS
25#ifdef __REACTOS__
26#define CONST_VTABLE
27#endif
28
29#include <windef.h>
30#include <winbase.h>
31#include <winnt.h>
32#include <winerror.h>
33
34#include "initguid.h"
35#include <ole2.h>
36#include "rpc.h"
37#include "rpcdce.h"
38#include "rpcproxy.h"
39
40#include "wine/heap.h"
41#include "wine/test.h"
42
43#include "cstub_p.h"
44
46
48{
50}
51
53{
55}
56
57static GUID IID_if1 = {0x12345678, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}};
58static GUID IID_if2 = {0x12345679, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}};
59static GUID IID_if3 = {0x1234567a, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}};
60static GUID IID_if4 = {0x1234567b, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}};
61static CLSID CLSID_psfact = {0x1234567c, 1234, 5678, {12,34,56,78,90,0xab,0xcd,0xef}};
62
63static int my_alloc_called;
64static int my_free_called;
65
67{
69 return NdrOleAllocate(size);
70}
71
72static void CALLBACK my_free(void *ptr)
73{
76}
77
78typedef struct _MIDL_PROC_FORMAT_STRING
79{
80 short Pad;
81 unsigned char Format[ 2 ];
83
84typedef struct _MIDL_TYPE_FORMAT_STRING
85{
86 short Pad;
87 unsigned char Format[ 2 ];
89
90
92{
93 0,
94 {
95 0, 0
96 }
97};
98
100{
101 0,
102 {
103 0, 0
104 }
105};
106
108 {
109 NULL,
110 my_alloc,
111 my_free,
112 { 0 },
113 0,
114 0,
115 0,
116 0,
118 1, /* -error bounds_check flag */
119 0x20000, /* Ndr library version */
120 0,
121 0x50100a4, /* MIDL Version 5.1.164 */
122 0,
123 NULL,
124 0, /* notify & notify_flag routine table */
125 1, /* Flags */
126 0, /* Reserved3 */
127 0, /* Reserved4 */
128 0 /* Reserved5 */
129 };
130
132{
133 return S_OK;
134}
135
138 IRpcChannelBuffer *_pRpcChannelBuffer,
139 PRPC_MESSAGE _pRpcMessage,
140 DWORD *_pdwStubPhase)
141{
142 trace("fn1 stub\n");
143}
144
146{
147 return S_OK;
148}
149
152 IRpcChannelBuffer *_pRpcChannelBuffer,
153 PRPC_MESSAGE _pRpcMessage,
154 DWORD *_pdwStubPhase)
155{
156 trace("fn2 stub\n");
157}
158
159static CINTERFACE_PROXY_VTABLE(5) if1_proxy_vtbl =
160{
161 { &IID_if1 },
167 }
168};
169
170
171static const unsigned short if1_FormatStringOffsetTable[] =
172 {
173 0,
174 0
175 };
176
178 {
180 0,
183 0,
184 0,
185 0,
186 0};
187
188
190{
193};
194
196{
197 {
198 &IID_if1,
200 5,
201 &if1_table[-3]
202 },
203 {
214 }
215};
216
217static CINTERFACE_PROXY_VTABLE(13) if2_proxy_vtbl =
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};
235
236static const unsigned short if2_FormatStringOffsetTable[] =
237 {
238 (unsigned short) -1,
239 (unsigned short) -1,
240 (unsigned short) -1,
241 (unsigned short) -1,
242 (unsigned short) -1,
243 (unsigned short) -1,
244 (unsigned short) -1,
245 (unsigned short) -1,
246 (unsigned short) -1,
247 (unsigned short) -1,
248 0
249 };
250
252 {
254 0,
257 0,
258 0,
259 0,
260 0};
261
262
264{
275};
276
278{
279 {
280 &IID_if2,
282 13,
283 &if2_table[-3]
284 },
285 { 0, 0, test_CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0 }
286};
287
288static CINTERFACE_PROXY_VTABLE(5) if3_proxy_vtbl =
289{
290 { &IID_if3 },
295 0
296 }
297};
298
299
300static const unsigned short if3_FormatStringOffsetTable[] =
301 {
302 0,
303 0
304 };
305
307 {
309 0,
312 0,
313 0,
314 0,
315 0};
316
318{
319 {
320 &IID_if3,
322 5,
323 &if1_table[-3]
324 },
325 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
326};
327
328static CINTERFACE_PROXY_VTABLE(7) if4_proxy_vtbl =
329{
330 { &IID_if4 },
334 0,
335 0,
336 0,
337 0
338 }
339};
340
341static const unsigned short if4_FormatStringOffsetTable[] =
342 {
343 (unsigned short) -1,
344 (unsigned short) -1,
345 (unsigned short) -1,
346 (unsigned short) -1,
347 0
348 };
349
351 {
353 0,
356 0,
357 0,
358 0,
359 0};
360
362{
363 {
364 &IID_if4,
366 7,
367 &if2_table[-3]
368 },
369 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
370};
371
373{
374 (const CInterfaceProxyVtbl *) &if1_proxy_vtbl,
375 (const CInterfaceProxyVtbl *) &if2_proxy_vtbl,
376 (const CInterfaceProxyVtbl *) &if3_proxy_vtbl,
377 (const CInterfaceProxyVtbl *) &if4_proxy_vtbl,
378 NULL
379};
380
382{
387 NULL
388};
389
391{
392 "if1",
393 "if2",
394 "if3",
395 "if4",
396 NULL
397};
398
399static const IID *base_iid_list[] =
400{
401 NULL,
402 &IID_ITypeLib,
403 NULL,
405 NULL
406};
407
408#define cstub_CHECK_IID(n) IID_GENERIC_CHECK_IID( cstub, pIID, n)
409
410static int __stdcall iid_lookup( const IID * pIID, int * pIndex )
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}
420
421
422static BOOL check_address(void *actual, void *expected)
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}
459
461{
464 (const PCInterfaceName *) &if_name_list,
465 (const IID **) &base_iid_list,
466 &iid_lookup,
467 4,
468 1,
469 NULL,
470 0,
471 0,
472 0
473};
474
477 NULL
478};
479
480
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}
670
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}
679
680static IRpcStubBufferVtbl base_buffer_vtbl = {
681 (void*)0xcafebab0,
682 (void*)0xcafebab1,
683 (void*)0xcafebab2,
684 (void*)0xcafebab3,
685 (void*)0xcafebab4,
687 (void*)0xcafebab6,
688 (void*)0xcafebab7,
689 (void*)0xcafebab8,
690 (void*)0xcafebab9
691};
692
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}
711
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}
721
723{
724 ok(IsEqualIID(iid, &IID_if1), "incorrect iid\n");
725 *ppv = (void*)0xdeadbeef;
726 return S_OK;
727}
728
729static IUnknownVtbl create_stub_test_vtbl =
730{
732 NULL,
733 NULL
734};
735
737{
738 ok(IsEqualIID(iid, &IID_if1), "incorrect iid\n");
739 *ppv = NULL;
740 return E_NOINTERFACE;
741}
742
743static IUnknownVtbl create_stub_test_fail_vtbl =
744{
746 NULL,
747 NULL
748};
749
751{
754};
755
756static inline struct dummy_unknown *impl_from_IUnknown(IUnknown *iface)
757{
758 return CONTAINING_RECORD(iface, struct dummy_unknown, IUnknown_iface);
759}
760
762{
763 *ppv = NULL;
764 return E_NOINTERFACE;
765}
766
768{
769 struct dummy_unknown *this = impl_from_IUnknown(iface);
770 return InterlockedIncrement( &this->ref );
771}
772
774{
775 struct dummy_unknown *this = impl_from_IUnknown(iface);
776 return InterlockedDecrement( &this->ref );
777}
778
779static IUnknownVtbl dummy_unknown_vtbl =
780{
784};
786
787static void create_proxy_test( IPSFactoryBuffer *ppsf, REFIID iid, const void *expected_vtbl )
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}
815
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}
823
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}
845
847{
848 ok(IsEqualIID(iid, &IID_if1) ||
849 IsEqualIID(iid, &IID_if2), "incorrect iid\n");
850 *ppv = (void*)This;
851 return S_OK;
852}
853
856{
858 return 0;
859}
860
861static IUnknownVtbl connect_test_orig_vtbl =
862{
864 NULL,
866};
867
869{
870 ok(IsEqualIID(iid, &IID_if1) ||
871 IsEqualIID(iid, &IID_if2), "incorrect iid\n");
872 *ppv = (void*)0xcafebabe;
873 return S_OK;
874}
875
876static IUnknownVtbl connect_test_new_vtbl =
877{
879 NULL,
880 NULL
881};
882
884{
885 ok(IsEqualIID(iid, &IID_if1), "incorrect iid\n");
886 *ppv = (void*)0xdeadbeef;
887 return E_NOINTERFACE;
888}
889
890static IUnknownVtbl connect_test_new_fail_vtbl =
891{
893 NULL,
894 NULL
895};
896
899{
901 ok(*(void**)obj == (void*)0xbeefcafe, "unexpected obj %p\n", obj);
902 return S_OK;
903}
904
905static IRpcStubBufferVtbl connect_test_base_stub_buffer_vtbl =
906{
907 (void*)0xcafebab0,
908 (void*)0xcafebab1,
909 (void*)0xcafebab2,
911 (void*)0xcafebab4,
912 (void*)0xcafebab5,
913 (void*)0xcafebab6,
914 (void*)0xcafebab7,
915 (void*)0xcafebab8,
916 (void*)0xcafebab9
917};
918
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}
967
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}
981
982
985{
987 return 1;
988}
989
991{
992 NULL,
993 NULL,
995};
996
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}
1026
1028{
1029
1030 *ppv = pUnk;
1031 return S_OK;
1032}
1033
1035{
1036 return 1;
1037}
1038
1040{
1041 return 1;
1042}
1043
1045{
1046 return 0xabcdef;
1047}
1048
1050{
1055 NULL,
1056 NULL,
1057 NULL,
1058 NULL,
1059 NULL,
1060 NULL,
1061 NULL,
1062 NULL,
1063 NULL
1064};
1065
1067 REFIID iid,
1068 void **ppv)
1069{
1070 ok(0, "call to QueryInterface not expected\n");
1071 return E_NOINTERFACE;
1072}
1073
1075{
1076 return 2;
1077}
1078
1080{
1081 return 1;
1082}
1083
1085 RPCOLEMESSAGE *msg,
1086 REFIID iid)
1087{
1088 msg->Buffer = HeapAlloc(GetProcessHeap(), 0, msg->cbBuffer);
1089 return S_OK;
1090}
1091
1093 RPCOLEMESSAGE *pMessage,
1094 ULONG *pStatus)
1095{
1096 ok(0, "call to SendReceive not expected\n");
1097 return E_NOTIMPL;
1098}
1099
1101 RPCOLEMESSAGE *pMessage)
1102{
1103 ok(0, "call to FreeBuffer not expected\n");
1104 return E_NOTIMPL;
1105}
1106
1108 DWORD *pdwDestContext,
1109 void **ppvDestContext)
1110{
1111 *pdwDestContext = MSHCTX_LOCAL;
1112 *ppvDestContext = NULL;
1113 return S_OK;
1114}
1115
1117{
1118 ok(0, "call to IsConnected not expected\n");
1119 return E_NOTIMPL;
1120}
1121
1122static IRpcChannelBufferVtbl delegating_invoke_test_rpc_chan_vtbl =
1123{
1132};
1133
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}
1159{
1160 NULL
1161};
1162
1164{
1165 NULL
1166};
1167
1169{
1170 NULL
1171};
1172
1173static const IID *base_iid_list2[] =
1174{
1175 NULL,
1176};
1177
1179{
1182 (const PCInterfaceName *) &if_name_list2,
1183 (const IID **) &base_iid_list2,
1184 &iid_lookup,
1185 0,
1186 1,
1187 NULL,
1188 0,
1189 0,
1190 0
1191};
1192
1195 NULL
1196};
1197
1198static void test_NdrDllRegisterProxy( void )
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}
1221
1222static HANDLE create_process(const char *arg)
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}
1238
1239DEFINE_GUID(CLSID_test1,0xdeadf00d,0x0001,0x44c7,0x85,0x0f,0x2a,0x0f,0x46,0x5c,0x0c,0x6c);
1240
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}
1252
1254{
1255 return 2;
1256}
1257
1259{
1260 return 1;
1261}
1262
1264{
1265 *clsid = CLSID_test1;
1266 return S_OK;
1267}
1268
1269static int WINAPI test1_square(ITest1 *iface, int x)
1270{
1271 return x * x;
1272}
1273
1274static const ITest1Vtbl test1_vtbl =
1275{
1281};
1282
1284{
1286 {
1287 *out = iface;
1288 return S_OK;
1289 }
1290 *out = NULL;
1291 return E_NOINTERFACE;
1292}
1293
1295{
1296 return 2;
1297}
1298
1300{
1301 return 1;
1302}
1303
1305{
1306 ITest1 *obj = heap_alloc(sizeof(*obj));
1307
1308 obj->lpVtbl = &test1_vtbl;
1309
1310 return ITest1_QueryInterface(obj, iid, out);
1311}
1312
1314{
1315 return S_OK;
1316}
1317
1318static const IClassFactoryVtbl test_cf_vtbl =
1319{
1325};
1326
1328
1330extern const ProxyFileInfo * aProxyFileList;
1331
1332static void local_server_proc(void)
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}
1374
1375static void test_delegated_methods(void)
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}
1420
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
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define msg(x)
Definition: auth_time.c:54
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(A)
Definition: main.h:20
const GUID IID_IUnknown
const GUID IID_IClassFactory
_In_ BOOLEAN Release
Definition: cdrom.h:920
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
HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid)
Definition: cpsf.c:221
HRESULT WINAPI NdrDllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid, CStdPSFactoryBuffer *pPSFactoryBuffer)
Definition: cpsf.c:182
HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid)
Definition: cpsf.c:298
HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub) DECLSPEC_HIDDEN
Definition: ndr_ole.c:466
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1487
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
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2897
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
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
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
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 __RPC_STUB NdrStubForwardingFunction(IRpcStubBuffer *iface, IRpcChannelBuffer *pChannel, PRPC_MESSAGE pMsg, DWORD *pdwStubPhase)
Definition: cstub.c:624
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
ULONG WINAPI NdrCStdStubBuffer2_Release(LPRPCSTUBBUFFER iface, LPPSFACTORYBUFFER pPSF)
Definition: cstub.c:438
HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface(LPRPCSTUBBUFFER iface, LPVOID *ppv)
Definition: cstub.c:537
ULONG WINAPI NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface, LPPSFACTORYBUFFER pPSF)
Definition: cstub.c:417
HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface, LPUNKNOWN lpUnkServer)
Definition: cstub.c:463
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
Definition: ntddk_ex.h:187
struct _IMAGE_DOS_HEADER * PIMAGE_DOS_HEADER
int proxy
Definition: main.c:67
__in WDFDMATRANSACTION __out NTSTATUS * pStatus
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLsizeiptr size
Definition: glext.h:5919
GLuint res
Definition: glext.h:9613
GLuint index
Definition: glext.h:6031
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
REFIID LPVOID * ppv
Definition: atlbase.h:39
Definition: cstub.idl:30
#define S_OK
Definition: intsafe.h:52
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
_In_ PKSPIN_CONNECT Connect
Definition: ks.h:4536
static PVOID ptr
Definition: dispmode.c:27
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
BOOL expected
Definition: store.c:2063
const char * expected_result
Definition: mimeole.c:1468
#define create_process(cmd, pi)
Definition: process.c:2408
static HRESULT QueryInterface(REFIID, void **)
Definition: events.c:2587
#define todo_wine
Definition: custom.c:89
static CInterfaceStubVtbl if2_stub_vtbl
Definition: cstub.c:277
#define VTBL_TEST_CHANGE_TO(name, i)
static CInterfaceStubVtbl if3_stub_vtbl
Definition: cstub.c:317
static HRESULT WINAPI connect_test_new_QI(IUnknown *This, REFIID iid, void **ppv)
Definition: cstub.c:868
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 const unsigned short if3_FormatStringOffsetTable[]
Definition: cstub.c:300
static const unsigned short if4_FormatStringOffsetTable[]
Definition: cstub.c:341
static BOOL check_address(void *actual, void *expected)
Definition: cstub.c:422
static IUnknownVtbl connect_test_orig_vtbl
Definition: cstub.c:861
static HRESULT WINAPI test_cf_LockServer(IClassFactory *iface, BOOL lock)
Definition: cstub.c:1313
static int connect_test_base_Connect_called
Definition: cstub.c:897
static const IID * base_iid_list[]
Definition: cstub.c:399
static ULONG WINAPI delegating_invoke_test_release(ITypeLib *pUnk)
Definition: cstub.c:1039
static void test_delegated_methods(void)
Definition: cstub.c:1375
static HRESULT WINAPI base_buffer_Invoke(IRpcStubBuffer *This, RPCOLEMESSAGE *msg, IRpcChannelBuffer *channel)
Definition: cstub.c:672
static const PRPC_STUB_FUNCTION if2_table[]
Definition: cstub.c:263
static HRESULT WINAPI delegating_invoke_test_QI(ITypeLib *pUnk, REFIID iid, void **ppv)
Definition: cstub.c:1027
static void test_CreateProxy(IPSFactoryBuffer *ppsf)
Definition: cstub.c:816
static int base_buffer_invoke_called
Definition: cstub.c:671
static const unsigned short if1_FormatStringOffsetTable[]
Definition: cstub.c:171
static const unsigned short if2_FormatStringOffsetTable[]
Definition: cstub.c:236
static const CInterfaceStubVtbl * cstub_StubVtblList[]
Definition: cstub.c:381
static PCInterfaceName const if_name_list[]
Definition: cstub.c:390
static CStdPSFactoryBuffer PSFactoryBuffer
Definition: cstub.c:45
static PCInterfaceName const if_name_list2[]
Definition: cstub.c:1168
static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString
Definition: cstub.c:91
static IUnknownVtbl connect_test_new_vtbl
Definition: cstub.c:876
static int connect_test_orig_release_called
Definition: cstub.c:854
static const MIDL_STUB_DESC Object_StubDesc
Definition: cstub.c:107
const ProxyFileInfo * aProxyFileList
static void create_proxy_test(IPSFactoryBuffer *ppsf, REFIID iid, const void *expected_vtbl)
Definition: cstub.c:787
static const IClassFactoryVtbl test_cf_vtbl
Definition: cstub.c:1318
static ULONG WINAPI delegating_invoke_chan_release(IRpcChannelBuffer *pchan)
Definition: cstub.c:1079
static IUnknownVtbl create_stub_test_fail_vtbl
Definition: cstub.c:743
static void __RPC_STUB if1_fn2_Stub(IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
Definition: cstub.c:150
static IClassFactory test_cf
Definition: cstub.c:1327
static int release_test_psfacbuf_release_called
Definition: cstub.c:983
static void test_NdrDllRegisterProxy(void)
Definition: cstub.c:1198
static HRESULT WINAPI dummy_QueryInterface(IUnknown *This, REFIID iid, void **ppv)
Definition: cstub.c:761
static const MIDL_SERVER_INFO if3_server_info
Definition: cstub.c:306
static ULONG WINAPI test_cf_AddRef(IClassFactory *iface)
Definition: cstub.c:1294
static HRESULT WINAPI create_stub_test_QI(IUnknown *This, REFIID iid, void **ppv)
Definition: cstub.c:722
static int my_free_called
Definition: cstub.c:64
static IUnknownVtbl release_test_pretend_psfacbuf_vtbl
Definition: cstub.c:990
static HRESULT WINAPI test_cf_QueryInterface(IClassFactory *iface, REFIID iid, void **out)
Definition: cstub.c:1283
static CLSID CLSID_psfact
Definition: cstub.c:61
static HRESULT WINAPI test1_QueryInterface(ITest1 *iface, REFIID iid, void **out)
Definition: cstub.c:1241
static ULONG WINAPI delegating_invoke_chan_add_ref(IRpcChannelBuffer *pchan)
Definition: cstub.c:1074
static IRpcStubBufferVtbl connect_test_base_stub_buffer_vtbl
Definition: cstub.c:905
static IUnknownVtbl connect_test_new_fail_vtbl
Definition: cstub.c:890
static HRESULT WINAPI connect_test_new_fail_QI(IUnknown *This, REFIID iid, void **ppv)
Definition: cstub.c:883
static IUnknownVtbl create_stub_test_vtbl
Definition: cstub.c:729
#define VTBL_TEST_NOT_CHANGE_TO(name, i)
static HRESULT WINAPI delegating_invoke_chan_is_connected(IRpcChannelBuffer *pchan)
Definition: cstub.c:1116
static const CInterfaceStubVtbl * cstub_StubVtblList2[]
Definition: cstub.c:1163
static void test_delegating_Invoke(IPSFactoryBuffer *ppsf)
Definition: cstub.c:1134
#define VTBL_TEST_ZERO(name, i)
static HRESULT WINAPI delegating_invoke_chan_free_buffer(IRpcChannelBuffer *pchan, RPCOLEMESSAGE *pMessage)
Definition: cstub.c:1100
static const ITest1Vtbl test1_vtbl
Definition: cstub.c:1274
static IRpcStubBufferVtbl base_buffer_vtbl
Definition: cstub.c:680
static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
Definition: cstub.c:99
static HRESULT WINAPI connect_test_orig_QI(IUnknown *This, REFIID iid, void **ppv)
Definition: cstub.c:846
static HRESULT WINAPI create_stub_test_fail_QI(IUnknown *This, REFIID iid, void **ppv)
Definition: cstub.c:736
static const PRPC_STUB_FUNCTION if1_table[]
Definition: cstub.c:189
static CInterfaceStubVtbl if1_stub_vtbl
Definition: cstub.c:195
static const MIDL_SERVER_INFO if1_server_info
Definition: cstub.c:177
static IRpcChannelBufferVtbl delegating_invoke_test_rpc_chan_vtbl
Definition: cstub.c:1122
static struct dummy_unknown * impl_from_IUnknown(IUnknown *iface)
Definition: cstub.c:756
static ULONG WINAPI dummy_AddRef(LPUNKNOWN iface)
Definition: cstub.c:767
static HRESULT WINAPI connect_test_base_Connect(IRpcStubBuffer *pstub, IUnknown *obj)
Definition: cstub.c:898
static ULONG WINAPI test1_Release(ITest1 *iface)
Definition: cstub.c:1258
static HRESULT WINAPI delegating_invoke_chan_get_dest_ctx(IRpcChannelBuffer *pchan, DWORD *pdwDestContext, void **ppvDestContext)
Definition: cstub.c:1107
static void *CALLBACK my_alloc(SIZE_T size)
Definition: cstub.c:66
static const MIDL_SERVER_INFO if2_server_info
Definition: cstub.c:251
static GUID IID_if2
Definition: cstub.c:58
static HRESULT WINAPI if1_fn2_Proxy(void *This)
Definition: cstub.c:145
static ULONG WINAPI connect_test_orig_release(IUnknown *This)
Definition: cstub.c:855
static const IID * base_iid_list2[]
Definition: cstub.c:1173
static IUnknownVtbl dummy_unknown_vtbl
Definition: cstub.c:779
static ULONG WINAPI test_CStdStubBuffer_Release(IRpcStubBuffer *This)
Definition: cstub.c:47
static void test_Connect(IPSFactoryBuffer *ppsf)
Definition: cstub.c:919
static int my_alloc_called
Definition: cstub.c:63
static ITypeLibVtbl delegating_invoke_test_obj_vtbl
Definition: cstub.c:1049
static HRESULT WINAPI test_cf_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **out)
Definition: cstub.c:1304
static const ExtendedProxyFileInfo my_proxy_file_info
Definition: cstub.c:460
static GUID IID_if1
Definition: cstub.c:57
#define VTBL_PROXY_TEST(i, num, ptr)
struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING
static void test_Release(IPSFactoryBuffer *ppsf)
Definition: cstub.c:997
static ULONG WINAPI test1_AddRef(ITest1 *iface)
Definition: cstub.c:1253
static void local_server_proc(void)
Definition: cstub.c:1332
static const ProxyFileInfo * proxy_file_list2[]
Definition: cstub.c:1193
static HRESULT WINAPI delegating_invoke_chan_get_buffer(IRpcChannelBuffer *pchan, RPCOLEMESSAGE *msg, REFIID iid)
Definition: cstub.c:1084
static ULONG WINAPI test_CStdStubBuffer2_Release(IRpcStubBuffer *This)
Definition: cstub.c:52
#define VTBL_PROXY_TEST_NOT_ZERO(i, num)
static HRESULT WINAPI delegating_invoke_chan_query_interface(IRpcChannelBuffer *pchan, REFIID iid, void **ppv)
Definition: cstub.c:1066
static HRESULT WINAPI if1_fn1_Proxy(void *This)
Definition: cstub.c:131
static void CALLBACK my_free(void *ptr)
Definition: cstub.c:72
static const ExtendedProxyFileInfo my_proxy_file_info2
Definition: cstub.c:1178
static HRESULT WINAPI test1_GetClassID(ITest1 *iface, CLSID *clsid)
Definition: cstub.c:1263
static void test_CreateStub(IPSFactoryBuffer *ppsf)
Definition: cstub.c:824
static ULONG WINAPI release_test_pretend_psfacbuf_release(IUnknown *pUnk)
Definition: cstub.c:984
static GUID IID_if3
Definition: cstub.c:59
static ULONG WINAPI dummy_Release(LPUNKNOWN iface)
Definition: cstub.c:773
static HRESULT WINAPI delegating_invoke_chan_send_receive(IRpcChannelBuffer *pchan, RPCOLEMESSAGE *pMessage, ULONG *pStatus)
Definition: cstub.c:1092
static const MIDL_SERVER_INFO if4_server_info
Definition: cstub.c:350
static void __RPC_STUB if1_fn1_Stub(IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
Definition: cstub.c:136
static IPSFactoryBuffer * test_NdrDllGetClassObject(void)
Definition: cstub.c:481
static const ProxyFileInfo * proxy_file_list[]
Definition: cstub.c:475
static const CInterfaceProxyVtbl * cstub_ProxyVtblList2[]
Definition: cstub.c:1158
static const CInterfaceProxyVtbl * cstub_ProxyVtblList[]
Definition: cstub.c:372
static GUID IID_if4
Definition: cstub.c:60
CStdPSFactoryBuffer gPFactory
static ULONG WINAPI test_cf_Release(IClassFactory *iface)
Definition: cstub.c:1299
static int __stdcall iid_lookup(const IID *pIID, int *pIndex)
Definition: cstub.c:410
static void test_Disconnect(IPSFactoryBuffer *ppsf)
Definition: cstub.c:968
static int WINAPI test1_square(ITest1 *iface, int x)
Definition: cstub.c:1269
static void test_NdrStubForwardingFunction(void)
Definition: cstub.c:693
struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING
static CInterfaceStubVtbl if4_stub_vtbl
Definition: cstub.c:361
static refpint_t pi[]
Definition: server.c:96
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
#define argv
Definition: mplay32.c:18
REFCLSID clsid
Definition: msctf.c:82
_Out_ PULONG _Out_ PULONG pIndex
Definition: ndis.h:4565
unsigned int UINT
Definition: ndis.h:50
void *WINAPI NdrOleAllocate(SIZE_T Size)
Definition: ndr_ole.c:423
void WINAPI NdrOleFree(void *NodeToFree)
Definition: ndr_ole.c:432
static LPUNKNOWN
Definition: ndr_ole.c:49
HANDLE stop_event
Definition: nfs41_daemon.c:55
@ REGCLS_MULTIPLEUSE
Definition: objbase.h:393
const GUID IID_IDispatch
long LONG
Definition: pedump.c:60
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: guiddef.h:68
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
static FILE * out
Definition: regtests2xml.c:44
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:107
#define STUB_FORWARDING_FUNCTION
Definition: rpcproxy.h:126
#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
void(__RPC_STUB * PRPC_STUB_FUNCTION)(IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *pdwStubPhase)
Definition: rpcproxy.h:88
const char * PCInterfaceName
Definition: rpcproxy.h:42
#define IID_BS_LOOKUP_SETUP
Definition: rpcproxy.h:229
#define IID_BS_LOOKUP_NEXT_TEST(name, split)
Definition: rpcproxy.h:232
#define CINTERFACE_PROXY_VTABLE(n)
Definition: rpcproxy.h:71
#define __RPC_STUB
Definition: rpc.h:66
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
int winetest_debug
int winetest_get_mainargs(char ***pargv)
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
TCHAR * cmdline
Definition: stretchblt.cpp:32
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
unsigned char Format[PROC_FORMAT_STRING_SIZE]
Definition: client.c:20
unsigned char Format[TYPE_FORMAT_STRING_SIZE]
Definition: client.c:14
DWORD cb
Definition: winbase.h:856
LONG ref
Definition: cstub.c:753
IUnknown IUnknown_iface
Definition: cstub.c:752
Definition: send.c:48
CInterfaceProxyHeader header
Definition: rpcproxy.h:80
struct IUnknown * pvServerObject
Definition: rpcproxy.h:112
const IRpcStubBufferVtbl * lpVtbl
Definition: rpcproxy.h:110
struct IPSFactoryBuffer * pPSFactory
Definition: rpcproxy.h:115
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
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
rwlock_t lock
Definition: tcpcore.h:0
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define __stdcall
Definition: typedefs.h:25
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_HANDLE
Definition: winerror.h:2850
#define E_ACCESSDENIED
Definition: winerror.h:2849
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663