[proxy,modules] replace global constructor

This commit is contained in:
Armin Novak 2024-06-05 15:45:23 +02:00
parent fd586a2e89
commit 2c4604ed1c
No known key found for this signature in database
GPG Key ID: 2CF4A2D2D3D72105
2 changed files with 28 additions and 9 deletions

View File

@ -42,8 +42,21 @@ static constexpr char plugin_name[] = "bitmap-filter";
static constexpr char plugin_desc[] =
"this plugin deactivates and filters persistent bitmap cache.";
static const std::vector<std::string> plugin_static_intercept = { DRDYNVC_SVC_CHANNEL_NAME };
static const std::vector<std::string> plugin_dyn_intercept = { RDPGFX_DVC_CHANNEL_NAME };
static const std::vector<std::string>& plugin_static_intercept()
{
static std::vector<std::string> vec;
if (vec.empty())
vec.push_back(DRDYNVC_SVC_CHANNEL_NAME);
return vec;
}
static const std::vector<std::string>& plugin_dyn_intercept()
{
static std::vector<std::string> vec;
if (vec.empty())
vec.push_back(RDPGFX_DVC_CHANNEL_NAME);
return vec;
}
class DynChannelState
{
@ -126,8 +139,8 @@ static BOOL filter_dyn_channel_intercept_list(proxyPlugin* plugin, proxyData* pd
WINPR_ASSERT(pdata);
WINPR_ASSERT(data);
auto intercept = std::find(plugin_dyn_intercept.begin(), plugin_dyn_intercept.end(),
data->name) != plugin_dyn_intercept.end();
auto intercept = std::find(plugin_dyn_intercept().begin(), plugin_dyn_intercept().end(),
data->name) != plugin_dyn_intercept().end();
if (intercept)
data->intercept = TRUE;
return TRUE;
@ -141,8 +154,8 @@ static BOOL filter_static_channel_intercept_list(proxyPlugin* plugin, proxyData*
WINPR_ASSERT(pdata);
WINPR_ASSERT(data);
auto intercept = std::find(plugin_static_intercept.begin(), plugin_static_intercept.end(),
data->name) != plugin_static_intercept.end();
auto intercept = std::find(plugin_static_intercept().begin(), plugin_static_intercept().end(),
data->name) != plugin_static_intercept().end();
if (intercept)
data->intercept = TRUE;
return TRUE;

View File

@ -55,7 +55,13 @@ static constexpr char plugin_name[] = "dyn-channel-dump";
static constexpr char plugin_desc[] =
"This plugin dumps configurable dynamic channel data to a file.";
static const std::vector<std::string> plugin_static_intercept = { DRDYNVC_SVC_CHANNEL_NAME };
static const std::vector<std::string>& plugin_static_intercept()
{
static std::vector<std::string> vec;
if (vec.empty())
vec.push_back(DRDYNVC_SVC_CHANNEL_NAME);
return vec;
}
static constexpr char key_path[] = "path";
static constexpr char key_channels[] = "channels";
@ -286,8 +292,8 @@ static BOOL dump_static_channel_intercept_list(proxyPlugin* plugin, proxyData* p
WINPR_ASSERT(pdata);
WINPR_ASSERT(data);
auto intercept = std::find(plugin_static_intercept.begin(), plugin_static_intercept.end(),
data->name) != plugin_static_intercept.end();
auto intercept = std::find(plugin_static_intercept().begin(), plugin_static_intercept().end(),
data->name) != plugin_static_intercept().end();
if (intercept)
{
WLog_INFO(TAG, "intercepting channel '%s'", data->name);