Try/Catch

Hi

A simple question. What do I have to do to get try / catch blocks to compile
for my filter driver ?

I either get
warning C4530: C++ exception handler used, but unwind semantics are not
enabled. Specify -GX
or
Command line warning D4025 : overriding ‘/GX’ with ‘/GX-’

Please Help.

TTFN
Paul Delivett

Use __try/__catch, not try/catch.
Switch C++ unwind semantics off or use the C compiler.

Max

----- Original Message -----
From: “Paul Delivett”
To: “File Systems Developers”
Sent: Tuesday, October 03, 2000 2:06 PM
Subject: [ntfsd] Try/Catch

> Hi
>
> A simple question. What do I have to do to get try / catch blocks to
compile
> for my filter driver ?
>
> I either get
> warning C4530: C++ exception handler used, but unwind semantics are not
> enabled. Specify -GX
> or
> Command line warning D4025 : overriding ‘/GX’ with ‘/GX-’
>
> Please Help.
>
> TTFN
> Paul Delivett
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>

Hi Max

Thanks for the help. Had to go with __try / __finally in the end. Didn’t
help though cause the exception still occurred :frowning:

TTFN
Paul Delivett

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Maxim S. Shatskih
Sent: Tuesday, October 03, 2000 11:36 AM
To: File Systems Developers
Subject: [ntfsd] Re: Try/Catch

Use __try/__catch, not try/catch.
Switch C++ unwind semantics off or use the C compiler.

Max

----- Original Message -----
From: “Paul Delivett”
> To: “File Systems Developers”
> Sent: Tuesday, October 03, 2000 2:06 PM
> Subject: [ntfsd] Try/Catch
>
>
> > Hi
> >
> > A simple question. What do I have to do to get try / catch blocks to
> compile
> > for my filter driver ?
> >
> > I either get
> > warning C4530: C++ exception handler used, but unwind semantics are not
> > enabled. Specify -GX
> > or
> > Command line warning D4025 : overriding ‘/GX’ with ‘/GX-’
> >
> > Please Help.
> >
> > TTFN
> > Paul Delivett
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> >
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@Carraig.co.uk
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>
>

How about using __try / __except if you’re interested in catching
exceptions.

Marc

-----Original Message-----
From: Paul Delivett [mailto:xxxxx@Carraig.co.uk]
Sent: Tuesday, October 03, 2000 9:09 AM
To: File Systems Developers
Subject: [ntfsd] Re: Try/Catch

Hi Max

Thanks for the help. Had to go with __try / __finally in the
end. Didn’t
help though cause the exception still occurred :frowning:

TTFN
Paul Delivett

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Maxim
S. Shatskih
> Sent: Tuesday, October 03, 2000 11:36 AM
> To: File Systems Developers
> Subject: [ntfsd] Re: Try/Catch
>
>
> Use __try/__catch, not try/catch.
> Switch C++ unwind semantics off or use the C compiler.
>
> Max
>
> ----- Original Message -----
> From: “Paul Delivett”
> > To: “File Systems Developers”
> > Sent: Tuesday, October 03, 2000 2:06 PM
> > Subject: [ntfsd] Try/Catch
> >
> >
> > > Hi
> > >
> > > A simple question. What do I have to do to get try /
> catch blocks to
> > compile
> > > for my filter driver ?
> > >
> > > I either get
> > > warning C4530: C++ exception handler used, but unwind
> semantics are not
> > > enabled. Specify -GX
> > > or
> > > Command line warning D4025 : overriding ‘/GX’ with ‘/GX-’
> > >
> > > Please Help.
> > >
> > > TTFN
> > > Paul Delivett
> > >
> > >
> > > —
> > > You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to
> $subst(‘Email.Unsub’)
> > >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@Carraig.co.uk
> > To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> >
> >
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@bionetrix.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>

Hi

Tried that with all 3 different parms, still causes an exception that I do
not see. How can I test that the try/catch is working. I have a simply pass
through driver that crashes when the floppy is accessed just after inserting
a floppy.

TTFN
Paul

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Marc Sherman
Sent: Tuesday, October 03, 2000 2:15 PM
To: File Systems Developers
Subject: [ntfsd] Re: Try/Catch

How about using __try / __except if you’re interested in catching
exceptions.

Marc

