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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? lion-tutorial30.htm

?? 內(nèi)有一些代碼
?? HTM
字號:
<html>

<head>
<link rel="stylesheet" href="../../asm.css">

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Iczelion's win32 asm tutorial</title>
</head>

<body bgcolor="#FFFFFF" background="../../images/back01.jpg">
<p align="center">Tutorial 30: Win32 Debug API part 3</p>
<hr 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>. 
<h3>Theory:</h3>
<p>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 <b>trap flag</b>. 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:</p>
<ol>
  <li>Call <b>GetThreadContext</b>, specifying <b>CONTEXT_CONTROL</b> in<b> ContextFlags</b>, 
    to obtain the value of the flag register.</li>
  <li>Set the trap bit in <b>regFlag</b> member of the <b>CONTEXT</b> structure</li>
  <li>call<b> SetThreadContext </b></li>
  <li>Wait for the debug events as usual. The debuggee will execute in single-step 
    mode. After it executes each instruction, we will get <b>EXCEPTION_DEBUG_EVENT</b> 
    with <b>EXCEPTION_SINGLE_STEP</b> value in <b>u.Exception.pExceptionRecord.ExceptionCode</b></li>
  <li>If you need to trace the next instruction, you need to set the trap bit 
    again.</li>
</ol>
<h3>Example:</h3>
<p>.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 </p>
<h3>Analysis:</h3>
<p>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. </p>
<p>&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 
</p>
<p>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.</p>
<p> &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 </p>
<p>We call <b>GetThreadContext</b> to fill the <b>CONTEXT </b>structure with the 
  current values in the registers of the debuggee. More specifically, we need 
  the current value of the flag register.</p>
<p> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or 
  context.regFlag,100h </p>
<p>We set the trap bit (8th bit) in the flag register image.</p>
<p> &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 
</p>
<p>Then we call <b>SetThreadContext</b> to overwrite the values in the <b>CONTEXT</b> 
  structure with the new one(s) and call <b>ContinueDebugEvent </b>with <b>DBG_CONTINUE</b> 
  flag to resume the debuggee.</p>
<p> &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 </p>
<p>When an instruction is executed in the debuggee, we receive an <b>EXCEPTION_DEBUG_EVENT</b>. 
  We must examine the value of <b>u.Exception.pExceptionRecord.ExceptionCode</b>. 
  If the value is <b>EXCEPTION_SINGLE_STEP</b>, then this debug event is generated 
  because of the single-step mode. In this case, we can increment the variable<b> 
  TotalInstruction</b> by one because we know that exactly one instruction was 
  executed in the debuggee.</p>
<p> &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>
</p>
<p>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.<br>
  <b>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.</b><strong> 
  </strong></p>
<hr size="1">
<div align="center"> This article come from Iczelion's asm page, Welcom to <a href="http://asm.yeah.net">http://asm.yeah.net</a></div>

