-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathInteractionHandlerRegistration.cs
More file actions
146 lines (141 loc) · 6.54 KB
/
Copy pathInteractionHandlerRegistration.cs
File metadata and controls
146 lines (141 loc) · 6.54 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
using System;
using System.Runtime.InteropServices;
namespace BinaryNinja
{
public abstract partial class InteractionHandler
{
private NativeDelegates.BNInteractionReport? plainReportCallback;
private NativeDelegates.BNInteractionRichReport? markdownReportCallback;
private NativeDelegates.BNInteractionRichReport? htmlReportCallback;
private NativeDelegates.BNInteractionGraphReport? graphReportCallback;
private NativeDelegates.BNInteractionReportCollection?
reportCollectionCallback;
private NativeDelegates.BNInteractionStringInput? textInputCallback;
private NativeDelegates.BNInteractionIntegerInput? integerInputCallback;
private NativeDelegates.BNInteractionAddressInput? addressInputCallback;
private NativeDelegates.BNInteractionChoiceInput? choiceInputCallback;
private NativeDelegates.BNInteractionChoiceInput? largeChoiceInputCallback;
private NativeDelegates.BNInteractionStringInput? openFileInputCallback;
private NativeDelegates.BNInteractionSaveFileInput? saveFileInputCallback;
private NativeDelegates.BNInteractionStringInput? directoryInputCallback;
private NativeDelegates.BNInteractionCheckboxInput? checkboxInputCallback;
private NativeDelegates.BNInteractionFormInput? formInputCallback;
private NativeDelegates.BNInteractionMessageBox? messageBoxCallback;
private NativeDelegates.BNInteractionOpenUrl? openUrlCallback;
private NativeDelegates.BNInteractionProgressDialog? progressDialogCallback;
private void InitializeCallbacks()
{
this.plainReportCallback = new NativeDelegates.BNInteractionReport(
this.InvokeShowPlainTextReport
);
this.markdownReportCallback =
new NativeDelegates.BNInteractionRichReport(
this.InvokeShowMarkdownReport
);
this.htmlReportCallback =
new NativeDelegates.BNInteractionRichReport(
this.InvokeShowHtmlReport
);
this.graphReportCallback =
new NativeDelegates.BNInteractionGraphReport(
this.InvokeShowGraphReport
);
this.reportCollectionCallback =
new NativeDelegates.BNInteractionReportCollection(
this.InvokeShowReportCollection
);
this.textInputCallback =
new NativeDelegates.BNInteractionStringInput(
this.InvokeGetTextLineInput
);
this.integerInputCallback =
new NativeDelegates.BNInteractionIntegerInput(
this.InvokeGetIntegerInput
);
this.addressInputCallback =
new NativeDelegates.BNInteractionAddressInput(
this.InvokeGetAddressInput
);
this.choiceInputCallback =
new NativeDelegates.BNInteractionChoiceInput(
this.InvokeGetChoiceInput
);
this.largeChoiceInputCallback =
new NativeDelegates.BNInteractionChoiceInput(
this.InvokeGetLargeChoiceInput
);
this.openFileInputCallback =
new NativeDelegates.BNInteractionStringInput(
this.InvokeGetOpenFileNameInput
);
this.saveFileInputCallback =
new NativeDelegates.BNInteractionSaveFileInput(
this.InvokeGetSaveFileNameInput
);
this.directoryInputCallback =
new NativeDelegates.BNInteractionStringInput(
this.InvokeGetDirectoryNameInput
);
this.checkboxInputCallback =
new NativeDelegates.BNInteractionCheckboxInput(
this.InvokeGetCheckboxInput
);
this.formInputCallback = new NativeDelegates.BNInteractionFormInput(
this.InvokeGetFormInput
);
this.messageBoxCallback =
new NativeDelegates.BNInteractionMessageBox(
this.InvokeShowMessageBox
);
this.openUrlCallback = new NativeDelegates.BNInteractionOpenUrl(
this.InvokeOpenUrl
);
this.progressDialogCallback =
new NativeDelegates.BNInteractionProgressDialog(
this.InvokeRunProgressDialog
);
}
private BNInteractionHandlerCallbacks CreateCallbacks()
{
BNInteractionHandlerCallbacks callbacks =
new BNInteractionHandlerCallbacks();
callbacks.context = IntPtr.Zero;
callbacks.showPlainTextReport = Pointer(this.plainReportCallback!);
callbacks.showMarkdownReport = Pointer(this.markdownReportCallback!);
callbacks.showHTMLReport = Pointer(this.htmlReportCallback!);
callbacks.showGraphReport = Pointer(this.graphReportCallback!);
callbacks.showReportCollection = Pointer(
this.reportCollectionCallback!
);
callbacks.getTextLineInput = Pointer(this.textInputCallback!);
callbacks.getIntegerInput = Pointer(this.integerInputCallback!);
callbacks.getAddressInput = Pointer(this.addressInputCallback!);
callbacks.getChoiceInput = Pointer(this.choiceInputCallback!);
callbacks.getLargeChoiceInput = Pointer(
this.largeChoiceInputCallback!
);
callbacks.getOpenFileNameInput = Pointer(
this.openFileInputCallback!
);
callbacks.getSaveFileNameInput = Pointer(
this.saveFileInputCallback!
);
callbacks.getDirectoryNameInput = Pointer(
this.directoryInputCallback!
);
callbacks.getCheckboxInput = Pointer(this.checkboxInputCallback!);
callbacks.getFormInput = Pointer(this.formInputCallback!);
callbacks.showMessageBox = Pointer(this.messageBoxCallback!);
callbacks.openUrl = Pointer(this.openUrlCallback!);
callbacks.runProgressDialog = Pointer(
this.progressDialogCallback!
);
return callbacks;
}
private static IntPtr Pointer<TDelegate>(TDelegate callback)
where TDelegate : Delegate
{
return Marshal.GetFunctionPointerForDelegate<TDelegate>(callback);
}
}
}