如何在Windows 32位x86程序集中获取EXCEPTION_POINTERS?

问题描述

因此,我有一些基本的asm文件,看起来像下面的文件(由于print_eax很大且与问题无关,因此将其删除),并且一直使用此http://www.godevtool.com/ExceptFrame.htm作为信息源。但是我不确定如何获得EXCEPTION_POINTERS。我试图从堆栈中弹出,并使用不同的寄存器以防万一它通过了这些寄存器,以及每个寄存器的各种偏移量,但是老实说,我很茫然,无法通过Google找到解决方案。当我们输入FINAL_HANDLER时如何获得EXCEPTION_POINTERS?

    global _main
    extern  _GetStdHandle@4
    extern  _WriteFile@20
    extern  _ExitProcess@4
    extern _SetUnhandledExceptionFilter@4

    section .text
_main:
    
    push FINAL_HANDLER
    CALL _SetUnhandledExceptionFilter@4

    ;---Protected code---
    mov eax,dword [0xffffffff] ;Force C0000005h exception

    ; ExitProcess(0)
    push    0
    call    _ExitProcess@4

    ; never here
    hlt

FINAL_HANDLER:
    ; get EXCEPTION_POINTERS
    ;????
    ; get EXCEPTION_RECORD(dword [EXCEPTION_POINTERS+0])
    mov eax,dword [EXCEPTION_POINTERS]
    ; get ExceptionCode(dword [EXCEPTION_RECORD+0])
    mov eax,dword [eax]
    call print_eax ; a simple procedure that outputs eax in hex

    ; ExitProcess(1)
    push    1
    call    _ExitProcess@4

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)