亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tut30.html

?? WINDOWS程序員使用指南--匯編基礎
?? HTML
字號:
<html>
<head>
<title>Iczelion's Win32 Assembly Tutorial 30: Win32 Debug API part 3</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#000000" text="#FFFFFF" link="#FFFFCC" vlink="#FFCCCC" alink="#CCFFCC">
<h1 align="center"><font face="Arial, Helvetica, sans-serif" color="#FFFFCC">Tutorial 
  30: Win32 Debug API part 3</font></h1>
<p><font face="MS Sans Serif" size="-1">In this tutorial, we continue the exploration 
  of win32 debug api. Specifically, we will learn how to trace the debuggee.<br>
  Download <b><a href="files/tut30.zip" style="text-decoration:none">the example</a></b>.</font></p>
<h3><font face="Arial, Helvetica, sans-serif">Theory:</font></h3>
<p><font face="MS Sans Serif" size="-1">If you have used a debugger before, you 
  would be familiar with tracing. When you &quot;trace&quot; a program, the program 
  stops after executing each instruction, giving you the chance to examine the 
  values of registers/memory. Single-stepping is the official name of tracing.<br>
  The single-step feature is provided by the CPU itself. The 8th bit of the flag 
  register is called <font color="#FFFFCC"><b>trap flag</b></font>. If this flag(bit) 
  is set, the CPU executes in single-step mode. The CPU will generate a debug 
  exception after each instruction. After the debug exception is generated, the 
  trap flag is cleared automatically.<br>
  We can also single-step the debuggee, using win32 debug api. The steps are as 
  follows:</font></p>
<ol>
  <li><font face="MS Sans Serif" size="-1">Call <b><font color="#FFFFCC">GetThreadContext</font></b>, 
    specifying <font color="#CCFFCC"><b>CONTEXT_CONTROL</b></font> in<font color="#FF9900"><b> 
    ContextFlags</b></font>, to obtain the value of the flag register.</font></li>
  <li><font face="MS Sans Serif" size="-1">Set the trap bit in <font color="#FFCCCC"><b>regFlag</b></font> 
    member of the <font color="#CCCCFF"><b>CONTEXT</b></font> structure</font></li>
  <li><font face="MS Sans Serif" size="-1">call<font color="#FFFFCC"><b> SetThreadContext 
    </b></font></font></li>
  <li><font face="MS Sans Serif" size="-1">Wait for the debug events as usual. 
    The debuggee will execute in single-step mode. After it executes each instruction, 
    we will get <font color="#CCFFCC"><b>EXCEPTION_DEBUG_EVENT</b></font> with 
    <font color="#CCCCFF"> <b>EXCEPTION_SINGLE_STEP</b></font> value in <font color="#CCFFCC"><b>u.Exception.pExceptionRecord.ExceptionCode</b></font></font></li>
  <li><font face="MS Sans Serif" size="-1">If you need to trace the next instruction, 
    you need to set the trap bit again.</font></li>
