// ************************************************************************
// *** C/C++ example (Visual C++) for a simple input plugin ***
// *** Returns true if the filename contains "ACME" ***
// *** ***
// *** Last modified: 2012APR19 ***
// *** (c) Christian Schnettelker 2011, 2012 ***
// *** ***
// *** Compile this as dll and place the dll in a sub-directory ***
// *** "Plugins". Use CALL PLUGIN action in the configuration ***
// *** www.finefiles.com mail@finefiles.com ***
// ************************************************************************
#include <windows.h>
#include "Plugin.h"
extern "C"
{
// Return an identifier if this plugin can be accessed for
// Input section, Inspection section or both
__declspec(dllexport) int ____ffPlugin__Type( const int iVersion )
{
// You may check iVersion, if not valid for your plugin return __FFPLUGIN__TYPE__NONE
// to instruct finefiles not to include the plugin and not to call any functions
return __FFPLUGIN__TYPE__INPUT;
}
// Return a messages if ____ffPlugin__Input() or ____ffPlugin__Insp() fails
// Please note that all messages are truncated if longer than __FFPLUGIN__MSG__MAX
// If nothing is returned finefiles will state "plugin returns false"
// Always return wide (Unicode) strings!
static wchar_t swFalseMsg[] = L"filename doesn't contains \"ACME\"";
__declspec(dllexport) const wchar_t *____ffPlugin__FalseMsg( void )
{
return swFalseMsg;
}
/* Please note: plugins with type == __FFPLUGIN__TYPE__INPUT have to include the
function ____ffPlugin__Input(). Plugins with type == __FFPLUGIN__TYPE__INSP have
to include the function ____ffPlugin__Insp(). Plugins with type == __FFPLUGIN__TYPE__II
have to include both functions */
// Perform input actions
__declspec(dllexport) int ____ffPlugin__Input( const wchar_t *swRoot, const wchar_t *swFileName )
{
// This is only an example, you are free to analyze swRoot and swFileName in any
// way or to open the file to parse the content. Please always make shure that open
// files are closed before returning!!! Note: swRoot und swFileName are wide
// strings (Unicode)
if ( wcsstr(swFileName,L"ACME") != NULL ) return __FFPLUGIN__RETURN__TRUE;
return __FFPLUGIN__RETURN__FALSE;
}
}
// DLL main
bool WINAPI DllMain( HINSTANCE hInstDLL, // handle to DLL module
DWORD dwReason, // reason for calling function
LPVOID lpReserved // reserved
)
{
switch( dwReason ) // Perform actions based on the reason for calling
{
case DLL_PROCESS_ATTACH : // Initialize once for each new process
// return false to fail DLL load
break;
case DLL_THREAD_ATTACH : // Do thread-specific initialization
break;
case DLL_THREAD_DETACH : // Do thread-specific cleanup
break;
case DLL_PROCESS_DETACH : // Perform any necessary cleanup
break;
}
return true; // DLL_PROCESS_ATTACH was successful
}
/* eof */