[Bug 14639] ngen.exe from .NET 2.0 show exception E_INVALIDARG when trying to compile an assembly

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Jul 26 10:42:43 CDT 2008


http://bugs.winehq.org/show_bug.cgi?id=14639


Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |focht at gmx.net




--- Comment #1 from Anastasius Focht <focht at gmx.net>  2008-07-26 10:42:41 ---
Hello,

the behaviour you are observing (e.g. SetPriorityClass() call with priority
class param = -1) is a result of earlier damage.
To be honest, the real problem is not visible using (relay/olerelay) trace
output, one has to debug through the mess.

It's a COM proxy/server call which imbalances the stack, resulting in funny
behaviour ... 
Pure coincidence due to a combination of compiler generated EH prolog/epilog
code prevents a page fault and actually disguises the location.
The real problem is that wine doesn't handle VT_USERDEFINED args in typelib
marshaler properly.

Consider the following typelib info snippet:

--- snip ---
..

typedef struct tag_NGenPrivateAttributes {
unsigned long Flags;
unsigned long ZapStats;
BSTR DbgDir;
} _NGenPrivateAttributes;

interface ICorSvcSetPrivateAttributes : IUnknown {
    HRESULT _stdcall SetNGenPrivateAttributes([in] _NGenPrivateAttributes
ngenPrivateAttributes);
};

..
--- snip ---

When the proxy entry point code for SetNGenPrivateAttributes() method is setup,
the size of argument stack is calculated by _argsize().
Because of fall through, VT_USERDEFINED argument size will be ever one DWORD,
which is incorrect.

The custom type (struct) is passed by value.
In this example, 3 DWORDs are put on stack (0,0,NULL).
Wine has to take care of this, recursively walking through type descriptors for
VT_USERDEFINED args, calculating the sizes of the structure fields so the stack
can be properly cleaned up after returning from proxy.

I hope I gave enough information fix this...

Regards


-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list