[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)

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Apr 22 08:33:51 CDT 2012


http://bugs.winehq.org/show_bug.cgi?id=30485

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|-unknown                    |oleaut32
            Summary|MeGUI 2112 crashes after    |MeGUI 2112 crashes after
                   |first update / restart -    |first update / restart
                   |won't restart               |(application XML settings
                   |                            |can't be fully deserialized
                   |                            |due to oleaut32 VarDecRound
                   |                            |being a semi-stub)
     Ever Confirmed|0                           |1

--- Comment #4 from Anastasius Focht <focht at gmx.net> 2012-04-22 08:33:51 CDT ---
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

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list