-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathCDisasmData.cpp
181 lines (146 loc) · 4.39 KB
/
CDisasmData.cpp
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/*
8888888b. 888 888 d8b
888 Y88b 888 888 Y8P
888 888 888 888
888 d88P 888d888 .d88b. Y88b d88P 888 .d88b. 888 888 888
8888888P" 888P" d88""88b Y88b d88P 888 d8P Y8b 888 888 888
888 888 888 888 Y88o88P 888 88888888 888 888 888
888 888 Y88..88P Y888P 888 Y8b. Y88b 888 d88P
888 888 "Y88P" Y8P 888 "Y8888 "Y8888888P"
PE Editor & Dissasembler & File Identifier
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Written by Shany Golan.
In januar, 2003.
I have investigated P.E. file format as thoroughly as possible,
But I cannot claim that I am an expert yet, so some of its information
May give you wrong results.
Language used: Visual C++ 6.0
Date of creation: July 06, 2002
Date of first release: unknown ??, 2003
You can contact me: e-mail address: [email protected]
Copyright (C) 2011. By Shany Golan.
Permission is granted to make and distribute verbatim copies of this
Program provided the copyright notice and this permission notice are
Preserved on all copies.
File: CDisasmData.cpp (main)
This program was written by Shany Golan, Student at :
Ruppin, department of computer science and engineering University.
*/
//////////////////////////////////////////////////////////////////////////
// INCLUDES //
//////////////////////////////////////////////////////////////////////////
#include "CDisasmData.h"
#include "functions.h"
//////////////////////////////////////////////////////////////////////////
// FUNCTIONS //
//////////////////////////////////////////////////////////////////////////
// Default constructor
CDisasmData::CDisasmData()
{
m_pcAddress=NULL;
m_pcCode=NULL;
m_pcMnemonic=NULL;
m_pcComments=NULL;
m_pcReference=NULL;
m_InstructionSize=0;
m_PrefixSize=0;
}
//Copy Constructor
CDisasmData::CDisasmData(const CDisasmData &obj)
{
this->m_pcAddress=_strdup(obj.m_pcAddress);
this->m_pcCode=_strdup(obj.m_pcCode);
this->m_pcMnemonic=_strdup(obj.m_pcMnemonic);
this->m_pcComments=_strdup(obj.m_pcComments);
this->m_pcReference=_strdup(obj.m_pcReference);
this->m_InstructionSize=obj.m_InstructionSize;
this->m_PrefixSize = obj.m_PrefixSize;
}
// Advanced constructor
CDisasmData::CDisasmData(char* pcAddress, char* pcCode, char* pcMnemonic, char* pcComments, DWORD dwSize,DWORD dwPrefSize,char* pcRef)
{
m_pcAddress = _strdup(pcAddress);
m_pcCode = _strdup(pcCode);
m_pcMnemonic = _strdup(pcMnemonic);
m_pcComments = _strdup(pcComments);
m_pcReference = _strdup(pcRef);
m_InstructionSize = dwSize;
m_PrefixSize = dwPrefSize;
}
// Destructor
CDisasmData::~CDisasmData()
{
if(m_pcAddress!=NULL) delete[] m_pcAddress;
if(m_pcCode!=NULL) delete[] m_pcCode;
if(m_pcMnemonic!=NULL) delete[] m_pcMnemonic;
if(m_pcComments!=NULL) delete[] m_pcComments;
if(m_pcReference!=NULL) delete[] m_pcReference;
}
// Set the address of the disassembled line
void CDisasmData::SetAddress(char* pcAddress)
{
if(m_pcAddress!=NULL)
delete m_pcAddress;
m_pcAddress = _strdup(pcAddress);
}
void CDisasmData::SetCode(char* pcCode)
{
if(m_pcCode!=NULL)
delete m_pcCode;
m_pcCode =_strdup(pcCode);
}
void CDisasmData::SetComments(char* pcComment)
{
if(m_pcComments!=NULL)
delete m_pcComments;
m_pcComments = _strdup(pcComment);
}
void CDisasmData::SetMnemonic(char* pcMnemonic)
{
if(m_pcMnemonic!=NULL)
delete m_pcMnemonic;
m_pcMnemonic = _strdup(pcMnemonic);
}
void CDisasmData::SetReference(char* pcRef)
{
if(m_pcReference!=NULL)
delete m_pcReference;
m_pcReference = _strdup(pcRef);
}
void CDisasmData::SetSize(DWORD dwSize)
{
m_InstructionSize = dwSize;
}
void CDisasmData::SetPrefixSize(DWORD dwPrefSize)
{
m_PrefixSize = dwPrefSize;
}
// Get the address of the disassembled line
char* CDisasmData::GetAddress()
{
return m_pcAddress;
}
char* CDisasmData::GetCode()
{
return m_pcCode;
}
char* CDisasmData::GetComments()
{
return m_pcComments;
}
char* CDisasmData::GetMnemonic()
{
return m_pcMnemonic;
}
DWORD CDisasmData::GetSize()
{
return m_InstructionSize;
}
DWORD CDisasmData::GetPrefixSize()
{
return m_PrefixSize;
}
char* CDisasmData::GetReference()
{
return m_pcReference;
}