PixTools architecture consists of several components. First of all there is Pixtools runtime - set of .dll files - which usually installed in %Windows%\System32 folder. Drivers are another main part of pixtools distribution. There are several types of drivers:
- scanner drivers
- compression drivers
Drivers are used to create pipes which are heart of ISIS technology. The pipe forms road for image data from source to destination, for example from scanner to file on disk. Canonical place for drivers is %Windows%\Pixtran folder. From end-user application side it is not convenient to distribute pixtools components to its historical places. Instead, good installation practices dictate that application with any support files should use root installation folder. So, it will be good if application installation would have following structure:
PixTools for .NET provides functionality to achieve this packaging. Class PixRegister allows specifying location of the runtime and drivers, for example:
void InitializePixTools(String rootPath)
String runtimePath = Path.Combine(rootPath, "PixToolsRuntime");
String driversPath = Path.Combine(rootPath, "Drivers");
PixRegister.PixtranDir = driversPath;
Consider the case when target system has old-style pixtools-based application (with drivers in %Windows%\Pixtran) and modern-style application (with custom drivers folder). Assume that both driver folders contain driver for mythical Fast Scanner - fastScn.pxn. What happens when modern application tries to load fastScn.pxn? What drivers search order is used by PixTools SDK?
To answer for the question we should first describe what search order is used by PixDrvLoad function from native PixTools toolkit and then using this knowledge consider PixTools for .NET implementation.
PixDrvLoad search order is as follows:
- The directory from which the application is loaded
- Custom Pixtran directory
- %Windows%\Pixtran directory
Driver loading process differs from DLL loading in stop criteria. Loading DLL with LoadLibrary will stop when file with specified name is found. Instead, PixTools driver loading process continues even if specified driver was found on previous step. Idea is to find the newest driver, i.e. the driver with highest version. So, if fastScn.pxn will be found in both custom Pixtran folder and %Windows%\Pixtran folder then newer version of the driver will be loaded. In case when several identical drivers were found then driver which was found earlier will be loaded.
PixTools for .NET uses native PixDrvLoad API to load drivers so all information about loading process in native PixTools toolkit is applicable. Driver search order described above is a common algorithm for driver loading, i.e. all ISIS drivers (both scanner and compression drivers) are loaded using described search order.