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