Draft implementation of DispCallFunc.

This commit is contained in:
Marcus Meissner 2002-11-08 18:51:28 +00:00 committed by Alexandre Julliard
parent ac36f95082
commit 1bd4bbb569
2 changed files with 47 additions and 1 deletions

View File

@ -142,7 +142,7 @@
142 stdcall VarAnd(ptr ptr ptr) VarAnd
143 stub VarDiv # stdcall (ptr ptr ptr)
144 stub OACreateTypeLib2
146 stub DispCallFunc
146 stdcall DispCallFunc(ptr long long long long ptr ptr ptr) DispCallFunc
147 stdcall VariantChangeTypeEx(ptr ptr long long long) VariantChangeTypeEx
148 stdcall SafeArrayPtrOfIndex(ptr ptr ptr) SafeArrayPtrOfIndex
149 stdcall SysStringByteLen(ptr) SysStringByteLen

View File

@ -4192,6 +4192,52 @@ _invoke(LPVOID func,CALLCONV callconv, int nrargs, DWORD *args) {
extern int const _argsize(DWORD vt);
HRESULT WINAPI
DispCallFunc(
void* pvInstance, ULONG oVft, CALLCONV cc, VARTYPE vtReturn, UINT cActuals,
VARTYPE* prgvt, VARIANTARG** prgpvarg, VARIANT* pvargResult
) {
int i, argsize, argspos;
DWORD *args;
HRESULT hres;
FIXME("(%p, %ld, %d, %d, %d, %p, %p, %p)\n",
pvInstance, oVft, cc, vtReturn, cActuals, prgvt, prgpvarg, pvargResult
);
argsize = 0;
for (i=0;i<cActuals;i++) {
FIXME("arg %d: type %d\n",i,prgvt[i]);
dump_Variant(prgpvarg[i]);
argsize += _argsize(prgvt[i]);
}
args = (DWORD*)HeapAlloc(GetProcessHeap(),0,sizeof(DWORD)*argsize);
argspos = 0;
for (i=0;i<cActuals;i++) {
int arglen;
VARIANT *arg = prgpvarg[i];
arglen = _argsize(prgvt[i]);
if (V_VT(arg) == prgvt[i]) {
memcpy(&args[argspos],&V_UNION(arg,lVal), arglen*sizeof(DWORD));
} else {
if (prgvt[i] == VT_VARIANT) {
memcpy(&args[argspos],arg, arglen*sizeof(DWORD));
} else {
ERR("Set arg %d to disparg type %d vs %d\n",i,
V_VT(arg),prgvt[i]
);
}
}
argspos += arglen;
}
FIXME("Do not know how to handle pvargResult %p. Expect crash ...\n",pvargResult);
hres = _invoke((*(DWORD***)pvInstance)[oVft/4],cc,argsize/4,args);
HeapFree(GetProcessHeap(),0,args);
return hres;
}
static HRESULT WINAPI ITypeInfo_fnInvoke(
ITypeInfo2 *iface,
VOID *pIUnk,