Repository navigation
Expand file tree
/
Copy pathidascript.idc
More file actions
73 lines (60 loc) · 1.56 KB
/
Copy pathidascript.idc
File metadata and controls
73 lines (60 loc) · 1.56 KB
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
/*
IDC utility functions.
(c) Hex-Rays
*/
#include <idc.idc>
#define Print(x) LogWrite(sprintf x)
//--------------------------------------------------------------------------
extern g_idcutil_oldopt;
//--------------------------------------------------------------------------
extern g_idcutil_logfile;
static LogInit()
{
g_idcutil_logfile = fopen("idaout.txt", "w");
if (g_idcutil_logfile == 0)
return 0;
return 1;
}
//--------------------------------------------------------------------------
static LogWrite(str)
{
if (g_idcutil_logfile != 0)
return fprintf(g_idcutil_logfile, "%s", str);
return -1;
}
//--------------------------------------------------------------------------
static QuitMsg(code, s)
{
LogWrite(s);
Quit(code);
}
//--------------------------------------------------------------------------
static LogTerm()
{
if (g_idcutil_logfile == 0)
return;
fclose(g_idcutil_logfile);
g_idcutil_logfile = 0;
}
//--------------------------------------------------------------------------
static InitUtils()
{
// We mark as snapshot so that we can load the debuggers
SetCharPrm(INF_LFLAGS, GetCharPrm(INF_LFLAGS) | LFLG_SNAPSHOT);
// Disable all debugger output
g_idcutil_oldopt = SetDebuggerOptions(0);
return LogInit();
}
//--------------------------------------------------------------------------
static Quit(code)
{
TermUtils();
Exit(code);
}
//--------------------------------------------------------------------------
static TermUtils()
{
// Restore debugger options
SetDebuggerOptions(g_idcutil_oldopt);
LogTerm();
}