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";
}
// 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
std::wstring resource = m_Path + L"Languages\\";
if (GetPrivateProfileString(L"Rainmeter", L"Language", L"", tmpSzPath, MAX_LINE_LENGTH, m_IniFile.c_str()) == 0)
@ -936,6 +945,9 @@ int CRainmeter::Initialize(HWND hParent, HINSTANCE hInstance, LPCWSTR szPath)
RegCloseKey(hKey);
}
}
if (tmpSzPath[0] != L'\0')
{
// Try selected language
m_ResourceLCID = wcstoul(tmpSzPath, NULL, 10);
resource += tmpSzPath;
resource += L".dll";
@ -945,9 +957,13 @@ int CRainmeter::Initialize(HWND hParent, HINSTANCE hInstance, LPCWSTR szPath)
{
resource.insert(0, L"Unable to load language: ");
Log(LOG_ERROR, resource.c_str());
}
}
if (!m_ResourceInstance)
{
// 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_ResourceLCID = 1033;
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 += L"Plugins\\";
m_AddonPath += L"Addons\\";