首页
社区
课程
招聘
[求助]ASM WIN32调试API获得CONTEXT
发表于: 2012-8-30 13:59 3553

[求助]ASM WIN32调试API获得CONTEXT

2012-8-30 13:59
3553

;****************************************************
;线程函数
;****************************************************
_debugThread_proc proc uses esi edi ebx lpParam
LOCAL @nReaderNumber
LOCAL @result[20]
invoke RtlZeroMemory,addr @nReaderNumber,sizeof @nReaderNumber
invoke GetStartupInfo,offset stStartUp
invoke CreateProcess,offset szFilePath,NULL,NULL,NULL,NULL,DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS,NULL,\
NULL,offset stStartUp,offset stPF ;创建进程
;nvoke _showerror_proc,250h
.while TRUE
invoke WaitForDebugEvent,offset stDebugEvent,INFINITE
mov stContext.ContextFlags,CONTEXT_FULL ;设置获得所有寄存器
invoke GetThreadContext,stPF.hThread,offset stContext;获得线程的上下文
or stContext.regFlag,0100h;对TF位置为操作
invoke SetThreadContext,stPF.hThread,offset stContext ;设置线程的上下文
.break .if stDebugEvent.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT
.if stDebugEvent.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT
invoke ReadProcessMemory,stPF.hProcess,lpEntryPointer,offset Oldcommand,1,addr @nReaderNumber
invoke WriteProcessMemory,stPF.hProcess,lpEntryPointer,offset dbINT3,1,addr @nReaderNumber
invoke _setTextToPeInfoDialog,addr stContext ;将CONTEXT中的数据显示到dialog上
.elseif stDebugEvent.dwDebugEventCode == EXCEPTION_DEBUG_EVENT
invoke _setTextToPeInfoDialog,addr stContext
.endif
invoke WaitForSingleObject,hEvent,INFINITE;将此进程挂起
invoke ContinueDebugEvent,stPF.dwProcessId,stPF.dwThreadId,DBG_CONTINUE
.endw
invoke MessageBox,NULL,offset szExitDebug,offset szExitDebug,MB_OK
invoke ExitThread,12
ret

_debugThread_proc endp


从我获得的CONTEXT中的EIP的值是7C8106F5,...7C8106F5是程序开始的地方么??还是????

[课程]Android-CTF解题方法汇总!

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 8
活跃值: (12)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
= =好吧..我知道哪错了..我没忘回复 入口处的代码了..在入口处加了个int3 代码结果后来忘了替换回去了= =导致可能就直接形成了个新的指令= =
2012-8-30 17:57
0
游客
登录 | 注册 方可回帖
返回
//