idalib/
meta.rs

1use std::marker::PhantomData;
2use std::mem;
3
4use bitflags::bitflags;
5
6use crate::Address;
7use crate::ffi::BADADDR;
8use crate::ffi::inf::*;
9use crate::ffi::nalt::*;
10use crate::idb::IDB;
11
12bitflags! {
13    #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
14    pub struct AnalysisFlags: u32 {
15        const CODE = AF_CODE as _;
16        const MARKCODE = AF_MARKCODE as _;
17        const JUMPTBL = AF_JUMPTBL as _;
18        const PURDAT = AF_PURDAT as _;
19        const USED = AF_USED as _;
20        const UNK = AF_UNK as _;
21
22        const PROCPTR = AF_PROCPTR as _;
23        const PROC = AF_PROC as _;
24        const FTAIL = AF_FTAIL as _;
25        const LVAR = AF_LVAR as _;
26        const STKARG = AF_STKARG as _;
27        const REGARG = AF_REGARG as _;
28        const TRACE = AF_TRACE as _;
29        const VERSP = AF_VERSP as _;
30        const ANORET = AF_ANORET as _;
31        const MEMFUNC = AF_MEMFUNC as _;
32        const TRFUNC = AF_TRFUNC as _;
33
34        const STRLIT = AF_STRLIT as _;
35        const CHKUNI = AF_CHKUNI as _;
36        const FIXUP = AF_FIXUP as _;
37        const DREFOFF = AF_DREFOFF as _;
38        const IMMOFF = AF_IMMOFF as _;
39        const DATOFF = AF_DATOFF as _;
40
41        const FLIRT = AF_FLIRT as _;
42        const SIGCMT = AF_SIGCMT as _;
43        const SIGMLT = AF_SIGMLT as _;
44        const HFLIRT = AF_HFLIRT as _;
45
46        const JFUNC = AF_JFUNC as _;
47        const NULLSUB = AF_NULLSUB as _;
48
49        const DODATA = AF_DODATA as _;
50        const DOCODE = AF_DOCODE as _;
51        const FINAL = AF_FINAL as _;
52    }
53}
54
55bitflags! {
56    #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
57    pub struct AnalysisFlags2: u32 {
58        const DOEH = AF2_DOEH as _;
59        const DORTTI = AF2_DORTTI as _;
60        const MACRO = AF2_MACRO as _;
61        const MERGESTR = AF2_MERGESTR as _;
62    }
63}
64
65bitflags! {
66    #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
67    pub struct ShowXRefFlags: u8 {
68        const SEGXRF = SW_SEGXRF as _;
69        const XRFMRK = SW_XRFMRK as _;
70        const XRFFNC = SW_XRFFNC as _;
71        const XRFVAL = SW_XRFVAL as _;
72    }
73}
74
75#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
76#[repr(u32)]
77pub enum FileType {
78    #[doc(hidden)]
79    OldEXE = filetype_t::f_EXE_old as _,
80    #[doc(hidden)]
81    OldCOM = filetype_t::f_COM_old as _,
82    BIN = filetype_t::f_BIN as _,
83    DRV = filetype_t::f_DRV as _,
84    WIN = filetype_t::f_WIN as _,
85    HEX = filetype_t::f_HEX as _,
86    MEX = filetype_t::f_MEX as _,
87    LX = filetype_t::f_LX as _,
88    LE = filetype_t::f_LE as _,
89    NLM = filetype_t::f_NLM as _,
90    COFF = filetype_t::f_COFF as _,
91    PE = filetype_t::f_PE as _,
92    OMF = filetype_t::f_OMF as _,
93    SREC = filetype_t::f_SREC as _,
94    ZIP = filetype_t::f_ZIP as _,
95    OMFLIB = filetype_t::f_OMFLIB as _,
96    AR = filetype_t::f_AR as _,
97    LOADER = filetype_t::f_LOADER as _,
98    ELF = filetype_t::f_ELF as _,
99    W32RUN = filetype_t::f_W32RUN as _,
100    AOUT = filetype_t::f_AOUT as _,
101    PRC = filetype_t::f_PRC as _,
102    EXE = filetype_t::f_EXE as _,
103    COM = filetype_t::f_COM as _,
104    AIXAR = filetype_t::f_AIXAR as _,
105    MACHO = filetype_t::f_MACHO as _,
106    PSXOBJ = filetype_t::f_PSXOBJ as _,
107    MD1IMG = filetype_t::f_MD1IMG as _,
108}
109
110#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
111#[repr(u8)]
112pub enum Compiler {
113    UNK = COMP_UNK as _,
114    MS = COMP_MS as _,
115    BC = COMP_BC as _,
116    WATCOM = COMP_WATCOM as _,
117    GNU = COMP_GNU as _,
118    VISAGE = COMP_VISAGE as _,
119    BP = COMP_BP as _,
120    UNSURE = COMP_UNSURE as _,
121}
122
123pub struct Metadata<'a> {
124    _marker: PhantomData<&'a IDB>,
125}
126
127impl<'a> Metadata<'a> {
128    pub(crate) fn new() -> Self {
129        Self {
130            _marker: PhantomData,
131        }
132    }
133
134    pub fn version(&self) -> u16 {
135        unsafe { idalib_inf_get_version() }
136    }
137
138    pub fn genflags(&self) -> u16 {
139        unsafe { idalib_inf_get_genflags() }
140    }
141
142    pub fn is_auto_enabled(&self) -> bool {
143        unsafe { idalib_inf_is_auto_enabled() }
144    }
145
146    pub fn use_allasm(&self) -> bool {
147        unsafe { idalib_inf_use_allasm() }
148    }
149
150    pub fn loading_idc(&self) -> bool {
151        unsafe { idalib_inf_loading_idc() }
152    }
153
154    pub fn no_store_user_info(&self) -> bool {
155        unsafe { idalib_inf_no_store_user_info() }
156    }
157
158    pub fn readonly_idb(&self) -> bool {
159        unsafe { idalib_inf_readonly_idb() }
160    }
161
162    pub fn check_manual_ops(&self) -> bool {
163        unsafe { idalib_inf_check_manual_ops() }
164    }
165
166    pub fn allow_non_matched_ops(&self) -> bool {
167        unsafe { idalib_inf_allow_non_matched_ops() }
168    }
169
170    pub fn is_graph_view(&self) -> bool {
171        unsafe { idalib_inf_is_graph_view() }
172    }
173
174    pub fn lflags(&self) -> u32 {
175        unsafe { idalib_inf_get_lflags() }
176    }
177
178    pub fn decode_fpp(&self) -> bool {
179        unsafe { idalib_inf_decode_fpp() }
180    }
181
182    pub fn is_32bit_or_higher(&self) -> bool {
183        unsafe { idalib_inf_is_32bit_or_higher() }
184    }
185
186    pub fn is_32bit_exactly(&self) -> bool {
187        unsafe { idalib_inf_is_32bit_exactly() }
188    }
189
190    pub fn is_16bit(&self) -> bool {
191        unsafe { idalib_inf_is_16bit() }
192    }
193
194    pub fn is_64bit(&self) -> bool {
195        unsafe { idalib_inf_is_64bit() }
196    }
197
198    pub fn is_dll(&self) -> bool {
199        unsafe { idalib_inf_is_dll() }
200    }
201
202    pub fn is_flat_off32(&self) -> bool {
203        unsafe { idalib_inf_is_flat_off32() }
204    }
205
206    pub fn is_be(&self) -> bool {
207        unsafe { idalib_inf_is_be() }
208    }
209
210    pub fn is_wide_high_byte_first(&self) -> bool {
211        unsafe { idalib_inf_is_wide_high_byte_first() }
212    }
213
214    pub fn dbg_no_store_path(&self) -> bool {
215        unsafe { idalib_inf_dbg_no_store_path() }
216    }
217
218    pub fn is_snapshot(&self) -> bool {
219        unsafe { idalib_inf_is_snapshot() }
220    }
221
222    pub fn pack_idb(&self) -> bool {
223        unsafe { idalib_inf_pack_idb() }
224    }
225
226    pub fn compress_idb(&self) -> bool {
227        unsafe { idalib_inf_compress_idb() }
228    }
229
230    pub fn is_kernel_mode(&self) -> bool {
231        unsafe { idalib_inf_is_kernel_mode() }
232    }
233
234    pub fn app_bitness(&self) -> u32 {
235        unsafe { idalib_inf_get_app_bitness().into() }
236    }
237
238    pub fn database_change_count(&self) -> u32 {
239        unsafe { idalib_inf_get_database_change_count() }
240    }
241
242    pub fn filetype(&self) -> FileType {
243        unsafe { mem::transmute(idalib_inf_get_filetype()) }
244    }
245
246    pub fn ostype(&self) -> u16 {
247        unsafe { idalib_inf_get_ostype() }
248    }
249
250    pub fn apptype(&self) -> u16 {
251        unsafe { idalib_inf_get_apptype() }
252    }
253
254    pub fn asmtype(&self) -> u8 {
255        unsafe { idalib_inf_get_asmtype() }
256    }
257
258    pub fn specsegs(&self) -> u8 {
259        unsafe { idalib_inf_get_specsegs() }
260    }
261
262    pub fn af(&self) -> AnalysisFlags {
263        AnalysisFlags::from_bits_retain(unsafe { idalib_inf_get_af() })
264    }
265
266    pub fn trace_flow(&self) -> bool {
267        unsafe { idalib_inf_trace_flow() }
268    }
269
270    pub fn mark_code(&self) -> bool {
271        unsafe { idalib_inf_mark_code() }
272    }
273
274    pub fn create_jump_tables(&self) -> bool {
275        unsafe { idalib_inf_create_jump_tables() }
276    }
277
278    pub fn noflow_to_data(&self) -> bool {
279        unsafe { idalib_inf_noflow_to_data() }
280    }
281
282    pub fn create_all_xrefs(&self) -> bool {
283        unsafe { idalib_inf_create_all_xrefs() }
284    }
285
286    pub fn create_func_from_ptr(&self) -> bool {
287        unsafe { idalib_inf_create_func_from_ptr() }
288    }
289
290    pub fn create_func_from_call(&self) -> bool {
291        unsafe { idalib_inf_create_func_from_call() }
292    }
293
294    pub fn create_func_tails(&self) -> bool {
295        unsafe { idalib_inf_create_func_tails() }
296    }
297
298    pub fn should_create_stkvars(&self) -> bool {
299        unsafe { idalib_inf_should_create_stkvars() }
300    }
301
302    pub fn propagate_stkargs(&self) -> bool {
303        unsafe { idalib_inf_propagate_stkargs() }
304    }
305
306    pub fn propagate_regargs(&self) -> bool {
307        unsafe { idalib_inf_propagate_regargs() }
308    }
309
310    pub fn should_trace_sp(&self) -> bool {
311        unsafe { idalib_inf_should_trace_sp() }
312    }
313
314    pub fn full_sp_ana(&self) -> bool {
315        unsafe { idalib_inf_full_sp_ana() }
316    }
317
318    pub fn noret_ana(&self) -> bool {
319        unsafe { idalib_inf_noret_ana() }
320    }
321
322    pub fn guess_func_type(&self) -> bool {
323        unsafe { idalib_inf_guess_func_type() }
324    }
325
326    pub fn truncate_on_del(&self) -> bool {
327        unsafe { idalib_inf_truncate_on_del() }
328    }
329
330    pub fn create_strlit_on_xref(&self) -> bool {
331        unsafe { idalib_inf_create_strlit_on_xref() }
332    }
333
334    pub fn check_unicode_strlits(&self) -> bool {
335        unsafe { idalib_inf_check_unicode_strlits() }
336    }
337
338    pub fn create_off_using_fixup(&self) -> bool {
339        unsafe { idalib_inf_create_off_using_fixup() }
340    }
341
342    pub fn create_off_on_dref(&self) -> bool {
343        unsafe { idalib_inf_create_off_on_dref() }
344    }
345
346    pub fn op_offset(&self) -> bool {
347        unsafe { idalib_inf_op_offset() }
348    }
349
350    pub fn data_offset(&self) -> bool {
351        unsafe { idalib_inf_data_offset() }
352    }
353
354    pub fn use_flirt(&self) -> bool {
355        unsafe { idalib_inf_use_flirt() }
356    }
357
358    pub fn append_sigcmt(&self) -> bool {
359        unsafe { idalib_inf_append_sigcmt() }
360    }
361
362    pub fn allow_sigmulti(&self) -> bool {
363        unsafe { idalib_inf_allow_sigmulti() }
364    }
365
366    pub fn hide_libfuncs(&self) -> bool {
367        unsafe { idalib_inf_hide_libfuncs() }
368    }
369
370    pub fn rename_jumpfunc(&self) -> bool {
371        unsafe { idalib_inf_rename_jumpfunc() }
372    }
373
374    pub fn rename_nullsub(&self) -> bool {
375        unsafe { idalib_inf_rename_nullsub() }
376    }
377
378    pub fn coagulate_data(&self) -> bool {
379        unsafe { idalib_inf_coagulate_data() }
380    }
381
382    pub fn coagulate_code(&self) -> bool {
383        unsafe { idalib_inf_coagulate_code() }
384    }
385
386    pub fn final_pass(&self) -> bool {
387        unsafe { idalib_inf_final_pass() }
388    }
389
390    pub fn af2(&self) -> u32 {
391        unsafe { idalib_inf_get_af2() }
392    }
393
394    pub fn handle_eh(&self) -> bool {
395        unsafe { idalib_inf_handle_eh() }
396    }
397
398    pub fn handle_rtti(&self) -> bool {
399        unsafe { idalib_inf_handle_rtti() }
400    }
401
402    pub fn macros_enabled(&self) -> bool {
403        unsafe { idalib_inf_macros_enabled() }
404    }
405
406    pub fn merge_strlits(&self) -> bool {
407        unsafe { idalib_inf_merge_strlits() }
408    }
409
410    pub fn base_address(&self) -> Option<Address> {
411        let ea = unsafe { idalib_inf_get_baseaddr() };
412        if ea != BADADDR { Some(ea.into()) } else { None }
413    }
414
415    pub fn start_stack_segment(&self) -> Option<Address> {
416        let ea = unsafe { idalib_inf_get_start_ss() };
417        if ea != BADADDR { Some(ea.into()) } else { None }
418    }
419
420    pub fn start_code_segment(&self) -> Option<Address> {
421        let ea = unsafe { idalib_inf_get_start_cs() };
422        if ea != BADADDR { Some(ea.into()) } else { None }
423    }
424
425    pub fn start_instruction_pointer(&self) -> Option<Address> {
426        let ea = unsafe { idalib_inf_get_start_ip() };
427        if ea != BADADDR { Some(ea.into()) } else { None }
428    }
429
430    pub fn start_address(&self) -> Option<Address> {
431        let ea = unsafe { idalib_inf_get_start_ea() };
432        if ea != BADADDR { Some(ea.into()) } else { None }
433    }
434
435    pub fn start_stack_pointer(&self) -> Option<Address> {
436        let ea = unsafe { idalib_inf_get_start_sp() };
437        if ea != BADADDR { Some(ea.into()) } else { None }
438    }
439
440    pub fn main_address(&self) -> Option<Address> {
441        let ea = unsafe { idalib_inf_get_main() };
442        if ea != BADADDR { Some(ea.into()) } else { None }
443    }
444
445    pub fn min_address(&self) -> Address {
446        unsafe { idalib_inf_get_min_ea().into() }
447    }
448
449    pub fn max_address(&self) -> Address {
450        unsafe { idalib_inf_get_max_ea().into() }
451    }
452
453    pub fn omin_address(&self) -> Address {
454        unsafe { idalib_inf_get_omin_ea().into() }
455    }
456
457    pub fn omax_ea(&self) -> Address {
458        unsafe { idalib_inf_get_omax_ea().into() }
459    }
460
461    pub fn lowoff(&self) -> u64 {
462        unsafe { idalib_inf_get_lowoff().into() }
463    }
464
465    pub fn highoff(&self) -> u64 {
466        unsafe { idalib_inf_get_highoff().into() }
467    }
468
469    pub fn maxref(&self) -> u64 {
470        unsafe { idalib_inf_get_maxref().into() }
471    }
472
473    pub fn netdelta(&self) -> i64 {
474        unsafe { idalib_inf_get_netdelta().into() }
475    }
476
477    pub fn xrefnum(&self) -> u8 {
478        unsafe { idalib_inf_get_xrefnum() }
479    }
480
481    pub fn type_xrefnum(&self) -> u8 {
482        unsafe { idalib_inf_get_type_xrefnum() }
483    }
484
485    pub fn refcmtnum(&self) -> u8 {
486        unsafe { idalib_inf_get_refcmtnum() }
487    }
488
489    pub fn xrefflag(&self) -> u8 {
490        unsafe { idalib_inf_get_xrefflag() }
491    }
492
493    pub fn show_xref_seg(&self) -> bool {
494        unsafe { idalib_inf_show_xref_seg() }
495    }
496
497    pub fn show_xref_tmarks(&self) -> bool {
498        unsafe { idalib_inf_show_xref_tmarks() }
499    }
500
501    pub fn show_xref_fncoff(&self) -> bool {
502        unsafe { idalib_inf_show_xref_fncoff() }
503    }
504
505    pub fn show_xref_val(&self) -> bool {
506        unsafe { idalib_inf_show_xref_val() }
507    }
508
509    pub fn max_autoname_len(&self) -> u16 {
510        unsafe { idalib_inf_get_max_autoname_len() }
511    }
512
513    pub fn nametype(&self) -> i8 {
514        unsafe { idalib_inf_get_nametype() }
515    }
516
517    pub fn short_demnames(&self) -> u32 {
518        unsafe { idalib_inf_get_short_demnames() }
519    }
520
521    pub fn long_demnames(&self) -> u32 {
522        unsafe { idalib_inf_get_long_demnames() }
523    }
524
525    pub fn demnames(&self) -> u8 {
526        unsafe { idalib_inf_get_demnames() }
527    }
528
529    pub fn listnames(&self) -> u8 {
530        unsafe { idalib_inf_get_listnames() }
531    }
532
533    pub fn indent(&self) -> u8 {
534        unsafe { idalib_inf_get_indent() }
535    }
536
537    pub fn cmt_indent(&self) -> u8 {
538        unsafe { idalib_inf_get_cmt_indent() }
539    }
540
541    pub fn margin(&self) -> u16 {
542        unsafe { idalib_inf_get_margin() }
543    }
544
545    pub fn lenxref(&self) -> u16 {
546        unsafe { idalib_inf_get_lenxref() }
547    }
548
549    pub fn outflags(&self) -> u32 {
550        unsafe { idalib_inf_get_outflags() }
551    }
552
553    pub fn show_void(&self) -> bool {
554        unsafe { idalib_inf_show_void() }
555    }
556
557    pub fn show_auto(&self) -> bool {
558        unsafe { idalib_inf_show_auto() }
559    }
560
561    pub fn gen_null(&self) -> bool {
562        unsafe { idalib_inf_gen_null() }
563    }
564
565    pub fn show_line_pref(&self) -> bool {
566        unsafe { idalib_inf_show_line_pref() }
567    }
568
569    pub fn line_pref_with_seg(&self) -> bool {
570        unsafe { idalib_inf_line_pref_with_seg() }
571    }
572
573    pub fn gen_lzero(&self) -> bool {
574        unsafe { idalib_inf_gen_lzero() }
575    }
576
577    pub fn gen_org(&self) -> bool {
578        unsafe { idalib_inf_gen_org() }
579    }
580
581    pub fn gen_assume(&self) -> bool {
582        unsafe { idalib_inf_gen_assume() }
583    }
584
585    pub fn gen_tryblks(&self) -> bool {
586        unsafe { idalib_inf_gen_tryblks() }
587    }
588
589    pub fn cmtflg(&self) -> u8 {
590        unsafe { idalib_inf_get_cmtflg() }
591    }
592
593    pub fn show_repeatables(&self) -> bool {
594        unsafe { idalib_inf_show_repeatables() }
595    }
596
597    pub fn show_all_comments(&self) -> bool {
598        unsafe { idalib_inf_show_all_comments() }
599    }
600
601    pub fn hide_comments(&self) -> bool {
602        unsafe { idalib_inf_hide_comments() }
603    }
604
605    pub fn show_src_linnum(&self) -> bool {
606        unsafe { idalib_inf_show_src_linnum() }
607    }
608
609    pub fn test_mode(&self) -> bool {
610        unsafe { idalib_inf_test_mode() }
611    }
612
613    pub fn show_hidden_insns(&self) -> bool {
614        unsafe { idalib_inf_show_hidden_insns() }
615    }
616
617    pub fn show_hidden_funcs(&self) -> bool {
618        unsafe { idalib_inf_show_hidden_funcs() }
619    }
620
621    pub fn show_hidden_segms(&self) -> bool {
622        unsafe { idalib_inf_show_hidden_segms() }
623    }
624
625    pub fn limiter(&self) -> u8 {
626        unsafe { idalib_inf_get_limiter() }
627    }
628
629    pub fn is_limiter_thin(&self) -> bool {
630        unsafe { idalib_inf_is_limiter_thin() }
631    }
632
633    pub fn is_limiter_thick(&self) -> bool {
634        unsafe { idalib_inf_is_limiter_thick() }
635    }
636
637    pub fn is_limiter_empty(&self) -> bool {
638        unsafe { idalib_inf_is_limiter_empty() }
639    }
640
641    pub fn bin_prefix_size(&self) -> i16 {
642        unsafe { idalib_inf_get_bin_prefix_size().into() }
643    }
644
645    pub fn prefflag(&self) -> u8 {
646        unsafe { idalib_inf_get_prefflag() }
647    }
648
649    pub fn prefix_show_segaddr(&self) -> bool {
650        unsafe { idalib_inf_prefix_show_segaddr() }
651    }
652
653    pub fn prefix_show_funcoff(&self) -> bool {
654        unsafe { idalib_inf_prefix_show_funcoff() }
655    }
656
657    pub fn prefix_show_stack(&self) -> bool {
658        unsafe { idalib_inf_prefix_show_stack() }
659    }
660
661    pub fn prefix_truncate_opcode_bytes(&self) -> bool {
662        unsafe { idalib_inf_prefix_truncate_opcode_bytes() }
663    }
664
665    pub fn strlit_flags(&self) -> u8 {
666        unsafe { idalib_inf_get_strlit_flags() }
667    }
668
669    pub fn strlit_names(&self) -> bool {
670        unsafe { idalib_inf_strlit_names() }
671    }
672
673    pub fn strlit_name_bit(&self) -> bool {
674        unsafe { idalib_inf_strlit_name_bit() }
675    }
676
677    pub fn strlit_serial_names(&self) -> bool {
678        unsafe { idalib_inf_strlit_serial_names() }
679    }
680
681    pub fn unicode_strlits(&self) -> bool {
682        unsafe { idalib_inf_unicode_strlits() }
683    }
684
685    pub fn strlit_autocmt(&self) -> bool {
686        unsafe { idalib_inf_strlit_autocmt() }
687    }
688
689    pub fn strlit_savecase(&self) -> bool {
690        unsafe { idalib_inf_strlit_savecase() }
691    }
692
693    pub fn strlit_break(&self) -> u8 {
694        unsafe { idalib_inf_get_strlit_break() }
695    }
696
697    pub fn strlit_zeroes(&self) -> i8 {
698        unsafe { idalib_inf_get_strlit_zeroes() }
699    }
700
701    pub fn strtype(&self) -> i32 {
702        unsafe { idalib_inf_get_strtype() }
703    }
704
705    pub fn strlit_sernum(&self) -> u64 {
706        unsafe { idalib_inf_get_strlit_sernum().into() }
707    }
708
709    pub fn datatypes(&self) -> u64 {
710        unsafe { idalib_inf_get_datatypes().into() }
711    }
712
713    pub fn abibits(&self) -> u32 {
714        unsafe { idalib_inf_get_abibits() }
715    }
716
717    pub fn is_mem_aligned4(&self) -> bool {
718        unsafe { idalib_inf_is_mem_aligned4() }
719    }
720
721    pub fn pack_stkargs(&self) -> bool {
722        unsafe { idalib_inf_pack_stkargs() }
723    }
724
725    pub fn big_arg_align(&self) -> bool {
726        unsafe { idalib_inf_big_arg_align() }
727    }
728
729    pub fn stack_ldbl(&self) -> bool {
730        unsafe { idalib_inf_stack_ldbl() }
731    }
732
733    pub fn stack_varargs(&self) -> bool {
734        unsafe { idalib_inf_stack_varargs() }
735    }
736
737    pub fn is_hard_float(&self) -> bool {
738        unsafe { idalib_inf_is_hard_float() }
739    }
740
741    pub fn abi_set_by_user(&self) -> bool {
742        unsafe { idalib_inf_abi_set_by_user() }
743    }
744
745    pub fn use_gcc_layout(&self) -> bool {
746        unsafe { idalib_inf_use_gcc_layout() }
747    }
748
749    pub fn map_stkargs(&self) -> bool {
750        unsafe { idalib_inf_map_stkargs() }
751    }
752
753    pub fn huge_arg_align(&self) -> bool {
754        unsafe { idalib_inf_huge_arg_align() }
755    }
756
757    pub fn appcall_options(&self) -> u32 {
758        unsafe { idalib_inf_get_appcall_options() }
759    }
760
761    pub fn privrange_start_address(&self) -> Option<Address> {
762        let ea = unsafe { idalib_inf_get_privrange_start_ea() };
763        if ea != BADADDR { Some(ea.into()) } else { None }
764    }
765
766    pub fn privrange_end_address(&self) -> Option<Address> {
767        let ea = unsafe { idalib_inf_get_privrange_end_ea() };
768        if ea != BADADDR { Some(ea.into()) } else { None }
769    }
770
771    pub fn cc_id(&self) -> Compiler {
772        unsafe { mem::transmute(idalib_inf_get_cc_id() & COMP_MASK) }
773    }
774
775    pub fn cc_cm(&self) -> u8 {
776        unsafe { idalib_inf_get_cc_cm() }
777    }
778
779    pub fn cc_size_i(&self) -> u8 {
780        unsafe { idalib_inf_get_cc_size_i() }
781    }
782
783    pub fn cc_size_b(&self) -> u8 {
784        unsafe { idalib_inf_get_cc_size_b() }
785    }
786
787    pub fn cc_size_e(&self) -> u8 {
788        unsafe { idalib_inf_get_cc_size_e() }
789    }
790
791    pub fn cc_defalign(&self) -> u8 {
792        unsafe { idalib_inf_get_cc_defalign() }
793    }
794
795    pub fn cc_size_s(&self) -> u8 {
796        unsafe { idalib_inf_get_cc_size_s() }
797    }
798
799    pub fn cc_size_l(&self) -> u8 {
800        unsafe { idalib_inf_get_cc_size_l() }
801    }
802
803    pub fn cc_size_ll(&self) -> u8 {
804        unsafe { idalib_inf_get_cc_size_ll() }
805    }
806
807    pub fn cc_size_ldbl(&self) -> u8 {
808        unsafe { idalib_inf_get_cc_size_ldbl() }
809    }
810
811    pub fn procname(&self) -> String {
812        unsafe { idalib_inf_get_procname() }
813    }
814
815    pub fn strlit_pref(&self) -> String {
816        unsafe { idalib_inf_get_strlit_pref() }
817    }
818
819    pub fn input_file_md5(&self) -> [u8; 16] {
820        let mut md5 = [0u8; 16];
821        unsafe {
822            retrieve_input_file_md5(md5.as_mut_ptr());
823        }
824        md5
825    }
826
827    pub fn input_file_sha256(&self) -> [u8; 32] {
828        let mut sha256 = [0u8; 32];
829        unsafe {
830            retrieve_input_file_sha256(sha256.as_mut_ptr());
831        }
832        sha256
833    }
834
835    pub fn input_file_path(&self) -> String {
836        unsafe { idalib_get_input_file_path() }
837    }
838
839    pub fn input_file_size(&self) -> usize {
840        unsafe { retrieve_input_file_size() }
841    }
842}
843
844pub struct MetadataMut<'a> {
845    _marker: PhantomData<&'a mut IDB>,
846}
847
848impl<'a> MetadataMut<'a> {
849    pub(crate) fn new() -> Self {
850        Self {
851            _marker: PhantomData,
852        }
853    }
854
855    pub fn set_show_all_comments(&mut self) -> bool {
856        unsafe { idalib_inf_set_show_all_comments() }
857    }
858
859    pub fn set_show_hidden_insns(&mut self) -> bool {
860        unsafe { idalib_inf_set_show_hidden_insns() }
861    }
862
863    pub fn set_show_hidden_funcs(&mut self) -> bool {
864        unsafe { idalib_inf_set_show_hidden_funcs() }
865    }
866
867    pub fn set_show_hidden_segms(&mut self) -> bool {
868        unsafe { idalib_inf_set_show_hidden_segms() }
869    }
870}