4 * Copyright 2002 Marcus Meissner
6 * The olerelay debug channel allows you to see calls marshalled by
7 * the typelib marshaller. It is not a generic COM relaying system.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #define NONAMELESSUNION
34 #define NONAMELESSSTRUCT
43 #include "wine/unicode.h"
46 #include "wine/debug.h"
49 static const WCHAR riidW
[5] = {'r','i','i','d',0};
50 static const WCHAR pdispparamsW
[] = {'p','d','i','s','p','p','a','r','a','m','s',0};
51 static const WCHAR ppvObjectW
[] = {'p','p','v','O','b','j','e','c','t',0};
53 WINE_DEFAULT_DEBUG_CHANNEL(ole
);
54 WINE_DECLARE_DEBUG_CHANNEL(olerelay
);
56 typedef struct _marshal_state
{
62 IID iid
; /* HACK: for VT_VOID */
65 /* used in the olerelay code to avoid having the L"" stuff added by debugstr_w */
66 static char *relaystr(WCHAR
*in
) {
67 char *tmp
= (char *)debugstr_w(in
);
69 tmp
[strlen(tmp
)-1] = '\0';
74 xbuf_add(marshal_state
*buf
, LPBYTE stuff
, DWORD size
) {
75 while (buf
->size
- buf
->curoff
< size
) {
78 buf
->base
= HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,buf
->base
,buf
->size
);
82 buf
->base
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,32);
88 memcpy(buf
->base
+buf
->curoff
,stuff
,size
);
94 xbuf_get(marshal_state
*buf
, LPBYTE stuff
, DWORD size
) {
95 if (buf
->size
< buf
->curoff
+size
) return E_FAIL
;
96 memcpy(stuff
,buf
->base
+buf
->curoff
,size
);
102 xbuf_skip(marshal_state
*buf
, DWORD size
) {
103 if (buf
->size
< buf
->curoff
+size
) return E_FAIL
;
109 _unmarshal_interface(marshal_state
*buf
, REFIID riid
, LPUNKNOWN
*pUnk
) {
111 ULARGE_INTEGER newpos
;
112 LARGE_INTEGER seekto
;
117 TRACE("...%s...\n",debugstr_guid(riid
));
119 hres
= xbuf_get(buf
,(LPBYTE
)&xsize
,sizeof(xsize
));
120 if (hres
) return hres
;
121 if (xsize
== 0) return S_OK
;
122 hres
= CreateStreamOnHGlobal(0,TRUE
,&pStm
);
124 FIXME("Stream create failed %lx\n",hres
);
127 hres
= IStream_Write(pStm
,buf
->base
+buf
->curoff
,xsize
,&res
);
128 if (hres
) { FIXME("stream write %lx\n",hres
); return hres
; }
129 memset(&seekto
,0,sizeof(seekto
));
130 hres
= IStream_Seek(pStm
,seekto
,SEEK_SET
,&newpos
);
131 if (hres
) { FIXME("Failed Seek %lx\n",hres
); return hres
;}
132 hres
= CoUnmarshalInterface(pStm
,riid
,(LPVOID
*)pUnk
);
134 FIXME("Marshalling interface %s failed with %lx\n",debugstr_guid(riid
),hres
);
137 IStream_Release(pStm
);
138 return xbuf_skip(buf
,xsize
);
142 _marshal_interface(marshal_state
*buf
, REFIID riid
, LPUNKNOWN pUnk
) {
147 ULARGE_INTEGER newpos
;
148 LARGE_INTEGER seekto
;
157 TRACE("...%s...\n",debugstr_guid(riid
));
158 hres
=IUnknown_QueryInterface(pUnk
,riid
,(LPVOID
*)&newiface
);
160 TRACE("%p does not support iface %s\n",pUnk
,debugstr_guid(riid
));
163 hres
= CreateStreamOnHGlobal(0,TRUE
,&pStm
);
165 FIXME("Stream create failed %lx\n",hres
);
168 hres
= CoMarshalInterface(pStm
,riid
,newiface
,0,NULL
,0);
169 IUnknown_Release(newiface
);
171 FIXME("Marshalling interface %s failed with %lx\n",
172 debugstr_guid(riid
),hres
176 hres
= IStream_Stat(pStm
,&ststg
,0);
177 tempbuf
= HeapAlloc(GetProcessHeap(), 0, ststg
.cbSize
.u
.LowPart
);
178 memset(&seekto
,0,sizeof(seekto
));
179 hres
= IStream_Seek(pStm
,seekto
,SEEK_SET
,&newpos
);
180 if (hres
) { FIXME("Failed Seek %lx\n",hres
); goto fail
;}
181 hres
= IStream_Read(pStm
,tempbuf
,ststg
.cbSize
.u
.LowPart
,&res
);
182 if (hres
) { FIXME("Failed Read %lx\n",hres
); goto fail
;}
183 IStream_Release(pStm
);
184 xsize
= ststg
.cbSize
.u
.LowPart
;
185 xbuf_add(buf
,(LPBYTE
)&xsize
,sizeof(xsize
));
186 hres
= xbuf_add(buf
,tempbuf
,ststg
.cbSize
.u
.LowPart
);
187 HeapFree(GetProcessHeap(),0,tempbuf
);
191 xbuf_add(buf
,(LPBYTE
)&xsize
,sizeof(xsize
));
195 /********************* OLE Proxy/Stub Factory ********************************/
196 static HRESULT WINAPI
197 PSFacBuf_QueryInterface(LPPSFACTORYBUFFER iface
, REFIID iid
, LPVOID
*ppv
) {
198 if (IsEqualIID(iid
,&IID_IPSFactoryBuffer
)||IsEqualIID(iid
,&IID_IUnknown
)) {
199 *ppv
= (LPVOID
)iface
;
200 /* No ref counting, static class */
203 FIXME("(%s) unknown IID?\n",debugstr_guid(iid
));
204 return E_NOINTERFACE
;
207 static ULONG WINAPI
PSFacBuf_AddRef(LPPSFACTORYBUFFER iface
) { return 2; }
208 static ULONG WINAPI
PSFacBuf_Release(LPPSFACTORYBUFFER iface
) { return 1; }
211 _get_typeinfo_for_iid(REFIID riid
, ITypeInfo
**ti
) {
214 char tlguid
[200],typelibkey
[300],interfacekey
[300],ver
[100];
217 DWORD tlguidlen
, verlen
, type
, tlfnlen
;
220 sprintf( interfacekey
, "Interface\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\Typelib",
221 riid
->Data1
, riid
->Data2
, riid
->Data3
,
222 riid
->Data4
[0], riid
->Data4
[1], riid
->Data4
[2], riid
->Data4
[3],
223 riid
->Data4
[4], riid
->Data4
[5], riid
->Data4
[6], riid
->Data4
[7]
226 if (RegOpenKeyA(HKEY_CLASSES_ROOT
,interfacekey
,&ikey
)) {
227 FIXME("No %s key found.\n",interfacekey
);
231 tlguidlen
= sizeof(tlguid
);
232 if (RegQueryValueExA(ikey
,NULL
,NULL
,&type
,tlguid
,&tlguidlen
)) {
233 FIXME("Getting typelib guid failed.\n");
238 verlen
= sizeof(ver
);
239 if (RegQueryValueExA(ikey
,"Version",NULL
,&type
,ver
,&verlen
)) {
240 FIXME("Could not get version value?\n");
245 sprintf(typelibkey
,"Typelib\\%s\\%s\\0\\win32",tlguid
,ver
);
246 tlfnlen
= sizeof(tlfn
);
247 if (RegQueryValueA(HKEY_CLASSES_ROOT
,typelibkey
,tlfn
,&tlfnlen
)) {
248 FIXME("Could not get typelib fn?\n");
251 MultiByteToWideChar(CP_ACP
, 0, tlfn
, -1, tlfnW
, -1);
252 hres
= LoadTypeLib(tlfnW
,&tl
);
254 ERR("Failed to load typelib for %s, but it should be there.\n",debugstr_guid(riid
));
257 hres
= ITypeLib_GetTypeInfoOfGuid(tl
,riid
,ti
);
259 ERR("typelib does not contain info for %s?\n",debugstr_guid(riid
));
260 ITypeLib_Release(tl
);
263 /* FIXME: do this? ITypeLib_Release(tl); */
267 /* Determine nr of functions. Since we use the toplevel interface and all
268 * inherited ones have lower numbers, we are ok to not to descent into
269 * the inheritance tree I think.
271 static int _nroffuncs(ITypeInfo
*tinfo
) {
278 hres
= ITypeInfo_GetFuncDesc(tinfo
,n
,&fdesc
);
281 if (fdesc
->oVft
/4 > max
)
288 #include "pshpack1.h"
290 typedef struct _TMAsmProxy
{
303 typedef struct _TMProxyImpl
{
305 ICOM_VTABLE(IRpcProxyBuffer
) *lpvtbl2
;
308 TMAsmProxy
*asmstubs
;
310 IRpcChannelBuffer
* chanbuf
;
314 static HRESULT WINAPI
315 TMProxyImpl_QueryInterface(LPRPCPROXYBUFFER iface
, REFIID riid
, LPVOID
*ppv
) {
317 if (IsEqualIID(riid
,&IID_IUnknown
)||IsEqualIID(riid
,&IID_IRpcProxyBuffer
)) {
318 *ppv
= (LPVOID
)iface
;
319 IRpcProxyBuffer_AddRef(iface
);
322 FIXME("no interface for %s\n",debugstr_guid(riid
));
323 return E_NOINTERFACE
;
327 TMProxyImpl_AddRef(LPRPCPROXYBUFFER iface
) {
328 ICOM_THIS_MULTI(TMProxyImpl
,lpvtbl2
,iface
);
336 TMProxyImpl_Release(LPRPCPROXYBUFFER iface
) {
337 ICOM_THIS_MULTI(TMProxyImpl
,lpvtbl2
,iface
);
341 if (This
->ref
) return This
->ref
;
342 if (This
->chanbuf
) IRpcChannelBuffer_Release(This
->chanbuf
);
343 HeapFree(GetProcessHeap(),0,This
);
347 static HRESULT WINAPI
349 LPRPCPROXYBUFFER iface
,IRpcChannelBuffer
* pRpcChannelBuffer
351 ICOM_THIS_MULTI(TMProxyImpl
,lpvtbl2
,iface
);
353 TRACE("(%p)\n",pRpcChannelBuffer
);
354 This
->chanbuf
= pRpcChannelBuffer
;
355 IRpcChannelBuffer_AddRef(This
->chanbuf
);
360 TMProxyImpl_Disconnect(LPRPCPROXYBUFFER iface
) {
361 ICOM_THIS_MULTI(TMProxyImpl
,lpvtbl2
,iface
);
364 IRpcChannelBuffer_Release(This
->chanbuf
);
365 This
->chanbuf
= NULL
;
369 static ICOM_VTABLE(IRpcProxyBuffer
) tmproxyvtable
= {
370 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
371 TMProxyImpl_QueryInterface
,
375 TMProxyImpl_Disconnect
378 /* how much space do we use on stack in DWORD steps. */
383 return sizeof(DATE
)/sizeof(DWORD
);
385 return (sizeof(VARIANT
)+3)/sizeof(DWORD
);
392 _xsize(TYPEDESC
*td
) {
397 return sizeof(VARIANT
)+3;
400 ARRAYDESC
*adesc
= td
->u
.lpadesc
;
402 for (i
=0;i
<adesc
->cDims
;i
++)
403 arrsize
*= adesc
->rgbounds
[i
].cElements
;
404 return arrsize
*_xsize(&adesc
->tdescElem
);
429 TRACE("(tdesc.vt %d)\n",tdesc
->vt
);
432 case VT_EMPTY
: /* nothing. empty variant for instance */
443 if (debugout
) TRACE_(olerelay
)("%lx",*arg
);
445 hres
= xbuf_add(buf
,(LPBYTE
)arg
,sizeof(DWORD
));
449 VARIANT
*vt
= (VARIANT
*)arg
;
450 DWORD vttype
= V_VT(vt
);
452 if (debugout
) TRACE_(olerelay
)("Vt(%ld)(",vttype
);
455 hres
= xbuf_add(buf
,(LPBYTE
)&vttype
,sizeof(vttype
));
456 if (hres
) return hres
;
458 /* need to recurse since we need to free the stuff */
459 hres
= serialize_param(tinfo
,writeit
,debugout
,dealloc
,&tdesc2
,&(V_I4(vt
)),buf
);
460 if (debugout
) TRACE_(olerelay
)(")");
466 TRACE_(olerelay
)("%s",relaystr((BSTR
)*arg
));
468 TRACE_(olerelay
)("<bstr NULL>");
473 hres
= xbuf_add(buf
,(LPBYTE
)&fakelen
,4);
477 DWORD
*bstr
= ((DWORD
*)(*arg
))-1;
479 hres
= xbuf_add(buf
,(LPBYTE
)bstr
,bstr
[0]+4);
486 SysFreeString((BSTR
)*arg
);
492 if (debugout
) TRACE_(olerelay
)("*");
494 cookie
= *arg
? 0x42424242 : 0;
495 hres
= xbuf_add(buf
,(LPBYTE
)&cookie
,sizeof(cookie
));
500 if (debugout
) TRACE_(olerelay
)("NULL");
503 hres
= serialize_param(tinfo
,writeit
,debugout
,dealloc
,tdesc
->u
.lptdesc
,(DWORD
*)*arg
,buf
);
504 if (dealloc
) HeapFree(GetProcessHeap(),0,(LPVOID
)arg
);
508 if (debugout
) TRACE_(olerelay
)("unk(0x%lx)",*arg
);
510 hres
= _marshal_interface(buf
,&IID_IUnknown
,(LPUNKNOWN
)*arg
);
513 if (debugout
) TRACE_(olerelay
)("idisp(0x%lx)",*arg
);
515 hres
= _marshal_interface(buf
,&IID_IDispatch
,(LPUNKNOWN
)*arg
);
518 if (debugout
) TRACE_(olerelay
)("<void>");
520 case VT_USERDEFINED
: {
524 hres
= ITypeInfo_GetRefTypeInfo(tinfo
,tdesc
->u
.hreftype
,&tinfo2
);
526 FIXME("Could not get typeinfo of hreftype %lx for VT_USERDEFINED.\n",tdesc
->u
.hreftype
);
529 ITypeInfo_GetTypeAttr(tinfo2
,&tattr
);
530 switch (tattr
->typekind
) {
532 case TKIND_INTERFACE
:
534 hres
=_marshal_interface(buf
,&(tattr
->guid
),(LPUNKNOWN
)arg
);
538 if (debugout
) TRACE_(olerelay
)("{");
539 for (i
=0;i
<tattr
->cVars
;i
++) {
544 hres
= ITypeInfo2_GetVarDesc(tinfo2
, i
, &vdesc
);
546 FIXME("Could not get vardesc of %d\n",i
);
549 /* Need them for hack below */
551 memset(names,0,sizeof(names));
552 hres = ITypeInfo_GetNames(tinfo2,vdesc->memid,names,sizeof(names)/sizeof(names[0]),&nrofnames);
553 if (nrofnames > sizeof(names)/sizeof(names[0])) {
554 ERR("Need more names!\n");
556 if (!hres && debugout)
557 TRACE_(olerelay)("%s=",relaystr(names[0]));
559 elem2
= &vdesc
->elemdescVar
;
560 tdesc2
= &elem2
->tdesc
;
561 hres
= serialize_param(
567 (DWORD
*)(((LPBYTE
)arg
)+vdesc
->u
.oInst
),
572 if (debugout
&& (i
<(tattr
->cVars
-1)))
573 TRACE_(olerelay
)(",");
575 if (buf
->thisisiid
&& (tattr
->cbSizeInstance
==sizeof(GUID
)))
576 memcpy(&(buf
->iid
),arg
,sizeof(buf
->iid
));
577 if (debugout
) TRACE_(olerelay
)("}");
581 FIXME("Unhandled typekind %d\n",tattr
->typekind
);
585 ITypeInfo_Release(tinfo2
);
589 ARRAYDESC
*adesc
= tdesc
->u
.lpadesc
;
592 if (debugout
) TRACE_(olerelay
)("carr");
593 for (i
=0;i
<adesc
->cDims
;i
++) {
594 if (debugout
) TRACE_(olerelay
)("[%ld]",adesc
->rgbounds
[i
].cElements
);
595 arrsize
*= adesc
->rgbounds
[i
].cElements
;
597 if (debugout
) TRACE_(olerelay
)("[");
598 for (i
=0;i
<arrsize
;i
++) {
599 hres
= serialize_param(tinfo
, writeit
, debugout
, dealloc
, &adesc
->tdescElem
, (DWORD
*)((LPBYTE
)arg
+i
*_xsize(&adesc
->tdescElem
)), buf
);
602 if (debugout
&& (i
<arrsize
-1)) TRACE_(olerelay
)(",");
604 if (debugout
) TRACE_(olerelay
)("]");
608 ERR("Unhandled marshal type %d.\n",tdesc
->vt
);
614 serialize_LPVOID_ptr(
626 if ((tdesc
->vt
!= VT_PTR
) ||
627 (tdesc
->u
.lptdesc
->vt
!= VT_PTR
) ||
628 (tdesc
->u
.lptdesc
->u
.lptdesc
->vt
!= VT_VOID
)
630 FIXME("ppvObject not expressed as VT_PTR -> VT_PTR -> VT_VOID?\n");
633 cookie
= (*arg
) ? 0x42424242: 0x0;
635 hres
= xbuf_add(buf
, (LPVOID
)&cookie
, sizeof(cookie
));
640 if (debugout
) TRACE_(olerelay
)("<lpvoid NULL>");
644 TRACE_(olerelay
)("ppv(%p)",*(LPUNKNOWN
*)*arg
);
646 hres
= _marshal_interface(buf
,&(buf
->iid
),*(LPUNKNOWN
*)*arg
);
651 HeapFree(GetProcessHeap(),0,(LPVOID
)*arg
);
656 serialize_DISPPARAM_ptr(
670 if ((tdesc
->vt
!= VT_PTR
) || (tdesc
->u
.lptdesc
->vt
!= VT_USERDEFINED
)) {
671 FIXME("DISPPARAMS not expressed as VT_PTR -> VT_USERDEFINED?\n");
675 cookie
= *arg
? 0x42424242 : 0x0;
677 hres
= xbuf_add(buf
,(LPBYTE
)&cookie
,sizeof(cookie
));
682 if (debugout
) TRACE_(olerelay
)("<DISPPARAMS NULL>");
685 disp
= (DISPPARAMS
*)*arg
;
687 hres
= xbuf_add(buf
,(LPBYTE
)&disp
->cArgs
,sizeof(disp
->cArgs
));
691 if (debugout
) TRACE_(olerelay
)("D{");
692 for (i
=0;i
<disp
->cArgs
;i
++) {
695 vtdesc
.vt
= VT_VARIANT
;
702 (DWORD
*)(disp
->rgvarg
+i
),
705 if (debugout
&& (i
<disp
->cArgs
-1))
706 TRACE_(olerelay
)(",");
709 HeapFree(GetProcessHeap(),0,disp
->rgvarg
);
711 hres
= xbuf_add(buf
,(LPBYTE
)&disp
->cNamedArgs
,sizeof(disp
->cNamedArgs
));
715 if (debugout
) TRACE_(olerelay
)("}{");
716 for (i
=0;i
<disp
->cNamedArgs
;i
++) {
726 (DWORD
*)(disp
->rgdispidNamedArgs
+i
),
729 if (debugout
&& (i
<disp
->cNamedArgs
-1))
730 TRACE_(olerelay
)(",");
732 if (debugout
) TRACE_(olerelay
)("}");
734 HeapFree(GetProcessHeap(),0,disp
->rgdispidNamedArgs
);
735 HeapFree(GetProcessHeap(),0,disp
);
752 TRACE("vt %d at %p\n",tdesc
->vt
,arg
);
757 if (debugout
) TRACE_(olerelay
)("<empty>");
760 if (debugout
) TRACE_(olerelay
)("<null>");
763 VARIANT
*vt
= (VARIANT
*)arg
;
768 hres
= xbuf_get(buf
,(LPBYTE
)&vttype
,sizeof(vttype
));
770 FIXME("vt type not read?\n");
773 memset(&tdesc2
,0,sizeof(tdesc2
));
776 if (debugout
) TRACE_(olerelay
)("Vt(%ld)(",vttype
);
777 hres
= deserialize_param(tinfo
, readit
, debugout
, alloc
, &tdesc2
, &(V_I4(vt
)), buf
);
778 TRACE_(olerelay
)(")");
786 case VT_BOOL
: case VT_I4
: case VT_UI4
: case VT_UINT
: case VT_R4
:
790 hres
= xbuf_get(buf
,(LPBYTE
)arg
,sizeof(DWORD
));
791 if (hres
) FIXME("Failed to read integer 4 byte\n");
793 if (debugout
) TRACE_(olerelay
)("%lx",*arg
);
800 hres
= xbuf_get(buf
,(LPBYTE
)&len
,sizeof(DWORD
));
802 FIXME("failed to read bstr klen\n");
807 if (debugout
) TRACE_(olerelay
)("<bstr NULL>");
809 str
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,len
+sizeof(WCHAR
));
810 hres
= xbuf_get(buf
,(LPBYTE
)str
,len
);
812 FIXME("Failed to read BSTR.\n");
815 *arg
= (DWORD
)SysAllocStringLen(str
,len
);
816 if (debugout
) TRACE_(olerelay
)("%s",relaystr(str
));
817 HeapFree(GetProcessHeap(),0,str
);
828 derefhere
= (tdesc
->u
.lptdesc
->vt
!= VT_USERDEFINED
);
831 hres
= xbuf_get(buf
,(LPBYTE
)&cookie
,sizeof(cookie
));
833 FIXME("Failed to load pointer cookie.\n");
836 if (cookie
!= 0x42424242) {
837 if (debugout
) TRACE_(olerelay
)("NULL");
841 if (debugout
) TRACE_(olerelay
)("*");
845 *arg
=(DWORD
)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,_xsize(tdesc
->u
.lptdesc
));
848 return deserialize_param(tinfo
, readit
, debugout
, alloc
, tdesc
->u
.lptdesc
, (LPDWORD
)*arg
, buf
);
850 return deserialize_param(tinfo
, readit
, debugout
, alloc
, tdesc
->u
.lptdesc
, arg
, buf
);
853 /* FIXME: UNKNOWN is unknown ..., but allocate 4 byte for it */
855 *arg
=(DWORD
)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(DWORD
));
858 hres
= _unmarshal_interface(buf
,&IID_IUnknown
,(LPUNKNOWN
*)arg
);
860 TRACE_(olerelay
)("unk(%p)",arg
);
865 hres
= _unmarshal_interface(buf
,&IID_IDispatch
,(LPUNKNOWN
*)arg
);
867 TRACE_(olerelay
)("idisp(%p)",arg
);
870 if (debugout
) TRACE_(olerelay
)("<void>");
872 case VT_USERDEFINED
: {
876 hres
= ITypeInfo_GetRefTypeInfo(tinfo
,tdesc
->u
.hreftype
,&tinfo2
);
878 FIXME("Could not get typeinfo of hreftype %lx for VT_USERDEFINED.\n",tdesc
->u
.hreftype
);
881 hres
= ITypeInfo_GetTypeAttr(tinfo2
,&tattr
);
883 FIXME("Could not get typeattr in VT_USERDEFINED.\n");
886 *arg
= (DWORD
)HeapAlloc(GetProcessHeap(),0,tattr
->cbSizeInstance
);
887 switch (tattr
->typekind
) {
889 case TKIND_INTERFACE
:
891 hres
= _unmarshal_interface(buf
,&(tattr
->guid
),(LPUNKNOWN
*)arg
);
896 if (debugout
) TRACE_(olerelay
)("{");
897 for (i
=0;i
<tattr
->cVars
;i
++) {
900 hres
= ITypeInfo2_GetVarDesc(tinfo2
, i
, &vdesc
);
902 FIXME("Could not get vardesc of %d\n",i
);
905 hres
= deserialize_param(
910 &vdesc
->elemdescVar
.tdesc
,
911 (DWORD
*)(((LPBYTE
)*arg
)+vdesc
->u
.oInst
),
914 if (debugout
&& (i
<tattr
->cVars
-1)) TRACE_(olerelay
)(",");
916 if (buf
->thisisiid
&& (tattr
->cbSizeInstance
==sizeof(GUID
)))
917 memcpy(&(buf
->iid
),(LPBYTE
)*arg
,sizeof(buf
->iid
));
918 if (debugout
) TRACE_(olerelay
)("}");
922 ERR("Unhandled typekind %d\n",tattr
->typekind
);
928 FIXME("failed to stuballoc in TKIND_RECORD.\n");
929 ITypeInfo_Release(tinfo2
);
933 /* arg is pointing to the start of the array. */
934 ARRAYDESC
*adesc
= tdesc
->u
.lpadesc
;
937 if (adesc
->cDims
> 1) FIXME("cDims > 1 in VT_CARRAY. Does it work?\n");
938 for (i
=0;i
<adesc
->cDims
;i
++)
939 arrsize
*= adesc
->rgbounds
[i
].cElements
;
940 for (i
=0;i
<arrsize
;i
++)
947 (DWORD
*)((LPBYTE
)(arg
)+i
*_xsize(&adesc
->tdescElem
)),
953 ERR("No handler for VT type %d!\n",tdesc
->vt
);
960 deserialize_LPVOID_ptr(
972 if ((tdesc
->vt
!= VT_PTR
) ||
973 (tdesc
->u
.lptdesc
->vt
!= VT_PTR
) ||
974 (tdesc
->u
.lptdesc
->u
.lptdesc
->vt
!= VT_VOID
)
976 FIXME("ppvObject not expressed as VT_PTR -> VT_PTR -> VT_VOID?\n");
980 *arg
=(DWORD
)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(LPVOID
));
982 hres
= xbuf_get(buf
, (LPVOID
)&cookie
, sizeof(cookie
));
985 if (cookie
!= 0x42424242) {
987 if (debugout
) TRACE_(olerelay
)("<lpvoid NULL>");
992 hres
= _unmarshal_interface(buf
,&buf
->iid
,(LPUNKNOWN
*)*arg
);
996 if (debugout
) TRACE_(olerelay
)("ppv(%p)",(LPVOID
)*arg
);
1001 deserialize_DISPPARAM_ptr(
1015 if ((tdesc
->vt
!= VT_PTR
) || (tdesc
->u
.lptdesc
->vt
!= VT_USERDEFINED
)) {
1016 FIXME("DISPPARAMS not expressed as VT_PTR -> VT_USERDEFINED?\n");
1020 hres
= xbuf_get(buf
,(LPBYTE
)&cookie
,sizeof(cookie
));
1025 if (debugout
) TRACE_(olerelay
)("<DISPPARAMS NULL>");
1030 *arg
= (DWORD
)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(DISPPARAMS
));
1031 disps
= (DISPPARAMS
*)*arg
;
1034 hres
= xbuf_get(buf
, (LPBYTE
)&disps
->cArgs
, sizeof(disps
->cArgs
));
1038 disps
->rgvarg
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(VARIANT
)*disps
->cArgs
);
1039 if (debugout
) TRACE_(olerelay
)("D{");
1040 for (i
=0; i
< disps
->cArgs
; i
++) {
1043 vdesc
.vt
= VT_VARIANT
;
1044 hres
= deserialize_param(
1050 (DWORD
*)(disps
->rgvarg
+i
),
1054 if (debugout
) TRACE_(olerelay
)("}{");
1055 hres
= xbuf_get(buf
, (LPBYTE
)&disps
->cNamedArgs
, sizeof(disps
->cNamedArgs
));
1058 if (disps
->cNamedArgs
) {
1060 disps
->rgdispidNamedArgs
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(DISPID
)*disps
->cNamedArgs
);
1061 for (i
=0; i
< disps
->cNamedArgs
; i
++) {
1065 hres
= deserialize_param(
1071 (DWORD
*)(disps
->rgdispidNamedArgs
+i
),
1074 if (debugout
&& i
<(disps
->cNamedArgs
-1)) TRACE_(olerelay
)(",");
1077 if (debugout
) TRACE_(olerelay
)("}");
1081 /* Searches function, also in inherited interfaces */
1084 ITypeInfo
*tinfo
, int iMethod
, FUNCDESC
**fdesc
, BSTR
*iname
, BSTR
*fname
1089 if (fname
) *fname
= NULL
;
1090 if (iname
) *iname
= NULL
;
1093 hres
= ITypeInfo_GetFuncDesc(tinfo
, i
, fdesc
);
1099 hres
= ITypeInfo_GetTypeAttr(tinfo
, &attr
);
1101 FIXME("GetTypeAttr failed with %lx\n",hres
);
1104 /* Not found, so look in inherited ifaces. */
1105 for (j
=0;j
<attr
->cImplTypes
;j
++) {
1106 hres
= ITypeInfo_GetRefTypeOfImplType(tinfo
, j
, &href
);
1108 FIXME("Did not find a reftype for interface offset %d?\n",j
);
1111 hres
= ITypeInfo_GetRefTypeInfo(tinfo
, href
, &tinfo2
);
1113 FIXME("Did not find a typeinfo for reftype %ld?\n",href
);
1116 hres
= _get_funcdesc(tinfo2
,iMethod
,fdesc
,iname
,fname
);
1117 ITypeInfo_Release(tinfo2
);
1118 if (!hres
) return S_OK
;
1122 if (((*fdesc
)->oVft
/4) == iMethod
) {
1124 ITypeInfo_GetDocumentation(tinfo
,(*fdesc
)->memid
,fname
,NULL
,NULL
,NULL
);
1126 ITypeInfo_GetDocumentation(tinfo
,-1,iname
,NULL
,NULL
,NULL
);
1135 xCall(LPVOID retptr
, int method
, TMProxyImpl
*tpinfo
/*, args */) {
1136 DWORD
*args
= ((DWORD
*)&tpinfo
)+1, *xargs
;
1139 int i
, relaydeb
= TRACE_ON(olerelay
);
1147 hres
= _get_funcdesc(tpinfo
->tinfo
,method
,&fdesc
,&iname
,&fname
);
1149 ERR("Did not find typeinfo/funcdesc entry for method %d!\n",method
);
1154 TRACE_(olerelay
)("->");
1156 TRACE_(olerelay
)("%s:",relaystr(iname
));
1158 TRACE_(olerelay
)("%s(%d)",relaystr(fname
),method
);
1160 TRACE_(olerelay
)("%d",method
);
1161 TRACE_(olerelay
)("(");
1162 if (iname
) SysFreeString(iname
);
1163 if (fname
) SysFreeString(fname
);
1165 /* Need them for hack below */
1166 memset(names
,0,sizeof(names
));
1167 if (ITypeInfo_GetNames(tpinfo
->tinfo
,fdesc
->memid
,names
,sizeof(names
)/sizeof(names
[0]),&nrofnames
))
1169 if (nrofnames
> sizeof(names
)/sizeof(names
[0]))
1170 ERR("Need more names!\n");
1172 memset(&buf
,0,sizeof(buf
));
1173 buf
.iid
= IID_IUnknown
;
1175 xbuf_add(&buf
,(LPBYTE
)args
[0],sizeof(IID
));
1176 if (relaydeb
) TRACE_(olerelay
)("riid=%s,[out]",debugstr_guid((REFIID
)args
[0]));
1179 for (i
=0;i
<fdesc
->cParams
;i
++) {
1180 ELEMDESC
*elem
= fdesc
->lprgelemdescParam
+i
;
1181 BOOL isserialized
= FALSE
;
1183 if (i
) TRACE_(olerelay
)(",");
1184 if (i
+1<nrofnames
&& names
[i
+1])
1185 TRACE_(olerelay
)("%s=",relaystr(names
[i
+1]));
1187 /* No need to marshal other data than FIN */
1188 if (!(elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FIN
)) {
1189 xargs
+=_argsize(elem
->tdesc
.vt
);
1190 if (relaydeb
) TRACE_(olerelay
)("[out]");
1193 if (((i
+1)<nrofnames
) && !IsBadStringPtrW(names
[i
+1],1)) {
1194 /* If the parameter is 'riid', we use it as interface IID
1195 * for a later ppvObject serialization.
1197 buf
.thisisiid
= !lstrcmpW(names
[i
+1],riidW
);
1199 /* DISPPARAMS* needs special serializer */
1200 if (!lstrcmpW(names
[i
+1],pdispparamsW
)) {
1201 hres
= serialize_DISPPARAM_ptr(
1203 elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FIN
,
1210 isserialized
= TRUE
;
1212 if (!lstrcmpW(names
[i
+1],ppvObjectW
)) {
1213 hres
= serialize_LPVOID_ptr(
1215 elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FIN
,
1223 isserialized
= TRUE
;
1227 hres
= serialize_param(
1229 elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FIN
,
1238 FIXME("Failed to serialize param, hres %lx\n",hres
);
1241 xargs
+=_argsize(elem
->tdesc
.vt
);
1244 if (relaydeb
) TRACE_(olerelay
)(")");
1245 memset(&msg
,0,sizeof(msg
));
1246 msg
.cbBuffer
= buf
.curoff
;
1247 msg
.iMethod
= method
;
1248 hres
= IRpcChannelBuffer_GetBuffer(tpinfo
->chanbuf
,&msg
,&(tpinfo
->iid
));
1250 FIXME("RpcChannelBuffer GetBuffer failed, %lx\n",hres
);
1253 memcpy(msg
.Buffer
,buf
.base
,buf
.curoff
);
1254 if (relaydeb
) TRACE_(olerelay
)("\n");
1255 hres
= IRpcChannelBuffer_SendReceive(tpinfo
->chanbuf
,&msg
,&status
);
1257 FIXME("RpcChannelBuffer SendReceive failed, %lx\n",hres
);
1261 if (relaydeb
) TRACE_(olerelay
)(" = %08lx (",status
);
1263 buf
.base
= HeapReAlloc(GetProcessHeap(),0,buf
.base
,msg
.cbBuffer
);
1265 buf
.base
= HeapAlloc(GetProcessHeap(),0,msg
.cbBuffer
);
1266 buf
.size
= msg
.cbBuffer
;
1267 memcpy(buf
.base
,msg
.Buffer
,buf
.size
);
1270 _unmarshal_interface(&buf
,(REFIID
)args
[0],(LPUNKNOWN
*)args
[1]);
1271 if (relaydeb
) TRACE_(olerelay
)("[in],%p",*((DWORD
**)args
[1]));
1274 for (i
=0;i
<fdesc
->cParams
;i
++) {
1275 ELEMDESC
*elem
= fdesc
->lprgelemdescParam
+i
;
1276 BOOL isdeserialized
= FALSE
;
1279 if (i
) TRACE_(olerelay
)(",");
1280 if (i
+1<nrofnames
&& names
[i
+1]) TRACE_(olerelay
)("%s=",relaystr(names
[i
+1]));
1282 /* No need to marshal other data than FOUT I think */
1283 if (!(elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FOUT
)) {
1284 xargs
+= _argsize(elem
->tdesc
.vt
);
1285 if (relaydeb
) TRACE_(olerelay
)("[in]");
1288 if (((i
+1)<nrofnames
) && !IsBadStringPtrW(names
[i
+1],1)) {
1289 /* If the parameter is 'riid', we use it as interface IID
1290 * for a later ppvObject serialization.
1292 buf
.thisisiid
= !lstrcmpW(names
[i
+1],riidW
);
1294 /* deserialize DISPPARAM */
1295 if (!lstrcmpW(names
[i
+1],pdispparamsW
)) {
1296 hres
= deserialize_DISPPARAM_ptr(
1298 elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FOUT
,
1306 FIXME("Failed to deserialize DISPPARAM*, hres %lx\n",hres
);
1309 isdeserialized
= TRUE
;
1311 if (!lstrcmpW(names
[i
+1],ppvObjectW
)) {
1312 hres
= deserialize_LPVOID_ptr(
1314 elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FOUT
,
1322 isdeserialized
= TRUE
;
1325 if (!isdeserialized
)
1326 hres
= deserialize_param(
1328 elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FOUT
,
1336 FIXME("Failed to unmarshall param, hres %lx\n",hres
);
1339 xargs
+= _argsize(elem
->tdesc
.vt
);
1342 if (relaydeb
) TRACE_(olerelay
)(")\n");
1343 HeapFree(GetProcessHeap(),0,buf
.base
);
1347 static HRESULT WINAPI
1348 PSFacBuf_CreateProxy(
1349 LPPSFACTORYBUFFER iface
, IUnknown
* pUnkOuter
, REFIID riid
,
1350 IRpcProxyBuffer
**ppProxy
, LPVOID
*ppv
1358 TRACE("(...%s...)\n",debugstr_guid(riid
));
1359 hres
= _get_typeinfo_for_iid(riid
,&tinfo
);
1361 FIXME("No typeinfo for %s?\n",debugstr_guid(riid
));
1364 nroffuncs
= _nroffuncs(tinfo
);
1365 proxy
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(TMProxyImpl
));
1366 if (!proxy
) return E_OUTOFMEMORY
;
1367 proxy
->asmstubs
=HeapAlloc(GetProcessHeap(),0,sizeof(TMAsmProxy
)*nroffuncs
);
1369 assert(sizeof(TMAsmProxy
) == 12);
1371 proxy
->lpvtbl
= HeapAlloc(GetProcessHeap(),0,sizeof(LPBYTE
)*nroffuncs
);
1372 for (i
=0;i
<nroffuncs
;i
++) {
1374 TMAsmProxy
*xasm
= proxy
->asmstubs
+i
;
1376 /* nrofargs without This */
1378 case 0: nrofargs
= 2;
1380 case 1: case 2: nrofargs
= 0;
1384 hres
= _get_funcdesc(tinfo
,i
,&fdesc
,NULL
,NULL
);
1386 FIXME("GetFuncDesc %lx should not fail here.\n",hres
);
1389 /* some args take more than 4 byte on the stack */
1391 for (j
=0;j
<fdesc
->cParams
;j
++)
1392 nrofargs
+= _argsize(fdesc
->lprgelemdescParam
[j
].tdesc
.vt
);
1394 if (fdesc
->callconv
!= CC_STDCALL
) {
1395 ERR("calling convention is not stdcall????\n");
1401 /* popl %eax - return ptr
1408 * arg3 arg2 arg1 <method> <returnptr>
1410 xasm
->popleax
= 0x58;
1411 xasm
->pushlval
= 0x6a;
1413 xasm
->pushleax
= 0x50;
1414 xasm
->lcall
= 0xe8; /* relative jump */
1415 xasm
->xcall
= (DWORD
)xCall
;
1416 xasm
->xcall
-= (DWORD
)&(xasm
->lret
);
1418 xasm
->bytestopop
= (nrofargs
+2)*4; /* pop args, This, iMethod */
1419 proxy
->lpvtbl
[i
] = (DWORD
)xasm
;
1421 proxy
->lpvtbl2
= &tmproxyvtable
;
1422 /* 1 reference for the proxy and 1 for the object */
1424 proxy
->tinfo
= tinfo
;
1425 memcpy(&proxy
->iid
,riid
,sizeof(*riid
));
1426 *ppv
= (LPVOID
)proxy
;
1427 *ppProxy
= (IRpcProxyBuffer
*)&(proxy
->lpvtbl2
);
1431 typedef struct _TMStubImpl
{
1432 ICOM_VTABLE(IRpcStubBuffer
) *lpvtbl
;
1440 static HRESULT WINAPI
1441 TMStubImpl_QueryInterface(LPRPCSTUBBUFFER iface
, REFIID riid
, LPVOID
*ppv
) {
1442 if (IsEqualIID(riid
,&IID_IRpcStubBuffer
)||IsEqualIID(riid
,&IID_IUnknown
)){
1443 *ppv
= (LPVOID
)iface
;
1444 IRpcStubBuffer_AddRef(iface
);
1447 FIXME("%s, not supported IID.\n",debugstr_guid(riid
));
1448 return E_NOINTERFACE
;
1452 TMStubImpl_AddRef(LPRPCSTUBBUFFER iface
) {
1453 ICOM_THIS(TMStubImpl
,iface
);
1460 TMStubImpl_Release(LPRPCSTUBBUFFER iface
) {
1461 ICOM_THIS(TMStubImpl
,iface
);
1466 HeapFree(GetProcessHeap(),0,This
);
1470 static HRESULT WINAPI
1471 TMStubImpl_Connect(LPRPCSTUBBUFFER iface
, LPUNKNOWN pUnkServer
) {
1472 ICOM_THIS(TMStubImpl
,iface
);
1474 IUnknown_AddRef(pUnkServer
);
1475 This
->pUnk
= pUnkServer
;
1480 TMStubImpl_Disconnect(LPRPCSTUBBUFFER iface
) {
1481 ICOM_THIS(TMStubImpl
,iface
);
1483 IUnknown_Release(This
->pUnk
);
1488 static HRESULT WINAPI
1490 LPRPCSTUBBUFFER iface
, RPCOLEMESSAGE
* xmsg
,IRpcChannelBuffer
*rpcchanbuf
1494 ICOM_THIS(TMStubImpl
,iface
);
1496 DWORD
*args
, res
, *xargs
, nrofargs
;
1501 memset(&buf
,0,sizeof(buf
));
1502 buf
.size
= xmsg
->cbBuffer
;
1503 buf
.base
= xmsg
->Buffer
;
1505 buf
.iid
= IID_IUnknown
;
1508 if (xmsg
->iMethod
== 0) { /* QI */
1510 /* in: IID, out: <iface> */
1512 xbuf_get(&buf
,(LPBYTE
)&xiid
,sizeof(xiid
));
1514 hres
= _marshal_interface(&buf
,&xiid
,This
->pUnk
);
1515 xmsg
->Buffer
= buf
.base
; /* Might have been reallocated */
1516 xmsg
->cbBuffer
= buf
.size
;
1519 hres
= _get_funcdesc(This
->tinfo
,xmsg
->iMethod
,&fdesc
,NULL
,NULL
);
1521 FIXME("GetFuncDesc on method %ld failed with %lx\n",xmsg
->iMethod
,hres
);
1524 /* Need them for hack below */
1525 memset(names
,0,sizeof(names
));
1526 ITypeInfo_GetNames(This
->tinfo
,fdesc
->memid
,names
,sizeof(names
)/sizeof(names
[0]),&nrofnames
);
1527 if (nrofnames
> sizeof(names
)/sizeof(names
[0])) {
1528 ERR("Need more names!\n");
1531 /*dump_FUNCDESC(fdesc);*/
1533 for (i
=0;i
<fdesc
->cParams
;i
++)
1534 nrofargs
+= _argsize(fdesc
->lprgelemdescParam
[i
].tdesc
.vt
);
1535 args
= HeapAlloc(GetProcessHeap(),0,(nrofargs
+1)*sizeof(DWORD
));
1536 if (!args
) return E_OUTOFMEMORY
;
1538 /* Allocate all stuff used by call. */
1540 for (i
=0;i
<fdesc
->cParams
;i
++) {
1541 ELEMDESC
*elem
= fdesc
->lprgelemdescParam
+i
;
1542 BOOL isdeserialized
= FALSE
;
1544 if (((i
+1)<nrofnames
) && !IsBadStringPtrW(names
[i
+1],1)) {
1545 /* If the parameter is 'riid', we use it as interface IID
1546 * for a later ppvObject serialization.
1548 buf
.thisisiid
= !lstrcmpW(names
[i
+1],riidW
);
1550 /* deserialize DISPPARAM */
1551 if (!lstrcmpW(names
[i
+1],pdispparamsW
)) {
1552 hres
= deserialize_DISPPARAM_ptr(
1554 elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FIN
,
1562 FIXME("Failed to deserialize DISPPARAM*, hres %lx\n",hres
);
1565 isdeserialized
= TRUE
;
1567 if (!lstrcmpW(names
[i
+1],ppvObjectW
)) {
1568 hres
= deserialize_LPVOID_ptr(
1570 elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FOUT
,
1578 isdeserialized
= TRUE
;
1581 if (!isdeserialized
)
1582 hres
= deserialize_param(
1584 elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FIN
,
1591 xargs
+= _argsize(elem
->tdesc
.vt
);
1593 FIXME("Failed to deserialize param %s, hres %lx\n",relaystr(names
[i
+1]),hres
);
1597 hres
= IUnknown_QueryInterface(This
->pUnk
,&(This
->iid
),(LPVOID
*)&(args
[0]));
1599 ERR("Does not support iface %s\n",debugstr_guid(&(This
->iid
)));
1603 (*((FARPROC
**)args
[0]))[fdesc
->oVft
/4],
1608 IUnknown_Release((LPUNKNOWN
)args
[0]);
1611 for (i
=0;i
<fdesc
->cParams
;i
++) {
1612 ELEMDESC
*elem
= fdesc
->lprgelemdescParam
+i
;
1613 BOOL isserialized
= FALSE
;
1615 if (((i
+1)<nrofnames
) && !IsBadStringPtrW(names
[i
+1],1)) {
1616 /* If the parameter is 'riid', we use it as interface IID
1617 * for a later ppvObject serialization.
1619 buf
.thisisiid
= !lstrcmpW(names
[i
+1],riidW
);
1621 /* DISPPARAMS* needs special serializer */
1622 if (!lstrcmpW(names
[i
+1],pdispparamsW
)) {
1623 hres
= serialize_DISPPARAM_ptr(
1625 elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FOUT
,
1632 isserialized
= TRUE
;
1634 if (!lstrcmpW(names
[i
+1],ppvObjectW
)) {
1635 hres
= serialize_LPVOID_ptr(
1637 elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FOUT
,
1645 isserialized
= TRUE
;
1649 hres
= serialize_param(
1651 elem
->u
.paramdesc
.wParamFlags
& PARAMFLAG_FOUT
,
1658 xargs
+= _argsize(elem
->tdesc
.vt
);
1660 FIXME("Failed to stuballoc param, hres %lx\n",hres
);
1664 /* might need to use IRpcChannelBuffer_GetBuffer ? */
1665 xmsg
->cbBuffer
= buf
.curoff
;
1666 xmsg
->Buffer
= buf
.base
;
1667 HeapFree(GetProcessHeap(),0,args
);
1671 static LPRPCSTUBBUFFER WINAPI
1672 TMStubImpl_IsIIDSupported(LPRPCSTUBBUFFER iface
, REFIID riid
) {
1673 FIXME("Huh (%s)?\n",debugstr_guid(riid
));
1678 TMStubImpl_CountRefs(LPRPCSTUBBUFFER iface
) {
1679 ICOM_THIS(TMStubImpl
,iface
);
1681 return This
->ref
; /*FIXME? */
1684 static HRESULT WINAPI
1685 TMStubImpl_DebugServerQueryInterface(LPRPCSTUBBUFFER iface
, LPVOID
*ppv
) {
1690 TMStubImpl_DebugServerRelease(LPRPCSTUBBUFFER iface
, LPVOID ppv
) {
1694 ICOM_VTABLE(IRpcStubBuffer
) tmstubvtbl
= {
1695 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1696 TMStubImpl_QueryInterface
,
1700 TMStubImpl_Disconnect
,
1702 TMStubImpl_IsIIDSupported
,
1703 TMStubImpl_CountRefs
,
1704 TMStubImpl_DebugServerQueryInterface
,
1705 TMStubImpl_DebugServerRelease
1708 static HRESULT WINAPI
1709 PSFacBuf_CreateStub(
1710 LPPSFACTORYBUFFER iface
, REFIID riid
,IUnknown
*pUnkServer
,
1711 IRpcStubBuffer
** ppStub
1717 TRACE("(%s,%p,%p)\n",debugstr_guid(riid
),pUnkServer
,ppStub
);
1718 hres
= _get_typeinfo_for_iid(riid
,&tinfo
);
1720 FIXME("No typeinfo for %s?\n",debugstr_guid(riid
));
1723 stub
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(TMStubImpl
));
1725 return E_OUTOFMEMORY
;
1726 stub
->lpvtbl
= &tmstubvtbl
;
1728 stub
->tinfo
= tinfo
;
1729 memcpy(&(stub
->iid
),riid
,sizeof(*riid
));
1730 hres
= IRpcStubBuffer_Connect((LPRPCSTUBBUFFER
)stub
,pUnkServer
);
1731 *ppStub
= (LPRPCSTUBBUFFER
)stub
;
1733 FIXME("Connect to pUnkServer failed?\n");
1737 static ICOM_VTABLE(IPSFactoryBuffer
) psfacbufvtbl
= {
1738 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1739 PSFacBuf_QueryInterface
,
1742 PSFacBuf_CreateProxy
,
1746 /* This is the whole PSFactoryBuffer object, just the vtableptr */
1747 static ICOM_VTABLE(IPSFactoryBuffer
) *lppsfac
= &psfacbufvtbl
;
1749 /***********************************************************************
1750 * DllGetClassObject [OLE32.63]
1753 TypeLibFac_DllGetClassObject(REFCLSID rclsid
, REFIID iid
,LPVOID
*ppv
)
1755 if (IsEqualIID(iid
,&IID_IPSFactoryBuffer
)) {
1759 return E_NOINTERFACE
;