</ol>
<h3><font face="Arial, Helvetica, sans-serif">Example:</font></h3>
<p><font face="Fixedsys">.386<br>
  .model flat,stdcall <br>
  option casemap:none <br>
  include \masm32\include\windows.inc <br>
  include \masm32\include\kernel32.inc <br>
  include \masm32\include\comdlg32.inc <br>
  include \masm32\include\user32.inc <br>
  includelib \masm32\lib\kernel32.lib <br>
  includelib \masm32\lib\comdlg32.lib <br>
  includelib \masm32\lib\user32.lib <br>
  <br>
  .data <br>
  AppName db "Win32 Debug Example no.4",0 <br>
  ofn OPENFILENAME <> <br>
  FilterString db "Executable Files",0,"*.exe",0 <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; db 
  "All Files",0,"*.*",0,0 <br>
  ExitProc db "The debuggee exits",0Dh,0Ah <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;db "Total Instructions executed 
  : %lu",0 <br>
  TotalInstruction dd 0<br>
  <br>
  .data? <br>
  buffer db 512 dup(?) <br>
  startinfo STARTUPINFO <> <br>
  pi PROCESS_INFORMATION <> <br>
  DBEvent DEBUG_EVENT <> <br>
  context CONTEXT <> <br>
  <br>
  .code <br>
  start: <br>
  mov ofn.lStructSize,SIZEOF ofn <br>
  mov ofn.lpstrFilter, OFFSET FilterString <br>
  mov ofn.lpstrFile, OFFSET buffer <br>
  mov ofn.nMaxFile,512 <br>
  mov ofn.Flags, OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST or OFN_LONGNAMES or OFN_EXPLORER 
  or OFN_HIDEREADONLY <br>
  invoke GetOpenFileName, ADDR ofn <br>
  .if eax==TRUE <br>
  &nbsp;&nbsp;&nbsp; invoke GetStartupInfo,addr startinfo <br>
  &nbsp;&nbsp;&nbsp; invoke CreateProcess, addr buffer, NULL, NULL, NULL, FALSE, 
  DEBUG_PROCESS+ DEBUG_ONLY_THIS_PROCESS, NULL, NULL, addr startinfo, addr pi 
  <br>
  &nbsp;&nbsp;&nbsp; .while TRUE <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke WaitForDebugEvent, addr DBEvent, 
  INFINITE <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .if DBEvent.dwDebugEventCode==EXIT_PROCESS_DEBUG_EVENT 
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke wsprintf, addr 
  buffer, addr ExitProc, TotalInstruction <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke MessageBox, 0, 
  addr buffer, addr AppName, MB_OK+MB_ICONINFORMATION <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .break <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .elseif DBEvent.dwDebugEventCode==EXCEPTION_DEBUG_EVENT 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.if DBEvent.u.Exception.pExceptionRecord.ExceptionCode==EXCEPTION_BREAKPOINT 
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov 
  context.ContextFlags, CONTEXT_CONTROL <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  GetThreadContext, pi.hThread, addr context <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or 
  context.regFlag,100h <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  SetThreadContext,pi.hThread, addr context <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  ContinueDebugEvent, DBEvent.dwProcessId, DBEvent.dwThreadId, DBG_CONTINUE <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .continue 
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .elseif DBEvent.u.Exception.pExceptionRecord.ExceptionCode==EXCEPTION_SINGLE_STEP 
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inc 
  TotalInstruction <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  GetThreadContext,pi.hThread,addr context or context.regFlag,100h <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  SetThreadContext,pi.hThread, addr context <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  ContinueDebugEvent, DBEvent.dwProcessId, DBEvent.dwThreadId,DBG_CONTINUE <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .continue 
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .endif <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .endif <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke ContinueDebugEvent, DBEvent.dwProcessId, 
  DBEvent.dwThreadId, DBG_EXCEPTION_NOT_HANDLED <br>
  &nbsp;&nbsp;&nbsp; .endw <br>
  .endif <br>
  invoke CloseHandle,pi.hProcess <br>
  invoke CloseHandle,pi.hThread <br>
  invoke ExitProcess, 0 <br>
  end start </font></p>
<h3><font face="Arial, Helvetica, sans-serif">Analysis:</font></h3>
<p><font face="MS Sans Serif" size="-1">The program shows the openfile dialog 
  box. When the user chooses an executable file, it executes the program in single-step 
  mode, couting the number of instructions executed until the debuggee exits. 
  </font></p>
<p><font face="Fixedsys">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .elseif DBEvent.dwDebugEventCode==EXCEPTION_DEBUG_EVENT 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.if DBEvent.u.Exception.pExceptionRecord.ExceptionCode==EXCEPTION_BREAKPOINT 
  </font></p>
<p><font face="MS Sans Serif" size="-1">We take this opportunity to set the debuggee 
  into single-step mode. Remember that Windows sends an EXCEPTION_BREAKPOINT just 
  before it executes the first instruction of the debuggee.</font></p>
<p><font face="Fixedsys"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  mov context.ContextFlags, CONTEXT_CONTROL <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  GetThreadContext, pi.hThread, addr context </font></p>
<p><font face="MS Sans Serif" size="-1">We call <font color="#FFFFCC"><b>GetThreadContext</b></font> 
  to fill the <font color="#CCFFCC"><b>CONTEXT </b></font>structure with the current 
  values in the registers of the debuggee. More specifically, we need the current 
  value of the flag register.</font></p>
<p><font face="Fixedsys"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  or context.regFlag,100h </font></p>
<p><font face="MS Sans Serif" size="-1">We set the trap bit (8th bit) in the flag 
  register image.</font></p>
<p><font face="Fixedsys"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  invoke SetThreadContext,pi.hThread, addr context <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  ContinueDebugEvent, DBEvent.dwProcessId, DBEvent.dwThreadId, DBG_CONTINUE <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .continue 
  </font></p>
