Fixed "Unable to load language: <path>\Languages\.dll" issue.

This commit is contained in:
spx 2011-10-29 11:15:58 +00:00
parent 1808930c5a
commit ccd6061427

View File

@ -918,6 +918,15 @@ int CRainmeter::Initialize(HWND hParent, HINSTANCE hInstance, LPCWSTR szPath)
m_StatsFile += L".stats"; m_StatsFile += L".stats";
} }
// Read Logging settings beforehand
m_Logging = 0!=GetPrivateProfileInt(L"Rainmeter", L"Logging", 0, m_IniFile.c_str());
m_Debug = 0!=GetPrivateProfileInt(L"Rainmeter", L"Debug", 0, m_IniFile.c_str());
if (m_Logging)
{
StartLogging();
}
// Determine the language resource to load // Determine the language resource to load
std::wstring resource = m_Path + L"Languages\\"; std::wstring resource = m_Path + L"Languages\\";
if (GetPrivateProfileString(L"Rainmeter", L"Language", L"", tmpSzPath, MAX_LINE_LENGTH, m_IniFile.c_str()) == 0) if (GetPrivateProfileString(L"Rainmeter", L"Language", L"", tmpSzPath, MAX_LINE_LENGTH, m_IniFile.c_str()) == 0)
@ -936,18 +945,25 @@ int CRainmeter::Initialize(HWND hParent, HINSTANCE hInstance, LPCWSTR szPath)
RegCloseKey(hKey); RegCloseKey(hKey);
} }
} }
m_ResourceLCID = wcstoul(tmpSzPath, NULL, 10); if (tmpSzPath[0] != L'\0')
resource += tmpSzPath; {
resource += L".dll"; // Try selected language
m_ResourceLCID = wcstoul(tmpSzPath, NULL, 10);
resource += tmpSzPath;
resource += L".dll";
m_ResourceInstance = LoadLibraryEx(resource.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); m_ResourceInstance = LoadLibraryEx(resource.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
if (!m_ResourceInstance)
{
resource.insert(0, L"Unable to load language: ");
Log(LOG_ERROR, resource.c_str());
}
}
if (!m_ResourceInstance) if (!m_ResourceInstance)
{ {
resource.insert(0, L"Unable to load language: ");
Log(LOG_ERROR, resource.c_str());
// Try English // Try English
resource = m_Path + L"Languages\\1033.dll"; resource = m_Path;
resource += L"Languages\\1033.dll";
m_ResourceInstance = LoadLibraryEx(resource.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); m_ResourceInstance = LoadLibraryEx(resource.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
m_ResourceLCID = 1033; m_ResourceLCID = 1033;
if (!m_ResourceInstance) if (!m_ResourceInstance)
@ -956,15 +972,6 @@ int CRainmeter::Initialize(HWND hParent, HINSTANCE hInstance, LPCWSTR szPath)
} }
} }
// Read Logging settings beforehand
m_Logging = 0!=GetPrivateProfileInt(L"Rainmeter", L"Logging", 0, m_IniFile.c_str());
m_Debug = 0!=GetPrivateProfileInt(L"Rainmeter", L"Debug", 0, m_IniFile.c_str());
if (m_Logging)
{
StartLogging();
}
m_PluginPath = m_AddonPath = m_SkinPath = m_Path; m_PluginPath = m_AddonPath = m_SkinPath = m_Path;
m_PluginPath += L"Plugins\\"; m_PluginPath += L"Plugins\\";
m_AddonPath += L"Addons\\"; m_AddonPath += L"Addons\\";