-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.h
81 lines (70 loc) · 1.74 KB
/
version.h
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
/*
* =====================================================================================
*
* Filename: version.h
*
* Description:
*
* Version: 1.0
* Created: 03/21/2014 06:39:59 PM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Organization:
*
* =====================================================================================
*/
#ifndef VERSION_H
#define VERSION_H
#include <vector>
#include <elf.h>
#include <iostream>
#include <string.h>
#include "section.h"
#include "type.h"
class SCSection;
class SCSectionList;
class SCVersionDef
{
public:
friend class SCVersionList;
SCVersionDef() {}
void
init(int , SCSection *, SCSection *);
int
getNextOffset()
{ return this->ver_content->vd_next; }
UINT8 *
getName()
{ return this->ver_name; }
private:
Elf32_Verdef *ver_content;
Elf32_Verdaux *ver_aux;
UINT8 *ver_name;
};
class SCVersionList
{
public:
void
init(SCSectionList*);
/* FIXME How to release the space */
~SCVersionList()
{
vector<SCVersionDef*>::iterator it;
for (it = ver_list.begin(); it != ver_list.end(); ++it)
delete *it;
}
UINT8 *
getVersionName(UINT16 ver_number)
{
vector<SCVersionDef*>::iterator it;
for (it = ver_list.begin(); it != ver_list.end(); ++it) {
if ((*it)->ver_content->vd_ndx == ver_number)
return (*it)->getName();
}
}
private:
vector<SCVersionDef*> ver_list;
};
#endif