vdui_t Struct Reference

Information about pseudocode window. More...

List of all members.

Public Member Functions

bool visible (void) const
 Is the pseudocode window visible? if not, it might be invisible or destroyed.
bool valid (void) const
 Does the pseudocode window contain valid code? It can become invalid if the function type gets changed in IDA.
bool locked (void) const
 Does the pseudocode window contain valid code? We lock windows before modifying them.
void set_visible (bool v)
void set_valid (bool v)
void set_locked (bool v)
void __fastcall refresh_view (bool redo_mba)
 Refresh pseudocode window.
void __fastcall refresh_ctext (bool activate=true)
 Refresh pseudocode window.
void switch_to (cfunc_t *f)
 Display the specified pseudocode.
bool in_ctree (void) const
 Is the current item a statement?
cnumber_tget_number (void) const
 Get current number.
void __fastcall clear (void)
 Clear the pseudocode window.
bool __fastcall refresh_cpos (input_device_t idv)
 Refresh the current position.
bool __fastcall get_current_item (input_device_t idv)
 Get current item.
bool __fastcall ui_rename_lvar (lvar_t *v)
 Rename local variable.
bool __fastcall rename_lvar (lvar_t *v, const char *name, bool is_user_name)
 Rename local variable.
bool __fastcall ui_set_lvar_type (lvar_t *v)
 Set local variable type.
bool __fastcall set_lvar_type (lvar_t *v, const typestring &type)
 Set local variable type.
bool __fastcall ui_edit_lvar_cmt (lvar_t *v)
 Set local variable comment.
bool __fastcall set_lvar_cmt (lvar_t *v, const char *cmt)
 Set local variable comment.
bool __fastcall ui_map_lvar (lvar_t *v)
 Map a local variable to another.
bool __fastcall ui_unmap_lvar (lvar_t *v)
 Unmap a local variable.
bool __fastcall map_lvar (lvar_t *from, lvar_t *to)
 Map a local variable to another.
bool __fastcall set_strmem_type (struc_t *sptr, member_t *mptr)
 Set structure field type.
bool __fastcall rename_strmem (struc_t *sptr, member_t *mptr)
 Rename structure field.
bool __fastcall set_global_type (ea_t ea)
 Set global item type.
bool __fastcall rename_global (ea_t ea)
 Rename global item.
bool __fastcall rename_label (int label)
 Rename a label.
bool __fastcall jump_enter (input_device_t idv, bool new_window)
 Process the Enter key.
bool __fastcall ctree_to_disasm (void)
 Jump to disassembly.
bool __fastcall push_current_location (input_device_t idv)
 Push the current location into the navigation history.
bool __fastcall pop_current_location (void)
 Pop a location from the navigation history and jump to it.
cmt_type_t __fastcall calc_cmt_type (size_t lnnum, cmt_type_t cmttype) const
 Check if the specified line can have a comment.
bool __fastcall edit_cmt (const treeloc_t &loc)
 Edit an indented comment.
bool __fastcall edit_func_cmt (void)
 Edit a function comment.
bool __fastcall del_orphan_cmts (void)
 Delete all orphan comments.
bool __fastcall set_num_radix (int base)
 Change number base.
bool __fastcall set_num_enum (void)
 Convert number to symbolic constant.
bool __fastcall set_num_stroff (void)
 Convert number to structure field offset.
bool __fastcall invert_sign (void)
 Negate a number.
bool __fastcall collapse_item (bool hide)
 Collapse/uncollapse item.
bool __fastcall split_item (bool split)
 Split/unsplit item.
bool __fastcall set_vargloc_end (ea_t ea, argloc_t ida_argloc)
 Force number of argmuments of a variadic call.

Public Attributes

TFormform
 attention, may point to a destroyed form check the visibility before proceeding.
int flags
 Properties of pseudocode window
int view_idx
 pseudocode window index (0..)
TCustomControlmicroview
 unused in the current version
TCustomControlct
 pseudocode view
TCustomControlcv
 codeview control
mbl_array_tmba
 pointer to underlying microcode
cfunc_tcfunc
 pointer to function object
strvec_t sv
 decompilation output: function text
int hdrlines
 number of lines in the declaration area
int code
 result of the last micro_request(). See Microcode error codes
ctext_position_t cpos
 Current ctext position.
ctree_item_t head
 First ctree item on the current line (for block comments).
ctree_item_t item
 Current ctree item.
ctree_item_t tail
 Tail ctree item on the current line (for indented comments).
history_t history
 Nagivation history for pseudocode window.

Detailed Description

Information about pseudocode window.

Examples:

hexrays_sample3.cpp, hexrays_sample5.cpp, and hexrays_sample6.cpp.

Definition at line 2730 of file hexrays.hpp.


Member Function Documentation

cmt_type_t __fastcall vdui_t::calc_cmt_type ( size_t  lnnum,
cmt_type_t  cmttype 
) const

