WineHQ
Bug Tracking Database – Bug 30485

 Bugzilla

 

Last modified: 2013-11-15 13:39:30 UTC  

MeGUI 2112 crashes after first update / restart (application XML settings can't be fully deserialized due to oleaut32 VarDecRound being a semi-stub)

Bug 30485 - MeGUI 2112 crashes after first update / restart (application XML settings can't be fully deserialized due to oleaut32 VarDecRound being a semi-stub)
MeGUI 2112 crashes after first update / restart (application XML settings can...
Status: CLOSED FIXED
AppDB: Show Apps affected by this bug
Product: Wine
Classification: Unclassified
Component: oleaut32
1.5.2
x86-64 Linux
: P2 normal
: ---
Assigned To: Mr. Bugs
http://sourceforge.net/projects/megui...
: dotnet, download, source
Depends on:
Blocks: 32125
  Show dependency tree
 
Reported: 2012-04-19 19:45 UTC by Robert Walker
Modified: 2013-11-15 13:39 UTC (History)
2 users (show)

See Also:
Regression SHA1:
Fixed by SHA1: 87c459ab2359784f238c30073b1adc0111876987
Distribution: ---
Staged patchset:


Attachments
Wine MeGUI console log (first run) (33.11 KB, text/plain)
2012-04-19 19:45 UTC, Robert Walker
Details
Wine MeGUI console log (re-runs) (14.77 KB, text/plain)
2012-04-19 19:46 UTC, Robert Walker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Walker 2012-04-19 19:45:04 UTC
Created attachment 39866 [details]
Wine MeGUI console log (first run)

ARCH-Linux x86_64 (fully updated). Clean win32 prefix.


MeGUI (OpenSource GUI wrapper for various video encoding utilities) download latest build at:
http://sourceforge.net/projects/megui/files/latest/download?source=files


Install:
winetricks dotnet11
winetricks dotnet20
winetricks gdiplus
(all successfully install)

I've also tried installing avisynth 2.5.8 and K-Lite-Mega-Codec-Pack-7.8
(does step makes little difference to the MeGUI program crash).

MeGUI will run. Update itself. Updates are stored in a local /update_cache folder as zip'd/7z'd archives. Gets to a stage of asking for a system restart. Whether you say "yes" or "no" (and manually shutdown MeGUI with the "Exit" menu option) the program eventually crashes. The Wineserver shuts down. Starting MeGUI again results in an immediate crash.

This a deal breaker for the software. The download MeGUI zip archive needs to be updated to extract the tools in the /update_cache folder. Otherwise there will not be any encoders available to use. Earlier installable executable version of MeGUI exhibits an identical crash when updated...


Bob
Comment 1 Robert Walker 2012-04-19 19:46:09 UTC
Created attachment 39867 [details]
Wine MeGUI console log (re-runs)
Comment 2 Austin English 2012-04-19 20:57:32 UTC
Something tells me Focht would like this one.. ;)
Comment 3 Robert Walker 2012-04-20 08:35:54 UTC
Just tried the following:
Installing megui in Windows XP (32-bit) running on VirtualBox. Fully updated megui. Copied the megui folder back to my ARCH-Linux MeGUI WinePrefix and tried running MeGUI.

I'm still giving the same error/popup window as before...
Comment 4 Anastasius Focht 2012-04-22 08:33:51 UTC
Hello,

--- quote ---
Install:
winetricks dotnet11
winetricks dotnet20
winetricks gdiplus
--- quote ---

where did you get that prerequisites list?
IMHO there is no need to install .NET Framework 1.1 and gdiplus, 'winetricks -q dotnet20' is sufficient.

The app crashes while deserializing some settings from "settings.xml".
Managed code snippet:

--- snip ---
public void loadSettings()
{
    string path = Path.Combine(this.path, "settings.xml");
    if (File.Exists(path))
    {
        XmlSerializer serializer = null;
        using (Stream stream = File.OpenRead(path))
        {
            serializer = new XmlSerializer(typeof(MeGUISettings));
            try
            {
                this.settings = (MeGUISettings) serializer.Deserialize(stream);
            }
            catch (Exception exception)
            {
                Instance.Log.Info("Error").LogValue("loadSettings", exception, ImageType.Error);
                MessageBox.Show("Settings could not be loaded.", "Error loading profile", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
    }
}
--- snip ---

The XML deserialization fails due to Wine insufficiency, causing managed exception to be thrown (internally C++ and then managed exception).
The single-instance logger in exception handler isn't ready at this early point (ctors), causing the runtime to fail (no other app exception handler around).

--- snip ---
0033f51c 79e88f63 [GCFrame: 0033f51c] 
(2b.2c): C++ EH exception - code e06d7363 (first chance)
(2b.2c): CLR exception - code e0434f4d (first chance)
...
OS Thread Id: 0x2c (0)
ESP       EIP     
0033efc0 7b839357 [HelperMethodFrame: 0033efc0] 
0033f0d0 0393d162 MeGUI.MainForm.get_Log()
0033f0d4 03936f4d MeGUI.MainForm.loadSettings()
0033f180 03722218 MeGUI.MainForm.constructMeGUIInfo()
0033f18c 0372079d MeGUI.MainForm..ctor()
0033f2d4 0372027f MeGUI.MainForm.Main(System.String[])
0033f51c 79e88f63 [GCFrame: 0033f51c] 
(2b.2c): CLR exception - code e0434f4d (!!! second chance !!!)
--- snip ---

For serialization/deserialization of XML settings, the app dynamically generates assemblies on the fly using .NET compiler infrastructure.

--- snip ---
002b:Call KERNEL32.CreateProcessW(00000000,00184238 L"\"C:\\windows\\Microsoft.NET\\Framework\\v2.0.50727\\csc.exe\" /noconfig /fullpaths @\"C:\\users\\focht\\Temp\\ub-soeo_.cmdline\"",00000000,00000000,00000001,00000000,00876a64,0084f78c L"Z:\\home\\focht\\Downloads\\xxx",00184178,0084fe8c) ret=79ef064c
...
002f:Call KERNEL32.__wine_kernel_init() ret=7bc530d2
002b:Ret  KERNEL32.CreateProcessW() retval=00000001 ret=79ef064c  
--- snip ---

Example command file:

--- snip ---
/t:library /utf8output /R:"Z:\home\focht\Downloads\xxx\MeGUI.exe" /R:"C:\windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" /R:"C:\windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /out:"C:\users\focht\Temp\rvzrydjl.dll" /debug- /optimize+ /nostdlib /D:_DYNAMIC_XMLSERIALIZER_COMPILATION  "C:\users\focht\Temp\rvzrydjl.0.cs"
--- snip ---

Example C# code snippet to be turned into dynamically created assembly:

--- snip ---
#if _DYNAMIC_XMLSERIALIZER_COMPILATION
[assembly:System.Security.AllowPartiallyTrustedCallers()]
[assembly:System.Security.SecurityTransparent()]
#endif
[assembly:System.Reflection.AssemblyVersionAttribute("1.0.2112.0")]
namespace Microsoft.Xml.Serialization.GeneratedAssembly {

    public class XmlSerializationWriterGenericProfile1 : System.Xml.Serialization.XmlSerializationWriter {

        public void Write16_GenericProfileOfFlacSettings(object o) {
            WriteStartDocument();
            if (o == null) {
                WriteNullTagLiteral(@"GenericProfileOfFlacSettings", @"");
                return;
            }
            TopLevelElement();
            Write15_GenericProfileOfFlacSettings(@"GenericProfileOfFlacSettings", @"", ((global::MeGUI.GenericProfile<global::MeGUI.FlacSettings>)o), true, false);
        }
...
--- snip ---

These dynamically created assemblies are used for deserializing custom types.
Managed callstack where the deserialization fails:

--- snip ---
0033e740 7b839357 [HelperMethodFrame: 0033e740] System.Decimal.FCallRound(System.Decimal ByRef, System.Decimal, Int32)
0033e7c0 793bfc44 System.Decimal.Round(System.Decimal, Int32)
0033e804 793c6ad2 System.Math.Round(System.Decimal)
0033e818 03721cc3 MeGUI.core.util.FileSize.setExact(UInt64, System.Decimal)
0033e86c 0393d137 MeGUI.core.util.FileSize.set_GBExact(System.Decimal)
0033e880 0393cf68 Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMeGUISettings.Read4_FileSize(Boolean)
0033e928 0393c87c Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMeGUISettings.Read12_NullableOfFileSize(Boolean)
0033e958 0393c6ec Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMeGUISettings.Read13_AutoEncodeDefaultsSettings(Boolean, Boolean)
0033e998 0393a882 Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMeGUISettings.Read14_MeGUISettings(Boolean, Boolean)
0033eb0c 0393841d Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMeGUISettings.Read15_MeGUISettings()
0033ed88 79e88f63 [CustomGCFrame: 0033ed88] 
0033ed6c 79e88f63 [GCFrame: 0033ed6c] 
0033ed50 79e88f63 [GCFrame: 0033ed50] 
0033ef58 79e88f63 [HelperMethodFrame_1OBJ: 0033ef58] System.RuntimeMethodHandle._InvokeMethodFast(System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeTypeHandle)
0033efc8 793cf629 System.RuntimeMethodHandle.InvokeMethodFast(System.Object, System.Object[], System.Signature, System.Reflection.MethodAttributes, System.RuntimeTypeHandle)
0033f014 79401281 System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, Boolean)
0033f050 7940114a System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
0033f070 69d37219 System.Xml.Serialization.TempAssembly.InvokeReader(System.Xml.Serialization.XmlMapping, System.Xml.XmlReader, System.Xml.Serialization.XmlDeserializationEvents, System.String)
0033f0c0 69d9ca16 System.Xml.Serialization.XmlSerializer.Deserialize(System.Xml.XmlReader, System.String, System.Xml.Serialization.XmlDeserializationEvents)
0033f124 69d9c8fd System.Xml.Serialization.XmlSerializer.Deserialize(System.Xml.XmlReader, System.String)
0033f130 69d9c7e1 System.Xml.Serialization.XmlSerializer.Deserialize(System.IO.Stream)
0033f14c 03936f12 MeGUI.MainForm.loadSettings()
0033f180 03722218 MeGUI.MainForm.constructMeGUIInfo()
0033f18c 0372079d MeGUI.MainForm..ctor()
0033f2d4 0372027f MeGUI.MainForm.Main(System.String[])
--- snip ---

The culprit is oleaut32 VarDecRound() semi-stub

Source: http://source.winehq.org/git/wine.git/blob/c55db752a2922776ea97de69ae9986ad90093ad1:/dlls/oleaut32/vartype.c#l5752

--- snip ---
5766 HRESULT WINAPI VarDecRound(const DECIMAL* pDecIn, int cDecimals, DECIMAL* pDecOut)
5767 {
5768   if (cDecimals < 0 || (DEC_SIGN(pDecIn) & ~DECIMAL_NEG) || DEC_SCALE(pDecIn) > DEC_MAX_SCALE)
5769     return E_INVALIDARG;
5770 
5771   if (cDecimals >= DEC_SCALE(pDecIn))
5772   {
5773     *pDecOut = *pDecIn; /* More precision than we have */
5774     return S_OK;
5775   }
5776 
5777   FIXME("semi-stub!\n");
5778 
5779   return DISP_E_OVERFLOW;
5780 }
--- snip ---

With that semi-stub fixed, the app can successfully deserialize all its settings and the startup after update works.

$ du -sh MeGUI_2112_x86.zip 
38M	MeGUI_2112_x86.zip

$ sha1sum MeGUI_2112_x86.zip 
68c58259ad4fea8ccd981911e0d2f64d3a6a3bf2  MeGUI_2112_x86.zip

$ wine --version
wine-1.5.2-191-gd080774

Regards
Comment 5 Robert Walker 2012-04-29 05:23:30 UTC
(In reply to comment #4)
> Hello,
> 
> --- quote ---
> Install:
> winetricks dotnet11
> winetricks dotnet20
> winetricks gdiplus
> --- quote ---
> 
> where did you get that prerequisites list?
> IMHO there is no need to install .NET Framework 1.1 and gdiplus, 'winetricks -q
> dotnet20' is sufficient.
> 
> The app crashes while deserializing some settings from "settings.xml".
...
> $ wine --version
> wine-1.5.2-191-gd080774
> 
> Regards

@Anastasius

Thanks for the quick response! However I must be doing something else stupid...

I waited till ARCH had wine 1.5.3 in the official repository. Clean 32-bit wineprefix. Used
$ winetricks -q dotnet20
as suggested...

$ sha1sum MeGUI_2112_x86.zip 
68c58259ad4fea8ccd981911e0d2f64d3a6a3bf2  MeGUI_2112_x86.zip
$ wine --version
wine-1.5.3

Was your fix to the Wine Git tree a full fix or a partial fix...?? I am still seeing the same bug (practically identical error GUI and console output)...

Thanks
Bob
Comment 6 Anastasius Focht 2012-04-29 06:08:26 UTC
Hello Robert,

--- quote ---
Thanks for the quick response! However I must be doing something else stupid...

I waited till ARCH had wine 1.5.3 in the official repository. Clean 32-bit
wineprefix. Used
$ winetricks -q dotnet20
as suggested...

$ sha1sum MeGUI_2112_x86.zip 
68c58259ad4fea8ccd981911e0d2f64d3a6a3bf2  MeGUI_2112_x86.zip
$ wine --version
wine-1.5.3

Was your fix to the Wine Git tree a full fix or a partial fix...?? I am still
seeing the same bug (practically identical error GUI and console output)...
--- quote ---

No, I didn't provide a fix - I pointed out the function that is the culprit by using a link to Wine source tree (and quoting the source).
To be sure I verified by hacking that semi-stub to accept input with less precision and it fixes the app.

You'll have to wait until someone picks the bug up and submits a proper patch/implementation for review/inclusion.

Regards
Comment 7 gluk1024 2012-09-28 07:31:35 UTC
Used to step on that bug too. I've needed a fast fix, so wrote the implementation myself.
Here is the realisation for that function, that worked for me:


HRESULT WINAPI VarDecRound(const DECIMAL* pDecIn, int cDecimals, DECIMAL* pDecOut)
{
  if (cDecimals < 0 || (DEC_SIGN(pDecIn) & ~DECIMAL_NEG) || DEC_SCALE(pDecIn) > DEC_MAX_SCALE)
    return E_INVALIDARG;

  if (cDecimals >= DEC_SCALE(pDecIn))
  {
    *pDecOut = *pDecIn; /* More precision than we have */
    return S_OK;
  }
  else
  {
    double dbResult;
    HRESULT hRet;

    hRet = VarR8FromDec(pDecIn, &dbResult);
    if (SUCCEEDED(hRet))
    {
      dbResult = floor(dbResult * pow(10, cDecimals) + 0.5) / pow(10, cDecimals);
      hRet = VarDecFromR8(dbResult, pDecOut);
      if (SUCCEEDED(hRet))
      {
        return S_OK;
      }
    }
  }

  FIXME("semi-stub!\n");

  return DISP_E_OVERFLOW;
}
Comment 8 Anastasius Focht 2013-09-18 16:40:44 UTC
Hello folks,

this is fixed by commit http://source.winehq.org/git/wine.git/commitdiff/87c459ab2359784f238c30073b1adc0111876987

Thanks Andrew

Regards
Comment 9 Alexandre Julliard 2013-09-27 13:40:43 UTC
Closing bugs fixed in 1.7.3.
Comment 10 Alexandre Julliard 2013-11-15 13:39:30 UTC
Removing 1.6.x milestone from bugs included in 1.6.1.


Privacy Policy
If you have a privacy inquiry regarding this site, please write to [email protected]

Hosted By CodeWeavers