diff --git a/channels/rdpgfx/client/rdpgfx_main.c b/channels/rdpgfx/client/rdpgfx_main.c index 4407702e5..500c4934d 100644 --- a/channels/rdpgfx/client/rdpgfx_main.c +++ b/channels/rdpgfx/client/rdpgfx_main.c @@ -637,7 +637,7 @@ static UINT rdpgfx_load_cache_import_offer(RDPGFX_PLUGIN* gfx, RDPGFX_CACHE_IMPO offer->cacheEntriesCount = 0; - if (!settings->BitmapCachePersistEnabled) + if (!freerdp_settings_get_bool(settings, FreeRDP_BitmapCachePersistEnabled)) return CHANNEL_RC_OK; if (!settings->BitmapCachePersistFile) @@ -715,7 +715,7 @@ static UINT rdpgfx_save_persistent_cache(RDPGFX_PLUGIN* gfx) WINPR_ASSERT(context); WINPR_ASSERT(settings); - if (!settings->BitmapCachePersistEnabled) + if (!freerdp_settings_get_bool(settings, FreeRDP_BitmapCachePersistEnabled)) return CHANNEL_RC_OK; if (!settings->BitmapCachePersistFile) @@ -845,7 +845,7 @@ static UINT rdpgfx_send_cache_offer(RDPGFX_PLUGIN* gfx) RdpgfxClientContext* context = gfx->context; rdpSettings* settings = gfx->rdpcontext->settings; - if (!settings->BitmapCachePersistEnabled) + if (!freerdp_settings_get_bool(settings, FreeRDP_BitmapCachePersistEnabled)) return CHANNEL_RC_OK; if (!settings->BitmapCachePersistFile) @@ -930,7 +930,7 @@ static UINT rdpgfx_load_cache_import_reply(RDPGFX_PLUGIN* gfx, RDPGFX_CACHE_IMPO WINPR_ASSERT(settings); WINPR_ASSERT(reply); - if (!settings->BitmapCachePersistEnabled) + if (!freerdp_settings_get_bool(settings, FreeRDP_BitmapCachePersistEnabled)) return CHANNEL_RC_OK; if (!settings->BitmapCachePersistFile) diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 7a5b6cae7..abaeb9538 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -3825,7 +3825,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, CommandLineSwitchCase(arg, "persist-cache") { WLog_WARN(TAG, "/persist-cache is deprecated, use /cache:persist[:on|off] instead"); - settings->BitmapCachePersistEnabled = enable; + if (!freerdp_settings_set_bool(settings, FreeRDP_BitmapCachePersistEnabled, enable)) + return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; } CommandLineSwitchCase(arg, "persist-cache-file") { @@ -3834,7 +3835,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, if (!freerdp_settings_set_string(settings, FreeRDP_BitmapCachePersistFile, arg->Value)) return COMMAND_LINE_ERROR_MEMORY; - settings->BitmapCachePersistEnabled = TRUE; + if (!freerdp_settings_set_bool(settings, FreeRDP_BitmapCachePersistEnabled, TRUE)) + return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; } CommandLineSwitchCase(arg, "offscreen-cache") { diff --git a/libfreerdp/cache/bitmap.c b/libfreerdp/cache/bitmap.c index d3dc8463b..96fd6e273 100644 --- a/libfreerdp/cache/bitmap.c +++ b/libfreerdp/cache/bitmap.c @@ -296,7 +296,7 @@ static int bitmap_cache_save_persistent(rdpBitmapCache* bitmapCache) if (version != 2) return 0; /* persistent bitmap cache already saved in egfx channel */ - if (!settings->BitmapCachePersistEnabled) + if (!freerdp_settings_get_bool(settings, FreeRDP_BitmapCachePersistEnabled)) return 0; if (!settings->BitmapCachePersistFile) diff --git a/libfreerdp/core/activation.c b/libfreerdp/core/activation.c index ca3af6242..93d813684 100644 --- a/libfreerdp/core/activation.c +++ b/libfreerdp/core/activation.c @@ -282,7 +282,7 @@ static UINT32 rdp_load_persistent_key_list(rdpRdp* rdp, UINT64** pKeyList) *pKeyList = NULL; - if (!settings->BitmapCachePersistEnabled) + if (!freerdp_settings_get_bool(settings, FreeRDP_BitmapCachePersistEnabled)) return 0; if (!settings->BitmapCachePersistFile) diff --git a/libfreerdp/core/capabilities.c b/libfreerdp/core/capabilities.c index 7548735c6..365311d6d 100644 --- a/libfreerdp/core/capabilities.c +++ b/libfreerdp/core/capabilities.c @@ -1861,9 +1861,9 @@ static BOOL rdp_print_offscreen_bitmap_cache_capability_set(wStream* s) static BOOL rdp_apply_bitmap_cache_host_support_capability_set(rdpSettings* settings, const rdpSettings* src) { - if (freerdp_settings_get_bool(src, FreeRDP_BitmapCachePersistEnabled)) - return freerdp_settings_set_bool(settings, FreeRDP_BitmapCachePersistEnabled, TRUE); - return TRUE; + const BOOL val = (freerdp_settings_get_bool(src, FreeRDP_BitmapCachePersistEnabled) && + freerdp_settings_get_bool(settings, FreeRDP_BitmapCachePersistEnabled)); + return freerdp_settings_set_bool(settings, FreeRDP_BitmapCachePersistEnabled, val); } /* @@ -2052,7 +2052,7 @@ static BOOL rdp_write_bitmap_cache_v2_capability_set(wStream* s, const rdpSettin return FALSE; cacheFlags = ALLOW_CACHE_WAITING_LIST_FLAG; - if (settings->BitmapCachePersistEnabled) + if (freerdp_settings_get_bool(settings, FreeRDP_BitmapCachePersistEnabled)) { cacheFlags |= PERSISTENT_KEYS_EXPECTED_FLAG; settings->BitmapCacheV2CellInfo[0].persistent = 1; diff --git a/libfreerdp/core/connection.c b/libfreerdp/core/connection.c index 5a35714b8..a0e2f6a15 100644 --- a/libfreerdp/core/connection.c +++ b/libfreerdp/core/connection.c @@ -1261,7 +1261,7 @@ state_run_t rdp_client_connect_finalize(rdpRdp* rdp) */ if (!rdp_finalize_is_flag_set(rdp, FINALIZE_DEACTIVATE_REACTIVATE) && - rdp->settings->BitmapCachePersistEnabled) + freerdp_settings_get_bool(rdp->settings, FreeRDP_BitmapCachePersistEnabled)) { if (!rdp_client_transition_to_state(rdp, CONNECTION_STATE_FINALIZATION_PERSISTENT_KEY_LIST)) return STATE_RUN_FAILED;