Plugin Framework for KeePass
Copyright © 2009 Bill Rubin
Distributed under the Boost Software License
When KeePass (Classic Edition) introduced its COM interface to plugins in Version
1.15, I developed the Plugin Framework for KeePass (PFK) in order to more easily
convert Another Backup Plugin to this new interface. Other developers of existing
KeePass (Classic Edition) plugins may find PFK useful for the same purpose. Developers
of new KeePass Classic Edition plugins should also find PFK useful. In my view,
every plugin for KeePass 1.15 or later would benefit by using PFK.
Plugin Framework for KeePass (PFK) is a Visual Studio 2005 C++ project useful for
developing plugins for KeePass Version 1.15 or later. With PFK, the KeePass plugin
developer need not write or maintain large amounts of boilerplate code to interface
the plugin with Keepass, or to perform common plugin operations. With PFK, the plugin
developer can focus on the application code specific to the plugin. PFK features
- Complete implementation of the IID_IKpUnknown interface.
- Implementation of the IID_IKpPlugin interface, except for the OnMessage member
function, which is always application-specific.
- Ability to get smart pointers to any other KeePass interface, including IKpAPI,
IKPCommandLine, IKpCommandLineOption, IKpConfig, IKpDatabase, IKpFileTransaction,
IKpFullPathName, and IKpUtilities.
- Implementation of the KpCreateInstance function, which the plugin must export
from its DLL.
- Comprehensive error checking of COM handshaking for Items 3 and 4. If an error
is found, PFK displays a message box containing all information about the error.
Without this feature, a plugin will, in most cases, silently fail to load. In other
cases, it will fail to perform its function.
- Convenience utilities to display a message box, translate a Windows error code
into a natural language string, and declare a standard string independently of character
- Compile-time checking of constructor invocations for smart COM pointers. Without
this feature, it is difficult for a developer to interpret compiler error messages
caused by using the wrong smart COM pointer constructor.
- The PFK code avoids defining macros. Instead templates, inline functions, typedefs,
and other C++ constructs maintain safe design practices, with no runtime penalty.
The following table shows the correspondences between KeePass Classic Edition versions
and PFK versions.
Plugin Framework for KeePass
1.17 or later
1.16 or later
1.15 or later
1.14 or earlier
PFK Installation Instructions
- Download the PFK zip file from the above table.
- Unzip the downloaded file into a PluginFramework directory under the KeePass
- Add the PluginFramework Visual Studio project to the KeePass solution.
- Build the PluginFramework project. The output is a static library.
- To make PFK accessible to your plugin project, add PluginFramework as a reference
in the common properties of your plugin project.
To integrate PFK into your existing or new plugin, it is highly recommended to look
at the source code of
Another Backup Plugin,
other plugins which already use PFK.
PFK Version History
Version 1.2 for KeePass 1.17 or later (4Dec2009)
- Adds support for FileTransaction Interface.
Version 1.1 for KeePass 1.16 or later (4Jun2009)
- Uses IKpAPI2 interface instead of IKpAPI.
Version 1.0 for KeePass 1.15 or later (31Jan2009)