Skip to content

Commit 814db3b

Browse files
committed
Updated the memory module (still not finished)
- Removed unused wrap macros
1 parent 99aba70 commit 814db3b

File tree

8 files changed

+446
-847
lines changed

8 files changed

+446
-847
lines changed

src/core/modules/memory/memory_scanner.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ CBinaryFile::CBinaryFile(unsigned long ulAddr, unsigned long ulSize)
5252
m_ulSize = ulSize;
5353
}
5454

55-
CPointer* CBinaryFile::find_signature(object oSignature)
55+
CPointer* CBinaryFile::FindSignature(object oSignature)
5656
{
5757
// This is required because there's no straight way to get a string from a python
5858
// object from boost (without using the stl).
@@ -101,7 +101,7 @@ CPointer* CBinaryFile::find_signature(object oSignature)
101101
return new CPointer();
102102
}
103103

104-
CPointer* CBinaryFile::find_symbol(char* szSymbol)
104+
CPointer* CBinaryFile::FindSymbol(char* szSymbol)
105105
{
106106
#ifdef _WIN32
107107
return new CPointer((unsigned long) GetProcAddress((HMODULE) m_ulAddr, szSymbol));
@@ -207,24 +207,24 @@ CPointer* CBinaryFile::find_symbol(char* szSymbol)
207207
return new CPointer((unsigned long) sym_addr);
208208

209209
#else
210-
#error "BinaryFile::find_symbol() is not implemented on this OS"
210+
#error "BinaryFile::FindSymbol() is not implemented on this OS"
211211
#endif
212212
}
213213

214-
CPointer* CBinaryFile::find_pointer(object oIdentifier, int iOffset)
214+
CPointer* CBinaryFile::FindPointer(object oIdentifier, int iOffset)
215215
{
216-
CPointer* ptr = find_address(oIdentifier);
217-
return ptr->is_valid() ? ptr->get_ptr(iOffset) : ptr;
216+
CPointer* ptr = FindAddress(oIdentifier);
217+
return ptr->IsValid() ? ptr->GetPtr(iOffset) : ptr;
218218
}
219219

220-
CPointer* CBinaryFile::find_address(object oIdentifier)
220+
CPointer* CBinaryFile::FindAddress(object oIdentifier)
221221
{
222222
#ifdef _WIN32
223223
if(CheckClassname(oIdentifier, "bytes"))
224-
return find_signature(oIdentifier);
224+
return FindSignature(oIdentifier);
225225
#endif
226226

227-
return find_symbol(extract<char*>(oIdentifier));
227+
return FindSymbol(extract<char*>(oIdentifier));
228228
}
229229

230230
//-----------------------------------------------------------------------------
@@ -241,7 +241,7 @@ bool str_ends_with(const char *szString, const char *szSuffix)
241241
return strncmp(szString + stringlen - suffixlen, szSuffix, suffixlen) == 0;
242242
}
243243

244-
CBinaryFile* CBinaryManager::find_binary(char* szPath, bool bSrvCheck /* = true */)
244+
CBinaryFile* CBinaryManager::FindBinary(char* szPath, bool bSrvCheck /* = true */)
245245
{
246246
std::string szBinaryPath = szPath;
247247
#ifdef __linux__
@@ -266,7 +266,7 @@ CBinaryFile* CBinaryManager::find_binary(char* szPath, bool bSrvCheck /* = true
266266
for (std::list<CBinaryFile *>::iterator iter=m_Binaries.begin(); iter != m_Binaries.end(); iter++)
267267
{
268268
CBinaryFile* binary = *iter;
269-
if (binary->get_address() == ulAddr)
269+
if (binary->m_ulAddr == ulAddr)
270270
{
271271
// We don't need to open it several times
272272
dlFreeLibrary((DLLib *) ulAddr);
@@ -292,7 +292,7 @@ CBinaryFile* CBinaryManager::find_binary(char* szPath, bool bSrvCheck /* = true
292292
ulSize = buf.st_size;
293293

294294
#else
295-
#error "BinaryManager::find_binary() is not implemented on this OS"
295+
#error "BinaryManager::FindBinary() is not implemented on this OS"
296296
#endif
297297

298298
// Create a new Binary object and add it to the list
@@ -304,7 +304,7 @@ CBinaryFile* CBinaryManager::find_binary(char* szPath, bool bSrvCheck /* = true
304304
//-----------------------------------------------------------------------------
305305
// Functions
306306
//-----------------------------------------------------------------------------
307-
CBinaryFile* find_binary(char* szPath, bool bSrvCheck /* = true */)
307+
CBinaryFile* FindBinary(char* szPath, bool bSrvCheck /* = true */)
308308
{
309-
return s_pBinaryManager->find_binary(szPath, bSrvCheck);
309+
return s_pBinaryManager->FindBinary(szPath, bSrvCheck);
310310
}

src/core/modules/memory/memory_scanner.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,12 @@ class CBinaryFile
4646
public:
4747
CBinaryFile(unsigned long ulAddr, unsigned long ulSize);
4848

49-
CPointer* find_signature(object oSignature);
50-
CPointer* find_symbol(char* szSymbol);
51-
CPointer* find_pointer(object oIdentifier, int iOffset);
52-
CPointer* find_address(object oIdentifier);
49+
CPointer* FindSignature(object oSignature);
50+
CPointer* FindSymbol(char* szSymbol);
51+
CPointer* FindPointer(object oIdentifier, int iOffset);
52+
CPointer* FindAddress(object oIdentifier);
5353

54-
unsigned long get_address() { return m_ulAddr; }
55-
unsigned long get_size() { return m_ulSize; }
56-
57-
private:
54+
public:
5855
unsigned long m_ulAddr;
5956
unsigned long m_ulSize;
6057
std::list<Signature_t> m_Signatures;
@@ -64,14 +61,14 @@ class CBinaryFile
6461
class CBinaryManager
6562
{
6663
public:
67-
CBinaryFile* find_binary(char* szPath, bool bSrvCheck = true);
64+
CBinaryFile* FindBinary(char* szPath, bool bSrvCheck = true);
6865

6966
private:
7067
std::list<CBinaryFile*> m_Binaries;
7168
};
7269

7370
static CBinaryManager* s_pBinaryManager = new CBinaryManager();
7471

75-
CBinaryFile* find_binary(char* szPath, bool bSrvCheck = true);
72+
CBinaryFile* FindBinary(char* szPath, bool bSrvCheck = true);
7673

7774
#endif // _MEMORY_SCANNER_H

0 commit comments

Comments
 (0)