Should madExcept catch this DLL exception?

delphi package - automated exception handling
Post Reply
BarryStaes
Posts: 35
Joined: Wed Dec 14, 2011 8:13 am

Should madExcept catch this DLL exception?

Post by BarryStaes »

First, I’d like to point out we are happy with MadExcept. :)
I just encountered something, I wonder if madExcept should/could intercept this.

This crash is reproducible (random, odds 1/10) by dragging my application to dock to the screen sides in a Windows 10 VM.

There appears a “QLedText has stopped working” dialog, and the software quits. I believe that this dialog is shown for uncatched exceptions, but madExcept was not triggered.

In the Windows event log, I see that the cause is related to “uxtheme.dll” which apparently is used by my Delphi 2010 application. I attached event log details in a post below.
Is this something that madExcept should or could intercept?

And if anyone else had their Delphi application crash on uxtheme.dll .. insights welcome!
Last edited by BarryStaes on Tue Oct 27, 2015 10:26 am, edited 2 times in total.
BarryStaes
Posts: 35
Joined: Wed Dec 14, 2011 8:13 am

Re: Should madExcept catch this DLL exception?

Post by BarryStaes »

Obtained via Event Viewer Local > Windows Logs > Application:

Windows 10 crash event 1:

Code: Select all

Log Name:      Application
Source:        Application Error
Date:          10/27/2015 2:46:15 AM
Event ID:      1000
Task Category: (100)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      DESKTOP-FPIG4PK
Description:
Faulting application name: QLedText.exe, version: 1.1.3.4920, time stamp: 0x562f2282
Faulting module name: uxtheme.dll, version: 10.0.10240.16397, time stamp: 0x55af08da
Exception code: 0xc000008e
Fault offset: 0x000505d2
Faulting process id: 0x7c4
Faulting application start time: 0x01d1109c422d84dd
Faulting application path: C:\Program Files (x86)\Q-lite\QLedText\QLedText.exe
Faulting module path: C:\Windows\system32\uxtheme.dll
Report Id: 2c5d89ae-2fc4-46c3-b90c-042fd92c3ba7
Faulting package full name: 
Faulting package-relative application ID: 
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Application Error" />
    <EventID Qualifiers="0">1000</EventID>
    <Level>2</Level>
    <Task>100</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2015-10-27T09:46:15.000000000Z" />
    <EventRecordID>256</EventRecordID>
    <Channel>Application</Channel>
    <Computer>DESKTOP-FPIG4PK</Computer>
    <Security />
  </System>
  <EventData>
    <Data>QLedText.exe</Data>
    <Data>1.1.3.4920</Data>
    <Data>562f2282</Data>
    <Data>uxtheme.dll</Data>
    <Data>10.0.10240.16397</Data>
    <Data>55af08da</Data>
    <Data>c000008e</Data>
    <Data>000505d2</Data>
    <Data>7c4</Data>
    <Data>01d1109c422d84dd</Data>
    <Data>C:\Program Files (x86)\Q-lite\QLedText\QLedText.exe</Data>
    <Data>C:\Windows\system32\uxtheme.dll</Data>
    <Data>2c5d89ae-2fc4-46c3-b90c-042fd92c3ba7</Data>
    <Data>
    </Data>
    <Data>
    </Data>
  </EventData>
</Event>
Windows 10 crash event 2:

Code: Select all

Log Name:      Application
Source:        Application Error
Date:          10/27/2015 2:47:54 AM
Event ID:      1000
Task Category: (100)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      DESKTOP-FPIG4PK
Description:
Faulting application name: QLedText.exe, version: 1.1.3.4920, time stamp: 0x562f2282
Faulting module name: uxtheme.dll, version: 10.0.10240.16397, time stamp: 0x55af08da
Exception code: 0xc000008e
Fault offset: 0x000505d2
Faulting process id: 0xaa4
Faulting application start time: 0x01d1109c5a7f3865
Faulting application path: C:\Program Files (x86)\Q-lite\QLedText\QLedText.exe
Faulting module path: C:\Windows\system32\uxtheme.dll
Report Id: 95c912f0-b89f-4025-9cde-17db11c36ba2
Faulting package full name: 
Faulting package-relative application ID: 
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Application Error" />
    <EventID Qualifiers="0">1000</EventID>
    <Level>2</Level>
    <Task>100</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2015-10-27T09:47:54.000000000Z" />
    <EventRecordID>258</EventRecordID>
    <Channel>Application</Channel>
    <Computer>DESKTOP-FPIG4PK</Computer>
    <Security />
  </System>
  <EventData>
    <Data>QLedText.exe</Data>
    <Data>1.1.3.4920</Data>
    <Data>562f2282</Data>
    <Data>uxtheme.dll</Data>
    <Data>10.0.10240.16397</Data>
    <Data>55af08da</Data>
    <Data>c000008e</Data>
    <Data>000505d2</Data>
    <Data>aa4</Data>
    <Data>01d1109c5a7f3865</Data>
    <Data>C:\Program Files (x86)\Q-lite\QLedText\QLedText.exe</Data>
    <Data>C:\Windows\system32\uxtheme.dll</Data>
    <Data>95c912f0-b89f-4025-9cde-17db11c36ba2</Data>
    <Data>
    </Data>
    <Data>
    </Data>
  </EventData>
