reference:plugins:plugin_sdk:using_the_exported_functions

The Plugin Support functions are all exported from dopus.exe as named functions, and so accessing them is a simple matter of obtaining the function entry point with GetProcAddress and calling the function with the appropriate parameter(s). Defines for the names of all exported functions, along with typedefs for their parameters, are provided in the plugin support.h header file.

Because all Opus plugins are, naturally enough, loaded into the address space of the dopus.exe process, obtaining a module handle to pass to GetProcAddress is as simple as calling GetModuleHandle(0) (or GetModuleHandle("dopus.exe").)

For example, to obtain the address of the GetThumbnailPrefs function, the following code could be used:

PFNGETTHUMBNAILPREFS pfnGetThumbPrefs;
pfnGetThumbPrefs=(PFNGETTHUMBNAILPREFS)GetProcAddress( GetModuleHandle( 0 ),
    FUNCNAME_GETTHUMBNAILPREFS );

The plugin support.h header file can also optionally define helper classes which are automatically initialized with the addresses of the exported functions and provide inline wrapper functions which can make using them easier.

To take advantage of the helper classes you must define DOPUS_PLUGIN_HELPER before including the header file. For example,

#define DOPUS_PLUGIN_HELPER
#include "plugin support.h"

You will then be able to use the various helper classes in your plugin without having to call GetProcAddress manually. For reasons of efficiency the exported functions have been split into several separate helper classes:

  • DOpusPluginHelperConfig
    Contains functions concerning Opus configuration, as well as a simple interface for XML-based plugin configuration storage.
  • DOpusPluginHelperFunction
    Contains functions used by batch mode VFS plugin operations.
  • DOpusPluginHelperRegistry
    Contains functions that can be used to access the registry through Opus, taking advantage of the automatic XML-redirection for certain keys, as well as support for elevation (UAC) under Windows Vista.
  • DOpusPluginHelperUtil
    Contains miscellaneous utility functions.
  • DOpusPluginHelperWow64
    Contains utility functions for WOW64.
  • DOpusPluginHelperXML
    Contains functions that give access to the full Opus XML utility library (in case the simple LoadOrSaveConfig function is not flexible enough.)
  • DOpusPluginHelper
    Contains all the exported functions in the Plugin Support API.

Using the helper classes is as simple as instantiating an instance of the desired class, and then calling the member functions within it. For example, to call the GetThumbnailPrefs function using the helper classes:

DOpusPluginHelperConfig dphc;
DOPUSTHUMBNAILPREFSDATA dtp;
dtp.cbSize=sizeof(dtp);
dphc.GetThumbnailPrefs(&dtp);

Note that most functions that take string parameters are available in both ANSI and Unicode forms, with the exception of the registry functions.