</body>
</html>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
777xxx欧美| 91在线视频18| 欧美一区二区免费观在线| 视频一区中文字幕| 91精品免费在线| 久久精品国产澳门| 国产亚洲一区二区三区四区| 国产高清久久久久| 亚洲欧美日韩国产综合在线| 在线精品视频小说1| 午夜视频在线观看一区| 日韩一级在线观看| 国产一区二三区| 国产精品久久久99| 欧美午夜精品久久久| 肉肉av福利一精品导航| 久久人人爽人人爽| 色综合色狠狠综合色| 午夜久久久影院| 精品国产伦一区二区三区观看方式 | 午夜久久久久久| 欧美一级一区二区| 高清在线观看日韩| 夜夜嗨av一区二区三区| 日韩欧美国产不卡| 波多野结衣精品在线| 亚洲午夜在线电影| 久久九九久久九九| 欧美在线你懂的| 国模少妇一区二区三区| 亚洲人妖av一区二区| 91精品国产入口在线| 成人午夜av影视| 天堂久久一区二区三区| 欧美国产禁国产网站cc| 91精品国产综合久久久久久漫画 | 亚洲超碰97人人做人人爱| 欧美日本在线看| 成人午夜视频免费看| 亚洲大片在线观看| 国产精品欧美久久久久无广告| 丝袜诱惑制服诱惑色一区在线观看 | 日韩视频在线一区二区| 99久久伊人精品| 五月开心婷婷久久| 最近中文字幕一区二区三区| 91精品免费在线| 在线区一区二视频| 不卡一区二区三区四区| 久久99精品久久久久久动态图| 91精品久久久久久久99蜜桃| 成人国产精品免费网站| 久久精品二区亚洲w码| 亚洲精品福利视频网站| 国产精品全国免费观看高清| 日韩精品一区二| 欧美精品 国产精品| 91美女在线观看| 国产成人精品免费网站| 裸体一区二区三区| 天堂在线亚洲视频| 亚洲一二三四在线观看| 亚洲欧洲韩国日本视频| 久久久久九九视频| 久久午夜色播影院免费高清| 日韩精品一区二区三区在线观看| 国产在线播放一区| 麻豆精品新av中文字幕| 亚洲超碰精品一区二区| 亚洲综合在线免费观看| 亚洲私人影院在线观看| 亚洲欧洲成人精品av97| 国产精品视频线看| 国产精品美女一区二区三区| 久久一留热品黄| 精品国产乱码久久久久久久久 | av不卡免费电影| 粉嫩绯色av一区二区在线观看| 综合久久给合久久狠狠狠97色| 欧美中文字幕一区二区三区 | 亚洲欧美日韩在线| 国产精品久久久久影院| 国产精品美女久久久久久久网站| 欧洲av在线精品| 欧美又粗又大又爽| 欧美午夜精品一区二区三区| 欧美日韩国产另类一区| 欧美精品在线观看播放| 日韩视频免费观看高清完整版 | 91小视频免费看| 成人av免费在线播放| 99re这里都是精品| 日本高清无吗v一区| 欧美日本在线播放| 精品国产91洋老外米糕| 久久女同性恋中文字幕| 中文字幕精品一区二区三区精品| 91麻豆精品国产无毒不卡在线观看| 国产精品一区免费在线观看| 激情都市一区二区| 97国产一区二区| 欧美日韩免费观看一区二区三区 | 亚洲午夜久久久| 日本欧美在线观看| 国产成人欧美日韩在线电影| av一区二区三区四区| 欧美中文字幕不卡| 日韩精品一区二区三区四区视频| 欧美在线视频你懂得| 天天综合天天综合色| 激情综合网av| 国产91精品久久久久久久网曝门 | 欧美一区二区三区四区高清| 91精品免费在线| 久久理论电影网| 亚洲视频免费在线观看| 日本不卡的三区四区五区| 韩国女主播成人在线| 成人h动漫精品一区二区| 欧美亚洲国产bt| 日韩欧美中文字幕精品| 国产拍欧美日韩视频二区| 国产视频一区二区三区在线观看| 欧美一区二区三区在| 日韩精品一区二区三区在线观看| eeuss鲁片一区二区三区在线看| 午夜激情一区二区| 久久成人麻豆午夜电影| 成人免费视频视频| 欧美亚一区二区| 久久久久久亚洲综合| 亚洲综合在线视频| 国产精品综合av一区二区国产馆| 午夜精品福利一区二区三区av| 亚洲欧洲av另类| 免费在线成人网| 91麻豆国产自产在线观看| 91精品国产aⅴ一区二区| 亚洲精品欧美在线| 国内精品久久久久影院色| 色综合天天做天天爱| 日韩久久精品一区| 国产日本欧美一区二区| 老司机午夜精品99久久| 91麻豆免费看| 国产亚洲午夜高清国产拍精品 | 国产在线观看免费一区| 欧美午夜电影在线播放| 久久综合色婷婷| 亚洲国产视频在线| 91首页免费视频| 精品日韩欧美在线| 亚洲高清不卡在线| 成人av午夜电影| 欧美精品一二三| 亚洲成人激情自拍| 99久久精品国产网站| 久久久噜噜噜久久中文字幕色伊伊| 久久亚洲私人国产精品va媚药| 日韩一级完整毛片| 日本伊人午夜精品| 日本福利一区二区| 国产清纯美女被跳蛋高潮一区二区久久w| 欧美一区二区在线免费观看| 亚洲欧洲精品一区二区三区不卡| 国产精品欧美一区喷水| 久久国产麻豆精品| 欧美性生交片4| 亚洲欧美在线另类| 日本麻豆一区二区三区视频| 777色狠狠一区二区三区| 一区二区三区在线观看欧美| 成人精品在线视频观看| 久久综合久久综合久久| 国产一区二区三区四区在线观看 | 国产一区二区三区av电影| 91精品国产91综合久久蜜臀| 亚洲另类在线视频| 99精品视频中文字幕| 一区二区在线观看不卡| 色婷婷久久久综合中文字幕 | 欧美va日韩va| 精品中文字幕一区二区小辣椒| 国产精品一区二区在线观看网站| 成人黄动漫网站免费app| 中文一区二区在线观看| 91在线观看免费视频| 亚洲视频在线观看三级| av午夜精品一区二区三区| 日韩一区在线免费观看| 欧美午夜精品久久久久久孕妇| 欧美成人激情免费网| 免费高清视频精品| 精品国产一区a| 国产精品综合在线视频| 欧美精品一区二区三区很污很色的 | 久久精品在这里| 色综合久久久久综合体桃花网| 51午夜精品国产| 另类调教123区|