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

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

?? pe-tut2.html

?? 在DOS下編程因為實模式的限制
?? HTML
?? 第 1 頁 / 共 2 頁
字號:
<html>
<head>
<title>Iczelion's PE Tutorial 2: Detecting a Valid PE File</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#000066" text="#FFFFFF" link="#FFFFCC" vlink="#FFCCCC" alink="#CCFFCC">
<h1 align="center"><font face="Arial, Helvetica, sans-serif" color="#FFFFCC">Tutorial 
  2: Detecting a Valid PE File</font></h1>
<p><font face="MS Sans Serif" size="-1">In this tutorial, we will learn how to 
  check if a given file is a valid PE file.<br>
  Download <b><a href="files/PE-tut02.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">How can you verify if a given file is 
  a PE file? That question is difficult to answer. That depends on the length 
  that you want to go to do that. You can verify every data structure defined 
  in the PE file format or you are satisfied with verifying only the crucial ones. 
  Most of the time, it's pretty pointless to verify every single structure in 
  the files. If the crucial structures are valid, we can assume that the file 
  is a valid PE. And we will use that assumption.</font></p>
<p><font face="MS Sans Serif" size="-1">The essential structure we will verify 
  is the PE header itself. So we need to know a little about it, programmatically. 
  The PE header is actually a structure called IMAGE_NT_HEADERS. It has the following 
  definition:</font></p>
<p><font face="MS Sans Serif" size="-1"><b>IMAGE_NT_HEADERS STRUCT <br>
  &nbsp;&nbsp;&nbsp;Signature dd ? <br>
  &nbsp;&nbsp;&nbsp;FileHeader IMAGE_FILE_HEADER <> <br>
  &nbsp;&nbsp;&nbsp;OptionalHeader IMAGE_OPTIONAL_HEADER32 <> <br>
  IMAGE_NT_HEADERS ENDS </b></font></p>
<p><font face="MS Sans Serif" size="-1"><b><font color="#FFFFCC">Signature</font></b> 
  is a dword that contains the value 50h, 45h, 00h, 00h. In more human term, it 
  contains the text &quot;PE&quot; followed by two terminating zeroes. This member 
  is the PE signature so we will use it in verifying if a given file is a valid 
  PE one.</font><br>
  <font face="MS Sans Serif" size="-1"><b><font color="#FFFFCC">FileHeader </font></b>is 
  a structure that contains information about the physical layout of the PE file 
  such as the number of sections, the machine the file is targeted and so on.<br>
  <font color="#FFFFCC"><b>OptionalHeader</b></font> is a structure that contains 
  information about the logical layout of the PE file. Despite the &quot;Optional&quot; 
  in its name, it's always present.</font></p>
<p><font face="MS Sans Serif" size="-1">Our goal is now clear. If value of the 
  signature member of the<font color="#CCFFCC"><b> IMAGE_NT_HEADERS</b></font> 
  is equal to &quot;PE&quot; followed by two zeroes, then the file is a valid 
  PE. In fact, for comparison purpose, Microsoft has defined a constant named 
  <font color="#CCFFCC"> <b>IMAGE_NT_SIGNATURE</b></font> which we can readily 
  use.</font></p>
<p><font face="MS Sans Serif" size="-1"><b><font color="#FFCCFF">IMAGE_DOS_SIGNATURE 
  equ 5A4Dh </font><br>
  IMAGE_OS2_SIGNATURE equ 454Eh <br>
  IMAGE_OS2_SIGNATURE_LE equ 454Ch <br>
  IMAGE_VXD_SIGNATURE equ 454Ch <br>
  <font color="#FFCCFF">IMAGE_NT_SIGNATURE equ 4550h </font></b></font></p>
<p><font face="MS Sans Serif" size="-1"> The next question: how can we know where 
  the PE header is? The answer is simple: the DOS MZ header contains the file 
  offset of the PE header. The DOS MZ header is defined as<font color="#CCFFCC"><b> 
  IMAGE_DOS_HEADER</b></font> structure. You can check it out in windows.inc. 
  The <font color="#CC9900"><b>e_lfanew</b></font> member of the <font color="#CCFFCC"><b>IMAGE_DOS_HEADER</b></font> 
  structure contains the file offset of the PE header. </font></p>
