473,385 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

User defined SEH with Release build

Hi guys,

I created a user-defined SEH by following Crash Course SEH article by Matt
Pietrek. When building the app in Debug mode, it has no problem catching
exception and entering the user defined hanlder. In Release mode, however,
the app would just crash at the point where the exception occurs.

Why is that? Is there any way to solve this?

Thanks in advance,
Johnny

Aug 21 '06 #1
3 1417
"Johnny" <Jo****@discussions.microsoft.comwrote in message
news:55**********************************@microsof t.com...
I created a user-defined SEH by following Crash Course SEH article by Matt
Pietrek. When building the app in Debug mode, it has no problem catching
exception and entering the user defined hanlder. In Release mode,
however,
the app would just crash at the point where the exception occurs.

Why is that? Is there any way to solve this?
It may be the optimizer that is biting you.

Are you translating structured exceptions to C++ "typed" exceptions with
_set_se_translator()? If so, what is probably happening is that the compiler
sees no way that the C++ code could throw an exception so it just goes ahead
and removes the try / catch stuff.

If that's your problem you can "fix" it by compiling with the /EHa switch.

There is quite a lot to say on this subject and Doug does it best here:

http://members.cox.net/doug_web/eh.htm

Regards,
Will
Aug 21 '06 #2
"William DePalo [MVP VC++]" wrote:
Are you translating structured exceptions to C++ "typed" exceptions with
_set_se_translator()? If so, what is probably happening is that the compiler
sees no way that the C++ code could throw an exception so it just goes ahead
and removes the try / catch stuff.

If that's your problem you can "fix" it by compiling with the /EHa switch.

There is quite a lot to say on this subject and Doug does it best here:

http://members.cox.net/doug_web/eh.htm

Regards,
Will
Thanks for the reply, William,

I have tried the /Eha switch and still got the same problem.
I did not use the _set_se_translotr() , instead, using the assemly code to
directly replacing _EXCEPTION_REGISTRATION structure. It is a method
described in the Matt Pietrek's article and is commonly seen and used on the
net.

However, I still think it's a compiler related issue, as the method would
work fine with VC6 compilation (both Debug and Release) and not in VC 2005
(only Debug mode works)

P.S.
You can find Matt Pietrek's article here:
http://www.microsoft.com/msj/0197/Ex...Exception.aspx

Any more ideas?
Thanks again,
Johnny
Aug 22 '06 #3
Johnny wrote:
"William DePalo [MVP VC++]" wrote:
>Are you translating structured exceptions to C++ "typed" exceptions
with _set_se_translator()? If so, what is probably happening is that
the compiler sees no way that the C++ code could throw an exception
so it just goes ahead and removes the try / catch stuff.

If that's your problem you can "fix" it by compiling with the /EHa
switch.

There is quite a lot to say on this subject and Doug does it best
here:

http://members.cox.net/doug_web/eh.htm

Regards,
Will

Thanks for the reply, William,

I have tried the /Eha switch and still got the same problem.
I did not use the _set_se_translotr() , instead, using the assemly
code to directly replacing _EXCEPTION_REGISTRATION structure. It is
a method described in the Matt Pietrek's article and is commonly
seen and used on the net.

However, I still think it's a compiler related issue, as the method
would work fine with VC6 compilation (both Debug and Release) and not
in VC 2005 (only Debug mode works)

P.S.
You can find Matt Pietrek's article here:
http://www.microsoft.com/msj/0197/Ex...Exception.aspx
Note the ancient date on the article - it's nearly 10 years old.

I have a suspicion that your attempt at defining an exception record is
running afoul of new security measures that have been put into the
compiler/runtime libraries to block exception-based attack vectors. I don't
know any details of what's been changed, but I know that changes were made -
starting in VC7, I think. Have you tried VC7 or 7.1, or are VC6 and 8 your
only data points?

-cd
Aug 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kevin Mellor | last post by:
Hello all, I hope someone can help me. I am not new to developing but am new to C# (assemblies etc) and V Studio 2003, although familiar with terminology from VS6. I am in the nightmare...
0
by: bnc mag | last post by:
Hello, Visual Studio 6 allows users to specify seperate post-build steps to perform on Debug and Release builds. I am trying to do the same thing in C#.NET 2003, but it appears as though I only...
3
by: Steve Franks | last post by:
I'm using Visual Studio 2005 RC and cannot figure out how to produce a "release" build. Am I doing something wrong? I'm wondering if perhaps MS locked out the ability to produce a release build...
1
by: sethuganesh | last post by:
HI, i have ported vc++ 6.0 code to visual studio 2005. During batch build in debug mode i din't get any error.But if i build the same in release mode i am getting the following error. ...
1
by: kurt sune | last post by:
I am having trouble publishing a website for RELEASE. 1. web.config: <compilation defaultLanguage="vb" debug="false"> 2. in Configuration manager I set the configuration to Release for the...
6
by: Andrew Rowley | last post by:
I am having trouble getting debug and release builds to work properly with project references using C++ .NET and Visual Studio 2003. I created a test solution, with a basic Windows form C++...
1
by: =?Utf-8?B?SlI=?= | last post by:
I have an MFC app that was originally built using VC++ 6.0. I have built it in both debug and release (both unicode) and run them both fine. I recently converted the projects to VC++ 7.1 and...
2
by: sndive | last post by:
q#1: in C I want to check if a given PyObject is a xml.dom.minidom.Node (or a derivative). how do i extract a PyTypeObject for such a class? issue #2 I'm in a situation when i don't really...
3
by: =?Utf-8?B?bG10dGFn?= | last post by:
We have developed a number of different applications (ASP.NET web site, Windows services, DLLs, Windows forms, etc.) in C# 2.0. We have developed and unit tested all these applications/components...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.