GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Sheller/AddSection.h at master · binarysafe/Sheller

Expand file tree

/

AddSection.h

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
69 lines (54 loc) · 1.53 KB
/

AddSection.h

Copy path

File metadata and controls

69 lines (54 loc) · 1.53 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#pragma once
#ifndef ADDSECTION_H_
#define ADDSECTION_H_
#include "stdafx.h"
/*
类名称:AddSection
用途:添加一个区段
时间:2018/11/30
*/
class AddSection
{
public:
AddSection();
~AddSection();
public:
void puModifySectioNumber(){ this->ModifySectionNumber(); }
void puModifyProgramEntryPoint(){ this->ModifyProgramEntryPoint(); }
void puModifySizeofImage(){ this->ModifySizeofImage(); }
BOOL puModifySectionInfo(BYTE* Name, const DWORD & size){ return this->ModifySectionInfo(Name, size); }
BOOL puAddNewSectionByData(const DWORD & size){ return this->AddNewSectionByteData(size); }
void* puGetNewBaseAddress(){ return this->newlpBase; }
DWORD puGetNewBaseSize(){ return this->FileSize + 0x1000; }
private:
// 1. 修改区段数量
BOOL ModifySectionNumber();
// 2. 修改区段信息(RVA\大小\属性)
BOOL ModifySectionInfo(const BYTE* Name, const DWORD & size);
// 3. 修改程序入口点
BOOL ModifyProgramEntryPoint();
// 4. 修改SizeImage
BOOL ModifySizeofImage();
// 5. 增加新的字节(一定最后在调用)
BOOL AddNewSectionByteData(const DWORD & size);
private:
// 保存FileImage
void* pFileBaseData = nullptr;
// 保存Nt头
void* pNtHeadre = nullptr;
// 保存区段头
void* pSectionHeadre = nullptr;
// 保存区段一共多少个字节 (区段个数*每个区段大小--不是区段数据而是区段结构体(保存区段信息的大小))
DWORD SectionSizeof = 0;
// 保存文件大小
DWORD FileSize = 0;
// 新内存空间
static char* newlpBase;
// 保存文件句柄
HANDLE FileHandle = nullptr;
// 新区段
PIMAGE_SECTION_HEADER NewpSection = { 0 };
// 保存原始OEP
DWORD OldOep = 0;
};
#endif
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.