🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #15463

Get exception info as return code

#15463
From: Helmut Giese
Date: Sun, 29 Jun 2003 18:23
36 lines
2039 bytes
Hello out there,
we have an environment, where a master program executes other
programs. In case of error (in these "other programs") we want to tell
as precisely as possible what went wrong - including the kind of
exception thrown, if any.

To test this feature, we have a mini program which just causes an
exception (see raiseex.c below). We start it using CreateProcess and
obtain its exit code with GetExitCodeProcess - this all works.

The problem is, that (Builder 5 compiled) raiseex always returns -1 -
no matter what exception it raises. A customer provided a version
compiled with VC++, and this returns 0xC0000093 to our "master
program" (like expected).

What do we have to do to have a program return specific exception
information? Some kind of exception handler? Some compiler option?

Any hint will be greatly appreciated.
Helmut Giese

---------- raiseex.c -----------
#include <windows.h>

int main( void)
{
    int cmd = EXCEPTION_ACCESS_VIOLATION;

    /* Make sure the GPF dialog doesn't popup */
    SetErrorMode( SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
    /* SMASH! */
    RaiseException( cmd, EXCEPTION_NONCONTINUABLE, 0, NULL);

    /* NOTREACHED */
    return 0;
}
Technical Details
Message-ID: <3eff2d61.13577729@forums.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,2009127fe7e4b0b2,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-06-29 11:28:01 PST
From: hgiese@ratiosoft.com (Helmut Giese)
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Get exception info as return code
Date: Sun, 29 Jun 2003 18:23:02 GMT
Message-ID: <3eff2d61.13577729@forums.borland.com>
X-Newsreader: Forte Free Agent 1.21/32.243
NNTP-Posting-Host: 141.51.159.134
X-Trace: newsgroups.borland.com 1056911032 141.51.159.134 (29 Jun 2003 11:23:52 -0700)
Lines: 37
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail