Results 1 to 7 of 7

Thread: vectored exception handling

  1. #1

    vectored exception handling

    hi all

    I am asking here because i know there are many good coders around.
    I'd like to know something about vectored exception handling especially how to use it in masm.
    I have searched in google but there are no example in masm and msdn, which is often very helpful, doesnt give so many info.

    i understand that i need to call AddVectoredExceptionHandler but i am unsure about parameters:

    FirstHandler: if i am correct this equals to a number (0=last handler)
    VectoredHandler:here i get lost! is this the address where i must solve the exception like in seh? example:

    Code:
    push xxxxx <---- address where to solve exception
    push dword ptr fs:[0]
    mov dword ptr fs:[0],esp
    ...
    can you make me an example in masm on how to use veh? like this:

    Code:
    .386
    .model flat,stdcall
    option casemap:none
    
    include kernel32.inc
    includelib kernel32.lib
    include user32.inc
    includelib user32.lib
    include windows.inc
    
    .data
    text	db	"Problem!",0
    caption	db	"Help Me",0
    .data?
    hInstance	HINSTANCE		?
    .const
    .code
    
    start:
    invoke GetModuleHandle,NULL
    mov hInstance,eax
    invoke AddVectoredExceptionHandler,1,??? <--- here what does it go?
    xor ecx,ecx
    mov al,3
    idiv ecx  <-- exception
    end start
    when program comes accross exception i want it to show a msgbox and exit:

    Code:
    invoke MessageBox,hInstance,addr text,addr caption,MB_OK
    invoke ExitProcess,0
    Thanks in advance

    EDIT: Oh, forgot to say that i am a newbie plz keep things simple

  2. #2
    http://msdn.microsoft.com/en-us/library/ms679274(VS.85).aspx

  3. #3
    hi tofu,
    yes i already read msdn (i wrote that in my previous post). however i am a bit confused about parameters especially the vectoredhandler and ExceptionInfo.
    An example would help me a lot.

    I am very glad that you are here: on masm32 forum (http://www.masm32.com/board/index.php?PHPSESSID=c773094fca1c273c20e2e36c4df7794a&action=printpage;topic=7436.0) you said that you were able to use veh, pheraps you can share something with us

  4. #4
    <script>alert(0)</script> disavowed's Avatar
    Join Date
    Apr 2002
    Posts
    1,281
    The second argument is a callback that you supply. It receives one argument from Windows, namely a pointer to an EXCEPTION_POINTERS structure.

  5. #5
    <script>alert(0)</script> disavowed's Avatar
    Join Date
    Apr 2002
    Posts
    1,281
    And there's sample code here: http://msdn.microsoft.com/en-us/library/ms681411(VS.85).aspx

  6. #6
    AttonRand
    Information about the handlers stored in a linked list. Descriptor of each handler in the list contains the hash of the address of the handler. Manager expands the list of exceptions consistently, causing the hooks out of him. When you add a handler to the list, you can specify its position in the chain, namely the first or last to add to the list. The first parameter RtlAddVectoredExceptionHandler() is used for this and need.
    Recently, the task of blocking the handler in the list, so it should always be at the beginning of the list (called first). If interested, here is the solution:
    http://indy-vx.narod.ru/Bin/Barrier.zip

  7. #7
    Thank you all for the info! now i am studying what indy posted (thank you man for your example).
    Well believe me or not before posting i checked msdn but didnt understand anything especially the Exception_Pointers structure.

    I hope i can post here if i have future question about veh.

Similar Threads

  1. Differences in 32-bit exception handling on 32- and 64-bit host OS
    By omega_red in forum Advanced Reversing and Programming
    Replies: 12
    Last Post: November 27th, 2008, 15:39
  2. Replies: 0
    Last Post: April 24th, 2008, 09:42
  3. Replies: 0
    Last Post: April 24th, 2008, 09:42
  4. Replies: 0
    Last Post: April 24th, 2008, 09:42
  5. Armadillo, Nanomites and vectored exception-handling
    By Ring3 Circus in forum Blogs Forum
    Replies: 8
    Last Post: December 13th, 2007, 00:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •