void RunJkDefrag(WCHAR *path, int Mode, int Speed, double FreeSpace, WCHAR **Excludes, WCHAR **SpaceHogs, int *Running, int *RedrawSreen, ShowStatus //use a ptr to memoryblock or something, set to nil if dont' need it ShowMove //see above ShowAnalyze //see above ShowDebug //see above DrawCluster //see above ClearScreen //see above char **debugMsg); //Note that those structures there are all different //more info on structures //callback subroutines void (*ShowStatus) (struct DefragDataStruct *Data) void (*ShowMove) (struct ItemStruct *Item, ULONG64 Clusters, ULONG64 FromLcn, ULONG64 ToLcn, ULONG64 FromVcn); void ( *ShowAnalyze) (struct DefragDataStruct *Data, struct ItemStruct *Item); void ( *ShowDebug) (int Level, struct ItemStruct *Item, char *Message, ...); void ( *DrawCluster) (struct DefragDataStruct *Data, ULONG64 ClusterStart, ULONG64 ClusterEnd, int Color); void ( *ClearScreen) (char *Format, ...); //Definiations for the structures are available. Basically, it provides a ptr to these structures, and you can get info out of them void StopJkDefrag(int *Running, int TimeOut); //other exported functions that might be useful char *stristr(char *Haystack, char *Needle); //search case-insensitive for a substring WCHAR *stristrW(WCHAR *Haystack, WCHAR *Needle); //ditto void SystemErrorStr(DWORD ErrorCode, char *Out); //returns a string with the error message for GetLastError() WCHAR **AddArrayString(WCHAR **Array, WCHAR *NewString); //Add a string to a string Array ULONG64 GetItemLcn(struct ItemStruct *Item); //return the location on disk (LCN) of an item struct ItemStruct *TreeSmallest(struct ItemStruct *Top); //return pointer to first item in the tree (first file on the volume) struct ItemStruct *TreeBiggest(struct ItemStruct *Top); //return pointer to last item in the tree struct ItemStruct *TreeFirst(struct ItemStruct *Top, int Direction); //if Direction =0 then return first file, else, last file struct ItemStruct *TreePrev(struct ItemStruct *Here);//return pointer to previous item in the tree struct ItemStruct *TreeNext(struct ItemStruct *Here);//return pointer to next item in the tree struct ItemStruct *TreeNextPrev(struct ItemStruct *Here, int Direction); //if Direction = 0 then return next, else previous void TreeInsert(struct DefragDataStruct *Data, struct ItemStruct *New);//insert a record into the tree. The tree is sorted by LCN void TreeDetach(struct DefragDataStruct *Data, struct ItemStruct *Item);//unlink a record from the tree (not freed() ) int FragmentCount(struct ItemStruct *Item); //returns the number of fragments in the item int IsFragmented(struct ItemStruct *Item, ULONG64 Offset, ULONG64 Size); //returns YES if the block in the item starting at Offset with Size clusters is fragmented