473,383 Members | 1,929 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,383 software developers and data experts.

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.public.vstudio.general]
Nov 16 '05 #1
2 4643
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.public.dotnet.languages.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**********@google.com
!NNTP-Posting-Date: 16 Jul 2003 08:39:29 GMT
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!
newsfeed.online.be!216.170.153.135.MISMATCH!tdsnet-transit!newspeer.tds.net!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!sn-xit-09!
supernews.com!postnews1.google.com!not-for-mail
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vc:26219
!X-Tomcat-NG: microsoft.public.dotnet.languages.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.public.vstudio.general]
!
Nov 16 '05 #2
"Brandon Bray [MSFT]" <br******@online.microsoft.com> wrote in message
news:#9**************@TK2MSFTNGP12.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
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...
18
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...
0
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...
2
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...
0
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...
1
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...
1
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"...
6
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
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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.