-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathC_App.hpp
More file actions
145 lines (107 loc) · 4.13 KB
/
Copy pathC_App.hpp
File metadata and controls
145 lines (107 loc) · 4.13 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
//////////////////////////////////////////////////////////////////////////////////
// [ APP_Class_Header ]
//////////////////////////////////////////////////////////////////////////////////
//
// eldar ver:0.3
//
// [::Last modi: 29.09.17 L.ey (µ~)::]
//
//
#ifndef _C_APP_H_
#define _C_APP_H_
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <fstream>
using namespace std;
#include <elf.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "C_GUI.hpp"
//////////////////////////////////////////////////////////////////////////////////
// CONSTANT
//////////////////////////////////////////////////////////////////////////////////
const int C_APP_ERROR = 0x00;
const int C_APP_READY = 0x01;
const int32_t magic = 0x464C457F;
/* Note segment for SystemTap probes. */
#define NT_STAPSDT 3
#define ALIGN_UP(addr, align)(((addr) + (align) - 1) & (~((align) - 1)))
//////////////////////////////////////////////////////////////////////////////////
// CLASS
//////////////////////////////////////////////////////////////////////////////////
class C_App : public C_GUI {
public:
C_App();
virtual ~C_App(){};
protected:
//////////////////////////////////
//Signal handlers:
void on_button_open();
void on_button_save();
void on_tv_elf_changed();
void on_tv_pro_changed();
void on_tv_sec_changed();
//////////////////////////////////
int save_file(fstream* const pFStream);
//////////////////////////////////
int open_file();
int hFile = {-1};
char* pFile = {nullptr};
uint64_t cFile = {0};
bool bFile = {false};
string sFile;
struct stat st;
//////////////////////////////////
// 64Bit
Elf64_Ehdr* pElf64 = {nullptr};
Elf64_Phdr* pPHead64 = {nullptr};
Elf64_Shdr* pSHead64 = {nullptr};
Elf64_Shdr* pSHStr64 = {nullptr};
int read64bit();
int show_ELF64_Head();
int show_ELF64_PHead();
int show_ELF64_SHead();
int show_Section64();
int show_Relocation64( const Elf64_Shdr* const pSHead);
int show_Dynamic64( const Elf64_Shdr* const pSHead);
int show_SymTab64( const Elf64_Shdr* const pSHead);
int show_Note64( const Elf64_Shdr* const pSHead);
int show_String64( const Elf64_Shdr* const pSHead);
int show_GNU_Verdef64( const Elf64_Shdr* const pSHead);
int show_GNU_Verneed64( const Elf64_Shdr* const pSHead);
int show_GNU_Versym64( const Elf64_Shdr* const pSHead);
uint32_t cDynSum64 = {0};
vector<string> vGNUSymbol64;
bool bShnum64 = {false}; // true if pElf64->e_shnum == SHN_UNDEF
//////////////////////////////
//32Bit
Elf32_Ehdr* pElf32 = {nullptr};
Elf32_Phdr* pPHead32 = {nullptr};
Elf32_Shdr* pSHead32 = {nullptr};
Elf32_Shdr* pSHStr32 = {nullptr};
int read32bit();
int show_ELF32_Head();
int show_ELF32_PHead();
int show_ELF32_SHead();
int show_Section32();
int show_Relocation32( const Elf32_Shdr* const pSHead);
int show_Dynamic32( const Elf32_Shdr* const pSHead);
int show_SymTab32( const Elf32_Shdr* const pSHead);
int show_Note32( const Elf32_Shdr* const pSHead);
int show_String32( const Elf32_Shdr* const pSHead);
int show_GNU_Verdef32( const Elf32_Shdr* const pSHead);
int show_GNU_Verneed32( const Elf32_Shdr* const pSHead);
int show_GNU_Versym32( const Elf32_Shdr* const pSHead);
uint32_t cDynSum32 = {0};
vector<string> vGNUSymbol32;
bool bShnum32 = {false}; // true if pElf32->e_shnum == SHN_UNDEF
/////////////////////////////////
int show_hex(Gtk::TextView* const pTV, uint64_t Offset, uint64_t Size);
};
#endif // _C_APP_H_