</Event>
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Should madExcept catch this DLL exception?

Post by madshi »

madExcept by default does not care about handled exceptions. It does care about unhandled exceptions, of course. But what is really the difference between "handled" and "unhandled"? The way madExcept works is by hooking some RTL functions to be able to catch exceptions before they end up in the RTL default handler for unhandled exceptions. Furthermore, madExcept hooks into newly created threads so that it can catch exceptions which are not handled by the thread function itself.

madExcept doesn't seem to be handling this specific uxtheme.dll crash can have multiple reasons. Let me list by probability:

1) Could be that this crash neither ended up in any RTL exception handling related function, nor in any of madExcept's thread function wrappers, for some reason. One possible reason would be that there's some code somewhere, e.g. in uxtheme.dll, which catches exceptions and then directly passes them to the OS exception handler. Another possible reason would be that the crash occurred in a thread which wasn't protected by madExcept's thread function wrapper. This could happen if the thread was created before madExcept was initialized. Or if the thread was created in a way that madExcept's CreateThread() API hook didn't catch.

2) Could be a bug in madExcept of some kind.

3) Could be the process being in such a bad state that madExcept maybe caught the exception, but failed to do its work properly.

You could try calling madExcept.InstallUnhandledExceptionFilter() in your initialization. Does that make a difference? Or alternatively you could call madExcept.RegisterHiddenExceptionHandler() and in your handler set "handled := false" to force madExcept to take care even of properly handled exceptions. I'm not sure if either of these ideas will help, though.
BarryStaes
Posts: 35
Joined: Wed Dec 14, 2011 8:13 am

Re: Should madExcept catch this DLL exception?

Post by BarryStaes »

Thanks for your thorough yet fast answer.

Reason 1 seems probable, if only because the uxtheme.dll seems to be a part of Windows so its very possibly loaded before my application.
I'll try your suggestions, and i'll post insights on resolving this here if only for posterity / others having such a problem.
BarryStaes
Posts: 35
Joined: Wed Dec 14, 2011 8:13 am

Re: Should madExcept catch this DLL exception?

Post by BarryStaes »

i'll post insights on resolving this
This problem seems to have resolved itself after a Windows 10 update back in 2015.
BarryStaes
Posts: 35
Joined: Wed Dec 14, 2011 8:13 am

Re: Should madExcept catch this DLL exception?

Post by BarryStaes »

Sorry to resurrect this.. :oops:

I'm having another fatal and vague "has stopped working" crash in other software now. No bugreport and the system event log doesnt provide more details.

I have the bug narrowed down to networking code using WinSock2 (ws2_32.dll) since this was moved into threads.
It only occurs on machines of one client, where debugging using IDE is not possible.

Any suggestions on how find out what caused this?
I'm at a loss on how to make this work now.

edit: i just read about madCodeHook 4.1.0 and the new DLL injection. I'd be happy to try a new madExcept version that uses this.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Should madExcept catch this DLL exception?

Post by madshi »

madCodeHook has nothing to do with madExcept.

My previous comment (including the question and suggestions) still stands as a reply to your new problem.
BarryStaes
Posts: 35
Joined: Wed Dec 14, 2011 8:13 am

Re: Should madExcept catch this DLL exception?

Post by BarryStaes »

My previous comment (including the question and suggestions) still stands as a reply to your new problem.
Thanks for confirming this.
Post Reply