Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


AA with SEH — Structured Exception Handling (for advanced)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Auto Assembler tutorials
View previous topic :: View next topic  
Author Message
GH*master
Expert Cheater
Reputation: 8

Joined: 10 Jan 2008
Posts: 159

PostPosted: Tue Feb 02, 2016 8:04 am    Post subject: AA with SEH — Structured Exception Handling (for advanced) Reply with quote

This Auto Assembler tutorials about

Structured Exception Handling (for advanced)

Ooh yeah...

If you wish, you can will bypass the application crashes when doing something wrong


Code:

label(Handler)
label(NoException)
label(ExceptionHandled)
label(lpCaption)
label(lpText)

00270000:  // you need create thread on 00270000
   pushad
   mov esi, Handler
   push esi
   push fs:[0]
   mov fs:[0], esp

   mov ecx, [0]   // Oh my God, what is it? EXEPTION! Do not worry about it! We have SEH

   Jmp NoException
Handler:
   mov esp,[esp+0x08]
   pop fs:[0]
   add esp, 4
   popad

   // This point if we have exception runnig
   Jmp ExceptionHandled
   Jmp NoException

NoException:
   pop fs:[0]         // restore the old EXEPTION
   add esp, 0x24 //32+4
   ret

ExceptionHandled:
   // the exception was eaten
   push 0             //uType  (0=mb_ok)
   push lpCaption
   push lpText
   push 0           //hWnd
   call MessageBoxA
   ret

lpCaption:
   db 'Exception!' 0

lpText:
   db 'You have exception' 0
Back to top
View user's profile Send private message
Redouane
Master Cheater
Reputation: 3

Joined: 05 Sep 2013
Posts: 363
Location: Algeria

PostPosted: Tue Feb 02, 2016 8:56 am    Post subject: Re: AA with SEH — Structured Exception Handling (for advanc Reply with quote

Can you please explain the following lines?
GH*master wrote:

Code:

Handler:
   mov esp,[esp+0x08]
   pop fs:[0]
   add esp, 4
   popad

before executing the first Handler Instruction,the stack should look like this :
Code:

----------------------------------------------------------<ESP
|address of the instruction that comes after mov ecx, [0]|
----------------------------------------------------------<ESP+4
|Address to previous handler (previous FS:[0])           |
----------------------------------------------------------<ESP+8
|address of Handler (new handler)                        |
----------------------------------------------------------<ESP+0xC
|All the saved registers                                 |

So [esp+8] should be the address of the new handler,why are you moving it to esp?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Auto Assembler tutorials All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites