Solved

longjmp in windows

Posted on 1997-10-14
4
225 Views
Last Modified: 2013-12-03
I have a question concerning longjmp in Windows.

I am using some old DOS code in a Windows 3.1 program and longjump doesn't seem to work the same.

I call setjmp from a C function to store the required information and everything works just fine.  When call LONGJMP(not the same in DOS) from an assembly function I get an exeption 13 error in the LONGJMP code.

I can't find any manual that will help me find the differences between the DOS longjmp and the Windows LONGJMP.
I know that they are different functions but what else should I need to do except call LONGJMP in place of longjmp?
Thanks.

AJ.
0
Comment
Question by:youngs101497
  • 2
4 Comments
 
LVL 3

Expert Comment

by:mirek071497
ID: 1407548
In windows you are not  working in real mode so i think that this is your error. You can found some description about programming in protected and virtual mode at : www.intel.com. You can find there full set of instructions for pentium processors and description about them.

If you need more then ask, however i think so you must be familiar with other processor modes.
Good luck.
0
 
LVL 3

Accepted Solution

by:
Melange earned 100 total points
ID: 1407549
You should check out the Catch and Throw functions. These are 16-bit Win SDK functions that setjmp/longjmp map to.

Now things to consider are that you must NOT jump across message boundaries. In other words, in the same context of a windows message you must fully handle the catch/throw.

If you have visual C++, then check out mfc's afx.h header file. 16-bit MFC uses these functions for its simulated C++ exception handling.

0
 

Author Comment

by:youngs101497
ID: 1407550
I looked into using the Catch and Throw functions.  They will not work with the code I am using.  I don't want to have to rewrite large sections of code to do something that is suposed to work as well in Windows as it does in DOS.

All information I can find says that I can use setjmp and longjmp in a Windows program.

Do you know of any changes in the way which setjmp and long jmp are called?

This program has to work using setjmp and longjmp.  I wish I could use something else, it would just not be efficatious.


Thanks for your help.
0
 
LVL 3

Expert Comment

by:Melange
ID: 1407551
The most important thing to remember is NOT to jump across a windows message. You can't have one global setjmp for the program. Only use it within a specific context.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now