|
IDA C++ SDK 9.2
|
Add/Delete/Modify segments. More...
Topics | |
| Add segment flags | |
| Passed as 'flags' parameter to add_segm_ex() | |
| Segment modification flags | |
| Used by functions in Segment manipulation functions. | |
| Get segment info flags | |
| Flags for get_segment_info() to request additional string fields. | |
Functions | |
| idaman DEPRECATED 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 | add_segment_ex (segment_info_t *si, int flags) |
| Add a new segment using segment_info_t. | |
| 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 bool ida_export | del_segm (ea_t ea, int flags) |
| Delete a segment. | |
| idaman int ida_export | get_segm_qty () |
| Get number of segments. | |
| idaman DEPRECATED segment_t *ida_export | getseg (ea_t ea) |
| Get pointer to segment by linear address. | |
| idaman bool ida_export | get_segment_info (segment_info_t *out, ea_t ea, int flags=0) |
| Fill segment_info_t structure for segment at the specified address. | |
| idaman bool ida_export | set_segment_info (segment_info_t *si, int flags=0) |
| Apply segment_info_t modifications to the database. | |
| idaman ea_t ida_export | get_segment_ea (ea_t ea) |
| Get segment start address. | |
| idaman DEPRECATED segment_t *ida_export | getnseg (int n) |
| Get pointer to segment by its number. | |
| idaman bool ida_export | get_segment_info_by_num (segment_info_t *out, int n, int flags=0) |
| Fill segment_info_t structure for segment by its number. | |
| idaman ea_t ida_export | get_segment_ea_by_num (int n) |
| Get segment start address by its number. | |
| idaman int ida_export | get_segm_num (ea_t ea) |
| Get number of segment by address. | |
| idaman DEPRECATED segment_t *ida_export | get_next_seg (ea_t ea) |
| Get pointer to the next segment. | |
| idaman ea_t ida_export | get_next_segment_ea (ea_t seg_ea) |
| Get start address of the next segment. | |
| idaman DEPRECATED segment_t *ida_export | get_prev_seg (ea_t ea) |
| Get pointer to the previous segment. | |
| idaman ea_t ida_export | get_prev_segment_ea (ea_t seg_ea) |
| Get start address of the previous segment. | |
| idaman DEPRECATED segment_t *ida_export | get_first_seg () |
| Get pointer to the first segment. | |
| idaman ea_t ida_export | get_first_segment_ea () |
| Get start address of the first segment. | |
| idaman DEPRECATED segment_t *ida_export | get_last_seg () |
| Get pointer to the last segment. | |
| idaman ea_t ida_export | get_last_segment_ea () |
| Get start address of the last segment. | |
| idaman DEPRECATED segment_t *ida_export | get_segm_by_name (const char *name) |
| Get pointer to segment by its name. | |
| idaman ea_t ida_export | get_segment_ea_by_name (const char *name) |
| Get segment start address by its name. | |
Add/Delete/Modify segments.
| idaman DEPRECATED bool ida_export add_segm_ex | ( | segment_t *NONNULL | s, |
| const char * | name, | ||
| const char * | sclass, | ||
| int | flags ) |
Add a new segment.
| s | pointer to filled segment structure. segment selector should have proper mapping (see set_selector()).
|
| name | name of new segment. may be nullptr. if specified, the segment is immediately renamed |
| sclass | class of the segment. may be nullptr. if specified, the segment class is immediately changed |
| flags | Add segment flags |
| 1 | ok |
| 0 | failed, a warning message is displayed The specified default segment register values may be modified by processor modules (see ev_creating_segm). Also, if the default data segment value is BADSEL, it will be changed to the selector of the newly created segment. This ensures that the data segment is always correctly set, which is a good default for most processors. |
Add a new segment using segment_info_t.
If a segment already exists at the specified range of addresses, this segment will be truncated. Instructions and data in the old segment will be deleted if the new segment has another addressing mode or another segment base address. The segment name and class and comments are taken from the segment_info_t structure.
| si | segment_info_t structure containing segment properties. Required fields: start_ea, end_ea, sel (or use setup_selector()). Optional fields: name, sclass, comments, align, comb, bitness, type, perm, flags, orgbase, defsr, color. segment selector should have proper mapping (see set_selector()).
|
| flags | Add segment flags |
| true | segment was created successfully |
| false | failed, a warning message is displayed The specified default segment register values may be modified by processor modules (see ev_creating_segment). Also, if the default data segment value is BADSEL, it will be changed to the selector of the newly created segment. This ensures that the data segment is always correctly set, which is a good default for most processors. |
| 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.
Segment alignment is set to #saRelByte. Segment combination is "public" or "stack" (if segment class is "STACK"). Addressing mode of segment is taken as default (16-bit or 32-bit). Default segment registers are set to #BADSEL. If a segment already exists at the specified range of addresses, this segment will be truncated. Instructions and data in the old segment will be deleted if the new segment has another addressing mode or another segment base address.
| para | segment base paragraph. if paragraph can't fit in 16-bit, then a new selector is allocated and mapped to the paragraph. |
| start | start address of the segment. if start==#BADADDR then start <- to_ea(para,0). |
| end | end address of the segment. end address should be higher than start address. For emulate empty segments, use #SEG_NULL segment type. If the end address is lower than start address, then fail. If end==#BADADDR, then a segment up to the next segment will be created (if the next segment doesn't exist, then 1 byte segment will be created). If 'end' is too high and the new segment would overlap the next segment, 'end' is adjusted properly. |
| name | name of new segment. may be nullptr |
| sclass | class of the segment. may be nullptr. type of the new segment is modified if class is one of predefined names:
|
| flags | Add segment flags |
| 1 | ok |
| 0 | failed, a warning message is displayed |
Delete a segment.
| ea | any address belonging to the segment |
| flags | Segment modification flags |
| 1 | ok |
| 0 | failed, no segment at 'ea'. |
| idaman int ida_export get_segm_qty | ( | ) |
Get number of segments.
Get pointer to segment by linear address.
| ea | linear address belonging to the segment |
Fill segment_info_t structure for segment at the specified address.
By default, only fields present in segment_t are filled. Use GSI_* flags to request additional string fields (name, class, comments).
| out | output structure to fill (can be nullptr) |
| ea | linear address belonging to the segment |
| flags | combination of Get segment info flags flags (default: 0) |
Apply segment_info_t modifications to the database.
Uses start_ea as the segment handle.
| si | segment_info_t with modifications (set via set_* methods) |
| flags | combination of Add segment flags flags (default: 0) |
Get segment start address.
| ea | linear address belonging to the segment |
Get pointer to segment by its number.
| n | segment number in the range (0..get_segm_qty()-1) |
Fill segment_info_t structure for segment by its number.
By default, only fields present in segment_t are filled. Use GSI_* flags to request additional string fields (name, class, comments).
| out | output structure to fill (can be nullptr) |
| n | segment number (0..get_segm_qty()-1) |
| flags | combination of Get segment info flags flags (default: 0) |
Get segment start address by its number.
The returned address can be used as a handle for other segment_* functions.
| n | segment number in the range (0..get_segm_qty()-1) |
Get number of segment by address.
| ea | linear address belonging to the segment |
Get pointer to the next segment.
Get start address of the next segment.
| seg_ea | linear address belonging to the segment |
Get pointer to the previous segment.
Get start address of the previous segment.
| seg_ea | linear address belonging to the segment |
| idaman DEPRECATED segment_t *ida_export get_first_seg | ( | ) |
Get pointer to the first segment.
| idaman ea_t ida_export get_first_segment_ea | ( | ) |
Get start address of the first segment.
The returned address can be used as a handle for other segment_* functions.
| idaman DEPRECATED segment_t *ida_export get_last_seg | ( | ) |
Get pointer to the last segment.
| idaman ea_t ida_export get_last_segment_ea | ( | ) |
Get start address of the last segment.
| idaman DEPRECATED segment_t *ida_export get_segm_by_name | ( | const char * | name | ) |
Get pointer to segment by its name.
| name | segment name. may be nullptr. |
| idaman ea_t ida_export get_segment_ea_by_name | ( | const char * | name | ) |
Get segment start address by its name.
If there are several segments with the same name, returns the first of them.
| name | segment name (may be nullptr) |