GetBackgroundFlags
 
GetBackgroundFlags is called to determine whether a plugin supports background packing or unpacking.
 
int __stdcall GetBackgroundFlags(void);
 
Description
 
GetBackgroundFlags should return one of the following values:
 
Constant               Value Description
BACKGROUND_UNPACK        1 Calls to OpenArchive, ReadHeader(Ex), ProcessFile and CloseArchive are thread-safe (unpack in background)
BACKGROUND_PACK          2 Calls to PackFiles are thread-safe (pack in background)
BACKGROUND_MEMPACK       4 Calls to StartMemPack, PackToMem and DoneMemPack are thread-safe
Notes
To make your packer plugin thread-safe, you should remove any global variables which aren't the same for all pack or unpack operations. For example, the path to the ini file name can remain global, but something like the compression ratio, or file handles need to be stored separately.
 
Packing: The PackFiles function is just a single call, so you can store all variables on the stack (local variables of that function).
 
Unpacking: You can allocate a struct containing all the variables you need across function calls, like the compression method and ratio, and state variables, and return a pointer to this struct as a result to OpenArchive. This pointer will then passed to all other functions like ReadHeader as parameter hArcData.
 
Pack in memory: You can do the same in StartMemPack as described under Unpacking.