forked from Vector35/binaryninja-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interaction.cpp
774 lines (633 loc) · 20.5 KB
/
interaction.cpp
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
#include <stdlib.h>
#include <string.h>
#include "binaryninjaapi.h"
using namespace std;
using namespace BinaryNinja;
FormInputField FormInputField::Label(const string& text)
{
FormInputField result;
result.type = LabelFormField;
result.prompt = text;
result.hasDefault = false;
return result;
}
FormInputField FormInputField::Separator()
{
FormInputField result;
result.type = SeparatorFormField;
result.hasDefault = false;
return result;
}
FormInputField FormInputField::TextLine(const string& prompt)
{
FormInputField result;
result.type = TextLineFormField;
result.prompt = prompt;
result.hasDefault = false;
return result;
}
FormInputField FormInputField::MultilineText(const string& prompt)
{
FormInputField result;
result.type = MultilineTextFormField;
result.prompt = prompt;
result.hasDefault = false;
return result;
}
FormInputField FormInputField::Integer(const string& prompt)
{
FormInputField result;
result.type = IntegerFormField;
result.prompt = prompt;
result.hasDefault = false;
return result;
}
FormInputField FormInputField::Address(const std::string& prompt, BinaryView* view, uint64_t currentAddress)
{
FormInputField result;
result.type = AddressFormField;
result.prompt = prompt;
result.view = view;
result.currentAddress = currentAddress;
result.hasDefault = false;
return result;
}
FormInputField FormInputField::Choice(const string& prompt, const vector<string>& choices)
{
FormInputField result;
result.type = ChoiceFormField;
result.prompt = prompt;
result.choices = choices;
result.hasDefault = false;
return result;
}
FormInputField FormInputField::OpenFileName(const string& prompt, const string& ext)
{
FormInputField result;
result.type = OpenFileNameFormField;
result.prompt = prompt;
result.ext = ext;
result.hasDefault = false;
return result;
}
FormInputField FormInputField::SaveFileName(const string& prompt, const string& ext, const string& defaultName)
{
FormInputField result;
result.type = SaveFileNameFormField;
result.prompt = prompt;
result.ext = ext;
result.defaultName = defaultName;
result.hasDefault = false;
return result;
}
FormInputField FormInputField::DirectoryName(const string& prompt, const string& defaultName)
{
FormInputField result;
result.type = DirectoryNameFormField;
result.prompt = prompt;
result.defaultName = defaultName;
result.hasDefault = false;
return result;
}
void InteractionHandler::ShowMarkdownReport(
Ref<BinaryView> view, const string& title, const string& contents, const string& plainText)
{
(void)contents;
if (plainText.size() != 0)
ShowPlainTextReport(view, title, plainText);
}
void InteractionHandler::ShowHTMLReport(
Ref<BinaryView> view, const string& title, const string&, const string& plainText)
{
if (plainText.size() != 0)
ShowPlainTextReport(view, title, plainText);
}
void InteractionHandler::ShowGraphReport(Ref<BinaryView>, const std::string&, Ref<FlowGraph>) {}
void InteractionHandler::ShowReportCollection(const string&, Ref<ReportCollection>) {}
bool InteractionHandler::GetIntegerInput(int64_t& result, const string& prompt, const string& title)
{
while (true)
{
string input;
if (!GetTextLineInput(input, prompt, title))
return false;
if (input.size() == 0)
return false;
errno = 0;
result = strtoll(input.c_str(), nullptr, 0);
if (errno != 0)
{
errno = 0;
result = strtoull(input.c_str(), nullptr, 0);
if (errno != 0)
continue;
}
return true;
}
}
bool InteractionHandler::GetAddressInput(
uint64_t& result, const string& prompt, const string& title, Ref<BinaryView>, uint64_t)
{
int64_t value;
if (!GetIntegerInput(value, prompt, title))
return false;
result = (uint64_t)value;
return true;
}
bool InteractionHandler::GetOpenFileNameInput(string& result, const string& prompt, const string&)
{
return GetTextLineInput(result, prompt, "Open File");
}
bool InteractionHandler::GetSaveFileNameInput(string& result, const string& prompt, const string&, const string&)
{
return GetTextLineInput(result, prompt, "Save File");
}
bool InteractionHandler::GetDirectoryNameInput(string& result, const string& prompt, const string&)
{
return GetTextLineInput(result, prompt, "Select Directory");
}
static void ShowPlainTextReportCallback(void* ctxt, BNBinaryView* view, const char* title, const char* contents)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
handler->ShowPlainTextReport(view ? new BinaryView(BNNewViewReference(view)) : nullptr, title, contents);
}
static void ShowMarkdownReportCallback(
void* ctxt, BNBinaryView* view, const char* title, const char* contents, const char* plaintext)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
handler->ShowMarkdownReport(view ? new BinaryView(BNNewViewReference(view)) : nullptr, title, contents, plaintext);
}
static void ShowHTMLReportCallback(
void* ctxt, BNBinaryView* view, const char* title, const char* contents, const char* plaintext)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
handler->ShowHTMLReport(view ? new BinaryView(BNNewViewReference(view)) : nullptr, title, contents, plaintext);
}
static void ShowGraphReportCallback(void* ctxt, BNBinaryView* view, const char* title, BNFlowGraph* graph)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
handler->ShowGraphReport(view ? new BinaryView(BNNewViewReference(view)) : nullptr, title,
new CoreFlowGraph(BNNewFlowGraphReference(graph)));
}
static void ShowReportCollectionCallback(void* ctxt, const char* title, BNReportCollection* reports)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
handler->ShowReportCollection(title, new ReportCollection(BNNewReportCollectionReference(reports)));
}
static bool GetTextLineInputCallback(void* ctxt, char** result, const char* prompt, const char* title)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
string value;
if (!handler->GetTextLineInput(value, prompt, title))
return false;
*result = BNAllocString(value.c_str());
return true;
}
static bool GetIntegerInputCallback(void* ctxt, int64_t* result, const char* prompt, const char* title)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
return handler->GetIntegerInput(*result, prompt, title);
}
static bool GetAddressInputCallback(
void* ctxt, uint64_t* result, const char* prompt, const char* title, BNBinaryView* view, uint64_t currentAddr)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
return handler->GetAddressInput(
*result, prompt, title, view ? new BinaryView(BNNewViewReference(view)) : nullptr, currentAddr);
}
static bool GetChoiceInputCallback(
void* ctxt, size_t* result, const char* prompt, const char* title, const char** choices, size_t count)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
vector<string> choiceStrs;
for (size_t i = 0; i < count; i++)
choiceStrs.push_back(choices[i]);
return handler->GetChoiceInput(*result, prompt, title, choiceStrs);
}
static bool GetOpenFileNameInputCallback(void* ctxt, char** result, const char* prompt, const char* ext)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
string value;
if (!handler->GetOpenFileNameInput(value, prompt, ext))
return false;
*result = BNAllocString(value.c_str());
return true;
}
static bool GetSaveFileNameInputCallback(
void* ctxt, char** result, const char* prompt, const char* ext, const char* defaultName)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
string value;
if (!handler->GetSaveFileNameInput(value, prompt, ext, defaultName))
return false;
*result = BNAllocString(value.c_str());
return true;
}
static bool GetDirectoryNameInputCallback(void* ctxt, char** result, const char* prompt, const char* defaultName)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
string value;
if (!handler->GetDirectoryNameInput(value, prompt, defaultName))
return false;
*result = BNAllocString(value.c_str());
return true;
}
static bool GetFormInputCallback(void* ctxt, BNFormInputField* fieldBuf, size_t count, const char* title)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
// Convert list of fields from core structure to API structure
vector<FormInputField> fields;
for (size_t i = 0; i < count; i++)
{
vector<string> choices;
switch (fieldBuf[i].type)
{
case SeparatorFormField:
fields.push_back(FormInputField::Separator());
break;
case TextLineFormField:
fields.push_back(FormInputField::TextLine(fieldBuf[i].prompt));
break;
case MultilineTextFormField:
fields.push_back(FormInputField::MultilineText(fieldBuf[i].prompt));
break;
case IntegerFormField:
fields.push_back(FormInputField::Integer(fieldBuf[i].prompt));
break;
case AddressFormField:
fields.push_back(FormInputField::Address(fieldBuf[i].prompt,
fieldBuf[i].view ? new BinaryView(BNNewViewReference(fieldBuf[i].view)) : nullptr,
fieldBuf[i].currentAddress));
break;
case ChoiceFormField:
for (size_t j = 0; j < fieldBuf[i].count; j++)
choices.push_back(fieldBuf[i].choices[j]);
fields.push_back(FormInputField::Choice(fieldBuf[i].prompt, choices));
break;
case OpenFileNameFormField:
fields.push_back(FormInputField::OpenFileName(fieldBuf[i].prompt, fieldBuf[i].ext));
break;
case SaveFileNameFormField:
fields.push_back(
FormInputField::SaveFileName(fieldBuf[i].prompt, fieldBuf[i].ext, fieldBuf[i].defaultName));
break;
case DirectoryNameFormField:
fields.push_back(FormInputField::DirectoryName(fieldBuf[i].prompt, fieldBuf[i].defaultName));
break;
default:
fields.push_back(FormInputField::Label(fieldBuf[i].prompt));
break;
}
fields.back().hasDefault = fieldBuf[i].hasDefault;
if (fieldBuf[i].hasDefault)
{
switch (fieldBuf[i].type)
{
case TextLineFormField:
case MultilineTextFormField:
case OpenFileNameFormField:
case SaveFileNameFormField:
case DirectoryNameFormField:
fields.back().stringDefault = fieldBuf[i].stringDefault;
break;
case IntegerFormField:
fields.back().intDefault = fieldBuf[i].intDefault;
break;
case AddressFormField:
fields.back().addressDefault = fieldBuf[i].addressDefault;
break;
case ChoiceFormField:
fields.back().indexDefault = fieldBuf[i].indexDefault;
break;
default:
break;
}
}
}
if (!handler->GetFormInput(fields, title))
return false;
// Place results into core structure
for (size_t i = 0; i < count; i++)
{
switch (fieldBuf[i].type)
{
case TextLineFormField:
case MultilineTextFormField:
case OpenFileNameFormField:
case SaveFileNameFormField:
case DirectoryNameFormField:
fieldBuf[i].stringResult = BNAllocString(fields[i].stringResult.c_str());
break;
case IntegerFormField:
fieldBuf[i].intResult = fields[i].intResult;
break;
case AddressFormField:
fieldBuf[i].addressResult = fields[i].addressResult;
break;
case ChoiceFormField:
fieldBuf[i].indexResult = fields[i].indexResult;
break;
default:
break;
}
}
return true;
}
static BNMessageBoxButtonResult ShowMessageBoxCallback(
void* ctxt, const char* title, const char* text, BNMessageBoxButtonSet buttons, BNMessageBoxIcon icon)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
return handler->ShowMessageBox(title, text, buttons, icon);
}
static bool OpenUrlCallback(void* ctxt, const char* url)
{
InteractionHandler* handler = (InteractionHandler*)ctxt;
return handler->OpenUrl(url);
}
void BinaryNinja::RegisterInteractionHandler(InteractionHandler* handler)
{
BNInteractionHandlerCallbacks cb;
cb.context = handler;
cb.showPlainTextReport = ShowPlainTextReportCallback;
cb.showMarkdownReport = ShowMarkdownReportCallback;
cb.showHTMLReport = ShowHTMLReportCallback;
cb.showGraphReport = ShowGraphReportCallback;
cb.showReportCollection = ShowReportCollectionCallback;
cb.getTextLineInput = GetTextLineInputCallback;
cb.getIntegerInput = GetIntegerInputCallback;
cb.getAddressInput = GetAddressInputCallback;
cb.getChoiceInput = GetChoiceInputCallback;
cb.getOpenFileNameInput = GetOpenFileNameInputCallback;
cb.getSaveFileNameInput = GetSaveFileNameInputCallback;
cb.getDirectoryNameInput = GetDirectoryNameInputCallback;
cb.getFormInput = GetFormInputCallback;
cb.showMessageBox = ShowMessageBoxCallback;
cb.openUrl = OpenUrlCallback;
BNRegisterInteractionHandler(&cb);
}
string BinaryNinja::MarkdownToHTML(const string& contents)
{
char* str = BNMarkdownToHTML(contents.c_str());
string result = str;
BNFreeString(str);
return result;
}
void BinaryNinja::ShowPlainTextReport(const string& title, const string& contents)
{
BNShowPlainTextReport(nullptr, title.c_str(), contents.c_str());
}
void BinaryNinja::ShowMarkdownReport(const string& title, const string& contents, const string& plainText)
{
BNShowMarkdownReport(nullptr, title.c_str(), contents.c_str(), plainText.c_str());
}
void BinaryNinja::ShowHTMLReport(const string& title, const string& contents, const string& plainText)
{
BNShowHTMLReport(nullptr, title.c_str(), contents.c_str(), plainText.c_str());
}
void BinaryNinja::ShowGraphReport(const string& title, FlowGraph* graph)
{
Ref<Function> func = graph->GetFunction();
if (func)
BNShowGraphReport(func->GetView()->GetObject(), title.c_str(), graph->GetObject());
else
BNShowGraphReport(nullptr, title.c_str(), graph->GetObject());
}
void BinaryNinja::ShowReportCollection(const string& title, ReportCollection* reports)
{
BNShowReportCollection(title.c_str(), reports->GetObject());
}
bool BinaryNinja::GetTextLineInput(string& result, const string& prompt, const string& title)
{
char* value = nullptr;
if (!BNGetTextLineInput(&value, prompt.c_str(), title.c_str()))
return false;
result = value;
BNFreeString(value);
return true;
}
bool BinaryNinja::GetIntegerInput(int64_t& result, const string& prompt, const string& title)
{
return BNGetIntegerInput(&result, prompt.c_str(), title.c_str());
}
bool BinaryNinja::GetAddressInput(uint64_t& result, const string& prompt, const string& title)
{
return BNGetAddressInput(&result, prompt.c_str(), title.c_str(), nullptr, 0);
}
bool BinaryNinja::GetChoiceInput(size_t& idx, const string& prompt, const string& title, const vector<string>& choices)
{
const char** choiceStrs = new const char*[choices.size()];
for (size_t i = 0; i < choices.size(); i++)
choiceStrs[i] = choices[i].c_str();
bool ok = BNGetChoiceInput(&idx, prompt.c_str(), title.c_str(), choiceStrs, choices.size());
delete[] choiceStrs;
return ok;
}
bool BinaryNinja::GetOpenFileNameInput(string& result, const string& prompt, const string& ext)
{
char* value = nullptr;
if (!BNGetOpenFileNameInput(&value, prompt.c_str(), ext.c_str()))
return false;
result = value;
BNFreeString(value);
return true;
}
bool BinaryNinja::GetSaveFileNameInput(
string& result, const string& prompt, const string& ext, const string& defaultName)
{
char* value = nullptr;
if (!BNGetSaveFileNameInput(&value, prompt.c_str(), ext.c_str(), defaultName.c_str()))
return false;
result = value;
BNFreeString(value);
return true;
}
bool BinaryNinja::GetDirectoryNameInput(string& result, const string& prompt, const string& defaultName)
{
char* value = nullptr;
if (!BNGetDirectoryNameInput(&value, prompt.c_str(), defaultName.c_str()))
return false;
result = value;
BNFreeString(value);
return true;
}
bool BinaryNinja::GetFormInput(vector<FormInputField>& fields, const string& title)
{
// Construct field list in core format
BNFormInputField* fieldBuf = new BNFormInputField[fields.size()];
for (size_t i = 0; i < fields.size(); i++)
{
fieldBuf[i].type = fields[i].type;
fieldBuf[i].prompt = fields[i].prompt.c_str();
switch (fields[i].type)
{
case AddressFormField:
fieldBuf[i].view = fields[i].view ? fields[i].view->GetObject() : nullptr;
fieldBuf[i].currentAddress = fields[i].currentAddress;
break;
case ChoiceFormField:
fieldBuf[i].choices = new const char*[fields[i].choices.size()];
fieldBuf[i].count = fields[i].choices.size();
for (size_t j = 0; j < fields[i].choices.size(); j++)
fieldBuf[i].choices[j] = fields[i].choices[j].c_str();
break;
case OpenFileNameFormField:
fieldBuf[i].ext = fields[i].ext.c_str();
break;
case SaveFileNameFormField:
fieldBuf[i].ext = fields[i].ext.c_str();
fieldBuf[i].defaultName = fields[i].defaultName.c_str();
break;
case DirectoryNameFormField:
fieldBuf[i].defaultName = fields[i].defaultName.c_str();
break;
default:
break;
}
fieldBuf[i].hasDefault = fields[i].hasDefault;
if (fields[i].hasDefault)
{
switch (fields[i].type)
{
case TextLineFormField:
case MultilineTextFormField:
case OpenFileNameFormField:
case SaveFileNameFormField:
case DirectoryNameFormField:
fieldBuf[i].stringDefault = fields[i].stringDefault.c_str();
break;
case IntegerFormField:
fieldBuf[i].intDefault = fields[i].intDefault;
break;
case AddressFormField:
fieldBuf[i].addressDefault = fields[i].addressDefault;
break;
case ChoiceFormField:
fieldBuf[i].indexDefault = fields[i].indexDefault;
break;
default:
break;
}
}
}
bool ok = BNGetFormInput(fieldBuf, fields.size(), title.c_str());
// Free any memory used by field descriptions
for (size_t i = 0; i < fields.size(); i++)
{
if (fields[i].type == ChoiceFormField)
delete[] fieldBuf[i].choices;
}
// If user cancelled, there are no results
if (!ok)
return false;
// Copy results to API structures
for (size_t i = 0; i < fields.size(); i++)
{
switch (fields[i].type)
{
case TextLineFormField:
case MultilineTextFormField:
case OpenFileNameFormField:
case SaveFileNameFormField:
case DirectoryNameFormField:
fields[i].stringResult = fieldBuf[i].stringResult;
break;
case IntegerFormField:
fields[i].intResult = fieldBuf[i].intResult;
break;
case AddressFormField:
fields[i].addressResult = fieldBuf[i].addressResult;
break;
case ChoiceFormField:
fields[i].indexResult = fieldBuf[i].indexResult;
break;
default:
break;
}
}
BNFreeFormInputResults(fieldBuf, fields.size());
return true;
}
BNMessageBoxButtonResult BinaryNinja::ShowMessageBox(
const string& title, const string& text, BNMessageBoxButtonSet buttons, BNMessageBoxIcon icon)
{
return BNShowMessageBox(title.c_str(), text.c_str(), buttons, icon);
}
bool BinaryNinja::OpenUrl(const std::string& url)
{
return BNOpenUrl(url.c_str());
}
ReportCollection::ReportCollection()
{
m_object = BNCreateReportCollection();
}
ReportCollection::ReportCollection(BNReportCollection* reports)
{
m_object = reports;
}
size_t ReportCollection::GetCount() const
{
return BNGetReportCollectionCount(m_object);
}
BNReportType ReportCollection::GetType(size_t i) const
{
return BNGetReportType(m_object, i);
}
Ref<BinaryView> ReportCollection::GetView(size_t i) const
{
BNBinaryView* view = BNGetReportView(m_object, i);
if (!view)
return nullptr;
return new BinaryView(view);
}
string ReportCollection::GetTitle(size_t i) const
{
char* str = BNGetReportTitle(m_object, i);
string result = str;
BNFreeString(str);
return result;
}
string ReportCollection::GetContents(size_t i) const
{
char* str = BNGetReportContents(m_object, i);
string result = str;
BNFreeString(str);
return result;
}
string ReportCollection::GetPlainText(size_t i) const
{
char* str = BNGetReportPlainText(m_object, i);
string result = str;
BNFreeString(str);
return result;
}
Ref<FlowGraph> ReportCollection::GetFlowGraph(size_t i) const
{
BNFlowGraph* graph = BNGetReportFlowGraph(m_object, i);
if (!graph)
return nullptr;
return new CoreFlowGraph(graph);
}
void ReportCollection::AddPlainTextReport(Ref<BinaryView> view, const string& title, const string& contents)
{
BNAddPlainTextReportToCollection(m_object, view ? view->GetObject() : nullptr, title.c_str(), contents.c_str());
}
void ReportCollection::AddMarkdownReport(
Ref<BinaryView> view, const string& title, const string& contents, const string& plainText)
{
BNAddMarkdownReportToCollection(
m_object, view ? view->GetObject() : nullptr, title.c_str(), contents.c_str(), plainText.c_str());
}
void ReportCollection::AddHTMLReport(
Ref<BinaryView> view, const string& title, const string& contents, const string& plainText)
{
BNAddHTMLReportToCollection(
m_object, view ? view->GetObject() : nullptr, title.c_str(), contents.c_str(), plainText.c_str());
}
void ReportCollection::AddGraphReport(Ref<BinaryView> view, const string& title, Ref<FlowGraph> graph)
{
BNAddGraphReportToCollection(m_object, view ? view->GetObject() : nullptr, title.c_str(), graph->GetObject());
}
void ReportCollection::UpdateFlowGraph(size_t i, Ref<FlowGraph> graph)
{
BNUpdateReportFlowGraph(m_object, i, graph->GetObject());
}