madewokherd / wine-mono

Other
291 stars 39 forks source link

Missing mscorlib.tlb file #16

Open alesliehughes opened 11 years ago

alesliehughes commented 11 years ago

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.

madewokherd commented 11 years ago

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

madewokherd commented 11 years ago

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

madewokherd commented 11 years ago

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

madewokherd commented 11 years ago

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 commented 11 years ago

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

madewokherd commented 11 years ago

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.

alesliehughes commented 11 years ago

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)

madewokherd commented 11 years ago

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

madewokherd commented 3 years ago

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.