95#define saRel128Bytes 11
96#define saRel512Bytes 12
97#define saRel1024Bytes 13
98#define saRel2048Bytes 14
99#define saRel_MAX_ALIGN_CODE saRel2048Bytes
117#define sc_MAX_COMB_CODE scPub3
125#define SEGPERM_EXEC 1
126#define SEGPERM_WRITE 2
127#define SEGPERM_READ 4
128#define SEGPERM_MAXVAL (SEGPERM_EXEC + SEGPERM_WRITE + SEGPERM_READ)
135#define SEG_MAX_BITNESS_CODE 2
156#define SFL_COMORG 0x01
180#define SFL_HIDDEN 0x04
192#define SFL_DEBUG 0x08
204#define SFL_LOADER 0x10
215#define SFL_HIDETYPE 0x20
226#define SFL_HEADER 0x40
240 {
return (
flags & (SFL_DEBUG|SFL_LOADER)) == SFL_DEBUG; }
276#define SEG_MAX_SEGTYPE_CODE SEG_IMEM
461 if ( selector == BADSEL )
554#define ADDSEG_NOSREG 0x0001
556#define ADDSEG_OR_DIE 0x0002
557#define ADDSEG_NOTRUNC 0x0004
559#define ADDSEG_QUIET 0x0008
560#define ADDSEG_FILLGAP 0x0010
567#define ADDSEG_SPARSE 0x0020
572#define ADDSEG_NOAA 0x0040
573#define ADDSEG_IDBENC 0x0080
636#define SEGMOD_KILL 0x0001
637#define SEGMOD_KEEP 0x0002
638#define SEGMOD_SILENT 0x0004
639#define SEGMOD_KEEP0 0x0008
640#define SEGMOD_KEEPSEL 0x0010
641#define SEGMOD_NOMOVE 0x0020
643#define SEGMOD_SPARSE 0x0040
793#define MSF_SILENT 0x0001
794#define MSF_NOFIX 0x0002
795#define MSF_LDKEEP 0x0004
796#define MSF_FIXONCE 0x0008
798#define MSF_PRIORITY 0x0020
800#define MSF_NETNODES 0x0080
828#define CSS_NORANGE -2
839#define SNAP_ALL_SEG 0
840#define SNAP_LOAD_SEG 1
841#define SNAP_CUR_SEG 2
947#define MAX_SEGM_TRANSLATIONS 64
~lock_segment(void)
Definition segment.hpp:354
lock_segment(const segment_t *_segm)
Definition segment.hpp:350
Describes a program segment.
Definition segment.hpp:69
uchar comb
Segment combination codes
Definition segment.hpp:102
bool update(void)
Update segment information.
Definition segment.hpp:1216
uchar align
Segment alignment codes
Definition segment.hpp:77
void set_header_segm(bool on)
Definition segment.hpp:232
uchar type
segment type (see Segment types).
Definition segment.hpp:253
int abits(void) const
Get number of address bits.
Definition segment.hpp:144
sel_t defsr[SREG_NUM]
default segment register values.
Definition segment.hpp:249
DECLARE_COMPARISONS(segment_t)
uval_t name
use get/set_segm_name() functions
Definition segment.hpp:71
uchar bitness
Number of bits in the segment addressing.
Definition segment.hpp:131
bool is_visible_segm(void) const
Definition segment.hpp:185
void set_loader_segm(bool ldrseg)
Definition segment.hpp:210
bool is_16bit(void) const
Is a 16-bit segment?
Definition segment.hpp:138
void set_debugger_segm(bool debseg)
Definition segment.hpp:199
bool is_hidden_segtype(void) const
Definition segment.hpp:220
void clr_ob_ok(void)
Definition segment.hpp:175
uchar perm
Segment permissions (0 means no information)
Definition segment.hpp:120
bool is_header_segm(void) const
Definition segment.hpp:231
uval_t orgbase
this field is IDP dependent.
Definition segment.hpp:73
void set_ob_ok(void)
Definition segment.hpp:174
void clr_comorg(void)
Definition segment.hpp:163
bool comorg(void) const
Definition segment.hpp:161
bool is_ephemeral_segm(void) const
Ephemeral segments are not analyzed automatically (no flirt, no functions unless required,...
Definition segment.hpp:239
void set_visible_segm(bool visible)
Definition segment.hpp:186
void set_comorg(void)
Definition segment.hpp:162
bool is_loader_segm(void) const
Definition segment.hpp:209
uval_t sclass
use get/set_segm_class() functions
Definition segment.hpp:72
int abytes(void) const
Get number of address bytes.
Definition segment.hpp:146
bool is_64bit(void) const
Is a 64-bit segment?
Definition segment.hpp:142
segment_t(void)
Constructor.
Definition segment.hpp:288
bgcolor_t color
the segment color
Definition segment.hpp:279
bool is_32bit(void) const
Is a 32-bit segment?
Definition segment.hpp:140
sel_t sel
segment selector - should be unique.
Definition segment.hpp:242
ushort flags
Segment flags
Definition segment.hpp:152
bool ob_ok(void) const
Definition segment.hpp:173
void set_hidden_segtype(bool hide)
Definition segment.hpp:221
bool is_debugger_segm(void) const
Definition segment.hpp:197
move_segm_code_t
Definition segment.hpp:757
@ MOVE_SEGM_MAPPING
Memory mapping ranges of addresses hinder segment movement.
Definition segment.hpp:768
@ MOVE_SEGM_LOADER
The segment has been moved but the loader complained.
Definition segment.hpp:763
@ MOVE_SEGM_ROOM
Not enough free room at the target address.
Definition segment.hpp:760
@ MOVE_SEGM_PARAM
The specified segment does not exist.
Definition segment.hpp:759
@ MOVE_SEGM_OK
all ok
Definition segment.hpp:758
@ MOVE_SEGM_ORPHAN
Orphan bytes hinder segment movement.
Definition segment.hpp:765
@ MOVE_SEGM_IDP
IDP module forbids moving the segment.
Definition segment.hpp:761
@ MOVE_SEGM_INVAL
Invalid argument (delta/target does not fit the address space)
Definition segment.hpp:769
@ MOVE_SEGM_CHUNK
Too many chunks are defined, can't move.
Definition segment.hpp:762
@ MOVE_SEGM_ODD
Cannot move segments by an odd number of bytes.
Definition segment.hpp:764
@ MOVE_SEGM_SOURCEFILES
Source files ranges of addresses hinder segment movement.
Definition segment.hpp:767
@ MOVE_SEGM_DEBUG
Debugger segments cannot be moved.
Definition segment.hpp:766
idaman const char * end
Definition pro.h:1001
int code
Definition fpro.h:88
idaman size_t n
Definition pro.h:997
idaman bool ida_export set_segm_addressing(segment_t *s, size_t bitness)
Change segment addressing mode (16, 32, 64 bits).
idaman ea_t ida_export get_segm_base(const segment_t *s)
Get segment base linear address.
idaman ea_t ida_export get_segm_para(const segment_t *s)
Get segment base paragraph.
idaman const char *ida_export get_segment_combination(uchar comb)
Get text representation of segment combination code.
idaman const char *ida_export get_segment_alignment(uchar align)
Get text representation of segment alignment code.
idaman void ida_export set_segment_cmt(const segment_t *s, const char *cmt, bool repeatable)
Set segment comment.
idaman ssize_t ida_export get_segment_cmt(qstring *buf, const segment_t *s, bool repeatable)
Get segment comment.
idaman void ida_export std_out_segm_footer(struct outctx_t &ctx, segment_t *seg)
Generate segment footer line as a comment line.
idaman sel_t ida_export get_group_selector(sel_t grpsel)
Get common selector for a group of segments.
idaman int ida_export set_group_selector(sel_t grp, sel_t sel)
Create a new group of segments (used OMF files).
idaman segment_t *ida_export get_prev_seg(ea_t ea)
Get pointer to the previous segment.
idaman segment_t *ida_export get_first_seg(void)
Get pointer to the first segment.
idaman segment_t *ida_export get_next_seg(ea_t ea)
Get pointer to the next segment.
idaman segment_t *ida_export get_last_seg(void)
Get pointer to the last segment.
idaman int ida_export change_segment_status(segment_t *s, bool is_deb_segm)
Convert a debugger segment to a regular segment and vice versa.
idaman const char *ida_export move_segm_strerror(move_segm_code_t code)
Return string describing error MOVE_SEGM_... code.
idaman bool ida_export add_segm(ea_t para, ea_t start, ea_t end, const char *name, const char *sclass, int flags=0)
Add a new segment, second form.
idaman segment_t *ida_export get_segm_by_name(const char *name)
Get pointer to segment by its name.
idaman int ida_export get_segm_qty(void)
Get number of segments.
idaman bool ida_export add_segm_ex(segment_t *NONNULL s, const char *name, const char *sclass, int flags)
Add a new segment.
idaman bool ida_export move_segm_start(ea_t ea, ea_t newstart, int mode)
Move segment start.
idaman bool ida_export take_memory_snapshot(int type)
Take a memory snapshot of the running process.
idaman bool ida_export set_segm_end(ea_t ea, ea_t newend, int flags)
Set segment end address.
idaman segment_t *ida_export getnseg(int n)
Get pointer to segment by its number.
idaman segment_t *ida_export getseg(ea_t ea)
Get pointer to segment by linear address.
idaman int ida_export get_segm_num(ea_t ea)
Get number of segment by address.
idaman bool ida_export del_segm(ea_t ea, int flags)
Delete a segment.
idaman bool ida_export is_miniidb(void)
Is the database a miniidb created by the debugger?
idaman bool ida_export set_segm_base(segment_t *s, ea_t newbase)
Internal function.
idaman move_segm_code_t ida_export rebase_program(adiff_t delta, int flags)
Rebase the whole program by 'delta' bytes.
idaman move_segm_code_t ida_export move_segm(segment_t *s, ea_t to, int flags=0)
This function moves all information to the new address.
idaman bool ida_export set_segm_start(ea_t ea, ea_t newstart, int flags)
Set segment start address.
idaman ssize_t ida_export get_segm_name(qstring *buf, const segment_t *s, int flags=0)
Get true segment name by pointer to segment.
idaman int ida_export set_segm_name(segment_t *s, const char *name, int flags=0)
Rename segment.
ssize_t idaapi get_visible_segm_name(qstring *buf, const segment_t *s)
Get segment name by pointer to segment.
Definition segment.hpp:1067
ssize_t get_segm_expr(qstring *buf, ea_t from, sel_t sel)
Get colored segment name expression in the form (segname + displacement).
idaman sel_t ida_export allocate_selector(ea_t segbase)
Allocate a selector for a segment unconditionally.
ea_t idaapi sel2ea(sel_t selector)
Get mapping of a selector as a linear address.
Definition segment.hpp:459
idaman segment_t *ida_export get_segm_by_sel(sel_t selector)
Get pointer to segment structure.
idaman void ida_export del_selector(sel_t selector)
Delete mapping of a selector.
idaman ea_t ida_export enumerate_segments_with_selector(sel_t selector, ea_t(idaapi *func)(segment_t *s, void *ud), void *ud=nullptr)
Enumerate all segments with the specified selector.
idaman size_t ida_export get_selector_qty(void)
Get number of defined selectors.
idaman int ida_export enumerate_selectors(int(idaapi *func)(sel_t sel, ea_t para))
Enumerate all selectors from the translation table.
idaman ea_t ida_export sel2para(sel_t selector)
Get mapping of a selector.
idaman sel_t ida_export setup_selector(ea_t segbase)
Allocate a selector for a segment if necessary.
idaman bool ida_export getn_selector(sel_t *sel, ea_t *base, int n)
Get description of selector (0..get_selector_qty()-1)
idaman sel_t ida_export find_free_selector(void)
Find first unused selector.
idaman int ida_export set_selector(sel_t selector, ea_t paragraph)
Set mapping of selector to a paragraph.
idaman sel_t ida_export find_selector(ea_t base)
Find a selector that has mapping to the specified paragraph.
idaman void ida_export set_visible_segm(segment_t *s, bool visible)
See SFL_HIDDEN.
idaman bool ida_export is_segm_locked(const segment_t *segm)
Is a segment pointer locked?
idaman void ida_export lock_segm(const segment_t *segm, bool lock)
Lock segment pointer Locked pointers are guaranteed to remain valid until they are unlocked.
bool is_finally_visible_segm(segment_t *s)
See SFL_HIDDEN, SCF_SHHID_SEGM.
Definition segment.hpp:318
idaman bool ida_export is_spec_ea(ea_t ea)
Does the address belong to a segment with a special type?
idaman bool ida_export is_spec_segm(uchar seg_type)
Has segment a special type?
bool is_visible_segm(segment_t *s)
See SFL_HIDDEN.
Definition segment.hpp:316
CASSERT(sizeof(segment_t)==192)
idaman bool ida_export add_segment_translation(ea_t segstart, ea_t mappedseg)
Add segment translation.
idaman void ida_export del_segment_translations(ea_t segstart)
Delete the translation list.
idaman ssize_t ida_export get_segment_translations(eavec_t *transmap, ea_t segstart)
Get segment translation list.
idaman bool ida_export set_segment_translations(ea_t segstart, const eavec_t &transmap)
Set new translation list.
idaman int ida_export set_segm_class(segment_t *s, const char *sclass, int flags=0)
Set segment class.
idaman uchar ida_export segtype(ea_t ea)
Get segment type.
idaman ssize_t ida_export get_segm_class(qstring *buf, const segment_t *s)
Get segment class.
const tinfo_t & type
Definition hexrays.hpp:7301
Contains the inf structure definition and some functions common to the whole IDA project.
ea_t idaapi to_ea(sel_t reg_cs, uval_t reg_ip)
Convert (sel,off) value to a linear address.
Definition ida.hpp:1136
uchar inf_get_cmtflg()
Definition ida.hpp:889
uval_t uval_t
Definition kernwin.hpp:1878
asize_t size
Definition kernwin.hpp:6339
uint32 bgcolor_t
background color in RGB
Definition pro.h:5012
int64 adiff_t
Definition pro.h:424
uint64 ea_t
Definition pro.h:421
unsigned char uchar
unsigned 8 bit value
Definition pro.h:337
uint64 sel_t
Definition pro.h:422
qvector< ea_t > eavec_t
vector of addresses
Definition pro.h:2764
ptrdiff_t ssize_t
Signed size_t - used to check for size overflows when the counter becomes negative.
Definition pro.h:381
unsigned short ushort
unsigned 16 bit value
Definition pro.h:338
void idaapi setflag(T &where, U bit, bool cnd)
Set a 'bit' in 'where' if 'value' if not zero.
Definition pro.h:1527
_qstring< char > qstring
regular string
Definition pro.h:3694
Contains the definition of range_t.
idaman ea_t ida_export correct_address(ea_t ea, ea_t from, ea_t to, ea_t size, bool skip_check=false)
bool is_ephemeral_segm(ea_t ea)
Does the address belong to an ephemeral segment?
Definition segment.hpp:1204
idaman bool ida_export update_segm(segment_t *s)
bool is_debugger_segm(ea_t ea)
Does the address belong to a debug segment?
Definition segment.hpp:1196
idaman adiff_t ida_export segm_adjust_diff(const segment_t *s, adiff_t delta)
Truncate and sign extend a delta depending on the segment.
idaman ea_t ida_export segm_adjust_ea(const segment_t *s, ea_t ea)
Truncate an address depending on the segment.
range_t(ea_t ea1=0, ea_t ea2=0)
Definition range.hpp:39