diff --git a/Library/Litestep.cpp b/Library/Litestep.cpp index c660a800..7e2b9b98 100644 --- a/Library/Litestep.cpp +++ b/Library/Litestep.cpp @@ -235,82 +235,6 @@ void RunCommand(HWND Owner, LPCTSTR szCommand, int nShowCmd, bool asAdmin) } } -//void TransparentBltLS(HDC hdcDst, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc, int nXSrc, int nYSrc, COLORREF colorTransparent) -//{ -// // Use the lsapi.dll version of the method if possible -// if (fpTransparentBltLS) -// { -// fpTransparentBltLS(hdcDst, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, colorTransparent); -// } -// else -// { -// HDC hdcMem, hdcMask, hdcDstCpy; -// HBITMAP hbmMask, hbmMem, hbmDstCpy; -// HBITMAP hbmOldMem, hbmOldMask, hbmOldDstCpy; -// -// // create a destination compatble dc containing -// // a copy of the destination dc -// hdcDstCpy = CreateCompatibleDC(hdcDst); -// hbmDstCpy = CreateCompatibleBitmap(hdcDst, nWidth, nHeight); -// hbmOldDstCpy = (HBITMAP)SelectObject(hdcDstCpy, hbmDstCpy); -// -// BitBlt(hdcDstCpy, 0, 0, nWidth, nHeight, hdcDst, nXDest, nYDest, SRCCOPY); -// -// // create a destination compatble dc containing -// // a copy of the source dc -// hdcMem = CreateCompatibleDC(hdcDst); -// hbmMem = CreateCompatibleBitmap(hdcDst, nWidth, nHeight); -// hbmOldMem = (HBITMAP)SelectObject(hdcMem, hbmMem); -// -// BitBlt(hdcMem, 0, 0, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, SRCCOPY); -// -// // the transparent color should be selected as -// // bkcolor into the memory dc -// SetBkColor(hdcMem, colorTransparent); -// -// // Create monochrome bitmap for the mask -// hdcMask = CreateCompatibleDC(hdcDst); -// hbmMask = CreateBitmap(nWidth, nHeight, 1, 1, NULL); -// hbmOldMask = (HBITMAP)SelectObject(hdcMask, hbmMask); -// -// // Create the mask from the memory dc -// BitBlt(hdcMask, 0, 0, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY); -// -// // Set the background in hdcMem to black. Using SRCPAINT with black -// // and any other color results in the other color, thus making -// // black the transparent color -// SetBkColor(hdcMem, RGB(0, 0, 0)); -// SetTextColor(hdcMem, RGB(255, 255, 255)); -// -// BitBlt(hdcMem, 0, 0, nWidth, nHeight, hdcMask, 0, 0, SRCAND); -// -// // Set the foreground to black. See comment above. -// SetBkColor(hdcDst, RGB(255, 255, 255)); -// SetTextColor(hdcDst, RGB(0, 0, 0)); -// -// BitBlt(hdcDstCpy, 0, 0, nWidth, nHeight, hdcMask, 0, 0, SRCAND); -// -// // Combine the foreground with the background -// BitBlt(hdcDstCpy, 0, 0, nWidth, nHeight, hdcMem, 0, 0, SRCPAINT); -// -// // now we have created the image we want to blt -// // in the destination copy dc -// BitBlt(hdcDst, nXDest, nYDest, nWidth, nHeight, hdcDstCpy, 0, 0, SRCCOPY); -// -// SelectObject(hdcMask, hbmOldMask); -// DeleteObject(hbmMask); -// DeleteDC(hdcMask); -// -// SelectObject(hdcMem, hbmOldMem); -// DeleteObject(hbmMem); -// DeleteDC(hdcMem); -// -// SelectObject(hdcDstCpy, hbmOldDstCpy); -// DeleteObject(hbmDstCpy); -// DeleteDC(hdcDstCpy); -// } -//} - std::string ConvertToAscii(LPCTSTR str) { std::string szAscii; diff --git a/Library/MeasurePlugin.cpp b/Library/MeasurePlugin.cpp index 55c534bc..7f77b083 100644 --- a/Library/MeasurePlugin.cpp +++ b/Library/MeasurePlugin.cpp @@ -175,9 +175,14 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section) m_ID = id++; if (InitializeFunc) { + // Remove current directory from DLL search path + SetDllDirectory(L""); + double maxValue; maxValue = InitializeFunc(m_Plugin, parser.GetFilename().c_str(), section, m_ID); + // Reset to default + SetDllDirectory(L""); CSystem::ResetWorkingDirectory(); const std::wstring& szMaxValue = parser.ReadString(section, L"MaxValue", L""); diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index ce50c1b8..4fd8b16f 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -2346,33 +2346,6 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile) } } -/* -** SetActiveConfig -** -** Makes the given config active. If the config cannot be found this returns false. -*/ -bool CRainmeter::SetActiveConfig(const std::wstring& skinName, const std::wstring& skinIni) -{ - for (int i = 0, isize = (int)m_ConfigStrings.size(); i < isize; ++i) - { - m_ConfigStrings[i].active = 0; // Disable all other configs - - if (skinName == m_ConfigStrings[i].config) - { - for (int j = 0, jsize = (int)m_ConfigStrings[i].iniFiles.size(); j < jsize; ++j) - { - if (skinIni == m_ConfigStrings[i].iniFiles[j]) - { - m_ConfigStrings[i].active = j + 1; - return true; - } - } - } - } - - return false; -} - /* ** RefreshAll ** diff --git a/Library/Rainmeter.h b/Library/Rainmeter.h index 67d42c34..a31101e5 100644 --- a/Library/Rainmeter.h +++ b/Library/Rainmeter.h @@ -199,7 +199,6 @@ private: void ReadGeneralSettings(const std::wstring& iniFile); void SetLoadOrder(int configIndex, int order); int GetLoadOrder(const std::wstring& config); - bool SetActiveConfig(const std::wstring& skinName, const std::wstring& skinIni); void UpdateDesktopWorkArea(bool reset); HMENU CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU configMenu); void ChangeSkinIndex(HMENU subMenu, int index); diff --git a/Library/System.cpp b/Library/System.cpp index 085b22bd..2cca42e9 100644 --- a/Library/System.cpp +++ b/Library/System.cpp @@ -1044,17 +1044,22 @@ ULONGLONG CSystem::GetTickCount64() ** ** This function is a wrapper function for LoadLibrary(). ** +** Avoids loading a DLL from current directory. ** */ HMODULE CSystem::RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError, bool ignoreErrors) { UINT oldMode; + if (ignoreErrors) { oldMode = SetErrorMode(0); SetErrorMode(oldMode | SEM_FAILCRITICALERRORS); // Prevent the system from displaying message box } + // Remove current directory from DLL search path + SetDllDirectory(L""); + SetLastError(ERROR_SUCCESS); HMODULE hLib = LoadLibrary(lpLibFileName);