Createsorteddata

OllyDbg Plugin API

Createsorteddata

Initializes descriptor of sorted data (structure t_sorted). If descriptor alseady contains data, this data is destroyed. Returns 0 on success and -1 on error.

int Createsorteddata(t_sorted *sd,char *name,int itemsize,int nmax,SORTFUNC *sortfunc,DESTFUNC *destfunc);

Parameters:

sd - pointer to descriptor of sorted data;

name - optional name of sorted data, can be NULL. OllyDbg uses this name only in some rare cases;

itemsize - size, in bytes, of the element of sorted data (including standard header);

nmax - initial number of data elements that allocated buffer can keep. If necessary, OllyDbg will automatically allocate additional memory;

sortfunc - pointer to function that compares two data elements according to sorting criterium, or NULL if data cannot be sorted. This criterium is usually the index of column in table window. If you specify AUTOARRANGE, data is autoarrangeable, that is, assumes that address of the element is simply its (0-based) ordinal number in the data and size of element is always 1. Even in this case, element must begin with valid header. Addsorteddata always inserts new items to autoarrangeable data and never replaces existing;

destfunc - pointer to function that is called for each element being removed from the table, or NULL if destructor is not necessary. You need destfunc, for example, if elements of sorted data allocate additional memory that must be freed before element is deleted.

See also: Destroysorteddata, SORTFUNC, DESTFUNC