mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
PowerPlugin could unload the powrprof.dll even if some other skin was still using it. Fixed.
This commit is contained in:
parent
dcebc3bebd
commit
5d3d148b46
@ -64,6 +64,7 @@ enum POWER_STATE
|
|||||||
std::map<UINT, POWER_STATE> g_States;
|
std::map<UINT, POWER_STATE> g_States;
|
||||||
std::map<UINT, std::wstring> g_Formats;
|
std::map<UINT, std::wstring> g_Formats;
|
||||||
HINSTANCE hDLL = NULL;
|
HINSTANCE hDLL = NULL;
|
||||||
|
int g_Instances = 0;
|
||||||
FPCALLNTPOWERINFORMATION fpCallNtPowerInformation = NULL;
|
FPCALLNTPOWERINFORMATION fpCallNtPowerInformation = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -80,6 +81,7 @@ FPCALLNTPOWERINFORMATION fpCallNtPowerInformation = NULL;
|
|||||||
*/
|
*/
|
||||||
UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
||||||
{
|
{
|
||||||
|
g_Instances++;
|
||||||
if (hDLL == NULL)
|
if (hDLL == NULL)
|
||||||
{
|
{
|
||||||
hDLL = LoadLibrary(L"powrprof.dll");
|
hDLL = LoadLibrary(L"powrprof.dll");
|
||||||
@ -285,10 +287,12 @@ void Finalize(HMODULE instance, UINT id)
|
|||||||
g_Formats.erase(i2);
|
g_Formats.erase(i2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDLL != NULL)
|
g_Instances--;
|
||||||
|
if (hDLL != NULL && g_Instances == 0)
|
||||||
{
|
{
|
||||||
FreeLibrary(hDLL);
|
FreeLibrary(hDLL);
|
||||||
hDLL = NULL;
|
hDLL = NULL;
|
||||||
|
fpCallNtPowerInformation = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
const int revision_number = 302;
|
const int revision_number = 304;
|
Loading…
Reference in New Issue
Block a user