-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathfOutputCurrentJITDebuggerSettings.py
84 lines (82 loc) · 3.11 KB
/
fOutputCurrentJITDebuggerSettings.py
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
import mRegistry, mWindowsAPI;
from mNotProvided import fbIsProvided;
from foConsoleLoader import foConsoleLoader;
from fsCreateBugIdCommandLine import fsCreateBugIdCommandLine;
from mColorsAndChars import *;
import mJITDebuggerRegistry;
oConsole = foConsoleLoader();
def fOutputCurrentJITDebuggerSettings():
sOSISA = mWindowsAPI.oSystemInfo.sOSISA;
dsCommandLineKeyPath_by_sTargetBinaryISA = mJITDebuggerRegistry.ddsCommandLineKeyPath_by_sTargetBinaryISA_by_sOSISA[sOSISA];
oConsole.fLock();
try:
oConsole.fOutput(
"┌───[ ",
COLOR_INFO, "Current JIT Debugger", "s" if len(dsCommandLineKeyPath_by_sTargetBinaryISA) > 1 else "",
COLOR_NORMAL, " ]",
sPadding = "─"
);
dsCommandLineKeyPath_by_sTargetBinaryISA = mJITDebuggerRegistry.ddsCommandLineKeyPath_by_sTargetBinaryISA_by_sOSISA[sOSISA];
for (sTargetBinaryISA, sCommandLineKeyPath) in dsCommandLineKeyPath_by_sTargetBinaryISA.items():
# Get the current JIT debugger command line for the target binary ISA if one is installed.
oRegistryHiveKey = mRegistry.cRegistryHiveKey(
sHiveName = mJITDebuggerRegistry.sCommandLineHiveName,
sKeyPath = sCommandLineKeyPath,
);
o0RegistryValue = oRegistryHiveKey.fo0GetValueForName(sValueName = "Debugger");
if o0RegistryValue is None:
oConsole.fOutput(
"│ ",
COLOR_WARNING, CHAR_WARNING,
COLOR_NORMAL, " ",
COLOR_INFO, sTargetBinaryISA,
COLOR_NORMAL, " JIT debugger: ",
COLOR_INFO, "None",
COLOR_NORMAL, ".",
);
elif o0RegistryValue.sTypeName != "REG_SZ":
oConsole.fOutput(
"│ ",
COLOR_ERROR, CHAR_ERROR,
COLOR_NORMAL, " ",
COLOR_INFO, sTargetBinaryISA,
COLOR_NORMAL, " JIT debugger: ",
COLOR_INFO, "Unknown",
COLOR_NORMAL, " (registry value not a string).",
);
else:
sCurrentJITDebuggerCommandLine = o0RegistryValue.xValue;
sBugIdJITDebuggerCommandLineStartsWith = fsCreateBugIdCommandLine();
if sCurrentJITDebuggerCommandLine.startswith(sBugIdJITDebuggerCommandLineStartsWith):
oConsole.fOutput(
"│ ",
COLOR_OK, CHAR_OK,
COLOR_NORMAL, " ",
COLOR_INFO, sTargetBinaryISA,
COLOR_NORMAL, " JIT debugger: ",
COLOR_INFO, "BugId",
COLOR_NORMAL, ".",
);
sArguments = sCurrentJITDebuggerCommandLine[len(sBugIdJITDebuggerCommandLineStartsWith) + 1:];
oConsole.fOutput(
"│ Arguments: ",
COLOR_INFO, sArguments,
);
else:
oConsole.fOutput(
"│ ",
COLOR_INFO, CHAR_INFO,
COLOR_NORMAL, " ",
COLOR_INFO, sTargetBinaryISA,
COLOR_NORMAL, " JIT debugger: ",
COLOR_INFO, "Other",
COLOR_NORMAL, ".",
);
oConsole.fOutput(
"│ Command line: ",
COLOR_INFO, sCurrentJITDebuggerCommandLine,
);
oConsole.fOutput("└", sPadding = "─");
finally:
oConsole.fUnlock();