Click here to Skip to main content
15,881,898 members
Articles / Desktop Programming / MFC
Article

Error Reporter - Enables Back-2-Base Error Reporting

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
25 Sep 20021 min read 52.9K   939   24   4
Allows users to send bug reports to manufacturers without having to manually create bug reports. Requires only four lines of code to be added to your application and works with all versions of Microsoft Windows. No MFC.

Image 1

Introduction

Error Reporter is an add-in that enables applications to report back faults to the manufacturers. Any problem from a simple memory overwrite to a hidden 'double free' can be detected and the information sent. It sends reports via the SMTP protocol to a server and email address defined by the code creator. It also features the ability to allow the user to save the reports if they want! This would be a boon to helping debug your applications!

Updates In This Version

Memory leaks have been taken care of. Resource files have been added to allow people to see the dialog box. Added Compile.BAT to demo application to simplify usage. Simple!

What Do I Get With This?

Huh? See the above section. That is what you get!

But You Said Four Lines Of Code!?! (AKA: How Can I Use It?)

It's as simple as this:

#include "exceptionhandler.h"

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, 
                    LPSTR lpCmdLine, int nCmdShow)
{
    // Enable the exception handling...
    __try {
        // All your normal WinMain code goes in here...
        // :D Easy as that! 
    }

    // Catch any exceptions that occur.
    __except (ExceptionHandler (hInstance, GetExceptionInformation ())) {
        // No code; this block never executed.
    }

    return 0;
}

The system is very simple and self-explanatory so have a quick look through at the source to get an in-depth understanding!

Ok - That's Simple Enough; Anything Else

This is the usual nonsense - should you want to use it!

  1. Email me for permission to use/include (always given). I just want to know what purpose it is being used for. It is provided completely free for "Non-Commercial Usage."
  2. Include the files in your C++ project.
  3. Compile!
  4. Play!

Mentions

The code for this is loosely based on the MFC project "Dump Handler" by Shane Hyde. Except that this is easier to use and does not use MFC!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Researcher
Germany Germany
Iain Chesworth graduated from Heriot-Watt University in June of 2002 in Computer Science and Physics. He now works as a C++ programmer and plays with code in his spare time. He is also a keen cyclist and swimmer.

Comments and Discussions

 
GeneralNeed info on SendErrorReportToBase Pin
Neville Franks5-Oct-02 13:45
Neville Franks5-Oct-02 13:45 
Generaldoes not compile Pin
giorgio fresini12-Sep-02 1:45
giorgio fresini12-Sep-02 1:45 
Hi,

exceptionhandler.cpp/h does not compile.
First of all the include file #include <wspiapi.h> is not preset in my system.
Then the following compile time errors occur:

