On Thu, Jun 13, 2002 at 08:39:05PM +0100, Ann and Jason Edmeades wrote:
Hi all,
Playing further with my VB program and native oleaut32 I've hit an 'interesting issue' with the Microsoft Date/Time picker.
typelib.c in dlls\oleaut32 assumes all parms are dwords and picks the lval of a variant (which for most of the types of variant is the dword containing the important information). However as shown by the following trace:
trace:ole:ITypeInfo_fnInvoke (0x404560ac)(0x40418fac,id=20,flags=0x00000004,0x405c5d84,(nil),0x405c5d64,0 x405c5d94) partial stub! trace:ole:dump_DispParms args=1 named args=1 trace:ole:dump_Variant (0x405c5dec) trace:ole:dump_Variant VARTYPE: VT_DATE
This shows that the function takes one parm and that parm is a variant. We pass the value contained in the parm and it fails. We need to ensure the whole variant is put on the stack for the called function. Since we currently only call with dword parms this wont work.
Actually I think just the DATE part should be out there, which is 8 byte long.
This hack takes the parm and puts the variant into that arg and subsequent ones, meaning the stack to the called function should look as it would be. Unfortunately as it stands this would only work with one parm, so my question is how it is supposed to be fixed. I could potentially change args[i+1] to args[numArgWords+1] but it still feels very hacky.
No, just reuse _argsize() from tmarshal.c, calculate the number of stack positions using this function, allocate enough space, memcpy() out of the VARIANTS into the stack space and invoke. (I have submitted a patch to tmarshal.c).
Looking at the code in there ... I think I have to have another, closer look at it :/
Ciao, Marcus