working on it ...

Filters

Explore Public Snippets

Sort by

Found 18 snippets matching: madexcept

    external by David Heffernan modified Aug 8, 2016  1  0  2  0

    Modifying Bug report message generated by MadExcept

    The bug report generated by MadExcept shows computer name and other such details which is a security concern. How can I modify the message and remove such values from it.
    /* 
    In your madExcept exception handler, you have access to the bug report header fields. A madExcept exception handler looks like this:
     */
    procedure ExceptionHandler(const exceptIntf: IMEException; var handled: boolean);
    
    
    /* 
    You can remove fields from the bug report header by operating on the supplied exceptIntf interface.
    
    For instance define this helper function:
     */
    procedure RemoveField(const Fields: IMEFields; const FieldName: UnicodeString);
    var 
      Index: Integer;
    begin
      Index := exc.BugReportHeader.FindItem('computer name');
      if Index<>-1 then 
        Fields.Delete(Index);
    end;
    
    
    /* 
    Then call it from inside your exception handler like this:
     */
    RemoveField(exceptIntf.BugReportHeader, 'computer name');
    
    
    /* 
    
     */
    

    external by Sebastian Z modified Apr 9, 2015  1  0  2  0

    madExcept required compiler directives

    I use madExcept (not from the IDE) but in a automated batch process. Which compiler directives I should switch on in order to have stack trace and line numbers. I do not care about loaded modules, processes or CPU registers. I currently run with: {$DEBUGINFO ON} {$LOCALSYMBOLS ON} {$REFERENCEINFO OFF} But would like remove as much "fat" as pos
    /* 
    According to the mad except help file, you should pass the -gd switch to the command line compiler in order to get a detailed map file. Don't forget to run the madExceptPatch.exe tool after compiling.
    
    When you enable madexcept in the project options, it sets the following two compiler options:
     */
    {$DEBUGINFO 1}
    {$LOCALSYMBOLS ON}
    
    
    /* 
    
     */
    

    external by StackOverflow modified Aug 23, 2014  1  0  2  0

    Delphi XE6 issue with styled menus and madExcept

    I've faced a really odd behavior of Delphi VCL Styles. With VCL styles enabled, and when madExcept has the "instantly crash on buffer overrun" option activated, the menus become non-styled. Turning this option off, or switching it to "instantly crash on buffer UNDERrun" fixes the menus issue. Questions are: did anyone else encounter this issue?
    /* 
    That seems to indicate to me that the VCL styles code has a buffer overrun. The madExcept memory manager is succeeding in making that buffer overrun manifest as an exception. In turn the styles code responds by disabling styles. 
    
    The next course of action is to run the code under the debugger, with debug DCUs enabled so that you can debug the VCL code. Hopefully the debugger will catch the exception and then highlight the buffer overrun. 
    
    If you succeed in identifying the problem you can make a workaround and submit a bug report to QC. 
     */
    

    external by StackOverflow modified Jul 9, 2014  1  0  2  0

    MadExcept + try/finally block?

    I have some delphi code, kind of like this: try //some code //occasionally throws an exception here, for example an EIndexOutOfRangeException //more code...should get skipped if exception is thrown finally // there may or may not be any important cleanup code here end; The exception in this case is not something that needs handling beyon
    /* 
    It seems to me that you have a fundamental mis-understanding about what finally means. 
    
    A finally block does not influence the propagation of an exception. It just ensures that the finally block will execute, even if an exception has been raised, or the normal execution flow has been modified by exit, break etc. 
    
    Take the try/finally out and madExcept will still report that the program raised an exception that was not handled. 
    
    There are ways to tell madExcept to ignore certain exceptions. For instance some exceptions should be silent. The canonical example of such is EAbort. You would use RegisterExceptionHandler to customise how unhandled exceptions are treated. Although, as I will explain, I doubt this to be the solution for your problem. 
    
    What you need to do next is forget about madExcept. You need to work out what to do about this exception. Do you want to handle it here, or do you need to let the exception propagate? Only you can really know that. But madExcept is not the driver here. What must drive your decision is the correct execution of your program. Should the exception be handled or not, to make your program behave correctly? You must get that right first, and then worry about madExcept. 
    
    If you need to handle it here, then handle it selectively. Don't catch all exceptions. That's an absolute no-no. But if you handle it here, ask yourself if that is sensible. The code failed to perform some action. Is there some subsequent code that relies on that action succeeding? By handling the error, and ignoring it as you propose, you are forcing all subsequent code to be ambivalent about the success or failure of this action. That seems highly dubious to me.   
    
    Now, the exception is EIndexOutOfRangeException. That means you wrote something like A[i] where the value of i is invalid. I cannot think of a scenario where that would be acceptable. So it looks to me that your program contains an error and is simply using an invalid index. You should fix that error properly by not accessing out of bounds. Don't suppress the exception, stop it being raised. 
    
    Another way to look at this. How can you tell the difference between your current situation, and that which would arise from writing A[-i] instead of A[i]? Suppressing the exception means that you cannot detect such egregious errors as this. 
    
    The bottom line, so far as I can tell, is that madExcept is reporting an error in your code. You should regard madExcept as your friend and listen to what it says. It is telling you that you have a defect in your code that should be fixed.
     */
    

    external by LaBracca modified Aug 26, 2013  1  0  2  0

    MadExcept for delphi is not printing stacktrace after application crash

    Detailed question : We are trying to capture the stacktrace (bugreport.txt) using MadExcept in a delphi application where a thread is crashing the application with a fatal error. But MadExcept doesn't print any stacktrace after the application crashes. Any ideas why? OUR CODE : procedure TMainForm.WSServerExecute(AContext: TIdContext); begin t
    /* 
    You could try using RegisterHiddenExceptionHandler(stDontDync). See documentation for more details. In your handler then simply do this:
     */
    procedure YourHiddenExceptionHandler(const exceptIntf: IMEException; var handled: boolean);
    begin
      handled := false;
    end;
    
    
    /* 
    The above is a trick to force madexcept to work also with handled exceptions, of course it is risky to use it in production...
     */
    

    external by StackOverflow modified Jun 21, 2013  1  0  2  0

    Can madExcept Freeze my Application?

    I have a Delphi 5-based application using madExcept 3.0m. It appearantly freezes due to madExcept, a product whose quality I admire and thus don't usually blame for anything. Here's the code: AddLogEntry('ME_Settings'); try AddLogEntry('ME_Settings2'); with MESettings do begin // madExcept-Einstellungen AddLo
    /* 
    We have now deployed a regular update using a regular (and very same) madExcept 3.0m to the customer. It worked. They replaced the computer due to other problems, so I am quite confident that the problem was with the specific computer and nothing needs to be fixed in madExcept or our products.
     */
    

    external by StackOverflow modified Mar 1, 2013  1  0  2  0

    madSHI MadExcept equivalent for .NET (C#)

    I am a C# newbie having spent a lot of time with Delphi I am switching to .NET. A great package used for exception stack reporting etc. was madExcept from http://madshi.net/madExceptScreenShots.htm. Is there something equivalent for .NET (C#). What I am after is something that will provide me with a stack trace when an exception occurs. If so, I a
    /* 
    Unlike Delphi, C# exceptions will give you the stack trace if they are available through the Exception.StackTrace property.
    
    If you want alternatives for other aspects of MadExcept (of which there are a fair few), you should ask them explicitly.
     */
    

    external by Brian Frost modified Jan 21, 2013  1  0  2  0

    Detect madexcept inside an Delphi Application

    can I detect wheather madexcept is used inside an delphi application by analyzing the exe file only ? Is there a simple way by adding a few lines of code to my application and inform the final exe file user if madshi madexcept has been used or not
    /* 
    If you look into a project options with madExcept enabled I believe that you will see the define madExcept used, eg in your program anywhere you can do:
     */
    {$IFDEF madExcept}
      ....
    {$ENDIF}
    
    
    /* 
    
     */
    

    external by StackOverflow modified May 25, 2012  1  0  2  0

    MadExcept triggers on try finally

    I am using MadExcept to debug my applications. It's an excelent framework though when a exception ocurrs on a try finally block it still displays that ugly box and the user thinks the app has crashed. How can i remove that ? Is there a way ?
    /* 
    Sounds like it's working as designed.  A try/finally block does not catch exceptions; it ensures that proper cleanup can be done even if an exception is raised.
    
    If you want to handle an exception, you need to use a try/except block instead.
     */
    

    external by mj2008 modified Mar 23, 2012  1  0  2  0

    Fatal application error not caught by MadExcept

    I have an application which runs multiple threads. I use MadExcept to catch errors and debug it. The problem is that sometimes after 2-3 hours of running, Windows shows a close program dialog. Why isn't that error handled by MadExcept ?
    /* 
    Threads are a special case. If you have an exception in a thread, it will not get handled by the global handler, and will usually kill your application. The solution is easy though, with madExcept. Just catch the exception, and tell MadExcept about it. It will log in the usual way, and you won't kill your thread.
     */
    uses 
    {$IFDEF MadExcept}
     madExcept,
    {$ENDIF}
    
    
    procedure TMyThread.Execute;
    begin
      try
          SetName;
        // do your stuff
    
      except
        on errInfo : Exception do
        begin
    {$IFDEF MadExcept}
          HandleException(etNormal, errInfo);
    {$ENDIF}
        end;
      end;
    end;
    
    
    /* 
    What I also do is have the thread set a "RunningOK" property to true when it starts, and the exception sets it to False. This way my control code can see that something went wrong, and handle that appropriately (either restart it, or report the error, etc)
     */
    

    external by StackOverflow modified Jan 21, 2012  1  0  2  0

    MadExcept exception filter

    I am using Delphi XE2 and Mad Except i have an application witch uses Indy for some internet operations ... the problem is that when an simple exception is raised like there is no internet connection madexcept pops up. I want to disable these exceptions witch are coming from indy. I have the following exception class : EIdSocketError message : So
    /* 
    madExcept will only catch those exceptions that are not handled by your application itself. So a simple try-except block that handles the exceptions in question might be the cleanest solution to your problem.
     */
    

    external by StackOverflow modified Oct 27, 2011  1  0  2  0

    How can I find out the result of sending a MadExcept bug report from a Delphi app

    I can't find any way of determining whether it was possible to send a bug report from my D2006 app. If MadExcept can make some sort of return code available I can maybe provide some guidance to the user as to what might be wrong.
    /* 
    Maybe not a complete solution but useful information: if the bugreport is sent using a HTTP POST request to a web server, madExcept can detect if the response contains a HTTP redirect header, and in this case madExcept will launch the default web browser and load the URL given in the redirect.
    
    So the user can immediately see that the report has been received and stored.
    
    The web server could even analyze the bugreport and give additional information such as "This bug is already known and we have an update of the application which will fix it, you can download it here". (I wrote a web application, madxnet, for this purpose - it is still available for testing).
     */
    

    external by StackOverflow modified Sep 21, 2011  1  0  2  0

    How to fix madExcept creating temporal files in User\LocalSettings\Temp

    I sterated using "Standard User Analyzer" from Application Compatibility toolkit and it reported that my app is not UAC compatible because: "DeleteFileA: File (\Device\HarddiskVolume1\Documents and Settings\Administrator\Local Settings\Temp\mtgstudio.madExcept) is denied 'DELETE' access with error 0x5." "DeleteFileA: File (\Device\HarddiskVolume1
    /* 
    It doesn't look like there's anything to fix. The GetTempPath API function is exactly the function to use to get a location where a program is allowed to create temporary files. That the compatibility tester was unable to delete the directories doesn't mean that the directories should have been someplace else. It only means they couldn't be deleted at the time the program tried. It could be that another program (such as the one being tested) had a file open in one of those directories; Windows doesn't allow folders to be deleted when there are open files in them.
    
    One possible source of problems is the way MadExcept creates the directories. It creates them such that they inherit the permissions of their parent directories. If deletion is forbidden for the parent directory, then it will also be forbidden for the newly created temp directories. That partly points to a configuration problem on your system: GetTempPath might be returning a path for a directory that doesn't exist. It just returns the first value it finds in any of the TMP, TEMP, and USERPROFILE environment variables. It's the user's responsibility (not your program's) to make sure those are accurate.
    
    Knowing that MadExcept uses GetTempPath to discover the temp directory gives you an opportunity. You can call SetEnvironmentVariable to change the TMP value for your process, and MadExcept will create its directory there instead. (But if the system-designated location for temporary files already doesn't work, good luck finding some alternative to use.)
     */
    

    external by StackOverflow modified Jul 30, 2011  1  0  2  0

    Using [delphi] MadExcept errorhandling with MS Exchange Server 2007

    I currently use madExcept.MailAsSmtpClient to send my bug reports. However a couple of large clients have upgraded to Exchange Server 2007 and we can't get the SMTP support for our app configured (the app runs on individual workstations so the messages aren't all coming from one IP. We can configure an authenticated account in exchange and access i
    /* 
    If you upload a madExceptbug report via HTTP a web server is required which accepts POST requests. The bug report parts will be posted as form parameters, encoded as multipart/form-data. PHP example code for HTTP upload can be found here: http://forum.madshi.net/viewtopic.php?t=4611
     */
    

    external by mj2008 modified Apr 20, 2011  1  0  2  0

    Madexcept Bugreport location under Windows 7

    I've been using Madexcept for quite some time now and it work fine so far. I just noticed though that when I run my application under Windows 7 and an exception occurs, no bugreport.txt is being created. Usually Madexcept saves the bugreport in the programm directory. Under Windows 7 the software should not have the right to do this, that might be
    /* 
    To change the location use:
     */
    uses madExcept;
    // ...
     MESettings.BugReportFile := m_szLogPathName;
    
    
    /* 
    You can do this in your FormCreate and then any logs will be put where you want. Me, I choose the My Documents location.
     */
    

    external by StackOverflow modified Jan 7, 2011  1  0  2  0

    madExcept, getting top of current stack

    In an delphi 2007 application, we have used madExcept to handle exeptions for us. We use the standard dialog, letting the user send us a report with mail if he want to. We want to add a little to this functionality. If the user choose not to send a full report, we still want to log the exception to a file, but not a full report. We want the except
    /* 
    madStackTrace.pas has another function, StackAddrToStr that just takes a single address and returns the formatted text for it.  If you're in the except block for the crashing thread you can pass the global ExceptAddr variable to it.  If you're in one of the madExcept callbacks use `IMEException.ExceptAddr' instead.
     */
    

    external by jachguate modified Jan 28, 2010  1  0  2  0

    madExcept, checking state of checkbox in custom assistant before attaching additional files to the report

    I have modified the send-assistant of madExcept with a new checkbox. If the use checks this box, I want to send additional attachments with the bug report (a copy of the users data files). How can I check if the user checked the box? regards, -Vegar
    /* 
    I don't know madExcept, but as far as it source code is Delphi (which seems from your tags), you can check it like this:
     */
    begin
      if CheckBox1.Checked then
        AttachDataFile;
    end;
    
    
    /* 
    CheckBox1 is the name you set for the control when you dropped it into the forms editor.  If you don't know the name, select it with the mouse and look at the object inspector for the property Name.
     */
    

    external by StackOverflow modified May 5, 2009  1  0  0  0

    madExcept + UPX

    I'm having problems using madExcept + UPX on Delphi 2007. Whenever I open the compressed application, a Windows exception dialog appears code 0xc0000005. Anyone has the solution for this? Thanks!
    /* 
    Try the following switch with upx:
    
    --compress-exports=0
     */
    

    List Complete ( 18 snippets total )

    • Public Snippets
    • Channels Snippets