Descriptor of the sorted data, a collection of items of the fixed size that have address and size. Never change this descriptor directly!
typedef struct t_sorted { // Descriptor of sorted data
int n; // Actual number of entries
int nmax; // Maximal number of entries
ulong itemsize; // Size of single entry
int mode; // Storage mode, set of SDM_xxx
void *data; // Sorted data, NULL if SDM_INDEXED
void **block; // NBLOCK sorted data blocks, or NULL
int nblock; // Number of allocated blocks
ulong version; // Changes on each modification
void **dataptr; // Pointers to data, sorted by address
int selected; // Index of selected entry
ulong seladdr; // Base address of selected entry
ulong selsubaddr; // Subaddress of selected entry
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 *sortindex; // Indexes, sorted by criterium
} t_sorted;
Members:
n
Number of
items in the sorted data. It is save to use this member as an
enumeration limit in the series of calls to Getsortedbyindex()
nmax
Maximal
number of entries that fit into the allocated buffers. If necessary,
OllyDbg automatically extends data size, up to the full memory
available to the OllyDbg process
itemsize
Size of the
sorted data items, including obligatory header (t_sorthdr or t_sorthdr_nosize)
mode
Storage
mode, a combination of the following flags:
SDM_INDEXED - if cleared, all data items are kept in a single memory block pointed to by data. Allows for the fastest possible access, but adding or removing items may be time-consuming. If set, items are kept in the multiple large blocks, and only pointers to the items dataptr are physically moved
SDM_EXTADDR - if set, item's address is 40 bits long. 8 least significant bits are kept in the t_sorthdr.type, within TY_AEXTMASK. If SDM_EXTADDR is set, t_sorthdr.size must be 1
SDM_NOSIZE - if cleared, data items must begin with t_sorthdr. If set, data items begin with t_sorthdr_nosize and size of each item is assumed to be 1
SDM_NOEXTEND - if flag is set and initially allocated storage is full, calls to Addsorteddata() and similar functions fail
data
SDM_INDEXED - if cleared, all data items are kept in a single memory block pointed to by data. Allows for the fastest possible access, but adding or removing items may be time-consuming. If set, items are kept in the multiple large blocks, and only pointers to the items dataptr are physically moved
SDM_EXTADDR - if set, item's address is 40 bits long. 8 least significant bits are kept in the t_sorthdr.type, within TY_AEXTMASK. If SDM_EXTADDR is set, t_sorthdr.size must be 1
SDM_NOSIZE - if cleared, data items must begin with t_sorthdr. If set, data items begin with t_sorthdr_nosize and size of each item is assumed to be 1
SDM_NOEXTEND - if flag is set and initially allocated storage is full, calls to Addsorteddata() and similar functions fail
Storage
for data items, contiguous memory block where all data items are kept,
unaligned and sorted by address. NULL if descriptor is uninitialized or
mode is SDM_INDEXED
block
Storage for data items, nblock large blocks where items are kept in the order defined by dataptr. NULL if descriptor is uninitialized or mode is not SDM_INDEXED
nblock
Number of storage blocks in block, or 0 if descriptor is uninitialized or mode is not SDM_INDEXED
version
Version
of the sorted data. Changed each time some items are
added, removed or replaced. May be used to make secure data caching
dataptr
Pointers to data items in block, or NULL if descriptor is uninitialized or mode is not SDM_INDEXED
selected
Index of selected item, 0..n-1, or -1 if selection is not defined or removed
seladdr
Address (or 32 most significant bits of extended address in the SDM_EXTADDR mode) of the selected item. Undefined if selected is -1
selsubaddr
8 least significant bits of extended address of the selected item. Undefined if selected is -1
sortfunc
Pointer to the sorting function that compares two items and reports
destfunc
Pointer to the data destructor or NULL. When destfunc is defined, OllyDbg passes each data item to this function before it will be removed from the data
sort
Sorting criterium, passed to the sortfunc each time OllyDbg needs to sort the sortindex
sorted
Flag that indicates whether pointers in sortindex are sorted or not
sortindex
List of pointers to the data items sorted according to the criterium sort. Allocated but invalid if sorted is 0. NULL if sortfunc is NULL
See also:
Sorted data, tables, t_module, t_table, DESTFUNC, SORTFUNC, Addsorteddata(), Createsorteddata(), Deletesorteddata(), Destroysorteddata(), Findsorteddata(), Getsortedbyindex(), Getsortedbyselection()