-
-
[下载]关于seh,一些奇怪的地方
-
发表于:
2015-9-26 22:09
3599
-
代码如下:
#include <windows.h>
#include <stdio.h>
DWORD scratch;
EXCEPTION_DISPOSITION __cdecl __my_excep_handler(
struct _EXCEPTION_RECORD *ExceptionRecord,
void *EstablisherFrame,
struct _CONTEXT *ContextRecord,
void * DispatcherContext)
{
unsigned i;
// 指明是我们让流程转到我们的异常处理程序的
printf( "Hello from an exception handler\n" );
// 改变CONTEXT结构中EAX的值,以便它指向可以成功进写操作的位置
ContextRecord->Eax = (DWORD)&scratch;
// 告诉操作系统重新执行出错的指令
return ExceptionContinueExecution;
}
int _tmain(int argc, _TCHAR* argv[])
{
DWORD handler = (DWORD)__my_excep_handler;
__asm
{
push handler
push fs:[0]
mov fs:[0], esp
}
__asm
{
mov eax, 0
mov [eax], 1
}
printf( "after exception!\n" );
__asm
{
mov eax, [esp]
mov fs:[0], eax
add esp, 8
}
return 0;
}
本人环境:
1. win7 64位系统
2. vs2010编译
遇到问题:
1. debug编译后执行正常

2. release编译后直接挂掉了
[培训]科锐逆向工程师培训第53期2025年7月8日开班!