forked from Vector35/binaryninja-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
binaryninjacore.h
6156 lines (5503 loc) · 301 KB
/
binaryninjacore.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
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
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2015-2022 Vector 35 Inc
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
#ifndef __BINARYNINJACORE_H__
#define __BINARYNINJACORE_H__
#ifdef __cplusplus
#include <cstdint>
#include <cstddef>
#include <cstdlib>
#else
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#endif
// Current ABI version for linking to the core. This is incremented any time
// there are changes to the API that affect linking, including new functions,
// new types, or modifications to existing functions or types.
#define BN_CURRENT_CORE_ABI_VERSION 20
// Minimum ABI version that is supported for loading of plugins. Plugins that
// are linked to an ABI version less than this will not be able to load and
// will require rebuilding. The minimum version is increased when there are
// incompatible changes that break binary compatibility, such as changes to
// existing types or functions.
#define BN_MINIMUM_CORE_ABI_VERSION 20
#ifdef __GNUC__
#ifdef BINARYNINJACORE_LIBRARY
#define BINARYNINJACOREAPI __attribute__((visibility("default")))
#else
#define BINARYNINJACOREAPI
#endif
#define BINARYNINJAPLUGIN __attribute__((visibility("default")))
#else
#ifdef _MSC_VER
#ifndef DEMO_VERSION
#ifdef BINARYNINJACORE_LIBRARY
#define BINARYNINJACOREAPI __declspec(dllexport)
#else
#define BINARYNINJACOREAPI
#endif
#define BINARYNINJAPLUGIN __declspec(dllexport)
#else
#define BINARYNINJACOREAPI
#define BINARYNINJAPLUGIN
#endif
#else
#define BINARYNINJACOREAPI
#endif
#endif
#ifdef WIN32
#define PATH_SEP "\\"
#else
#define PATH_SEP "/"
#endif
#define BN_MAX_INSTRUCTION_LENGTH 256
#define BN_DEFAULT_INSTRUCTION_LENGTH 16
#define BN_DEFAULT_OPCODE_DISPLAY 8
#define BN_MAX_INSTRUCTION_BRANCHES 3
#define BN_MAX_STORED_DATA_LENGTH 0x3fffffff
#define BN_NULL_ID -1
#define LLIL_TEMP(n) (0x80000000 | (uint32_t)(n))
#define LLIL_REG_IS_TEMP(n) (((n)&0x80000000) != 0)
#define LLIL_GET_TEMP_REG_INDEX(n) ((n)&0x7fffffff)
#define BN_INVALID_REGISTER 0xffffffff
#define BN_AUTOCOERCE_EXTERN_PTR 0xfffffffd
#define BN_NOCOERCE_EXTERN_PTR 0xfffffffe
#define BN_INVALID_OPERAND 0xffffffff
#define BN_INVALID_EXPR ((size_t)-1)
#define BN_MAX_STRING_LENGTH 128
#define LLVM_SVCS_CB_NOTE 0
#define LLVM_SVCS_CB_WARNING 1
#define LLVM_SVCS_CB_ERROR 2
#define LLVM_SVCS_DIALECT_UNSPEC 0
#define LLVM_SVCS_DIALECT_ATT 1
#define LLVM_SVCS_DIALECT_INTEL 2
#define LLVM_SVCS_CM_DEFAULT 0
#define LLVM_SVCS_CM_SMALL 1
#define LLVM_SVCS_CM_KERNEL 2
#define LLVM_SVCS_CM_MEDIUM 3
#define LLVM_SVCS_CM_LARGE 4
#define LLVM_SVCS_RM_STATIC 0
#define LLVM_SVCS_RM_PIC 1
#define LLVM_SVCS_RM_DYNAMIC_NO_PIC 2
#define BN_MAX_VARIABLE_OFFSET 0x7fffffffffLL
#define BN_MAX_VARIABLE_INDEX 0xfffff
#define BN_FULL_CONFIDENCE 255
#define BN_MINIMUM_CONFIDENCE 1
#define BN_DEFAULT_CONFIDENCE 96
#define BN_HEURISTIC_CONFIDENCE 192
#define BN_DEBUGINFO_CONFIDENCE 200
#define DEFAULT_INTERNAL_NAMESPACE "BNINTERNALNAMESPACE"
#define DEFAULT_EXTERNAL_NAMESPACE "BNEXTERNALNAMESPACE"
// The BN_DECLARE_CORE_ABI_VERSION must be included in native plugin modules. If
// the ABI version is not declared, the core will not load the plugin.
#ifdef DEMO_VERSION
#define BN_DECLARE_CORE_ABI_VERSION
#else
#define BN_DECLARE_CORE_ABI_VERSION \
extern "C" \
{ \
BINARYNINJAPLUGIN uint32_t CorePluginABIVersion() { return BN_CURRENT_CORE_ABI_VERSION; } \
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
enum BNPluginLoadOrder
{
EarlyPluginLoadOrder,
NormalPluginLoadOrder,
LatePluginLoadOrder
};
enum PluginLoadStatus
{
NotAttemptedStatus,
LoadSucceededStatus,
LoadFailedStatus
};
typedef bool (*BNCorePluginInitFunction)(void);
typedef void (*BNCorePluginDependencyFunction)(void);
typedef uint32_t (*BNCorePluginABIVersionFunction)(void);
struct BNDataBuffer;
struct BNBinaryView;
struct BNBinaryViewType;
struct BNBinaryReader;
struct BNBinaryWriter;
struct BNKeyValueStore;
struct BNSnapshot;
struct BNDatabase;
struct BNFileMetadata;
struct BNTransform;
struct BNArchitecture;
struct BNFunction;
struct BNBasicBlock;
struct BNDownloadProvider;
struct BNDownloadInstance;
struct BNWebsocketProvider;
struct BNWebsocketClient;
struct BNTypeParser;
struct BNTypePrinter;
struct BNFlowGraph;
struct BNFlowGraphNode;
struct BNFlowGraphLayoutRequest;
struct BNSymbol;
struct BNTemporaryFile;
struct BNLowLevelILFunction;
struct BNMediumLevelILFunction;
struct BNHighLevelILFunction;
struct BNLanguageRepresentationFunction;
struct BNType;
struct BNTypeBuilder;
struct BNTypeLibrary;
struct BNTypeLibraryMapping;
struct BNStructure;
struct BNStructureBuilder;
struct BNTagType;
struct BNTag;
struct BNTagReference;
struct BNUser;
struct BNNamedTypeReference;
struct BNNamedTypeReferenceBuilder;
struct BNEnumeration;
struct BNEnumerationBuilder;
struct BNCallingConvention;
struct BNPlatform;
struct BNActivity;
struct BNAnalysisContext;
struct BNWorkflow;
struct BNAnalysisCompletionEvent;
struct BNDisassemblySettings;
struct BNSaveSettings;
struct BNScriptingProvider;
struct BNScriptingInstance;
struct BNMainThreadAction;
struct BNBackgroundTask;
struct BNRepository;
struct BNRepoPlugin;
struct BNRepositoryManager;
struct BNSettings;
struct BNMetadata;
struct BNReportCollection;
struct BNRelocation;
struct BNSegment;
struct BNSection;
struct BNRelocationInfo;
struct BNRelocationHandler;
struct BNDataBuffer;
struct BNDataRenderer;
struct BNDataRendererContainer;
struct BNDisassemblyTextRenderer;
struct BNLinearViewObject;
struct BNLinearViewCursor;
struct BNDebugInfo;
struct BNDebugInfoParser;
struct BNSecretsProvider;
struct BNLogger;
//! Console log levels
enum BNLogLevel
{
DebugLog = 0, //! Debug logging level, most verbose logging level
InfoLog = 1, //! Information logging level, default logging level
WarningLog = 2, //! Warning logging level, messages show with warning icon in the UI
ErrorLog = 3, //! Error logging level, messages show with error icon in the UI
AlertLog = 4 //! Alert logging level, messages are displayed with popup message box in the UI
};
enum BNEndianness
{
LittleEndian = 0,
BigEndian = 1
};
enum BNModificationStatus
{
Original = 0,
Changed = 1,
Inserted = 2
};
enum BNTransformType
{
BinaryCodecTransform = 0, // Two-way transform of data, binary input/output
TextCodecTransform = 1, // Two-way transform of data, encoder output is text
UnicodeCodecTransform = 2, // Two-way transform of data, encoder output is Unicode string (as UTF8)
DecodeTransform = 3, // One-way decode only
BinaryEncodeTransform = 4, // One-way encode only, output is binary
TextEncodeTransform = 5, // One-way encode only, output is text
EncryptTransform = 6, // Two-way encryption
InvertingTransform = 7, // Transform that can be undone by performing twice
HashTransform = 8 // Hash function
};
enum BNBranchType
{
UnconditionalBranch = 0,
FalseBranch = 1,
TrueBranch = 2,
CallDestination = 3,
FunctionReturn = 4,
SystemCall = 5,
IndirectBranch = 6,
ExceptionBranch = 7,
UnresolvedBranch = 127,
UserDefinedBranch = 128
};
enum BNInstructionTextTokenType
{
TextToken = 0,
InstructionToken = 1,
OperandSeparatorToken = 2,
RegisterToken = 3,
IntegerToken = 4,
PossibleAddressToken = 5,
BeginMemoryOperandToken = 6,
EndMemoryOperandToken = 7,
FloatingPointToken = 8,
AnnotationToken = 9,
CodeRelativeAddressToken = 10,
ArgumentNameToken = 11,
HexDumpByteValueToken = 12,
HexDumpSkippedByteToken = 13,
HexDumpInvalidByteToken = 14,
HexDumpTextToken = 15,
OpcodeToken = 16,
StringToken = 17,
CharacterConstantToken = 18,
KeywordToken = 19,
TypeNameToken = 20,
FieldNameToken = 21,
NameSpaceToken = 22,
NameSpaceSeparatorToken = 23,
TagToken = 24,
StructOffsetToken = 25,
StructOffsetByteValueToken = 26,
StructureHexDumpTextToken = 27,
GotoLabelToken = 28,
CommentToken = 29,
PossibleValueToken = 30,
PossibleValueTypeToken = 31,
ArrayIndexToken = 32,
IndentationToken = 33,
UnknownMemoryToken = 34,
// The following are output by the analysis system automatically, these should
// not be used directly by the architecture plugins
CodeSymbolToken = 64,
DataSymbolToken = 65,
LocalVariableToken = 66,
ImportToken = 67,
AddressDisplayToken = 68,
IndirectImportToken = 69,
ExternalSymbolToken = 70
};
enum BNInstructionTextTokenContext
{
NoTokenContext = 0,
LocalVariableTokenContext = 1,
DataVariableTokenContext = 2,
FunctionReturnTokenContext = 3,
InstructionAddressTokenContext = 4,
ILInstructionIndexTokenContext = 5
};
enum BNLinearDisassemblyLineType
{
BlankLineType,
BasicLineType,
CodeDisassemblyLineType,
DataVariableLineType,
HexDumpLineType,
FunctionHeaderLineType,
FunctionHeaderStartLineType,
FunctionHeaderEndLineType,
FunctionContinuationLineType,
LocalVariableLineType,
LocalVariableListEndLineType,
FunctionEndLineType,
NoteStartLineType,
NoteLineType,
NoteEndLineType,
SectionStartLineType,
SectionEndLineType,
SectionSeparatorLineType,
NonContiguousSeparatorLineType,
AnalysisWarningLineType
};
enum BNTokenEscapingType
{
NoTokenEscapingType = 0,
BackticksTokenEscapingType = 1,
};
enum BNAnalysisWarningActionType
{
NoAnalysisWarningAction = 0,
ForceAnalysisWarningAction = 1,
ShowStackGraphWarningAction = 2
};
enum BNSymbolType
{
FunctionSymbol = 0,
ImportAddressSymbol = 1,
ImportedFunctionSymbol = 2,
DataSymbol = 3,
ImportedDataSymbol = 4,
ExternalSymbol = 5,
LibraryFunctionSymbol = 6
};
enum BNSymbolBinding
{
NoBinding,
LocalBinding,
GlobalBinding,
WeakBinding
};
enum BNActionType
{
TemporaryAction = 0,
DataModificationAction = 1,
AnalysisAction = 2,
DataModificationAndAnalysisAction = 3
};
enum BNLowLevelILOperation
{
LLIL_NOP,
LLIL_SET_REG, // Not valid in SSA form (see LLIL_SET_REG_SSA)
LLIL_SET_REG_SPLIT, // Not valid in SSA form (see LLIL_SET_REG_SPLIT_SSA)
LLIL_SET_FLAG, // Not valid in SSA form (see LLIL_SET_FLAG_SSA)
LLIL_SET_REG_STACK_REL, // Not valid in SSA form (see LLIL_SET_REG_STACK_REL_SSA)
LLIL_REG_STACK_PUSH, // Not valid in SSA form (expanded)
LLIL_LOAD, // Not valid in SSA form (see LLIL_LOAD_SSA)
LLIL_STORE, // Not valid in SSA form (see LLIL_STORE_SSA)
LLIL_PUSH, // Not valid in SSA form (expanded)
LLIL_POP, // Not valid in SSA form (expanded)
LLIL_REG, // Not valid in SSA form (see LLIL_REG_SSA)
LLIL_REG_SPLIT, // Not valid in SSA form (see LLIL_REG_SPLIT_SSA)
LLIL_REG_STACK_REL, // Not valid in SSA form (see LLIL_REG_STACK_REL_SSA)
LLIL_REG_STACK_POP, // Not valid in SSA form (expanded)
LLIL_REG_STACK_FREE_REG, // Not valid in SSA form (see LLIL_REG_STACK_FREE_REL_SSA,
// LLIL_REG_STACK_FREE_ABS_SSA)
LLIL_REG_STACK_FREE_REL, // Not valid in SSA from (see LLIL_REG_STACK_FREE_REL_SSA)
LLIL_CONST,
LLIL_CONST_PTR,
LLIL_EXTERN_PTR,
LLIL_FLOAT_CONST,
LLIL_FLAG, // Not valid in SSA form (see LLIL_FLAG_SSA)
LLIL_FLAG_BIT, // Not valid in SSA form (see LLIL_FLAG_BIT_SSA)
LLIL_ADD,
LLIL_ADC,
LLIL_SUB,
LLIL_SBB,
LLIL_AND,
LLIL_OR,
LLIL_XOR,
LLIL_LSL,
LLIL_LSR,
LLIL_ASR,
LLIL_ROL,
LLIL_RLC,
LLIL_ROR,
LLIL_RRC,
LLIL_MUL,
LLIL_MULU_DP,
LLIL_MULS_DP,
LLIL_DIVU,
LLIL_DIVU_DP,
LLIL_DIVS,
LLIL_DIVS_DP,
LLIL_MODU,
LLIL_MODU_DP,
LLIL_MODS,
LLIL_MODS_DP,
LLIL_NEG,
LLIL_NOT,
LLIL_SX,
LLIL_ZX,
LLIL_LOW_PART,
LLIL_JUMP,
LLIL_JUMP_TO,
LLIL_CALL,
LLIL_CALL_STACK_ADJUST,
LLIL_TAILCALL,
LLIL_RET,
LLIL_NORET,
LLIL_IF,
LLIL_GOTO,
LLIL_FLAG_COND, // Valid only in Lifted IL
LLIL_FLAG_GROUP, // Valid only in Lifted IL
LLIL_CMP_E,
LLIL_CMP_NE,
LLIL_CMP_SLT,
LLIL_CMP_ULT,
LLIL_CMP_SLE,
LLIL_CMP_ULE,
LLIL_CMP_SGE,
LLIL_CMP_UGE,
LLIL_CMP_SGT,
LLIL_CMP_UGT,
LLIL_TEST_BIT,
LLIL_BOOL_TO_INT,
LLIL_ADD_OVERFLOW,
LLIL_SYSCALL,
LLIL_BP,
LLIL_TRAP,
LLIL_INTRINSIC,
LLIL_UNDEF,
LLIL_UNIMPL,
LLIL_UNIMPL_MEM,
// Floating point
LLIL_FADD,
LLIL_FSUB,
LLIL_FMUL,
LLIL_FDIV,
LLIL_FSQRT,
LLIL_FNEG,
LLIL_FABS,
LLIL_FLOAT_TO_INT,
LLIL_INT_TO_FLOAT,
LLIL_FLOAT_CONV,
LLIL_ROUND_TO_INT,
LLIL_FLOOR,
LLIL_CEIL,
LLIL_FTRUNC,
LLIL_FCMP_E,
LLIL_FCMP_NE,
LLIL_FCMP_LT,
LLIL_FCMP_LE,
LLIL_FCMP_GE,
LLIL_FCMP_GT,
LLIL_FCMP_O,
LLIL_FCMP_UO,
// The following instructions are only used in SSA form
LLIL_SET_REG_SSA,
LLIL_SET_REG_SSA_PARTIAL,
LLIL_SET_REG_SPLIT_SSA,
LLIL_SET_REG_STACK_REL_SSA,
LLIL_SET_REG_STACK_ABS_SSA,
LLIL_REG_SPLIT_DEST_SSA, // Only valid within an LLIL_SET_REG_SPLIT_SSA instruction
LLIL_REG_STACK_DEST_SSA, // Only valid within LLIL_SET_REG_STACK_REL_SSA or LLIL_SET_REG_STACK_ABS_SSA
LLIL_REG_SSA,
LLIL_REG_SSA_PARTIAL,
LLIL_REG_SPLIT_SSA,
LLIL_REG_STACK_REL_SSA,
LLIL_REG_STACK_ABS_SSA,
LLIL_REG_STACK_FREE_REL_SSA,
LLIL_REG_STACK_FREE_ABS_SSA,
LLIL_SET_FLAG_SSA,
LLIL_FLAG_SSA,
LLIL_FLAG_BIT_SSA,
LLIL_CALL_SSA,
LLIL_SYSCALL_SSA,
LLIL_TAILCALL_SSA,
LLIL_CALL_PARAM, // Only valid within the LLIL_CALL_SSA, LLIL_SYSCALL_SSA, LLIL_INTRINSIC, LLIL_INTRINSIC_SSA
// instructions
LLIL_CALL_STACK_SSA, // Only valid within the LLIL_CALL_SSA or LLIL_SYSCALL_SSA instructions
LLIL_CALL_OUTPUT_SSA, // Only valid within the LLIL_CALL_SSA or LLIL_SYSCALL_SSA instructions
LLIL_LOAD_SSA,
LLIL_STORE_SSA,
LLIL_INTRINSIC_SSA,
LLIL_REG_PHI,
LLIL_REG_STACK_PHI,
LLIL_FLAG_PHI,
LLIL_MEM_PHI
};
enum BNLowLevelILFlagCondition
{
LLFC_E,
LLFC_NE,
LLFC_SLT,
LLFC_ULT,
LLFC_SLE,
LLFC_ULE,
LLFC_SGE,
LLFC_UGE,
LLFC_SGT,
LLFC_UGT,
LLFC_NEG,
LLFC_POS,
LLFC_O,
LLFC_NO,
LLFC_FE,
LLFC_FNE,
LLFC_FLT,
LLFC_FLE,
LLFC_FGE,
LLFC_FGT,
LLFC_FO,
LLFC_FUO
};
enum BNFlagRole
{
SpecialFlagRole = 0,
ZeroFlagRole = 1,
PositiveSignFlagRole = 2,
NegativeSignFlagRole = 3,
CarryFlagRole = 4,
OverflowFlagRole = 5,
HalfCarryFlagRole = 6,
EvenParityFlagRole = 7,
OddParityFlagRole = 8,
OrderedFlagRole = 9,
UnorderedFlagRole = 10
};
enum BNFunctionGraphType
{
InvalidILViewType = -1,
NormalFunctionGraph = 0,
LowLevelILFunctionGraph = 1,
LiftedILFunctionGraph = 2,
LowLevelILSSAFormFunctionGraph = 3,
MediumLevelILFunctionGraph = 4,
MediumLevelILSSAFormFunctionGraph = 5,
MappedMediumLevelILFunctionGraph = 6,
MappedMediumLevelILSSAFormFunctionGraph = 7,
HighLevelILFunctionGraph = 8,
HighLevelILSSAFormFunctionGraph = 9,
HighLevelLanguageRepresentationFunctionGraph = 10,
};
enum BNDisassemblyOption
{
ShowAddress = 0,
ShowOpcode = 1,
ExpandLongOpcode = 2,
ShowVariablesAtTopOfGraph = 3,
ShowVariableTypesWhenAssigned = 4,
ShowCallParameterNames = 6,
ShowRegisterHighlight = 7,
ShowFunctionAddress = 8,
ShowFunctionHeader = 9,
// Linear disassembly options
GroupLinearDisassemblyFunctions = 64,
HighLevelILLinearDisassembly = 65,
WaitForIL = 66,
IndentHLILBody = 67,
// Debugging options
ShowFlagUsage = 128,
ShowStackPointer = 129
};
enum BNTypeClass
{
VoidTypeClass = 0,
BoolTypeClass = 1,
IntegerTypeClass = 2,
FloatTypeClass = 3,
StructureTypeClass = 4,
EnumerationTypeClass = 5,
PointerTypeClass = 6,
ArrayTypeClass = 7,
FunctionTypeClass = 8,
VarArgsTypeClass = 9,
ValueTypeClass = 10,
NamedTypeReferenceClass = 11,
WideCharTypeClass = 12
};
enum BNNamedTypeReferenceClass
{
UnknownNamedTypeClass = 0,
TypedefNamedTypeClass = 1,
ClassNamedTypeClass = 2,
StructNamedTypeClass = 3,
UnionNamedTypeClass = 4,
EnumNamedTypeClass = 5
};
enum BNStructureVariant
{
ClassStructureType = 0,
StructStructureType = 1,
UnionStructureType = 2
};
enum BNMemberScope
{
NoScope,
StaticScope,
VirtualScope,
ThunkScope,
FriendScope
};
enum BNMemberAccess
{
NoAccess,
PrivateAccess,
ProtectedAccess,
PublicAccess
};
enum BNReferenceType
{
PointerReferenceType = 0,
ReferenceReferenceType = 1,
RValueReferenceType = 2,
NoReference = 3
};
enum BNPointerSuffix
{
Ptr64Suffix,
UnalignedSuffix,
RestrictSuffix,
ReferenceSuffix,
LvalueSuffix
};
// Caution: these enumeration values are used a lookups into the static NameTypeStrings in the core
// if you modify this you must also modify the string lookups as well
enum BNNameType
{
NoNameType,
ConstructorNameType,
DestructorNameType,
OperatorNewNameType,
OperatorDeleteNameType,
OperatorAssignNameType,
OperatorRightShiftNameType,
OperatorLeftShiftNameType,
OperatorNotNameType,
OperatorEqualNameType,
OperatorNotEqualNameType,
OperatorArrayNameType,
OperatorArrowNameType,
OperatorStarNameType,
OperatorIncrementNameType,
OperatorDecrementNameType,
OperatorMinusNameType,
OperatorPlusNameType,
OperatorBitAndNameType,
OperatorArrowStarNameType,
OperatorDivideNameType,
OperatorModulusNameType,
OperatorLessThanNameType,
OperatorLessThanEqualNameType,
OperatorGreaterThanNameType,
OperatorGreaterThanEqualNameType,
OperatorCommaNameType,
OperatorParenthesesNameType,
OperatorTildeNameType,
OperatorXorNameType,
OperatorBitOrNameType,
OperatorLogicalAndNameType,
OperatorLogicalOrNameType,
OperatorStarEqualNameType,
OperatorPlusEqualNameType,
OperatorMinusEqualNameType,
OperatorDivideEqualNameType,
OperatorModulusEqualNameType,
OperatorRightShiftEqualNameType,
OperatorLeftShiftEqualNameType,
OperatorAndEqualNameType,
OperatorOrEqualNameType,
OperatorXorEqualNameType,
VFTableNameType,
VBTableNameType,
VCallNameType,
TypeofNameType,
LocalStaticGuardNameType,
StringNameType,
VBaseDestructorNameType,
VectorDeletingDestructorNameType,
DefaultConstructorClosureNameType,
ScalarDeletingDestructorNameType,
VectorConstructorIteratorNameType,
VectorDestructorIteratorNameType,
VectorVBaseConstructorIteratorNameType,
VirtualDisplacementMapNameType,
EHVectorConstructorIteratorNameType,
EHVectorDestructorIteratorNameType,
EHVectorVBaseConstructorIteratorNameType,
CopyConstructorClosureNameType,
UDTReturningNameType,
LocalVFTableNameType,
LocalVFTableConstructorClosureNameType,
OperatorNewArrayNameType,
OperatorDeleteArrayNameType,
PlacementDeleteClosureNameType,
PlacementDeleteClosureArrayNameType,
OperatorReturnTypeNameType,
RttiTypeDescriptor,
RttiBaseClassDescriptor,
RttiBaseClassArray,
RttiClassHierarchyDescriptor,
RttiCompleteObjectLocator,
OperatorUnaryMinusNameType,
OperatorUnaryPlusNameType,
OperatorUnaryBitAndNameType,
OperatorUnaryStarNameType
};
enum BNCallingConventionName
{
NoCallingConvention,
CdeclCallingConvention,
PascalCallingConvention,
ThisCallCallingConvention,
STDCallCallingConvention,
FastcallCallingConvention,
CLRCallCallingConvention,
EabiCallCallingConvention,
VectorCallCallingConvention
};
enum BNStringType
{
AsciiString = 0,
Utf16String = 1,
Utf32String = 2,
Utf8String = 3
};
enum BNIntegerDisplayType
{
DefaultIntegerDisplayType,
BinaryDisplayType,
SignedOctalDisplayType,
UnsignedOctalDisplayType,
SignedDecimalDisplayType,
UnsignedDecimalDisplayType,
SignedHexadecimalDisplayType,
UnsignedHexadecimalDisplayType,
CharacterConstantDisplayType,
PointerDisplayType,
FloatDisplayType,
DoubleDisplayType
};
enum BNFlowGraphOption
{
FlowGraphUsesBlockHighlights,
FlowGraphUsesInstructionHighlights,
FlowGraphIncludesUserComments,
FlowGraphAllowsPatching,
FlowGraphAllowsInlineInstructionEditing,
FlowGraphShowsSecondaryRegisterHighlighting
};
struct BNLowLevelILInstruction
{
BNLowLevelILOperation operation;
size_t size;
uint32_t flags;
uint32_t sourceOperand;
uint64_t operands[4];
uint64_t address;
};
struct BNLowLevelILLabel
{
bool resolved;
size_t ref;
size_t operand;
};
enum BNImplicitRegisterExtend
{
NoExtend,
ZeroExtendToFullWidth,
SignExtendToFullWidth
};
struct BNRegisterInfo
{
uint32_t fullWidthRegister;
size_t offset;
size_t size;
BNImplicitRegisterExtend extend;
};
struct BNRegisterStackInfo
{
uint32_t firstStorageReg, firstTopRelativeReg;
uint32_t storageCount, topRelativeCount;
uint32_t stackTopReg;
};
enum BNRegisterValueType
{
UndeterminedValue,
EntryValue,
ConstantValue,
ConstantPointerValue,
ExternalPointerValue,
StackFrameOffset,
ReturnAddressValue,
ImportedAddressValue,
// The following are only valid in BNPossibleValueSet
SignedRangeValue,
UnsignedRangeValue,
LookupTableValue,
InSetOfValues,
NotInSetOfValues
};
enum BNDataFlowQueryOption
{
FromAddressesInLookupTableQueryOption // Use addresses instead of index in the from list within
// LookupTableValue results
};
enum BNPluginOrigin
{
OfficialPluginOrigin,
CommunityPluginOrigin,
OtherPluginOrigin
};
enum BNPluginStatus
{
NotInstalledPluginStatus = 0x00000000,
InstalledPluginStatus = 0x00000001,
EnabledPluginStatus = 0x00000002,
UpdateAvailablePluginStatus = 0x00000010,
DeletePendingPluginStatus = 0x00000020,
UpdatePendingPluginStatus = 0x00000040,
DisablePendingPluginStatus = 0x00000080,
PendingRestartPluginStatus = 0x00000200,
BeingUpdatedPluginStatus = 0x00000400,
BeingDeletedPluginStatus = 0x00000800,
DependenciesBeingInstalledStatus = 0x00001000
};
enum BNPluginType
{
CorePluginType,
UiPluginType,
ArchitecturePluginType,
BinaryViewPluginType,
HelperPluginType
};
struct BNLookupTableEntry
{
int64_t* fromValues;
size_t fromCount;
int64_t toValue;
};
struct BNRegisterValue
{
BNRegisterValueType state;
int64_t value;
int64_t offset;
};
struct BNRegisterValueWithConfidence
{
BNRegisterValue value;
uint8_t confidence;
};
struct BNValueRange
{
uint64_t start, end, step;
};
struct BNPossibleValueSet
{
BNRegisterValueType state;
int64_t value;
int64_t offset;
BNValueRange* ranges;
int64_t* valueSet;
BNLookupTableEntry* table;
size_t count;
};
struct BNRegisterOrConstant
{
bool constant;
uint32_t reg;
uint64_t value;
};
struct BNDataVariable
{
uint64_t address;
BNType* type;
bool autoDiscovered;
uint8_t typeConfidence;
};
struct BNDataVariableAndName
{
uint64_t address;
BNType* type;
char* name;
bool autoDiscovered;
uint8_t typeConfidence;
};
enum BNMediumLevelILOperation
{
MLIL_NOP,
MLIL_SET_VAR, // Not valid in SSA form (see MLIL_SET_VAR_SSA)
MLIL_SET_VAR_FIELD, // Not valid in SSA form (see MLIL_SET_VAR_FIELD)
MLIL_SET_VAR_SPLIT, // Not valid in SSA form (see MLIL_SET_VAR_SPLIT_SSA)
MLIL_LOAD, // Not valid in SSA form (see MLIL_LOAD_SSA)
MLIL_LOAD_STRUCT, // Not valid in SSA form (see MLIL_LOAD_STRUCT_SSA)