int Createsorteddata(t_sorted *sd,ulong itemsize,int nexp,SORTFUNC *sortfunc,DESTFUNC *destfunc,int mode);

Initializes descriptor of sorted data and allocates resources. If sd describes existing sorted data, it will be deleted. Returns 0 if sorted data is correctly initialized and -1 otherwise.


(in,out) Pointer to the descriptor of sorted data, structure of type t_sorted. When descriptor is used for the first time, set it to 0
(in) Size of the item of sorted data, at least sizeof(t_sorthdr) if mode flag SDM_NOSIZE is cleared and sizeof(t_sorthdr_nosize) if SDM_NOSIZE is set
(in) Initial estimated capacity of the data buffer, items. If necessary, OllyDbg automatically extends buffer size
(in) Pointer to the callback function of type SORTFUNC if data must be sorted by custom criteria, AUTOARRANGE to create autoarrangeable sorted data or NULL if custom sorting is not necessary
(in) Pointer to the destructor function of type DESTFUNC or NULL if items of sorted data contain no resources that must be freed. destfunc is called when API function deletes item of sorted data, either implicitly or due to the explicit call, separately for each data item
(in) Combination of zero or more of the following flag that determine the type of the sorted data:
SDM_INDEXED - creates indexed sorted data. Use when
data items are large and numerous. Indexed data is effective when total data size exceeds several megabytes
SDM_EXTADDR - Item address is extended by 8 additional least significant bits in TY_AEXTMASK
SDM_NOSIZE - items of sorted data contain neither size nor type, size is assumed to be 1

Return values:

0 if sorted data is initialized and ready to use, and -1 on any error



See also:
Sorted data, t_sorted, DESTFUNC, SORTFUNC, Destroysorteddata(), Issortedinit()