<p><font face="MS Sans Serif" size="-1">Then we call <font color="#FFFFCC"><b>SetThreadContext</b></font> 
  to overwrite the values in the <font color="#CCFFCC"><b>CONTEXT</b></font> structure 
  with the new one(s) and call <font color="#FFFFCC"><b>ContinueDebugEvent </b></font>with 
  <font color="#CCFFCC"> <b>DBG_CONTINUE</b></font> flag to resume the debuggee.</font></p>
<p><font face="Fixedsys"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  .elseif DBEvent.u.Exception.pExceptionRecord.ExceptionCode==EXCEPTION_SINGLE_STEP 
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inc 
  TotalInstruction </font></p>
<p><font face="MS Sans Serif" size="-1">When an instruction is executed in the 
  debuggee, we receive an <font color="#CCFFCC"><b>EXCEPTION_DEBUG_EVENT</b></font>. 
  We must examine the value of <b><font color="#FFCCCC">u.Exception.pExceptionRecord.ExceptionCode</font></b>. 
  If the value is <font color="#CCFFCC"><b>EXCEPTION_SINGLE_STEP</b></font>, then 
  this debug event is generated because of the single-step mode. In this case, 
  we can increment the variable<font color="#FFFFCC"><b> TotalInstruction</b></font> 
  by one because we know that exactly one instruction was executed in the debuggee.</font></p>
<p><font face="Fixedsys"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  invoke GetThreadContext,pi.hThread,addr context or context.regFlag,100h <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  SetThreadContext,pi.hThread, addr context <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke 
  ContinueDebugEvent, DBEvent.dwProcessId, DBEvent.dwThreadId,DBG_CONTINUE <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .continue 
  <br>
  </font></p>
<p><font face="MS Sans Serif" size="-1">Since the trap flag is cleared after the 
  debug exception is generated, we must set the trap flag again if we want to 
  continue in single-step mode.</font><br>
  <font face="MS Sans Serif" size="-1"><b><font color="#FF3333">Warning: Don't 
  use the example in this tutorial with a large program: tracing is SLOW. You 
  may have to wait for ten minutes before you can close the debuggee.</font></b></font></p>
<hr>
<p align="center"><b><font face="MS Sans Serif" size="-1">[<a href="http://win32asm.cjb.net">Iczelion's 
  Win32 Assembly Homepage</a>]</font></b></p>
