当前位置:网站首页>PE file-
PE file-
2022-06-28 21:49:00 【Huxiaonan awa】
Catalog
PE file
Format
PE File is windows Executable file format used under the operating system
1. species
Executable series :EXE、SCR
Driver family :SYS、VXD
Library Series :DLL、OCX、CPL、DRV
Object file series :OBJ( Itself cannot be executed in any form )
2. The basic structure
from DOS Head to head is PE The first part , The nodal regions under them are collectively called PE body . Offset is used in the file , Use in memory VA To show the position . When the file is loaded into memory , The size of the section 、 The position will change . The content of the file can be divided into code 、 data 、 Resource section , Keep separately .
Each section header defines the size of each section in file or memory 、 Location 、 Properties, etc . PE There is a region between the head and the tail of each section , Become NULL fill

3. VA & VRA
VA The absolute address of the virtual memory of the process ,VRA A relative address starting from a reference position (PE Most of the internal information in the header is in PVA The form )
4. PE head
(1) DOS head
stay PE Add a... To the front of the header IMAGE_DOS_HEADER Structure , To extend existing DOS EXE head
(2) DOS stub
stay DOS Under the head , from Code and data It's a mixture of
(3) NT head
IMAGE_NT_HEADER The structure consists of three members : Signature structure 、 The file header 、 Optional head
(4) NT head : The file header
That represents the general attributes of the file IMAGE_FILE_HEADER Structure , Yes 4 An important member :
- Machine: Every CPU Have a unique Machine code
- NumberOfSections: Used to indicate the number of sections in the file
- SizeOfOptionalHeader: Used to indicate IMAGE_OPTIONAL_HEADER The length of the structure
- Characteristics: This field is used to identify the attributes of the file , Whether the file is in a runnable form , Is it DLL Documents and other information , With bit OR Combine forms
(5) NT head : Optional head
IMAGE_OPTIONAL_HEADER yes PE The largest of the head structures
- Magic:IMAGE_OPTIONAL_HEADER32 When the structure is ,Magic Code for 10B.IMAGE_OPTIONAL_HEADER64 When the structure is ,Magic Code for 20B
- AddressOfEntryPoint: hold EP Of RVA value
- ImageBase:PE When a file is loaded into large memory ,ImageBase Indicates the preferred loading address of the file
- SectionAlignment,FileAlignment: The former specifies the minimum unit of the section in memory , The latter specifies the minimum unit of the section in the disk file
- SizeOflmage: load PE When a file is in memory ,SizeFlmage It specifies PE Image The amount of space occupied in virtual memory
- SizeOfHeaders: Used to point out the whole PE The size of the head
- Subsystem: Its value is used to distinguish the system driver file from the ordinary executable file

- NumberOfPvaAndSizes: Used to specify DataDiretory The number of arrays
- DataDiretory: By IMAGE_DATA_HEADER An array of structures , Each item of the array has a defined value
(6) Section head
PE The file format stores data with similar attributes in a file called “ Nodal region ” The place of , Then you need to record the attributes of each section in the section header .
The section head is made up of IMAGE_SECTION_HEADER An array of structures , Each structure corresponds to a section

4. RVA to RAW
PE When the file is loaded into memory , Each section should be able to accurately complete the mapping between memory address and file offset , The method is as follows :
- lookup PVA In the festival area
- Calculate the file offset using a simple formula
5. IAT
IAT The saved content is the same as windows The core process of the operating system 、 Memory 、DLL Structure, etc
(1) DLL
load DLL The way :
- Explicit links : Program usage DLL Time to load , Free memory after use
- Implicit linking : The program is loaded at the beginning DLL, Release the occupied memory when the program terminates
(2) IMAGE_IMPORT_DESCRIPTOR
It is often necessary to import multiple libraries when executing a common program , There are as many libraries as you import IMAGE_IMPORT_DESCRIPTOR Structure , These structures form an array , And the structure array ends with NULL The end of the structure
INT And IAT Is a long array , With NULL end
INT The value of each element in is IMAGE_IMPORT_BY_NAME Structure pointer
INT And IAT Same size for
6. EAT
“ library ” It is a file containing related functions in order to facilitate other program calls
EAT Is a core mechanism , It enables different applications to call the functions provided in the library file
IMAGE_EXPORT_DIRECTORY Structure :

notes : This paper is about 《 The core principle of Reverse Engineering 》 Excerpt from , I'm just a little porter ~~
边栏推荐
- How can the sports app keep the end-to-side background alive to make the sports record more complete?
- The blocks problem (uva101) Purple Book p110vector application
- LeetCode123. The best time to buy and sell stocks III
- Which is the most reliable and safe for a securities company to open an account
- LeetCode226. 翻转二叉树
- LeetCode560. 和为K的子数组
- 2022年股票在手机上开户安全吗?找谁可以办理?
- 二叉树类题目 力扣
- Figure neural network can also be used as CV backbone model. Huawei Noah Vig architecture is comparable to CNN and transformer
- E-commerce is popular, how to improve the store conversion rate?
猜你喜欢

河狸生存记:90后女博士与AI开发者们

Survival of beaver: post-90s female doctors and AI developers

QJsonObject的使用示例

【笔记:模拟MOS集成电路】带隙基准(基本原理+电流模+电压模电路详解)

Usage example of qjsonobject

How do independent site sellers efficiently manage complex Facebook pages?

17 `bs对象.节点名h3.parent` parents 获取父节点 祖先节点

视觉弱监督学习研究进展

华为云的AI深潜之旅

CVPR 2022 𞓜 a creative and aesthetic text generation method! Support any input
随机推荐
Progress in visual weakly supervised learning
PHP login problem
Recommend two high-quality Wallpaper software
How to analyze the relationship between enterprise digital transformation and data asset management?
The blocks problem (uva101) Purple Book p110vector application
The comprehensive application of the setstack computer (uva12096) Purple Book p116stl
Which software is safer to open an account on and what is the account opening process?
Can you make money by speculating in stocks? It's safe to open an account
Zero foundation self-study SQL course | complete collection of date functions in SQL
Go cryptobin common encryption and decryption Libraries
Leetcode daily question - 30 Concatenate substrings of all words
16 `bs object Node name Div. attribute contents ` children descendants get child nodes and descendants
[Note: circuit intégré MOS analogique] référence de bande Gap (principe de base + mode courant + circuit en mode tension)
Is the inter-bank certificate of deposit reliable and safe
Is it safe to open an account for stocks on mobile phones in 2022? Who can I ask?
Leetcode daily question - Sword finger offer II 091 Paint the house
Application of the purple book p113map of ananagrams (uva156)
LeetCode121. 买卖股票的最佳时机
运动App如何实现端侧后台保活,让运动记录更完整?
PHP自学Go日记(四):GO的变量声明方式
