News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Exceptions in Asm

Started by MusicalMike, August 24, 2006, 07:35:40 PM

Previous topic - Next topic

MusicalMike

How do I impliment exception handling in assembly language?

Biterider

Hi
there are several places where you can get the SEH implementation. OA32 has a file called SEH.inc in the macros directory containing supporting macros for this Windows functionality. Keep an eye on VEH for newer OSs.

Regards,

Biterider

zooba

My ASM Runtime has macros for implementing exception handling as well as a built in exception handler which will catch everything (except an INT3) and print a nice message on the console.

If you don't want to start using a new library, check out Jeremy Gordon's exception handling tutorial. There are also macro sets out there for exception handling. Use Google.

Cheers,

Zooba

MusicalMike

I was hoping for something that was OS independent.

ToutEnMasm

Hello,
Os independant is possible only if you have a computer without system.
You can also try to make a system driver.
Good work.
With a system and symbolic debugging ,you can have other thing that a "nice messagebox" .You can have the name of the source file and the line where the exception occure.
Exceptions are not the only way to debug an application and others methods are needed to complete debugging.
Samples that are in the internet are a little old,and use only FS:0 to instal the exceptions.XP provide functions that works better,look at the SDK (SEH et VEH)

                               ToutEnMasm

zooba

#5
For OS independent, you just have to check everything before you use it (ie. memory pointers, divisors, etc.).

Of course, OS independent is incredibly hard in assembly language, especially if you're doing anything complicated enough to require SEH. Perhaps you could investigate the output created by a C compiler to find out what is compiled for Windows, *nix and MacOS. I can't imagine any need to be more independent than this.

Cheers,

Zooba :U

Edit: Removed bad words

PBrennick

Why is it we are hearing more about reverse engineering, lately.  zooba, you are a disappointment to me.  You should not post such words.  If you feel strongly about it, use PM next time.  Be admonished.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Vortex

QuotePerhaps you could reverse-engineer some C code to find out what is compiled for...

zooba, why r*verse-engineering? The net offers a lot of material to study about structural exception handling.

Mark Jones

This battle is a lesson in futility; save your breath.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

MusicalMike

Hey, I never said anything about reverse engineering. I do not want to reverse engineer anything. And I am sure as hell not going to do anything illegal. So, please keep those things out of the threads.

PBrennick

Yes, I understand how you feel.  YOUR posting was quite proper and your wish that this type of thing be left out of your thread is commendable.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

zooba

I've clarified my meaning. I never meant disassemble other peoples programs, simply to create and compile a C program using SEH and then check the output.

9 times out of 10 the information on the net will have been found this way. Using the output and source to find the process is one valid (and legal) definition of reverse-engineering.

From Jeremy Gordon's tutorial:
QuoteThe information in this article was obtained using a test program and a debugger, and by disassembling code produced by "C" compilers.

PBrennick

zooba,
You just don't give up.  I am done with you.  You cannot justify your actions by the actions of others.  It looks like Mark Jones said it best.  Thank you Mark, I will follow your advice.
Paul
The GeneSys Project is available from:
The Repository or My crappy website

japheth


I don't understand the issue here: is it forbidden now to let a C compiler create an assembly listing and examine the listing then? AFAICS this is what zooba suggested. ??? Confused.

hutch--

I honestly don't know what the big deal is about, its common practice to write a test piece in C, compile it with the assembler output option then play with the assembler output. Its a perfectly viable method to look at compiled output that has nothing to do with reverse engineering.

Now cracking other peoples software is another matter, it involves working on someone elses binary without their permission which we will not allow in here but normal investigation of compiled output from a compiler is the option of the owner so there is nothing wrong with it at all.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php