https://bugs.winehq.org/show_bug.cgi?id=48499
Bug ID: 48499 Summary: eSowa 3.x (.NET 4.x app) fails to run with Wine-Mono ('System.InvalidProgramException: Invalid IL code') Product: Wine Version: 5.0 Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: mscoree Assignee: wine-bugs@winehq.org Reporter: focht@gmx.net Distribution: ---
Hello folks,
reported by a user in IRC #winehq
Vendor site (Polish):
https://e-sowa.com/pl/o-programie
Google translate:
--- quote --- The eSOWA program is a comprehensive solution for servicing a workshop, car shop, warehouse or tire store. On a daily basis, it is used in hundreds of garages and automotive stores throughout Poland (and not only!) --- quote ---
Snapshot via Internet Archive:
https://web.archive.org/web/20200122215502/https://cdn.intercars.eu/files/es...
--- snip --- $ pwd /home/focht/.wine/drive_c/Program Files (x86)/eSOWA
$ tree --charset=ANSI . |-- AForge.dll |-- AForge.Video.DirectShow.dll |-- AForge.Video.dll |-- AxInterop.THERMALLIBLib.dll |-- BarcodeLib.dll |-- BarcodeScanner.dll |-- brother | |-- adres_magazynowy.lbx | |-- karta_przechowalni.lbx | |-- kod_na_towar.lbx | |-- kontrahent_adres.lbx | |-- pracownik.lbx | |-- towar_duza.lbx | |-- towar_mala.lbx | `-- zlecenie_mala.lbx |-- Dapper.dll |-- DevExpress.BonusSkins.v15.2.dll |-- DevExpress.Charts.v15.2.Core.dll |-- DevExpress.DataAccess.v15.2.dll |-- DevExpress.Data.v15.2.dll |-- DevExpress.Office.v15.2.Core.dll |-- DevExpress.PivotGrid.v15.2.Core.dll |-- DevExpress.Printing.v15.2.Core.dll |-- DevExpress.RichEdit.v15.2.Core.dll |-- DevExpress.Sparkline.v15.2.Core.dll |-- DevExpress.Utils.v15.2.dll |-- DevExpress.Utils.v15.2.UI.dll |-- DevExpress.Xpo.v15.2.dll |-- DevExpress.XtraBars.v15.2.dll |-- DevExpress.XtraCharts.v15.2.dll |-- DevExpress.XtraEditors.v15.2.dll |-- DevExpress.XtraGauges.v15.2.Core.dll |-- DevExpress.XtraGrid.v15.2.dll |-- DevExpress.XtraLayout.v15.2.dll |-- DevExpress.XtraPrinting.v15.2.dll |-- DevExpress.XtraReports.v15.2.dll |-- DevExpress.XtraReports.v15.2.Extensions.dll |-- DevExpress.XtraRichEdit.v15.2.dll |-- DevExpress.XtraScheduler.v15.2.Core.dll |-- DevExpress.XtraScheduler.v15.2.dll |-- DevExpress.XtraTreeList.v15.2.dll |-- elzabdr.dll |-- ElzabDrv.dll |-- eSOWA.ico |-- Fiskarka.dll |-- ICSklepDBUpdater.exe |-- ICSklep.exe |-- ICSklep.exe.config |-- ICSklep.Reports.dll |-- ICSklep.Shared.dll |-- ICSklep.Wydruki.dll |-- IC.Tools.dll |-- IC.Visual.dll |-- Interop.OICFiscalPrinterLib.dll |-- Interop.THERMALLIBLib.dll |-- Ionic.Zip.dll |-- JPKFa.dll |-- JPKMag.dll |-- Labeler.dll |-- LiczbyNaSlowaNET.dll |-- Microsoft.ApplicationBlocks.Data.dll |-- Microsoft.Threading.Tasks.dll |-- Microsoft.Threading.Tasks.Extensions.Desktop.dll |-- Microsoft.Threading.Tasks.Extensions.dll |-- Microsoft.Win32.TaskScheduler.dll |-- msvcr71.dll |-- Newtonsoft.Json.dll |-- OICFiscalPrinterLib.ocx |-- pl | |-- DevExpress.XtraScheduler.v15.2.Core.resources.dll | `-- DevExpress.XtraScheduler.v15.2.resources.dll |-- plugin_ksiegowosc.dll |-- PomocZdalna.exe |-- ReceiptPrinter.dll |-- ReceiptPrinter_nat.dll |-- RemoteBillPrinter.exe |-- System.IO.dll |-- System.Runtime.dll |-- System.Threading.Tasks.dll |-- System.Windows.Forms.Themes.dll |-- ThermalLib.ocx |-- Thermal.NET.dll |-- ThermalPrinter.dll |-- unins000.dat |-- unins000.exe `-- zxing.dll
2 directories, 84 files --- snip ---
--- snip --- $ WINE_MONO_TRACE=program,assembly,wrapper wine ./ICSklep.exe
0009:fixme:mscoree:parse_startup useLegacyV2RuntimeActivationPolicy=L"true" not implemented 0009:fixme:mscoree:parse_startup useLegacyV2RuntimeActivationPolicy=L"true" not implemented Unknown heap type: #GUlD
Unknown heap type: #Blop
[00000009: 0.00000 0] ENTER: <Module>:.cctor ()() [00000009: 0.00035 1] ENTER: <Module>:mmYVUWQF9TSgerjM7L ()() [00000009: 0.00095 2] ENTER: pmKtkE6jq0ABkxP2ns.pEjfuOfpXERI4rArWm:.cctor ()() [00000009: 0.00233 2] LEAVE: pmKtkE6jq0ABkxP2ns.pEjfuOfpXERI4rArWm:.cctor () [00000009: 0.00242 2] ENTER: pmKtkE6jq0ABkxP2ns.pEjfuOfpXERI4rArWm:lLHifFIsCLsZtjvFfN0i ()() [00000009: 0.00257 3] ENTER: pmKtkE6jq0ABkxP2ns.pEjfuOfpXERI4rArWm:tCPuP1wMNqNfmgdXgOUS ()() [00000009: 0.00302 4] ENTER: (wrapper managed-to-native) System.AppDomain:getCurDomain ()() [00000009: 0.00311 4] LEAVE: (wrapper managed-to-native) System.AppDomain:getCurDomain ()[System.AppDomain:042B4120] [00000009: 0.00317 3] LEAVE: pmKtkE6jq0ABkxP2ns.pEjfuOfpXERI4rArWm:tCPuP1wMNqNfmgdXgOUS ()[System.AppDomain:042B4120] [00000009: 0.00343 3] ENTER: pmKtkE6jq0ABkxP2ns.pEjfuOfpXERI4rArWm:or1NDPwMtRrJOADN8Yda (object,object)([System.AppDomain:042B4120], [System.ResolveEventHandler:03000428], ) [00000009: 0.00394 3] LEAVE: pmKtkE6jq0ABkxP2ns.pEjfuOfpXERI4rArWm:or1NDPwMtRrJOADN8Yda (object,object) [00000009: 0.00399 2] LEAVE: pmKtkE6jq0ABkxP2ns.pEjfuOfpXERI4rArWm:lLHifFIsCLsZtjvFfN0i () [00000009: 0.00404 1] LEAVE: <Module>:mmYVUWQF9TSgerjM7L () [00000009: 0.00410 0] LEAVE: <Module>:.cctor () [00000009: 0.00498 0] ENTER: <PrivateImplementationDetails>{B071721A-CBFB-46A7-A51C-C20A4F77E1D5}:.cctor ()() [00000009: 0.00505 1] ENTER: pmKtkE6jq0ABkxP2ns.pEjfuOfpXERI4rArWm:lLHifFIsCLsZtjvFfN0i ()() [00000009: 0.00514 1] LEAVE: pmKtkE6jq0ABkxP2ns.pEjfuOfpXERI4rArWm:lLHifFIsCLsZtjvFfN0i () [00000009:] EXCEPTION handling: System.InvalidProgramException: Invalid IL code in btFy13pd5uf4WC4h18.kgbOBx7BanbFa22Hp9:CcHZl53jD (): IL_005b: call 0x0600ff32 ... Unhandled Exception: System.TypeInitializationException: The type initializer for '<PrivateImplementationDetails>{B071721A-CBFB-46A7-A51C-C20A4F77E1D5}' threw an exception. ---> System.InvalidProgramException: Invalid IL code in btFy13pd5uf4WC4h18.kgbOBx7BanbFa22Hp9:CcHZl53jD (): IL_005b: call 0x0600ff32
at <PrivateImplementationDetails>{B071721A-CBFB-46A7-A51C-C20A4F77E1D5}..cctor () [0x00005] in <792269a2804b491987265fa5a39b6813>:0 --- End of inner exception stack trace --- [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for '<PrivateImplementationDetails>{B071721A-CBFB-46A7-A51C-C20A4F77E1D5}' threw an exception. ---> System.InvalidProgramException: Invalid IL code in btFy13pd5uf4WC4h18.kgbOBx7BanbFa22Hp9:CcHZl53jD (): IL_005b: call 0x0600ff32
at <PrivateImplementationDetails>{B071721A-CBFB-46A7-A51C-C20A4F77E1D5}..cctor () [0x00005] in <792269a2804b491987265fa5a39b6813>:0 --- End of inner exception stack trace ---
--- snip ---
Likely a dupe of existing obfuscation/invalid IL code bugs (https://bugs.winehq.org/buglist.cgi?quicksearch=System.InvalidProgramExcepti...) but since no one bothers to classify them more closely, creating another one.
Can be worked around by using native .NET Frameworks.
$ sha1sum eSowaSetup.exe 29317e30ae1b9b044e5c667f6feb2af028816123 eSowaSetup.exe
$ du -sh eSowaSetup.exe 72M eSowaSetup.exe
$ wine --version wine-5.0
Regards
https://bugs.winehq.org/show_bug.cgi?id=48499
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |https://web.archive.org/web | |/20200122215502/https://cdn | |.intercars.eu/files/esowa/e | |SowaSetup.exe Keywords| |download
https://bugs.winehq.org/show_bug.cgi?id=48499
--- Comment #1 from Vincent Povirk madewokherd@gmail.com ---
Unknown heap type: #Blop
I think it's the problem described in this comment, and we can assume other things printing the Blop/GUlD heap message are the same: https://bugs.winehq.org/show_bug.cgi?id=40779#c10
https://bugs.winehq.org/show_bug.cgi?id=48499
--- Comment #2 from Vincent Povirk madewokherd@gmail.com --- It might be possible to detect this situation and de-obfuscate the code before JITting, but probably not worth it.
https://bugs.winehq.org/show_bug.cgi?id=48499
--- Comment #3 from Vincent Povirk madewokherd@gmail.com --- Copying my original comment explaining the problem:
The method is obfuscated by using a switch instruction to branch between parts of the IL. It also violates an important rule of IL code: For each IL instruction, the stack should be the same depth regardless of the path taken to reach that instruction. There are obvious loops involving the switch instruction where the stack depth would be changed. I don't think it's possible for Mono's JIT to execute code like this given the approach it currently takes.
https://bugs.winehq.org/show_bug.cgi?id=48499
Vincent Povirk madewokherd@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|eSowa 3.x (.NET 4.x app) |Images obfuscated with .NET |fails to run with Wine-Mono |Reactor fail to run with |('System.InvalidProgramExce |Wine-Mono (Unknown heap |ption: Invalid IL code') |type: #Blop, Invalid IL | |code)
https://bugs.winehq.org/show_bug.cgi?id=48499
--- Comment #4 from Vincent Povirk madewokherd@gmail.com --- Seems to be .NET Reactor.
Found this trying to figure out what obfuscator was used: https://github.com/0xd4d/de4dot
That could be a useful tool for identifying obfuscators in the future.
https://bugs.winehq.org/show_bug.cgi?id=48499
Vincent Povirk madewokherd@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
--- Comment #5 from Vincent Povirk madewokherd@gmail.com --- *** Bug 31002 has been marked as a duplicate of this bug. ***
https://bugs.winehq.org/show_bug.cgi?id=48499
Vincent Povirk madewokherd@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |arabek+wine@gmail.com
--- Comment #6 from Vincent Povirk madewokherd@gmail.com --- *** Bug 42052 has been marked as a duplicate of this bug. ***
https://bugs.winehq.org/show_bug.cgi?id=48499
Esme Povirk madewokherd@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |madewokherd@gmail.com