Check if the specified line can have a comment.

Due to the coordinate system for comments (http://hexblog.com/2007/08/coordinate_system_for_hexrays.html) some function lines can not have comments. This function checks if a comment can be attached to the specified line

Returns:
possible comment types
Parameters:
lnnum line number (0 based)
cmttype comment types to check

Definition at line 5002 of file hexrays.hpp.

References hexdsp.

void __fastcall vdui_t::clear ( void   ) 

Clear the pseudocode window.

It deletes the current function and microcode.

Definition at line 4876 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::collapse_item ( bool  hide  ) 

Collapse/uncollapse item.

This function collapses the current item.

Returns:
false if failed.

Definition at line 5050 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::ctree_to_disasm ( void   ) 

Jump to disassembly.

This function jumps to the address in the disassembly window which corresponds to the current item. The current item is determined based on the current keyboard cursor position.

Returns:
false if failed

Definition at line 4984 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::del_orphan_cmts ( void   ) 

Delete all orphan comments.

Delete all orphan comments and refresh the screen.

Returns:
true

Definition at line 5020 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::edit_cmt ( const treeloc_t loc  ) 

Edit an indented comment.

This function displays a dialog box and allows the user to edit the comment for the specified ctree location.

Returns:
false if failed or cancelled
Parameters:
loc comment location

Definition at line 5008 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::edit_func_cmt ( void   ) 

Edit a function comment.

This function displays a dialog box and allows the user to edit the function comment.

Returns:
false if failed or cancelled

Definition at line 5014 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::get_current_item ( input_device_t  idv  ) 

Get current item.

This function refreshes the cpos, item, tail fields.

Returns:
false if failed
Parameters:
idv keyboard or mouse
See also:
cfunc_t::get_line_item()
Examples:
hexrays_sample5.cpp.

Definition at line 4888 of file hexrays.hpp.

References hexdsp.

cnumber_t * vdui_t::get_number ( void   )  const

Get current number.

If the current item is a number, return pointer to it.

Returns:
NULL if the current item is not a number

Definition at line 4870 of file hexrays.hpp.

References hexdsp.

bool vdui_t::in_ctree ( void   )  const

Is the current item a statement?

Returns:
false if the cursor is in the local variable/type declaration area
true if the cursor is in the statement area

Definition at line 2804 of file hexrays.hpp.

References cpos, hdrlines, and ctext_position_t::in_ctree().

bool __fastcall vdui_t::invert_sign ( void   ) 

Negate a number.

This function negates the current number.

Returns:
false if failed.

Definition at line 5044 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::jump_enter ( input_device_t  idv,
bool  new_window 
)

Process the Enter key.

This function jumps to the definition of the item under the cursor. If the current item is a function, it will be decompiled. If the current item is a global data, its disassemly text will be displayed.

Returns:
false if failed
Parameters:
idv what cursor must be used, the keyboard or the mouse
new_window if true, new pseudocode window will open

Definition at line 4978 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::map_lvar ( lvar_t from,
lvar_t to 
)

Map a local variable to another.

This function permanently maps one lvar to another. All occurrences of the mapped variable are replaced by the new variable

Returns:
false if failed
Parameters:
from the variable being mapped
to the variable to map to. if NULL, unmaps the variable

Definition at line 4942 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::pop_current_location ( void   ) 

Pop a location from the navigation history and jump to it.

Returns:
false if failed

Definition at line 4996 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::push_current_location ( input_device_t  idv  ) 

Push the current location into the navigation history.

Returns:
false if failed
Parameters:
idv how to determine the current item

Definition at line 4990 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::refresh_cpos ( input_device_t  idv  ) 

Refresh the current position.

This function refreshes the cpos field.

Returns:
false if failed
Parameters:
idv keyboard or mouse

Definition at line 4882 of file hexrays.hpp.

References hexdsp.

void __fastcall vdui_t::refresh_ctext ( bool  activate = true  ) 

Refresh pseudocode window.

This function refreshes the pseudocode window by regenerating its text from cfunc_t. Use it after modifying cfunc_t from a plugin.

See also:
refresh_view()
Examples:
hexrays_sample3.cpp.

Definition at line 4858 of file hexrays.hpp.

References hexdsp.

void __fastcall vdui_t::refresh_view ( bool  redo_mba  ) 

Refresh pseudocode window.

This is the highest level refresh function. It causes the most profound refresh possible and can lead to redecompilation of the current function. Please consider using refresh_ctext() if you need a more superficial refresh.

Parameters:
redo_mba true means to redecompile the current function
false means to rebuild ctree without regenerating microcode
See also:
refresh_ctext()

Definition at line 4852 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::rename_global ( ea_t  ea  ) 

Rename global item.

This function displays a dialog box and allows the user to rename a global item (data or function).

Returns:
false if failed or cancelled
Parameters:
ea address of the global item

Definition at line 4966 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::rename_label ( int  label  ) 

Rename a label.

This function displays a dialog box and allows the user to rename a statement label.

Returns:
false if failed or cancelled
Parameters:
label label number

Definition at line 4972 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::rename_lvar ( lvar_t v,
const char *  name,
bool  is_user_name 
)

Rename local variable.

This function permanently renames a local variable.

Returns:
false if failed
Parameters:
v pointer to local variable
name new variable name
is_user_name use true to save the new name into the database

Definition at line 4900 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::rename_strmem ( struc_t *  sptr,
member_t *  mptr 
)

Rename structure field.

This function displays a dialog box and allows the user to rename a structure field.

Returns:
false if failed or cancelled
Parameters:
sptr pointer to structure
mptr pointer to structure member

Definition at line 4954 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::set_global_type ( ea_t  ea  ) 

Set global item type.

This function displays a dialog box and allows the user to change the type of a global item (data or function).

Returns:
false if failed or cancelled
Parameters:
ea address of the global item

Definition at line 4960 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::set_lvar_cmt ( lvar_t v,
const char *  cmt 
)

Set local variable comment.

This function permanently sets a variable comment.

Returns:
false if failed
Parameters:
v pointer to local variable
cmt new comment

Definition at line 4924 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::set_lvar_type ( lvar_t v,
const typestring type 
)

Set local variable type.

This function permanently sets a local variable type.

Returns:
false if failed
Parameters:
v pointer to local variable
type new variable type

Definition at line 4912 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::set_num_enum ( void   ) 

Convert number to symbolic constant.

This function displays a dialog box and allows the user to select a symbolic constant to represent the number.

Returns:
false if failed or cancelled

Definition at line 5032 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::set_num_radix ( int  base  ) 

Change number base.

This function changes the current number representation.

Returns:
false if failed
Parameters:
base number radix (10 or 16)
0 means a character constant

Definition at line 5026 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::set_num_stroff ( void   ) 

Convert number to structure field offset.

Currently not implemented.

Returns:
false if failed or cancelled

Definition at line 5038 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::set_strmem_type ( struc_t *  sptr,
member_t *  mptr 
)

Set structure field type.

This function displays a dialog box and allows the user to change the type of a structure field.

Returns:
false if failed or cancelled
Parameters:
sptr pointer to structure
mptr pointer to structure member

Definition at line 4948 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::set_vargloc_end ( ea_t  ea,
argloc_t  ida_argloc 
)

Force number of argmuments of a variadic call.

Returns:
false if failed.
Parameters:
ea address of the call instruction.
ida_argloc points past end of arglocs used by the call. for example, 4 means that there is one stack argument.

Definition at line 5062 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::split_item ( bool  split  ) 

Split/unsplit item.

This function splits the current assignment expression.

Returns:
false if failed.

Definition at line 5056 of file hexrays.hpp.

References hexdsp.

void vdui_t::switch_to ( cfunc_t f  ) 

Display the specified pseudocode.

This function replaces the pseudocode window contents with the specified cfunc_t.

Parameters:
f pointer to the function to display. The pointer will be stored in the current vdui_t object and be destroyed when necessary. The caller loses its ownership.

Definition at line 4864 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::ui_edit_lvar_cmt ( lvar_t v  ) 

Set local variable comment.

This function displays a dialog box and allows the user to edit the comment of a local variable.

Returns:
false if failed or cancelled
Parameters:
v pointer to local variable

Definition at line 4918 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::ui_map_lvar ( lvar_t v  ) 

Map a local variable to another.

This function displays a variable list and allows the user to select mapping.

Returns:
false if failed or cancelled
Parameters:
v pointer to local variable

Definition at line 4930 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::ui_rename_lvar ( lvar_t v  ) 

Rename local variable.

This function displays a dialog box and allows the user to rename a local variable.

Returns:
false if failed or cancelled
Parameters:
v pointer to local variable

Definition at line 4894 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::ui_set_lvar_type ( lvar_t v  ) 

Set local variable type.

This function displays a dialog box and allows the user to change the type of a local variable.

Returns:
false if failed or cancelled
Parameters:
v pointer to local variable

Definition at line 4906 of file hexrays.hpp.

References hexdsp.

bool __fastcall vdui_t::ui_unmap_lvar ( lvar_t v  ) 

Unmap a local variable.

This function displays list of variables mapped to the specified variable and allows the user to select a variable to unmap.

Returns:
false if failed or cancelled
Parameters:
v pointer to local variable

Definition at line 4936 of file hexrays.hpp.

References hexdsp.

bool vdui_t::valid ( void   )  const

Does the pseudocode window contain valid code? It can become invalid if the function type gets changed in IDA.

Definition at line 2748 of file hexrays.hpp.

References flags, and VDUI_VALID.


Member Data Documentation

attention, may point to a destroyed form check the visibility before proceeding.

Definition at line 2732 of file hexrays.hpp.