-
Notifications
You must be signed in to change notification settings - Fork 10
/
coffsymboltable.h
64 lines (46 loc) · 1.62 KB
/
coffsymboltable.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
#ifndef _COFFSymbolTable_H_
#define _COFFSymbolTable_H_
class COFFSymbolTable;
class COFFSymbol
{
PSTR m_pStringTable;
PIMAGE_SYMBOL m_pSymbolData;
DWORD m_index;
PSTR m_pszShortString;
char m_szTypeName[16];
void CleanUp( void ); // Called by destructor, COFFSymbolTable class
public:
COFFSymbol( PIMAGE_SYMBOL pSymbolData, PSTR pStringTable, DWORD index );
~COFFSymbol( );
DWORD GetIndex() { return m_index; }
PSTR GetName();
DWORD GetValue() { return m_pSymbolData ? m_pSymbolData->Value : 0; }
SHORT GetSectionNumber()
{ return m_pSymbolData ? m_pSymbolData->SectionNumber : 0; }
WORD GetType() { return m_pSymbolData ? m_pSymbolData->Type : 0; }
PSTR GetTypeName();
BYTE GetStorageClass()
{ return m_pSymbolData ? m_pSymbolData->StorageClass : 0; }
PSTR GetStorageClassName();
BOOL GetNumberOfAuxSymbols()
{ return m_pSymbolData ? m_pSymbolData->NumberOfAuxSymbols : 0; }
BOOL GetAuxSymbolAsString( PSTR pszBuffer, unsigned cbBuffer );
friend class COFFSymbolTable;
};
typedef COFFSymbol * PCOFFSymbol;
class COFFSymbolTable
{
private:
PIMAGE_SYMBOL m_pSymbolBase; // Array of IMAGE_SYMBOL's
unsigned m_cSymbols;
PSTR m_pStringTable;
public:
COFFSymbolTable( PVOID pSymbolBase, unsigned cSymbols );
~COFFSymbolTable( );
unsigned GetNumberOfSymbols( void ) { return m_cSymbols; }
PCOFFSymbol GetNextSymbol( PCOFFSymbol ); // 0 begins iteration
PCOFFSymbol GetNearestSymbolFromRVA( DWORD rva, BOOL fExact );
PCOFFSymbol GetSymbolFromIndex( DWORD index );
};
typedef COFFSymbolTable * PCOFFSymbolTable;
#endif