-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathModules.h
76 lines (64 loc) · 1.82 KB
/
Modules.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
// TTD module support
#pragma once
#include <DbgTtd.h>
// Module container with TTD lifetime info
struct Module
{
TTD::Replay::Position load; // Module load position
TTD::Replay::Position unload; // Module unload position
UINT64 start; // Start/base address
UINT64 end; // End address
LPCWCH path; // Full path (OS virtualized, no "SysWOW64" paths)
LPCWCH file; // Just file short name with extension
// Exported functions from this module
std::map<UINT64 /*address*/, std::string /*name*/> exports;
union
{
struct
{
UINT32 is32bit: 1; // Module is 32bit, else it's 64bit
UINT32 isTarget: 1; // Is the target module
UINT32 missingUnload: 1; // Missing a module unload event
UINT32 overlap: 1; // Overlaps one or more other modules (merges are not flagged)
UINT32 duplicate: 1; // Has a duplicate short file name
UINT32 shown: 1; // Already dumped in the overlap test code
};
UINT32 AsUint32;
} flags;
// Target module specific
LPCVOID image; // Internal memory buffer
UINT64 iatStart; // IAT start or 0 if none
UINT64 iatEnd; // IAT end
// -------------------------------------------------------
// Return a modules export name by address if it exists
BOOL FindExport(UINT64 address, __out LPCSTR *name)
{
auto it = exports.find(address);
if (it != exports.end())
{
*name = it->second.c_str();
return TRUE;
}
return FALSE;
}
void clear()
{
exports.clear();
if (image)
delete image;
image = NULL;
}
Module()
{
flags.AsUint32 = 0;
image = NULL;
iatStart = iatEnd = 0;
}
~Module()
{
path = file = NULL;
// Can't call, we want to keep internal data until explicitly not needed
//clear();
}
};
BOOL ProcessModule(__in TTD::Replay::Cursor *ICursorView, __inout Module &module);