-
Notifications
You must be signed in to change notification settings - Fork 217
/
binaryninjacore.h
8054 lines (7248 loc) · 438 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-2024 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__
#ifndef BN_TYPE_PARSER
#ifdef __cplusplus
#include <cstdint>
#include <cstddef>
#include <cstdlib>
#else
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#endif
#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 86
// 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 86
#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_EDITION
#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
/*!
@addtogroup core
@{
*/
#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"
#define BNDB_SUFFIX "bndb"
#define BNDB_EXT ("." BNDB_SUFFIX)
#define BNTA_SUFFIX "bnta"
#define BNTA_EXT ("." BNTA_SUFFIX)
#define BNPM_SUFFIX "bnpm"
#define BNPM_EXT ("." BNPM_SUFFIX)
#define BNPR_SUFFIX "bnpr"
#define BNPR_EXT ("." BNPR_SUFFIX)
// 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_EDITION
#define BN_DECLARE_CORE_ABI_VERSION
#else
#ifdef __cplusplus
#define BN_DECLARE_CORE_ABI_VERSION \
extern "C" \
{ \
BINARYNINJAPLUGIN uint32_t CorePluginABIVersion() { return BN_CURRENT_CORE_ABI_VERSION; } \
}
#else
#define BN_DECLARE_CORE_ABI_VERSION \
BINARYNINJAPLUGIN uint32_t CorePluginABIVersion(void) { return BN_CURRENT_CORE_ABI_VERSION; }
#endif
#endif
#ifdef __has_attribute
#define BN_HAVE_ATTRIBUTE(x) __has_attribute(x)
#else
#define BN_HAVE_ATTRIBUTE(x) 0
#endif
#if BN_HAVE_ATTRIBUTE(format) || (defined(__GNUC__) && !defined(__clang__))
#define BN_PRINTF_ATTRIBUTE(string_index, first_to_check) \
__attribute__((format(__printf__, string_index, first_to_check)))
#else
#define BN_PRINTF_ATTRIBUTE(string_index, first_to_check)
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum BNPluginLoadOrder
{
EarlyPluginLoadOrder,
NormalPluginLoadOrder,
LatePluginLoadOrder
} BNPluginLoadOrder;
typedef enum PluginLoadStatus
{
NotAttemptedStatus,
LoadSucceededStatus,
LoadFailedStatus
} PluginLoadStatus;
typedef bool (*BNCorePluginInitFunction)(void);
typedef void (*BNCorePluginDependencyFunction)(void);
typedef uint32_t (*BNCorePluginABIVersionFunction)(void);
typedef struct BNDataBuffer BNDataBuffer;
typedef struct BNBinaryView BNBinaryView;
typedef struct BNBinaryViewType BNBinaryViewType;
typedef struct BNBinaryReader BNBinaryReader;
typedef struct BNBinaryWriter BNBinaryWriter;
typedef struct BNKeyValueStore BNKeyValueStore;
typedef struct BNSnapshot BNSnapshot;
typedef struct BNDatabase BNDatabase;
typedef struct BNFileMetadata BNFileMetadata;
typedef struct BNTransform BNTransform;
typedef struct BNArchitecture BNArchitecture;
typedef struct BNFunction BNFunction;
typedef struct BNBasicBlock BNBasicBlock;
typedef struct BNDownloadProvider BNDownloadProvider;
typedef struct BNDownloadInstance BNDownloadInstance;
typedef struct BNWebsocketProvider BNWebsocketProvider;
typedef struct BNWebsocketClient BNWebsocketClient;
typedef struct BNTypeParser BNTypeParser;
typedef struct BNTypePrinter BNTypePrinter;
typedef struct BNFlowGraph BNFlowGraph;
typedef struct BNFlowGraphNode BNFlowGraphNode;
typedef struct BNFlowGraphLayout BNFlowGraphLayout;
typedef struct BNFlowGraphLayoutRequest BNFlowGraphLayoutRequest;
typedef struct BNSymbol BNSymbol;
typedef struct BNTemporaryFile BNTemporaryFile;
typedef struct BNLowLevelILFunction BNLowLevelILFunction;
typedef struct BNMediumLevelILFunction BNMediumLevelILFunction;
typedef struct BNHighLevelILFunction BNHighLevelILFunction;
typedef struct BNLanguageRepresentationFunction BNLanguageRepresentationFunction;
typedef struct BNLanguageRepresentationFunctionType BNLanguageRepresentationFunctionType;
typedef struct BNHighLevelILTokenEmitter BNHighLevelILTokenEmitter;
typedef struct BNType BNType;
typedef struct BNTypeBuilder BNTypeBuilder;
typedef struct BNTypeLibrary BNTypeLibrary;
typedef struct BNTypeLibraryMapping BNTypeLibraryMapping;
typedef struct BNStructure BNStructure;
typedef struct BNStructureBuilder BNStructureBuilder;
typedef struct BNTagType BNTagType;
typedef struct BNTag BNTag;
typedef struct BNTagReference BNTagReference;
typedef struct BNUser BNUser;
typedef struct BNNamedTypeReference BNNamedTypeReference;
typedef struct BNNamedTypeReferenceBuilder BNNamedTypeReferenceBuilder;
typedef struct BNEnumeration BNEnumeration;
typedef struct BNEnumerationBuilder BNEnumerationBuilder;
typedef struct BNCallingConvention BNCallingConvention;
typedef struct BNPlatform BNPlatform;
typedef struct BNActivity BNActivity;
typedef struct BNAnalysisContext BNAnalysisContext;
typedef struct BNWorkflow BNWorkflow;
typedef struct BNAnalysisCompletionEvent BNAnalysisCompletionEvent;
typedef struct BNDisassemblySettings BNDisassemblySettings;
typedef struct BNSaveSettings BNSaveSettings;
typedef struct BNScriptingProvider BNScriptingProvider;
typedef struct BNScriptingInstance BNScriptingInstance;
typedef struct BNMainThreadAction BNMainThreadAction;
typedef struct BNBackgroundTask BNBackgroundTask;
typedef struct BNRepository BNRepository;
typedef struct BNRepoPlugin BNRepoPlugin;
typedef struct BNRepositoryManager BNRepositoryManager;
typedef struct BNComponent BNComponent;
typedef struct BNSettings BNSettings;
typedef struct BNMetadata BNMetadata;
typedef struct BNReportCollection BNReportCollection;
typedef struct BNRelocation BNRelocation;
typedef struct BNSegment BNSegment;
typedef struct BNSection BNSection;
typedef struct BNRelocationInfo BNRelocationInfo;
typedef struct BNRelocationHandler BNRelocationHandler;
typedef struct BNDataBuffer BNDataBuffer;
typedef struct BNDataRenderer BNDataRenderer;
typedef struct BNDataRendererContainer BNDataRendererContainer;
typedef struct BNDisassemblyTextRenderer BNDisassemblyTextRenderer;
typedef struct BNLinearViewObject BNLinearViewObject;
typedef struct BNLinearViewCursor BNLinearViewCursor;
typedef struct BNDebugInfo BNDebugInfo;
typedef struct BNDebugInfoParser BNDebugInfoParser;
typedef struct BNSecretsProvider BNSecretsProvider;
typedef struct BNLogger BNLogger;
typedef struct BNSymbolQueue BNSymbolQueue;
typedef struct BNTypeArchive BNTypeArchive;
typedef struct BNTypeContainer BNTypeContainer;
typedef struct BNProject BNProject;
typedef struct BNProjectFile BNProjectFile;
typedef struct BNExternalLibrary BNExternalLibrary;
typedef struct BNExternalLocation BNExternalLocation;
typedef struct BNProjectFolder BNProjectFolder;
typedef struct BNBaseAddressDetection BNBaseAddressDetection;
typedef struct BNCollaborationChangeset BNCollaborationChangeset;
typedef struct BNRemoteFile BNRemoteFile;
typedef struct BNRemoteFolder BNRemoteFolder;
typedef struct BNCollaborationGroup BNCollaborationGroup;
typedef struct BNCollaborationPermission BNCollaborationPermission;
typedef struct BNRemoteProject BNRemoteProject;
typedef struct BNRemote BNRemote;
typedef struct BNCollaborationSnapshot BNCollaborationSnapshot;
typedef struct BNCollaborationUndoEntry BNCollaborationUndoEntry;
typedef struct BNCollaborationUser BNCollaborationUser;
typedef struct BNAnalysisMergeConflict BNAnalysisMergeConflict;
typedef struct BNAnalysisMergeConflictSplitter BNAnalysisMergeConflictSplitter;
typedef struct BNTypeArchiveMergeConflict BNTypeArchiveMergeConflict;
typedef struct BNCollaborationLazyT BNCollaborationLazyT;
typedef struct BNUndoAction BNUndoAction;
typedef struct BNUndoEntry BNUndoEntry;
typedef struct BNDemangler BNDemangler;
typedef struct BNFirmwareNinja BNFirmwareNinja;
//! Console log levels
typedef 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
} BNLogLevel;
typedef enum BNEndianness
{
LittleEndian = 0,
BigEndian = 1
} BNEndianness;
typedef enum BNModificationStatus
{
Original = 0,
Changed = 1,
Inserted = 2
} BNModificationStatus;
typedef 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
} BNTransformType;
typedef enum BNBranchType
{
UnconditionalBranch = 0,
FalseBranch = 1,
TrueBranch = 2,
CallDestination = 3,
FunctionReturn = 4,
SystemCall = 5,
IndirectBranch = 6,
ExceptionBranch = 7,
UnresolvedBranch = 127,
UserDefinedBranch = 128
} BNBranchType;
typedef 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,
EnumerationMemberToken = 35,
OperationToken = 36,
BaseStructureNameToken = 37,
BaseStructureSeparatorToken = 38,
BraceToken = 39,
// 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,
StackVariableToken = 71,
AddressSeparatorToken = 72,
CollapsedInformationToken = 73,
CollapseStateIndicatorToken = 74
} BNInstructionTextTokenType;
typedef enum BNInstructionTextTokenContext
{
NoTokenContext = 0,
LocalVariableTokenContext = 1,
DataVariableTokenContext = 2,
FunctionReturnTokenContext = 3,
InstructionAddressTokenContext = 4,
ILInstructionIndexTokenContext = 5,
ConstDataTokenContext = 6, // For Const Data arrays
ConstStringDataTokenContext = 7, // For ConstData strings
StringReferenceTokenContext = 8, // For References to strings
StringDataVariableTokenContext = 9, // For String DataVariables
StringDisplayTokenContext = 10, // For displaying strings which aren't associated with an address
ContentCollapsedContext = 11,
ContentExpandedContext = 12,
ContentCollapsiblePadding = 13
} BNInstructionTextTokenContext;
typedef enum BNLinearDisassemblyLineType
{
BlankLineType,
BasicLineType,
CodeDisassemblyLineType,
DataVariableLineType,
HexDumpLineType,
FunctionHeaderLineType,
FunctionHeaderStartLineType,
FunctionHeaderEndLineType,
FunctionContinuationLineType,
LocalVariableLineType,
LocalVariableListEndLineType,
FunctionEndLineType,
NoteStartLineType,
NoteLineType,
NoteEndLineType,
SectionStartLineType,
SectionEndLineType,
SectionSeparatorLineType,
NonContiguousSeparatorLineType,
AnalysisWarningLineType,
CollapsedFunctionEndLineType
} BNLinearDisassemblyLineType;
typedef enum BNTokenEscapingType
{
NoTokenEscapingType = 0,
BackticksTokenEscapingType = 1,
QuotedStringEscapingType = 2,
ReplaceInvalidCharsEscapingType = 3,
} BNTokenEscapingType;
typedef enum BNAnalysisWarningActionType
{
NoAnalysisWarningAction = 0,
ForceAnalysisWarningAction = 1,
ShowStackGraphWarningAction = 2
} BNAnalysisWarningActionType;
typedef enum BNSymbolType
{
FunctionSymbol = 0,
ImportAddressSymbol = 1,
ImportedFunctionSymbol = 2,
DataSymbol = 3,
ImportedDataSymbol = 4,
ExternalSymbol = 5,
LibraryFunctionSymbol = 6,
SymbolicFunctionSymbol = 7,
LocalLabelSymbol = 8,
} BNSymbolType;
typedef enum BNSymbolBinding
{
NoBinding,
LocalBinding,
GlobalBinding,
WeakBinding
} BNSymbolBinding;
typedef enum BNActionType
{
TemporaryAction = 0,
DataModificationAction = 1,
AnalysisAction = 2,
DataModificationAndAnalysisAction = 3
} BNActionType;
typedef 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,
// LLIL_MEMORY_INTRINSIC_SSA, LLIL_TAILCALL, LLIL_TAILCALL_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_SEPARATE_PARAM_LIST_SSA, // Only valid within the LLIL_CALL_PARAM instruction
LLIL_SHARED_PARAM_SLOT_SSA, // Only valid within the LLIL_CALL_PARAM or LLIL_SEPARATE_PARAM_LIST_SSA instructions
LLIL_MEMORY_INTRINSIC_OUTPUT_SSA, // Only valid within the LLIL_MEMORY_INTRINSIC_SSA instruction
LLIL_LOAD_SSA,
LLIL_STORE_SSA,
LLIL_INTRINSIC_SSA,
LLIL_MEMORY_INTRINSIC_SSA,
LLIL_REG_PHI,
LLIL_REG_STACK_PHI,
LLIL_FLAG_PHI,
LLIL_MEM_PHI
} BNLowLevelILOperation;
typedef 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
} BNLowLevelILFlagCondition;
typedef enum BNFlagRole
{
SpecialFlagRole = 0,
ZeroFlagRole = 1,
PositiveSignFlagRole = 2,
NegativeSignFlagRole = 3,
CarryFlagRole = 4,
OverflowFlagRole = 5,
HalfCarryFlagRole = 6,
EvenParityFlagRole = 7,
OddParityFlagRole = 8,
OrderedFlagRole = 9,
UnorderedFlagRole = 10,
CarryFlagWithInvertedSubtractRole = 11,
} BNFlagRole;
typedef 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,
} BNFunctionGraphType;
typedef struct BNFunctionViewType
{
BNFunctionGraphType type;
const char* name; // Only used for HighLevelLanguageRepresentationFunctionGraph
} BNFunctionViewType;
typedef enum BNDisassemblyOption
{
ShowAddress = 0,
ShowOpcode = 1,
ExpandLongOpcode = 2,
ShowVariablesAtTopOfGraph = 3,
ShowVariableTypesWhenAssigned = 4,
ShowRegisterHighlight = 7,
ShowFunctionAddress = 8,
ShowFunctionHeader = 9,
ShowTypeCasts = 10,
// Linear disassembly options
GroupLinearDisassemblyFunctions = 64,
HighLevelILLinearDisassembly = 65,
WaitForIL = 66,
IndentHLILBody = 67,
// Debugging options
ShowFlagUsage = 128,
ShowStackPointer = 129,
ShowILTypes = 130,
ShowILOpcodes = 131,
ShowCollapseIndicators = 132,
} BNDisassemblyOption;
typedef enum BNDisassemblyAddressMode
{
AbsoluteDisassemblyAddressMode,
RelativeToBinaryStartDisassemblyAddressMode,
RelativeToSegmentStartDisassemblyAddressMode,
RelativeToSectionStartDisassemblyAddressMode,
RelativeToFunctionStartDisassemblyAddressMode,
RelativeToAddressBaseOffsetDisassemblyAddressMode,
DisassemblyAddressModeMask = 0xFFFF,
IncludeNameDisassemblyAddressModeFlag = 0x10000,
DecimalDisassemblyAddressModeFlag = 0x20000,
DisassemblyAddressModeFlagsMask = 0xFFFF0000,
} BNDisassemblyAddressMode;
typedef enum BNDisassemblyCallParameterHints
{
NeverShowMatchingParameterHints,
AlwaysShowParameterHints,
NeverShowParameterHints,
} BNDisassemblyCallParameterHints;
typedef 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
} BNTypeClass;
typedef enum BNNamedTypeReferenceClass
{
UnknownNamedTypeClass = 0,
TypedefNamedTypeClass = 1,
ClassNamedTypeClass = 2,
StructNamedTypeClass = 3,
UnionNamedTypeClass = 4,
EnumNamedTypeClass = 5
} BNNamedTypeReferenceClass;
typedef enum BNStructureVariant
{
ClassStructureType = 0,
StructStructureType = 1,
UnionStructureType = 2
} BNStructureVariant;
typedef enum BNMemberScope
{
NoScope,
StaticScope,
VirtualScope,
ThunkScope,
FriendScope
} BNMemberScope;
typedef enum BNMemberAccess
{
NoAccess,
PrivateAccess,
ProtectedAccess,
PublicAccess
} BNMemberAccess;
typedef enum BNReferenceType
{
PointerReferenceType = 0,
ReferenceReferenceType = 1,
RValueReferenceType = 2,
NoReference = 3
} BNReferenceType;
typedef enum BNPointerSuffix
{
Ptr64Suffix,
UnalignedSuffix,
RestrictSuffix,
ReferenceSuffix,
LvalueSuffix,
} BNPointerSuffix;
typedef enum BNPointerBaseType
{
AbsolutePointerBaseType,
RelativeToConstantPointerBaseType,
RelativeToBinaryStartPointerBaseType,
RelativeToVariableAddressPointerBaseType,
} BNPointerBaseType;
// 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
typedef 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,
OmniCallSigNameType,
ManagedVectorConstructorIteratorNameType,
ManagedVectorDestructorIteratorNameType,
EHVectorCopyConstructorIteratorNameType,
EHVectorVBaseCopyConstructorIteratorNameType,
DynamicInitializerNameType,
DynamicAtExitDestructorNameType,
VectorCopyConstructorIteratorNameType,
VectorVBaseCopyConstructorIteratorNameType,
ManagedVectorCopyConstructorIteratorNameType,
LocalStaticThreadGuardNameType,
UserDefinedLiteralOperatorNameType,
} BNNameType;
typedef enum BNCallingConventionName
{
NoCallingConvention,
CdeclCallingConvention,
PascalCallingConvention,
ThisCallCallingConvention,
STDCallCallingConvention,
FastcallCallingConvention,
CLRCallCallingConvention,
EabiCallCallingConvention,
VectorCallCallingConvention,
SwiftCallingConvention,
SwiftAsyncCallingConvention
} BNCallingConventionName;
typedef enum BNStringType
{
AsciiString = 0,
Utf16String = 1,
Utf32String = 2,
Utf8String = 3
} BNStringType;
typedef enum BNIntegerDisplayType
{
DefaultIntegerDisplayType,
BinaryDisplayType,
SignedOctalDisplayType,
UnsignedOctalDisplayType,
SignedDecimalDisplayType,
UnsignedDecimalDisplayType,
SignedHexadecimalDisplayType,
UnsignedHexadecimalDisplayType,
CharacterConstantDisplayType,
PointerDisplayType,
FloatDisplayType,
DoubleDisplayType,
EnumerationDisplayType,
} BNIntegerDisplayType;
typedef enum BNFlowGraphOption
{
FlowGraphUsesBlockHighlights,
FlowGraphUsesInstructionHighlights,
FlowGraphIncludesUserComments,
FlowGraphAllowsPatching,
FlowGraphAllowsInlineInstructionEditing,
FlowGraphShowsSecondaryRegisterHighlighting,
FlowGraphIsAddressable,
FlowGraphIsWorkflowGraph
} BNFlowGraphOption;
typedef enum BNILInstructionAttribute
{
// If present on a store instruction, allows elimination of variables associated with the store
ILAllowDeadStoreElimination = 1,
// If present on a store instruction, prevents elimination of variables associated with the store
ILPreventDeadStoreElimination = 2,
// Assumes that a variable assignment might be used in some way during MLIL translation
MLILAssumePossibleUse = 4,
// MLIL variable usage has an unknown size and may be used partially (i.e. an automatically discovered register
// parameter in a call)
MLILUnknownSize = 8,
// lifted instruction uses pointer authentication
SrcInstructionUsesPointerAuth = 0x10,