wine-mono icon indicating copy to clipboard operation
wine-mono copied to clipboard

Missing mscorlib.tlb file

Open alesliehughes opened this issue 11 years ago • 9 comments

The file tlb needs to be created from mscorlib.dll. However there is currently no easy way to extract an TLB or IDL from it.

This is to support VS2008 express.

alesliehughes avatar Oct 29 '13 09:10 alesliehughes

In theory, we should implement regasm and use that, since windows programs may also need this functionality.

madewokherd avatar Oct 31 '13 16:10 madewokherd

Wine's oleview utility may also be useful for comparing our typelibs to those generated by native.

madewokherd avatar Oct 31 '13 16:10 madewokherd

Sorry, what we actually want is tlbexp, not regasm.

madewokherd avatar Oct 31 '13 16:10 madewokherd

OK, turns out there's a .NET API that looks the same as tlbexp: http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.itypelibconverter.convertassemblytotypelib%28v=vs.110%29.aspx

There's also a method in Marshal that gets a typeinfo from a Type: http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.getitypeinfofortype%28v=vs.110%29.aspx

I would guess that both tlbexp and the IDispatch methods of Mono's CCW's should be based on this stuff.

madewokherd avatar Oct 31 '13 18:10 madewokherd

Note the conversion rules are documented here: http://msdn.microsoft.com/en-us/library/xk1120c3(v=vs.110).aspx

madewokherd avatar Oct 31 '13 19:10 madewokherd

The immediate problem I'm running into is that I don't know exactly what they're hashing to generate the guids. For example, System.Object is this:

[ uuid(81C5FE01-027C-3E1C-98D5-DA9C9862AA21) ] coclass Object { [default] interface _Object; };

The '3' in the third group of digits means it's an md5 hash of something (according to rfc1422), but every variation of 'System' and 'Object' I've come up with shows something different.

madewokherd avatar Oct 31 '13 21:10 madewokherd

When creating a TLB from a .NET dll, I have observed the following.

When the TBL is created for the first time, new guids are created for each class which don't have the [guid] attribute.

On subsequent rebuilds, assuming it can find the TLB file, the guids are reused from the TBL file. (Using VS)

alesliehughes avatar Nov 01 '13 08:11 alesliehughes

According to the documentation, they should be consistent given the same dll, and in many cases even if the dll has been modified.

madewokherd avatar Nov 01 '13 14:11 madewokherd

With https://github.com/madewokherd/mono/commit/d5f338c088defdf81f4374f4e6fbff75c9b1e554 this is likely tractable now. That only implemented GUID generation for interfaces, but the code for classes should be available as well. We also have dispatch interfaces, and we should make sure those match.

madewokherd avatar Sep 19 '21 19:09 madewokherd