Catching GPF's

Post Reply
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Catching GPF's

Post by AlexSchaft »

Hi.

I'm looking at catching GPF's in xHarbour using SetUnhandledExceptionfilter. Has anybody done this already that can provide me with a sample?

Thanks,
Alex
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Alex,

If you use the xHarbour build we provide from www.fivetechsoft.com/files/xharbour.exe it already include GPFs catching using SetUnhandledExceptionfilter().

Both Harbour and xHarbour already include support for SetUnhandledExceptionfilter() but you have to build them using this flag: -DHB_INCLUDE_WINEXCHANDLER

Also in xharbour this fix is needed in source\vm\mainwin.c:

Code: Select all

int WINAPI WinMain( HINSTANCE hInstance,      /* handle to current instance */
                    HINSTANCE hPrevInstance,  /* handle to previous instance */
                    LPSTR lpCmdLine,          /* pointer to command line */
                    int iCmdShow )            /* show state of window */
{
   #ifdef HB_INCLUDE_WINEXCHANDLER
      LONG WINAPI hb_UnhandledExceptionFilter( struct _EXCEPTION_POINTERS * ExceptionInfo );
      
      LPTOP_LEVEL_EXCEPTION_FILTER ef = SetUnhandledExceptionFilter( hb_UnhandledExceptionFilter );
   #endif
And rename UnhandledExceptionFilter() as hb_UnhandledExceptionFilter() in source\vm\estack.c.

This code is already included in Harbour CVS files, but it is not in xharbour CVS.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

xHarbour gpf's

Post by AlexSchaft »

We're currently using the commercial version of xHarbour. I'll see what I can find out from their newsgroup.

Alex
Post Reply