t_sorted

OllyDbg Plugin API

t_sorted

Type of descriptor of sorted data.

typedef struct t_sorted { // Descriptor of sorted table

char name[MAXPATH]; // Name of table, as appears in error messages

int n; // Actual number of entries

int nmax; // Maximal number of entries

int selected; // Index of selected entry or -1

ulong seladdr; // Base address of selected entry

int itemsize; // Size of single entry

ulong version; // Unique version of table

void *data; // Elements, sorted by address

SORTFUNC *sortfunc; // Function which sorts data or NULL

DESTFUNC *destfunc; // Destructor function or NULL

int sort; // Sorting criterium (column)

int sorted; // Whether indexes are sorted

int *index; // Indexes, sorted by criterium

int suppresserr; // Suppress multiple overflow errors

} t_sorted;

Members:

name - name of the sorted data, of no real importance. You can set it to empty string or use for your own purposes;

n - actual number of elements in sorted data;

nmax - maximal number of elements that fit in allocated memory. If necessary, sorted data functions allocate additional memory to fit new elements;

selected - index of selected entry in data sorted by specified criterium. Only when t_sorted.sorted is NULL or data is sorted by address, this index coincides with index in t_sorted.data;

seladdr - base address of selected element;

itemsize - size of element of sorted data in bytes ;

version - variable that increments by 1 each time the contents of sorted data is changed. One can use version to avoid unnecessary searches in sorted data: as long as version remains unchanged, pointers to elements of sorted data are valid. Createsorteddata initializes version to 1;

data - pointer to contiguous buffer that contains elements of sorted data sorted by address. If data is NULL, sorted data is not initialized;

sortfunc - pointer to function that sorts data by given criterium, or NULL if data is not sortable. See SORTFUNC;

destfunc - pointer to destructor function that frees resources allocated by element of sorted data, can be NULL if element doesn't allocate resources. See DESTFUNC;

sort - actual sorting criterium. OllyDbg passes this parameter to sortfunc;

sorted - flag indicating whether index array is actual;

index - array containing indexes of elements sorted by specified criterium. NULL if data is not initialized or sortfunc is NULL;

suppresserr - flag preventing from multiple error reports.

See also: Sorted data functions