<p>&nbsp;</p>
</body>
</html>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
青娱乐精品在线视频| 国产伦精一区二区三区| 亚洲一二三区不卡| 亚洲h精品动漫在线观看| 日韩精品亚洲一区二区三区免费| 性久久久久久久久| 成人亚洲一区二区一| 欧美视频一区在线观看| 日韩欧美一区二区三区在线| 久久综合九色综合欧美亚洲| 亚洲精品成人悠悠色影视| 免费一级片91| 欧美性生活一区| 久久久美女毛片| 一二三区精品福利视频| 麻豆国产一区二区| 在线精品国精品国产尤物884a| 精品盗摄一区二区三区| 亚洲 欧美综合在线网络| 成人午夜免费视频| 亚洲视频免费观看| 成人美女在线视频| 精品电影一区二区| 奇米777欧美一区二区| 欧美性色aⅴ视频一区日韩精品| 国产精品看片你懂得| 国产一区中文字幕| 欧美zozozo| 久久99热狠狠色一区二区| 欧美日韩高清在线| 亚洲国产视频a| 欧美三级三级三级爽爽爽| 综合色天天鬼久久鬼色| 国产福利不卡视频| 国产精品乱人伦| 9人人澡人人爽人人精品| 国产精品视频看| 成人黄色小视频在线观看| 国产精品美女视频| 91看片淫黄大片一级| 亚洲欧美综合色| 欧美日韩你懂得| 美国三级日本三级久久99| 精品久久久久久久久久久久久久久久久 | 久久久久久久久久久久久久久99| 国产一区二区精品久久99| 日韩一区二区免费视频| 国产成人av电影免费在线观看| 久久久另类综合| 色婷婷综合在线| 九一久久久久久| 国产精品的网站| 欧美精品1区2区| 成人av资源下载| 蓝色福利精品导航| 亚洲曰韩产成在线| 国产网站一区二区三区| 在线日韩一区二区| 丁香婷婷深情五月亚洲| 午夜亚洲福利老司机| 欧美国产日韩一二三区| 精品婷婷伊人一区三区三| 高清国产一区二区| jlzzjlzz亚洲女人18| 日本女人一区二区三区| 椎名由奈av一区二区三区| 精品国产乱码久久久久久免费| 欧美视频一区二| 91亚洲资源网| aaa亚洲精品一二三区| 国产精品一区在线观看乱码| 日韩精品91亚洲二区在线观看| 亚洲日本青草视频在线怡红院 | 午夜精品123| 亚洲动漫第一页| 亚洲一区二区三区视频在线 | 国产高清精品久久久久| 国产一本一道久久香蕉| 精品一区二区久久| 色噜噜偷拍精品综合在线| 日韩一区二区三区四区| 99久久国产免费看| 日韩一本二本av| 亚洲激情欧美激情| 成人毛片在线观看| 99v久久综合狠狠综合久久| 看电影不卡的网站| 亚洲午夜电影在线观看| 亚洲精品乱码久久久久久久久| 中文字幕日本乱码精品影院| 欧美激情一区二区三区在线| 国产亚洲成av人在线观看导航 | 最新成人av在线| 不卡的av电影在线观看| 日韩不卡免费视频| 国产一区二区三区四区在线观看| 精品亚洲欧美一区| 色综合夜色一区| 国产精品美女久久久久久久久| 成人国产精品免费网站| 亚洲欧美日韩中文字幕一区二区三区 | 亚洲男同性恋视频| 欧美日韩久久久| 国产又粗又猛又爽又黄91精品| 久久久亚洲精华液精华液精华液| 国产伦精品一区二区三区免费| 国产日产欧美一区二区视频| 成人免费av在线| 午夜a成v人精品| 欧美一级精品大片| 成人午夜伦理影院| 亚洲成人av福利| 日韩欧美成人激情| 亚洲激情图片qvod| 精品久久久久久久久久久院品网 | 久久人人爽人人爽| 日韩欧美国产综合| 91视视频在线观看入口直接观看www| 丝袜美腿高跟呻吟高潮一区| 国产亚洲一二三区| 51久久夜色精品国产麻豆| 色婷婷综合久久久中文一区二区| 亚洲天堂福利av| 7777女厕盗摄久久久| 一本大道久久a久久精二百| 激情成人午夜视频| 午夜亚洲国产au精品一区二区| 国产精品剧情在线亚洲| 欧美精品一区二| 正在播放一区二区| 欧美人与性动xxxx| 7777精品伊人久久久大香线蕉经典版下载 | 亚洲一区二区三区四区五区黄| 欧美一级一级性生活免费录像| av一二三不卡影片| 国产成都精品91一区二区三| 青草国产精品久久久久久| 亚洲图片一区二区| 亚洲午夜免费福利视频| 亚洲综合另类小说| 亚洲柠檬福利资源导航| 玉米视频成人免费看| 亚洲福利一区二区| 奇米综合一区二区三区精品视频 | 亚洲一区二区三区四区在线免费观看 | 欧美一区二区视频免费观看| 久久精品人人做人人爽人人| 亚洲欧美乱综合| 国产精品第13页| 亚洲综合偷拍欧美一区色| 综合久久一区二区三区| 亚洲精品国产一区二区三区四区在线 | 成人黄页在线观看| 色婷婷综合久久久中文字幕| 91久久精品日日躁夜夜躁欧美| 91福利国产精品| 欧美久久一二区| www国产成人| 一区二区三区在线观看欧美| 夜夜嗨av一区二区三区四季av | 91官网在线免费观看| 日韩精品中文字幕一区 | 成人欧美一区二区三区白人 | 亚洲欧美日韩在线播放| 婷婷丁香激情综合| 国产精品一区二区三区99| 92国产精品观看| 欧美变态tickling挠脚心| 日韩美女视频一区二区 | 日本大胆欧美人术艺术动态| 成人黄页在线观看| 欧美成人三级电影在线| 中文欧美字幕免费| 免费观看成人av| 欧美三级电影在线看| 欧美高清在线视频| 麻豆精品视频在线观看视频| 欧美日韩在线播放一区| 中文字幕一区二区三区四区不卡| 久久99久久久久| 欧美精品丝袜中出| 亚洲成av人片一区二区梦乃| 不卡大黄网站免费看| 中文字幕欧美激情一区| 韩国视频一区二区| 久久一夜天堂av一区二区三区| 免费久久99精品国产| 欧美精品一级二级| 亚洲午夜电影网| 欧美视频中文一区二区三区在线观看| 中文字幕中文在线不卡住| 成人一区二区三区视频在线观看| 91精品国产91久久综合桃花| 亚洲精品国产精品乱码不99| 99久久精品一区| 亚洲精品久久7777| 在线欧美日韩国产| 青青草精品视频| 国产三级欧美三级日产三级99| 国产馆精品极品|