Added workaround for loading C# plugins. (For some reason, C# x86 plugin with uncanonicalized path is not loaded correctly in Win7 32bit/WOW64.)

http://rainmeter.net/forum/viewtopic.php?f=18&t=239&start=30#p56921
http://rainmeter.net/forum/viewtopic.php?f=18&t=239&start=80#p64237
This commit is contained in:
spx 2012-02-09 08:57:20 +00:00
parent ec2b19f0dc
commit 4bd8e7db7d

View File

@ -144,7 +144,26 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
} }
pluginName.insert(0, Rainmeter->GetPluginPath()); pluginName.insert(0, Rainmeter->GetPluginPath());
m_Plugin = CSystem::RmLoadLibrary(pluginName.c_str(), NULL); // Canonicalize the path (Workaround for C# plugins)
{
pos = 0;
while ((pos = pluginName.find(L"\\\\", pos)) != std::wstring::npos)
{
pluginName.erase(pos, 1);
}
WCHAR buffer[MAX_PATH];
if (PathCanonicalize(buffer, pluginName.c_str()))
{
pluginName = buffer;
}
else
{
LogWithArgs(LOG_WARNING, L"Plugin: Failed to canonicalize plugin path: %s", pluginName.c_str());
}
}
m_Plugin = CSystem::RmLoadLibrary(pluginName.c_str());
if (m_Plugin == NULL) if (m_Plugin == NULL)
{ {
// Try to load from Rainmeter's folder // Try to load from Rainmeter's folder
@ -154,7 +173,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
std::wstring pluginName2 = Rainmeter->GetPath(); std::wstring pluginName2 = Rainmeter->GetPath();
pluginName2.append(pluginName, pos + 1, pluginName.length() - (pos + 1)); pluginName2.append(pluginName, pos + 1, pluginName.length() - (pos + 1));
m_Plugin = CSystem::RmLoadLibrary(pluginName2.c_str(), NULL); m_Plugin = CSystem::RmLoadLibrary(pluginName2.c_str());
} }
if (m_Plugin == NULL) if (m_Plugin == NULL)