aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmpplugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmidiplayer-desktop/qmpplugin.cpp')
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index 2117bcf..7dfb01f 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -18,23 +18,24 @@ void qmpPluginManager::scanPlugins()
HANDLE dir;
std::vector<std::string> cpluginpaths;
//FindFirstFile, FindNextFile, FindClose
- LPWIN32_FIND_DATA file;
- dir=FindFirstFileA(L".\\plugins\\*.dll",file);
+ LPWIN32_FIND_DATAA file;
+ dir=FindFirstFileA(".\\plugins\\*.dll",file);
if(dir!=INVALID_HANDLE_VALUE)
{
cpluginpaths.push_back(std::string(file->cFileName));
- while(FindNextFile(dir,file))
+ while(FindNextFileA(dir,file))
cpluginpaths.push_back(std::string(file->cFileName));
}
FindClose(dir);
for(unsigned i=0;i<cpluginpaths.size();++i)
{
- HMODULE hso=LoadLibraryA(cpluginpaths[i].c_str());
+ HMODULE hso=LoadLibraryA((std::string(".\\plugins\\")+cpluginpaths[i]).c_str());
if(!hso){fprintf(stderr,"Error while loading library: %d\n",GetLastError());continue;}
FARPROC hndi=GetProcAddress(hso,"qmpPluginGetInterface");
if(!hndi){fprintf(stderr,"file %s doesn't seem to be a qmidiplayer plugin.\n",cpluginpaths[i].c_str());continue;}
qmpPluginEntry e=(qmpPluginEntry)hndi;
qmpPluginIntf* intf=e(pluginAPI);
+ //!!FIXME: Windows version crashes if intf->pluginGetVersion is called. Reason is still unknown.
plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),std::string(cpluginpaths[i]),intf));
}
}
@@ -82,8 +83,8 @@ qmpPluginManager::~qmpPluginManager()
{
for(unsigned i=0;i<plugins.size();++i)
{
- if(plugins[i].initialized)plugins[i].interface->deinit();
- delete plugins[i].interface;
+ if(plugins[i].initialized)plugins[i].pinterface->deinit();
+ delete plugins[i].pinterface;
}
qmw=NULL;qsw=NULL;delete pluginAPI;
}
@@ -97,14 +98,14 @@ void qmpPluginManager::initPlugins()
{
if(!plugins[i].enabled)continue;
printf("Loaded plugin: %s\n",plugins[i].path.c_str());
- plugins[i].interface->init();plugins[i].initialized=true;
+ plugins[i].pinterface->init();plugins[i].initialized=true;
}
}
void qmpPluginManager::deinitPlugins()
{
for(unsigned i=0;i<plugins.size();++i)
{
- if(plugins[i].initialized)plugins[i].interface->deinit();
+ if(plugins[i].initialized)plugins[i].pinterface->deinit();
plugins[i].enabled=plugins[i].initialized=false;
}
}