473,585 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SAFESEH setting

Hi,
I'm trying to write my own 'safe' exception handler for Microsoft
Visual Studio .NET 2003.
1) It seems that you cannot mark a C++ function as a safe exception
handler.
2) I can't get the .SAFESEH directive to work with ml.

Has anyone tried and succeeded with the /safeseh option and .SAFESEH
directive with ML?
I've stripped my code to the barest minimum, and assembling
'testit.asm' like this:
ml /safeseh /c testit.asm libc.lib /link /dll
I am getting this linker error:
testit.obj : fatal error LNK1279: invalid or corrupt file: file
contains
invalid .sxdata contributions.

The code looks like this:

--------------- testit.asm ---------------
title testit - test safeseh
.586
..model FLAT

testit SEGMENT

fred PROC PUBLIC
push ebp
pop ebp
ret
fred ENDP

..SAFESEH fred

testit ENDS

END
--------------- testit.asm ---------------

Any help, anyone?

Roger Orr
--
[Originally posted to microsoft.publi c.vstudio.gener al]
Nov 16 '05 #1
2 4670
Hello Roger,

I am not familar with it. However, I will contact other engineers and reply you as soon as possible here. Thanks very much.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!From: ro****@howzatt. demon.co.uk (Roger Orr)
!Newsgroups: microsoft.publi c.dotnet.langua ges.vc
!Subject: SAFESEH setting
!Date: 16 Jul 2003 01:39:28 -0700
!Organization: http://groups.google.com/
!Lines: 44
!Message-ID: <7a************ **************@ posting.google. com>
!NNTP-Posting-Host: 141.228.156.225
!Content-Type: text/plain; charset=ISO-8859-1
!Content-Transfer-Encoding: 8bit
!X-Trace: posting.google. com 1058344769 8275 127.0.0.1 (16 Jul 2003 08:39:29 GMT)
!X-Complaints-To: gr**********@go ogle.com
!NNTP-Posting-Date: 16 Jul 2003 08:39:29 GMT
!Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!new sfeed00.sul.t-online.de!newsf eed01.sul.t-online.de!t-online.de!
newsfeed.online .be!216.170.153 .135.MISMATCH!t dsnet-transit!newspee r.tds.net!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!sn-xit-09!
supernews.com!p ostnews1.google .com!not-for-mail
!Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:26219
!X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vc
!
!Hi,
!I'm trying to write my own 'safe' exception handler for Microsoft
!Visual Studio .NET 2003.
!1) It seems that you cannot mark a C++ function as a safe exception
!handler.
!2) I can't get the .SAFESEH directive to work with ml.
!
!Has anyone tried and succeeded with the /safeseh option and .SAFESEH
!directive with ML?
!I've stripped my code to the barest minimum, and assembling
!'testit.asm' like this:
! ml /safeseh /c testit.asm libc.lib /link /dll
!I am getting this linker error:
! testit.obj : fatal error LNK1279: invalid or corrupt file: file
!contains
! invalid .sxdata contributions.
!
!The code looks like this:
!
!--------------- testit.asm ---------------
! title testit - test safeseh
! .586
!.model FLAT
!
!testit SEGMENT
!
!fred PROC PUBLIC
! push ebp
! pop ebp
! ret
!fred ENDP
!
!.SAFESEH fred
!
!testit ENDS
!
! END
!--------------- testit.asm ---------------
!
!Any help, anyone?
!
!Roger Orr
!--
![Originally posted to microsoft.publi c.vstudio.gener al]
!
Nov 16 '05 #2
"Brandon Bray [MSFT]" <br******@onlin e.microsoft.com > wrote in message
news:#9******** ******@TK2MSFTN GP12.phx.gbl...
testit is a data section. It has to be executable. Change the
SEGMENT directive to

testit SEGMENT 'CODE'


Aha - thanks Brandon.
The joys of Intel - you can of course execute code even when it is in a data
segment - it is just .safeseh which is unhappy....
It's been too long since I used the assembler - _asm is my tool of choice
for the tiny bits I write nowadays!

However even with this help there's something elseI still can't do. I want
to mark a C++ function as a safe exception handler:
Something like this:

handler.cpp
DWORD handler( ... )
{
...
}

and then:

makesafe.asm

.386
..model FLAT

EXTRN _handler:NEAR
..SAFESEH _handler

END

but this generates the same linker error as before.
Is what I am trying to do possible, if so how. Or is there a way to mark
the function as a safeseh in C++ ?

Regards,
Roger Orr
Nov 16 '05 #3

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

Similar topics

6
2725
by: Niyazi | last post by:
Hi, We have and IBM AS400 and I belive the reional setting is Turkish. The IBM Client-Access for Windows that install in our PC (WIN XP SP2) set to Turkish characters. Now my PC has English (US) regional setting and I am not having any problem to connect. But If I change my PC Regional setting to Turkish all of my VB.NET code is
18
18338
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on a remote update of tables and fields and can't find enough information on these things. Also, how do you index a field in code?
0
514
by: Roger Orr | last post by:
Having had several questions recently about the original thread with this name (from Jul 2003) I thought I'd post the eventual solution to getting 'hand written' exception handlers enabled with VC.Net 2003 and Windows 2003. The original problem was: I'm trying to write my own 'safe' exception handler for Microsoft Visual Studio .NET...
2
2564
by: junlia | last post by:
Hi All, I am working on a project that acts as a bridge. It does some checking with post xml data, and then redirects the request to an appropriate page. However, we find that depends on the browser cache setting (and OS), the program behaves differently. This is how it should work: 1. The client program opens a webbrowser control, using...
0
1719
by: Rohini | last post by:
Hi , I built a project in vc++ 7.1. I am able to succesfully build the project but with some warnings. I have done it in win32 release mode. And I have done it with verbose on. I have found the following link error in the progress information it displays....
1
2988
by: Matej Trampus | last post by:
Hi, Iam linking my C++ project with some external libraries and getting the following error: someLib.lib(omeObj.obj) : LNK9038: module unsafe for SAFESEH image. I do not have exception handling turned on in my main project (no /GX /Eh options). What is wrong?
1
6466
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located...
6
10045
by: metaperl | last post by:
I would like to check the setting of this variable in our MS-SQL 2000 database. Also, is there info on what the default value of this variable is?
0
1077
by: sathish74 | last post by:
Hi All, Is there any list of options that is not compatible with /SAFESEH. I have a static library that i build using VC 2005. Since its a library, setting /SAFESEH is ignored. Because of this library doesn't have /safeseh, i get LNK2026: module unsafe for SAFESEH image for the DLL with / safeseh set that uses the above said library.
0
7900
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8192
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7943
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8204
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6592
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5382
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3828
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2338
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.