> -----Original Message-----
> From: Paul Delivett [mailto:xxxxx@Carraig.co.uk]
> Sent: Tuesday, October 03, 2000 9:09 AM
> To: File Systems Developers
> Subject: [ntfsd] Re: Try/Catch
>
>
> Hi Max
>
> Thanks for the help. Had to go with __try / __finally in the
> end. Didn’t
> help though cause the exception still occurred :frowning:
>
> TTFN
> Paul Delivett
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Maxim
> S. Shatskih
> > Sent: Tuesday, October 03, 2000 11:36 AM
> > To: File Systems Developers
> > Subject: [ntfsd] Re: Try/Catch
> >
> >
> > Use __try/__catch, not try/catch.
> > Switch C++ unwind semantics off or use the C compiler.
> >
> > Max
> >
> > ----- Original Message -----
> > From: “Paul Delivett”
> > > To: “File Systems Developers”
> > > Sent: Tuesday, October 03, 2000 2:06 PM
> > > Subject: [ntfsd] Try/Catch
> > >
> > >
> > > > Hi
> > > >
> > > > A simple question. What do I have to do to get try /
> > catch blocks to
> > > compile
> > > > for my filter driver ?
> > > >
> > > > I either get
> > > > warning C4530: C++ exception handler used, but unwind
> > semantics are not
> > > > enabled. Specify -GX
> > > > or
> > > > Command line warning D4025 : overriding ‘/GX’ with ‘/GX-’
> > > >
> > > > Please Help.
> > > >
> > > > TTFN
> > > > Paul Delivett
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> > > > To unsubscribe send a blank email to
> > $subst(‘Email.Unsub’)
> > > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntfsd as: xxxxx@Carraig.co.uk
> > > To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> > >
> > >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@bionetrix.com
> > To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> >
>
> —
> You are currently subscribed to ntfsd as: xxxxx@Carraig.co.uk
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>
>

SEH provided by NT OS defines three keyword
__try, __except and __finally.Different compilers may provide different
wrapper around it.
u can get into ur exception code if there is some memory access violation
(0x00000005)
Lets say u call RtlZeroMemory on some invalid memory

Any other bug codes will not be trapped in ur __try /__except code
Hope this helps
Pash

----- Original Message -----
From: “Paul Delivett”
To: “File Systems Developers”
Sent: Wednesday, October 04, 2000 3:12 PM
Subject: [ntfsd] Re: Try/Catch

> Hi
>
> Tried that with all 3 different parms, still causes an exception that I do
> not see. How can I test that the try/catch is working. I have a simply
pass
> through driver that crashes when the floppy is accessed just after
inserting
> a floppy.
>
> TTFN
> Paul
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Marc Sherman
> > Sent: Tuesday, October 03, 2000 2:15 PM
> > To: File Systems Developers
> > Subject: [ntfsd] Re: Try/Catch
> >
> >
> > How about using try / except if you’re interested in catching
> > exceptions.
> >
> > Marc
> >
> > > -----Original Message-----
> > > From: Paul Delivett [mailto:xxxxx@Carraig.co.uk]
> > > Sent: Tuesday, October 03, 2000 9:09 AM
> > > To: File Systems Developers
> > > Subject: [ntfsd] Re: Try/Catch
> > >
> > >
> > > Hi Max
> > >
> > > Thanks for the help. Had to go with try / finally in the
> > > end. Didn’t
> > > help though cause the exception still occurred :frowning:
> > >
> > > TTFN
> > > Paul Delivett
> > >
> > >
> > > > -----Original Message-----
> > > > From: xxxxx@lists.osr.com
> > > > [mailto:xxxxx@lists.osr.com]On Behalf Of Maxim
> > > S. Shatskih
> > > > Sent: Tuesday, October 03, 2000 11:36 AM
> > > > To: File Systems Developers
> > > > Subject: [ntfsd] Re: Try/Catch
> > > >
> > > >
> > > > Use try/ catch, not try/catch.
> > > > Switch C++ unwind semantics off or use the C compiler.
> > > >
> > > > Max
> > > >
> > > > ----- Original Message -----
> > > > From: “Paul Delivett”
> > > > To: “File Systems Developers”
> > > > Sent: Tuesday, October 03, 2000 2:06 PM
> > > > Subject: [ntfsd] Try/Catch
> > > >
> > > >
> > > > > Hi
> > > > >
> > > > > A simple question. What do I have to do to get try /
> > > catch blocks to
> > > > compile
> > > > > for my filter driver ?
> > > > >
> > > > > I either get
> > > > > warning C4530: C++ exception handler used, but unwind
> > > semantics are not
> > > > > enabled. Specify -GX
> > > > > or
> > > > > Command line warning D4025 : overriding ‘/GX’ with ‘/GX-’
> > > > >
> > > > > Please Help.
> > > > >
> > > > > TTFN
> > > > > Paul Delivett
> > > > >
> > > > >
> > > > > —
> > > > > You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> > > > > To unsubscribe send a blank email to
> > > $subst(‘Email.Unsub’)
> > > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntfsd as: xxxxx@Carraig.co.uk
> > > > To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> > > >
> > > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntfsd as: xxxxx@bionetrix.com
> > > To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> > >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@Carraig.co.uk
> > To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> >
> >
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@Legato.COM
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>