--------------------Configuration: FinestX - Win32 Debug--------------------
Compiling...
exceptionhandler.cpp
V:\FinestX\exceptionhandler.cpp(74) : error C2065: 'IDD_EXCEPTDIALOG' : undeclared identifier
V:\FinestX\exceptionhandler.cpp(225) : error C2065: 'NI_MAXHOST' : undeclared identifier
V:\FinestX\exceptionhandler.cpp(225) : error C2057: expected constant expression
V:\FinestX\exceptionhandler.cpp(225) : error C2466: cannot allocate an array of constant size 0
V:\FinestX\exceptionhandler.cpp(225) : error C2133: 'szHost' : unknown size
V:\FinestX\exceptionhandler.cpp(225) : error C2065: 'NI_MAXSERV' : undeclared identifier
V:\FinestX\exceptionhandler.cpp(225) : error C2057: expected constant expression
V:\FinestX\exceptionhandler.cpp(225) : error C2466: cannot allocate an array of constant size 0
V:\FinestX\exceptionhandler.cpp(225) : error C2133: 'szServer' : unknown size
V:\FinestX\exceptionhandler.cpp(226) : error C2079: 'aiHints' uses undefined struct 'addrinfo'
V:\FinestX\exceptionhandler.cpp(247) : error C2228: left of '.ai_family' must have class/struct/union type
V:\FinestX\exceptionhandler.cpp(248) : error C2228: left of '.ai_socktype' must have class/struct/union type
V:\FinestX\exceptionhandler.cpp(249) : error C2228: left of '.ai_protocol' must have class/struct/union type
V:\FinestX\exceptionhandler.cpp(251) : error C2065: 'getaddrinfo' : undeclared identifier
V:\FinestX\exceptionhandler.cpp(271) : error C2027: use of undefined type 'addrinfo'
V:\FinestX\exceptionhandler.cpp(226) : see declaration of 'addrinfo'
V:\FinestX\exceptionhandler.cpp(271) : error C2227: left of '->ai_family' must point to class/struct/union
V:\FinestX\exceptionhandler.cpp(271) : error C2027: use of undefined type 'addrinfo'
V:\FinestX\exceptionhandler.cpp(226) : see declaration of 'addrinfo'
V:\FinestX\exceptionhandler.cpp(271) : error C2227: left of '->ai_socktype' must point to class/struct/union
V:\FinestX\exceptionhandler.cpp(271) : error C2027: use of undefined type 'addrinfo'
V:\FinestX\exceptionhandler.cpp(226) : see declaration of 'addrinfo'
V:\FinestX\exceptionhandler.cpp(271) : error C2227: left of '->ai_protocol' must point to class/struct/union
V:\FinestX\exceptionhandler.cpp(282) : error C2065: 'getnameinfo' : undeclared identifier
V:\FinestX\exceptionhandler.cpp(282) : error C2027: use of undefined type 'addrinfo'
V:\FinestX\exceptionhandler.cpp(226) : see declaration of 'addrinfo'
V:\FinestX\exceptionhandler.cpp(282) : error C2227: left of '->ai_addr' must point to class/struct/union
V:\FinestX\exceptionhandler.cpp(282) : error C2027: use of undefined type 'addrinfo'
V:\FinestX\exceptionhandler.cpp(226) : see declaration of 'addrinfo'
V:\FinestX\exceptionhandler.cpp(282) : error C2227: left of '->ai_addrlen' must point to class/struct/union
V:\FinestX\exceptionhandler.cpp(282) : error C2065: 'NI_NUMERICHOST' : undeclared identifier
V:\FinestX\exceptionhandler.cpp(282) : error C2065: 'NI_NUMERICSERV' : undeclared identifier
V:\FinestX\exceptionhandler.cpp(289) : error C2027: use of undefined type 'addrinfo'
V:\FinestX\exceptionhandler.cpp(226) : see declaration of 'addrinfo'
V:\FinestX\exceptionhandler.cpp(289) : error C2227: left of '->ai_addr' must point to class/struct/union
V:\FinestX\exceptionhandler.cpp(289) : error C2027: use of undefined type 'addrinfo'
V:\FinestX\exceptionhandler.cpp(226) : see declaration of 'addrinfo'
V:\FinestX\exceptionhandler.cpp(289) : error C2227: left of '->ai_addrlen' must point to class/struct/union
V:\FinestX\exceptionhandler.cpp(294) : error C2027: use of undefined type 'addrinfo'
V:\FinestX\exceptionhandler.cpp(226) : see declaration of 'addrinfo'
V:\FinestX\exceptionhandler.cpp(294) : error C2227: left of '->ai_next' must point to class/struct/union
V:\FinestX\exceptionhandler.cpp(300) : error C2065: 'freeaddrinfo' : undeclared identifier
V:\FinestX\exceptionhandler.cpp(335) : error C2065: 'IDC_EXCEPTIONTEXT' : undeclared identifier
V:\FinestX\exceptionhandler.cpp(376) : error C2374: 'nCounter' : redefinition; multiple initialization
V:\FinestX\exceptionhandler.cpp(352) : see declaration of 'nCounter'
V:\FinestX\exceptionhandler.cpp(436) : error C2374: 'nCounter' : redefinition; multiple initialization
V:\FinestX\exceptionhandler.cpp(352) : see declaration of 'nCounter'
V:\FinestX\exceptionhandler.cpp(551) : error C2065: 'IDC_TITLETEXT' : undeclared identifier
V:\FinestX\exceptionhandler.cpp(569) : error C2065: 'IDC_SAVEOUTPUT' : undeclared identifier
V:\FinestX\exceptionhandler.cpp(569) : error C2051: case expression not constant
V:\FinestX\exceptionhandler.cpp(574) : error C2065: 'IDC_SENDREPORT' : undeclared identifier
V:\FinestX\exceptionhandler.cpp(574) : error C2051: case expression not constant
Error executing cl.exe.

exceptionhandler.obj - 42 error(s), 0 warning(s)

Any clues?

Giorgio
GeneralDemo prog is 8Kb! Pin
Anonymous10-Sep-02 10:33
Anonymous10-Sep-02 10:33 
GeneralRe: Demo prog is 8Kb! Pin
voodoopriestess10-Sep-02 10:56
voodoopriestess10-Sep-02 10:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.