http://bugs.winehq.org/show_bug.cgi?id=24196
Summary: oleaut32: typelib registration should not fail bitness-neutral assemblies (32-bit typelib wrapped in 64-bit PE, x64 .NET 2.0 installer) Product: Wine Version: 1.3.1 Platform: x86-64 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: oleaut32 AssignedTo: wine-bugs@winehq.org ReportedBy: focht@gmx.net
Hello,
another x64 .NET Framework 2.0 installer bug. The typelib registration fails for some assemblies:
--- snip --- ... 002c:Call KERNEL32.CreateProcessA(00000000,7fffec16f650 ""C:\windows\Microsoft.NET\Framework64\v2.0.50727\regtlibv12.exe" "C:\windows\Microsoft.NET\Framework64\v2.0.50727\System.Drawing.tlb"",00000000,00000000,7fff00000001,00000000,00000000,00000000,7fffec8edfe8,7fffec8eb9e0) ret=4fc035780 ... 002e:Call oleaut32.LoadTypeLib(7ffff143f880 L"C:\windows\Microsoft.NET\Framework64\v2.0.50727\System.Drawing.tlb",7ffff143f870) ret=004027bf ... 002e:Call KERNEL32.LoadLibraryExW(7ffff143f360 L"C:\windows\Microsoft.NET\Framework64\v2.0.50727\System.Drawing.tlb",00000000,0000000b) ret=7ffff105ffb0 002e:Ret KERNEL32.LoadLibraryExW() retval=7fffefad0001 ret=7ffff105ffb0 ... 002e:Ret oleaut32.LoadTypeLib() retval=00000000 ret=004027bf 002e:Call oleaut32.RegisterTypeLib(7ffff74d30d0,7ffff143f880 L"C:\windows\Microsoft.NET\Framework64\v2.0.50727\System.Drawing.tlb",00000000) ret=00402808 ... 002e:Ret oleaut32.RegisterTypeLib() retval=800288bd ret=00402808 ... 002c:Call msi.MsiRecordSetStringW(00000005,00000000,7fffec8ec620 L"RegisterTypeLib of C:\windows\Microsoft.NET\Framework64\v2.0.50727\System.Drawing.tlb failed : 800288bd") ret=4fc0358bd --- snip ---
The PE file containing typelib resources "System.Drawing.tlb" is a PE64 binary.
Dumping the typelib resource reveals:
--- snip --- Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F Ascii
000002B0 4D 53 46 54 02 00 01 00 00 00 00 00 09 04 00 00 MSFT......... 000002C0 00 00 00 00 41 00 00 00 02 00 00 00 00 00 00 00 ....A.......... 000002D0 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ............... --- snip ---
flags: 0x41 -> indicates the typelib itself is 32 bit (SYSKIND = SYS_WIN32)
The folder "c:\windows\Microsoft.NET\Framework64\v2.0.50727" contains assemblies with following characteristics:
64-bit PE + 64 bit typelib part (flags = 0x43 -> SYSKIND = SYS_WIN64) 64-bit PE + 32 bit typelib part (flags = 0x41 -> SYSKIND = SYS_WIN32)
I verified that Wine msi correctly installs them into their appropriate 32 bit and 64 bit folders.
The 32-bit counterparts from "c:\windows\Microsoft.NET\Framework\v2.0.50727" are all:
32-bit PE + 32 bit typelib part (flags = 0x41 -> SYSKIND = SYS_WIN32)
===
What causes the embedded typelib to be 32-bit? Well, the .NET assemblies these typelibs belong to are flagged as "MSIL" assemblies. These are bitness-neutral assemblies that are portable and can run under any platform.
When you look at 64-bit -> "c:\windows\Microsoft.NET\Framework64\v2.0.50727\RedistList\FrameworkList.xml":
--- snip --- <File AssemblyName="System.Drawing" Version="2.0.0.0" PublicKeyToken="b03f5f7f11d50a3a" Culture="neutral" ProcessorArchitecture="MSIL" FileVersion="2.0.50727.42" InGAC="true" /> --- snip ---
Example for bitness-aware assembly (managed C++ assemblies are automatically platform specific):
64-bit -> "c:\windows\Microsoft.NET\Framework64\v2.0.50727\RedistList\FrameworkList.xml":
--- snip --- <File AssemblyName="System.Data" Version="2.0.0.0" PublicKeyToken="b77a5c561934e089" Culture="neutral" ProcessorArchitecture="AMD64" FileVersion="2.0.50727.42" InGAC="true" /> --- snip ---
32-bit -> "c:\windows\Microsoft.NET\Framework\v2.0.50727\RedistList\FrameworkList.xml":
(the 64 bit .NET Framework 2.0 redist contains both: the 64 bit _and_ 32 bit runtime)
--- snip --- <File AssemblyName="System.Data" Version="2.0.0.0" PublicKeyToken="b77a5c561934e089" Culture="neutral" ProcessorArchitecture="x86" FileVersion="2.0.50727.42" InGAC="true" /> --- snip ---
I guess Wine should not fail on these bitness-neutral assemblies that contain 32-bit typelibs.
--- snip dlls/oleaut32/typelib.c ---
HRESULT WINAPI RegisterTypeLib( ITypeLib * ptlib, /* [in] Pointer to the library*/ OLECHAR * szFullPath, /* [in] full Path of the library*/ OLECHAR * szHelpDir) /* [in] dir to the helpfile for the library, may be NULL*/ { ... if (ptlib == NULL || szFullPath == NULL) return E_INVALIDARG;
if (FAILED(ITypeLib_GetLibAttr(ptlib, &attr))) return E_FAIL;
TRACE("(%s,%d)", debugstr_w(szFullPath), attr->syskind);
#ifdef _WIN64 if (attr->syskind != SYS_WIN64) return TYPE_E_BADMODULEKIND; #else if (attr->syskind != SYS_WIN32 && attr->syskind != SYS_WIN16) return TYPE_E_BADMODULEKIND; #endif ... } --- snip dlls/oleaut32/typelib.c ---
Regards