You guys on ntfsd ought to monitor ntdev as well. This stuff was
discussed in detail there last month. SEH cannot prevent a buggy
driver from crashing the system, particularly if an OS component
decides to call KeBugCheck[Ex] because it doesn’t like what the
driver is doing.

You can test your exception handling by calling ExRaiseStatus() within
the __try block; use __except(EXCEPTION_EXECUTE_HANDLER) and within
the __except block call GetExceptionCode(). The code should match the
status passed to ExRaiseStatus().


Dave Cox
Hewlett-Packard Co.
HPSO/SMSO (Santa Barbara)
https://ecardfile.com/id/Dave+Cox

-----Original Message-----
From: Paul Delivett [mailto:xxxxx@Carraig.co.uk]
Sent: Wednesday, October 04, 2000 2:43 AM
To: File Systems Developers
Subject: [ntfsd] Re: Try/Catch

Hi

Tried that with all 3 different parms, still causes an exception that I do
not see. How can I test that the try/catch is working. I have a simply pass
through driver that crashes when the floppy is accessed just after inserting
a floppy.

TTFN
Paul

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Marc Sherman
Sent: Tuesday, October 03, 2000 2:15 PM
To: File Systems Developers
Subject: [ntfsd] Re: Try/Catch

How about using __try / __except if you’re interested in catching
exceptions.

Marc

> -----Original Message-----
> From: Paul Delivett [mailto:xxxxx@Carraig.co.uk]
> Sent: Tuesday, October 03, 2000 9:09 AM
> To: File Systems Developers
> Subject: [ntfsd] Re: Try/Catch
>
>
> Hi Max
>
> Thanks for the help. Had to go with __try / __finally in the
> end. Didn’t
> help though cause the exception still occurred :frowning:
>
> TTFN
> Paul Delivett
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Maxim
> S. Shatskih
> > Sent: Tuesday, October 03, 2000 11:36 AM
> > To: File Systems Developers
> > Subject: [ntfsd] Re: Try/Catch
> >
> >
> > Use __try/__catch, not try/catch.
> > Switch C++ unwind semantics off or use the C compiler.
> >
> > Max
> >
> > ----- Original Message -----
> > From: “Paul Delivett”
> > > To: “File Systems Developers”
> > > Sent: Tuesday, October 03, 2000 2:06 PM
> > > Subject: [ntfsd] Try/Catch
> > >
> > >
> > > > Hi
> > > >
> > > > A simple question. What do I have to do to get try /
> > catch blocks to
> > > compile
> > > > for my filter driver ?
> > > >
> > > > I either get
> > > > warning C4530: C++ exception handler used, but unwind
> > semantics are not
> > > > enabled. Specify -GX
> > > > or
> > > > Command line warning D4025 : overriding ‘/GX’ with ‘/GX-’
> > > >
> > > > Please Help.
> > > >
> > > > TTFN
> > > > Paul Delivett
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> > > > To unsubscribe send a blank email to
> > $subst(‘Email.Unsub’)
> > > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntfsd as: xxxxx@Carraig.co.uk
> > > To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> > >
> > >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@bionetrix.com
> > To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> >
>
> —
> You are currently subscribed to ntfsd as: xxxxx@Carraig.co.uk
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>
>


You are currently subscribed to ntfsd as: david_cox2@hp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)