<p><font face="MS Sans Serif" size="-1">The steps are now as follows:</font></p>
<ol>
  <li><font face="MS Sans Serif" size="-1">Verify if the given file has a valid 
    DOS MZ header by comparing the first word of the file with the value <font color="#CCFFCC"><b>IMAGE_DOS_SIGNATURE</b></font>.</font></li>
  <li><font face="MS Sans Serif" size="-1">If the file has a valid DOS header, 
    use the value in e_lfanew member to find the PE header</font></li>
  <li><font face="MS Sans Serif" size="-1">Comparing the first word of the PE 
    header with the value<font color="#CCFFCC"><b> IMAGE_NT_HEADER</b></font>. 
    If both values match, then we can assume that the file is a valid PE.</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\user32.lib <br>
  includelib \masm32\lib\kernel32.lib <br>
  includelib \masm32\lib\comdlg32.lib <br>
  <br>
  SEH struct <br>
  PrevLink dd ? &nbsp;&nbsp;&nbsp;; the address of the previous seh structure 
  <br>
  CurrentHandler dd ?&nbsp;&nbsp;&nbsp; ; the address of the exception handler 
  <br>
  SafeOffset dd ? &nbsp;&nbsp;&nbsp;; The offset where it's safe to continue execution 
  <br>
  PrevEsp dd ? &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; the old value in esp <br>
  PrevEbp dd ? &nbsp;&nbsp;&nbsp;&nbsp;; The old value in ebp <br>
  SEH ends<br>
  <br>
  .data <br>
  AppName db "PE tutorial no.2",0 <br>
  ofn OPENFILENAME <> <br>
  FilterString db "Executable Files (*.exe, *.dll)",0,"*.exe;*.dll",0 <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  db "All Files",0,"*.*",0,0 <br>
  FileOpenError db "Cannot open the file for reading",0 <br>
  FileOpenMappingError db "Cannot open the file for memory mapping",0 <br>
  FileMappingError db "Cannot map the file into memory",0 <br>
  FileValidPE db "This file is a valid PE",0 <br>
  FileInValidPE db "This file is not a valid PE",0 <br>
  <br>
  .data? <br>
  buffer db 512 dup(?) <br>
  hFile dd ? <br>
  hMapping dd ? <br>
  pMapping dd ? <br>
  ValidPE dd ? <br>
  <br>
  .code <br>
  start proc <br>
  LOCAL seh:SEH <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 CreateFile, addr buffer, GENERIC_READ, FILE_SHARE_READ, 
  NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL <br>
  &nbsp;&nbsp;&nbsp; .if eax!=INVALID_HANDLE_VALUE <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov hFile, eax <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke CreateFileMapping, hFile, NULL, 
  PAGE_READONLY,0,0,0 <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .if eax!=NULL <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov hMapping, eax <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invoke MapViewOfFile,hMapping,FILE_MAP_READ,0,0,0 
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .if eax!=NULL <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov 
  pMapping,eax <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; assume 
  fs:nothing <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push 
  fs:[0] <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pop 
  seh.PrevLink <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov 
  seh.CurrentHandler,offset SEHHandler <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov 
  seh.SafeOffset,offset FinalExit <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lea 
  eax,seh <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov 
  fs:[0], eax <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov 
  seh.PrevEsp,esp <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov 
  seh.PrevEbp,ebp <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov 
  edi, pMapping <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; assume 
  edi:ptr IMAGE_DOS_HEADER <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .if 
  [edi].e_magic==IMAGE_DOS_SIGNATURE <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  add edi, [edi].e_lfanew <br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产iv一区二区三区| 日本一区二区在线不卡| 亚洲一区二区在线免费看| 91美女视频网站| 亚洲一区在线免费观看| 欧美日韩高清一区二区| 蜜桃av噜噜一区二区三区小说| 欧美一级一级性生活免费录像| 精一区二区三区| 久久精品欧美日韩| 99视频国产精品| 亚洲最大成人综合| 91精品国产91热久久久做人人 | 亚洲成av人片在线| 欧美一级电影网站| 福利电影一区二区三区| 亚洲人精品午夜| 欧美一区二区性放荡片| 国产精品亚洲人在线观看| 国产精品电影院| 在线播放日韩导航| 国产传媒久久文化传媒| 一区二区三区日韩精品视频| 91麻豆精品国产自产在线观看一区| 卡一卡二国产精品| 中文字幕在线不卡一区| 4438x成人网最大色成网站| 国产在线看一区| 亚洲日本护士毛茸茸| 欧美电影一区二区三区| 国产成人在线视频播放| 亚洲网友自拍偷拍| 久久亚区不卡日本| 欧美日韩欧美一区二区| 国产一区二区在线免费观看| 国产一区二区三区四区五区入口| 中文字幕一区二区三区av| 欧美一区二区在线免费观看| 国产suv精品一区二区6| 日韩国产欧美三级| 17c精品麻豆一区二区免费| 日韩精品一区二区三区四区视频 | 婷婷六月综合网| 国产欧美精品一区| 日韩一区二区麻豆国产| 色噜噜狠狠色综合中国| 国产乱码精品一区二区三区五月婷| 一区二区三区四区在线播放| 久久精品亚洲精品国产欧美kt∨| 欧美日韩1234| 91福利社在线观看| www.视频一区| 国产激情一区二区三区四区| 日韩和欧美一区二区三区| 亚洲免费av高清| 国产人成亚洲第一网站在线播放 | 日韩一级片网站| 欧美综合一区二区三区| 成人影视亚洲图片在线| 黄网站免费久久| 日本亚洲欧美天堂免费| 亚洲成人av资源| 夜夜精品视频一区二区| 亚洲乱码国产乱码精品精可以看 | 亚洲www啪成人一区二区麻豆| 国产精品短视频| 中文字幕欧美日韩一区| 久久九九久精品国产免费直播| 91精品国产综合久久久久久| 欧美视频一区二区三区在线观看| 成人18精品视频| 成人在线综合网站| 国产精品99久| 国产成人av一区二区三区在线观看| 蜜臀av性久久久久av蜜臀妖精| 亚洲成人激情综合网| 亚洲成人午夜电影| 亚洲成人综合在线| 日韩黄色在线观看| 日日嗨av一区二区三区四区| 亚洲成人免费观看| 热久久国产精品| 日本怡春院一区二区| 奇米精品一区二区三区四区 | 日韩你懂的电影在线观看| 欧美一二三四在线| 精品精品欲导航| 久久久99精品免费观看不卡| 久久亚洲二区三区| 中文字幕第一区第二区| 国产精品欧美极品| 亚洲摸摸操操av| 亚洲国产日日夜夜| 午夜精品久久久久久久99水蜜桃| 三级不卡在线观看| 黄色小说综合网站| 成人激情综合网站| 欧美亚洲国产bt| 欧美一级电影网站| 亚洲国产精华液网站w| 亚洲人成人一区二区在线观看 | 国产一区二区三区日韩| 国产aⅴ精品一区二区三区色成熟| 成人午夜大片免费观看| 色中色一区二区| 日韩午夜三级在线| 日本一区免费视频| 亚洲.国产.中文慕字在线| 久久疯狂做爰流白浆xx| www.一区二区| 91精品一区二区三区久久久久久| 精品国内二区三区| 亚洲色图一区二区三区| 日韩有码一区二区三区| 国产成人三级在线观看| 日本精品一区二区三区四区的功能| 欧美日韩亚洲综合| 久久久久久久久久久久久久久99| 国内偷窥港台综合视频在线播放| 国产成人av影院| 欧美日韩一区精品| 国产日韩欧美综合一区| 亚洲国产精品嫩草影院| 国产一区二区三区日韩 | 国产一区二区三区在线观看免费视频| 不卡大黄网站免费看| 欧美一区二区成人| 亚洲色图欧洲色图| 国产在线精品一区二区不卡了| 成人ar影院免费观看视频| 91精品国产高清一区二区三区蜜臀| 国产日韩成人精品| 蜜桃91丨九色丨蝌蚪91桃色| 99re热视频这里只精品| 精品免费日韩av| 亚洲1区2区3区4区| 93久久精品日日躁夜夜躁欧美| 精品99999| 视频一区中文字幕国产| 色诱视频网站一区| 国产精品免费av| 韩国精品在线观看| 欧美精品色综合| 一区二区三区国产精华| 福利电影一区二区三区| 日韩视频一区在线观看| 亚洲一区二区三区中文字幕| 成人激情视频网站| 久久蜜臀精品av| 精品制服美女丁香| 欧美一区二区三区免费在线看| 一区二区三区四区国产精品| www.欧美.com| 国产精品免费免费| 高清beeg欧美| 久久久精品综合| 国产一区二区调教| 精品国产污网站| 九九九久久久精品| 日韩欧美国产精品| 欧美三级电影在线看| 亚洲美女免费在线| 91美女在线观看| 亚洲嫩草精品久久| 色偷偷88欧美精品久久久| 中文幕一区二区三区久久蜜桃| 国产乱码精品一品二品| 久久久久久久久伊人| 国产呦萝稀缺另类资源| 国产亚洲精品7777| 国产成人在线网站| 国产精品久久久久久久久免费桃花 | 亚洲影视在线播放| 欧美中文字幕不卡| 亚洲成人av免费| 日韩一区二区电影网| 精品制服美女久久| 久久久久九九视频| 成人av在线一区二区| 亚洲免费在线电影| 欧美午夜寂寞影院| 视频一区中文字幕国产| 欧美一区二区高清| 国产一区二区不卡在线| 中文字幕不卡在线观看| 97超碰欧美中文字幕| 一区二区三区欧美在线观看| 欧美挠脚心视频网站| 美女在线一区二区| 国产日产欧美一区二区三区| 99v久久综合狠狠综合久久| 亚洲午夜日本在线观看| 91精品国产综合久久国产大片| 久久激情五月激情| 国产精品久久久久精k8| 欧美色手机在线观看| 精品一区二区三区免费视频| 中文在线免费一区三区高中清不卡| 91美女片黄在线观看91美女| 丝袜美腿高跟呻吟高潮一区|