Quoting Alexandre Julliard <[EMAIL PROTECTED]>:

> Francois Jacques <[EMAIL PROTECTED]> writes:
> 
> > +static HRESULT
> > +INVOKE_InvokeStdCallFunction(IUnknown*   pIUnk,
> > +                             FUNCDESC*   pFuncDesc,
> > +                             VARIANTARG* paArgsCoerced,
> > +                             VARIANT*    pVarResult,
> > +                             EXCEPINFO*  pExcepInfo)
> > +{
> > +    typedef DWORD  (__stdcall *pDWORDRetFunc) (IUnknown*);   
> > +    typedef double (__stdcall *pDoubleRetFunc)(IUnknown*); 
> > +
> > +    HRESULT hr = E_FAIL;
> > +
> > +    /* retrieve current stack pointer, keep a copy */
> > +#ifdef __GNUC__ 
> > +#ifdef __i386__
> > +    register DWORD esp asm("esp");
> > +#endif 
> > +#endif
> 
> You absolutely cannot manipulate the stack behind gcc's back. There is
> no way this can work except by pure blind luck. You should build the
> arguments into a DWORD array and then use a switch statement to pass
> the right number of parameters, like we do in relay32/relay386.c.

Actually, you can manipulate the stack, you just have to make sure that gcc 
never sees it -- i.e. you have to do everything inside one big volatile asm 
statement and leave the stack the same afterwards.

-- 
Taral <[EMAIL PROTECTED]>

Reply via email to