Fixed proxy compilation issues after rdpUpdate refactoring

This commit is contained in:
Armin Novak 2022-01-11 17:00:26 +01:00 committed by akallabeth
parent 0b3d5351e1
commit 1fedd36f65
8 changed files with 53 additions and 44 deletions

View File

@ -1453,7 +1453,7 @@ static BOOL read_pem_file(rdpSettings* settings, size_t id, const char* file)
{ {
INT64 s; INT64 s;
int rs; int rs;
size_t r, fr; size_t fr;
char* ptr; char* ptr;
BOOL rc = FALSE; BOOL rc = FALSE;
FILE* fp = winpr_fopen(file, "r"); FILE* fp = winpr_fopen(file, "r");

View File

@ -237,7 +237,23 @@ struct rdp_update
pSurfaceFrameAcknowledge SurfaceFrameAcknowledge; /* 68 */ pSurfaceFrameAcknowledge SurfaceFrameAcknowledge; /* 68 */
pSaveSessionInfo SaveSessionInfo; /* 69 */ pSaveSessionInfo SaveSessionInfo; /* 69 */
pServerStatusInfo ServerStatusInfo; /* 70 */ pServerStatusInfo ServerStatusInfo; /* 70 */
UINT32 paddingE[80 - 71]; /* 71 */ /* if autoCalculateBitmapData is set to TRUE, the server automatically
* fills BITMAP_DATA struct members: flags, cbCompMainBodySize and cbCompFirstRowSize.
*/
BOOL autoCalculateBitmapData; /* 71 */
UINT32 paddingE[80 - 72]; /* 72 */
}; };
#ifdef __cplusplus
extern "C"
{
#endif
FREERDP_API void rdp_update_lock(rdpUpdate* update);
FREERDP_API void rdp_update_unlock(rdpUpdate* update);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_UPDATE_H */ #endif /* FREERDP_UPDATE_H */

View File

@ -152,7 +152,7 @@ static BOOL update_write_bitmap_data(rdpUpdate* update_pub, wStream* s, BITMAP_D
if (!Stream_EnsureRemainingCapacity(s, 64 + bitmapData->bitmapLength)) if (!Stream_EnsureRemainingCapacity(s, 64 + bitmapData->bitmapLength))
return FALSE; return FALSE;
if (update->autoCalculateBitmapData) if (update->common.autoCalculateBitmapData)
{ {
bitmapData->flags = 0; bitmapData->flags = 0;
bitmapData->cbCompFirstRowSize = 0; bitmapData->cbCompFirstRowSize = 0;
@ -3095,7 +3095,7 @@ rdpUpdate* update_new(rdpRdp* rdp)
deleteList->cIndices = 0; deleteList->cIndices = 0;
update->common.SuppressOutput = update_send_suppress_output; update->common.SuppressOutput = update_send_suppress_output;
update->initialState = TRUE; update->initialState = TRUE;
update->autoCalculateBitmapData = TRUE; update->common.autoCalculateBitmapData = TRUE;
update->queue = MessageQueue_New(&cb); update->queue = MessageQueue_New(&cb);
if (!update->queue) if (!update->queue)
@ -3143,13 +3143,13 @@ void update_free(rdpUpdate* update)
} }
} }
void update_lock(rdpUpdate* update) void rdp_update_lock(rdpUpdate* update)
{ {
rdp_update_internal* up = update_cast(update); rdp_update_internal* up = update_cast(update);
EnterCriticalSection(&up->mux); EnterCriticalSection(&up->mux);
} }
void update_unlock(rdpUpdate* update) void rdp_update_unlock(rdpUpdate* update)
{ {
rdp_update_internal* up = update_cast(update); rdp_update_internal* up = update_cast(update);
LeaveCriticalSection(&up->mux); LeaveCriticalSection(&up->mux);
@ -3157,7 +3157,7 @@ void update_unlock(rdpUpdate* update)
BOOL update_begin_paint(rdpUpdate* update) BOOL update_begin_paint(rdpUpdate* update)
{ {
update_lock(update); rdp_update_lock(update);
if (!update->BeginPaint) if (!update->BeginPaint)
return TRUE; return TRUE;
@ -3175,6 +3175,6 @@ BOOL update_end_paint(rdpUpdate* update)
if (update->EndPaint) if (update->EndPaint)
rc = update->EndPaint(update->context); rc = update->EndPaint(update->context);
update_unlock(update); rdp_update_unlock(update);
return rc; return rc;
} }

View File

@ -60,11 +60,6 @@ typedef struct
rdpBounds currentBounds; rdpBounds currentBounds;
rdpBounds previousBounds; rdpBounds previousBounds;
CRITICAL_SECTION mux; CRITICAL_SECTION mux;
/* if autoCalculateBitmapData is set to TRUE, the server automatically
* fills BITMAP_DATA struct members: flags, cbCompMainBodySize and cbCompFirstRowSize.
*/
BOOL autoCalculateBitmapData;
} rdp_update_internal; } rdp_update_internal;
typedef struct typedef struct
@ -203,7 +198,4 @@ FREERDP_LOCAL int update_process_messages(rdpUpdate* update);
FREERDP_LOCAL BOOL update_begin_paint(rdpUpdate* update); FREERDP_LOCAL BOOL update_begin_paint(rdpUpdate* update);
FREERDP_LOCAL BOOL update_end_paint(rdpUpdate* update); FREERDP_LOCAL BOOL update_end_paint(rdpUpdate* update);
FREERDP_LOCAL void update_lock(rdpUpdate* update);
FREERDP_LOCAL void update_unlock(rdpUpdate* update);
#endif /* FREERDP_LIB_CORE_UPDATE_H */ #endif /* FREERDP_LIB_CORE_UPDATE_H */

View File

@ -1164,7 +1164,7 @@ static BOOL gdi_init_primary(rdpGdi* gdi, UINT32 stride, UINT32 format, BYTE* bu
WINPR_ASSERT(gdi->context); WINPR_ASSERT(gdi->context);
WINPR_ASSERT(gdi->context->update); WINPR_ASSERT(gdi->context->update);
if (!isLocked) if (!isLocked)
update_lock(gdi->context->update); rdp_update_lock(gdi->context->update);
gdi->primary = (gdiBitmap*)calloc(1, sizeof(gdiBitmap)); gdi->primary = (gdiBitmap*)calloc(1, sizeof(gdiBitmap));
@ -1218,7 +1218,7 @@ static BOOL gdi_init_primary(rdpGdi* gdi, UINT32 stride, UINT32 format, BYTE* bu
if (!gdi->drawing) if (!gdi->drawing)
gdi->drawing = gdi->primary; gdi->drawing = gdi->primary;
update_unlock(gdi->context->update); rdp_update_unlock(gdi->context->update);
return TRUE; return TRUE;
fail_hwnd: fail_hwnd:
gdi_DeleteObject((HGDIOBJECT)gdi->primary->bitmap); gdi_DeleteObject((HGDIOBJECT)gdi->primary->bitmap);
@ -1228,7 +1228,7 @@ fail_hdc:
free(gdi->primary); free(gdi->primary);
gdi->primary = NULL; gdi->primary = NULL;
fail_primary: fail_primary:
update_unlock(gdi->context->update); rdp_update_unlock(gdi->context->update);
return FALSE; return FALSE;
} }
@ -1252,7 +1252,7 @@ BOOL gdi_resize_ex(rdpGdi* gdi, UINT32 width, UINT32 height, UINT32 stride, UINT
WINPR_ASSERT(gdi->context); WINPR_ASSERT(gdi->context);
WINPR_ASSERT(gdi->context->update); WINPR_ASSERT(gdi->context->update);
update_lock(gdi->context->update); rdp_update_lock(gdi->context->update);
if (gdi->drawing == gdi->primary) if (gdi->drawing == gdi->primary)
gdi->drawing = NULL; gdi->drawing = NULL;

View File

@ -62,14 +62,15 @@ static BOOL similarRGB(const BYTE* src, const BYTE* dst, size_t size, UINT32 for
{ {
fprintf( fprintf(
stderr, stderr,
"Color value mismatch R[%02X %02X], G[%02X %02X], B[%02X %02X] at position %lu\n", "Color value mismatch R[%02X %02X], G[%02X %02X], B[%02X %02X] at position %" PRIuz
"\n",
sR, dR, sG, dG, sA, dA, x); sR, dR, sG, dG, sA, dA, x);
return FALSE; return FALSE;
} }
if (dA != fill) if (dA != fill)
{ {
fprintf(stderr, "[%s] Invalid destination alpha value %02X at position %lu\n", fprintf(stderr, "[%s] Invalid destination alpha value %02X at position %" PRIuz "\n",
use444 ? "AVC444" : "AVC420", dA, x); use444 ? "AVC444" : "AVC420", dA, x);
return FALSE; return FALSE;
} }

View File

@ -1251,9 +1251,9 @@ BOOL pf_channel_rdpdr_client_handle(pClientContext* pc, UINT16 channelId, const
default: default:
WLog_ERR(TAG, WLog_ERR(TAG,
"[%s]: Channel %s [0x%04" PRIx16 "[%s]: Channel %s [0x%04" PRIx16
"] we´ve reached an impossible state %s! [%s] aliens invaded!", "] we´ve reached an impossible state %s! aliens invaded!",
__FUNCTION__, channel_name, channelId, __FUNCTION__, channel_name, channelId,
rdpdr_client_state_to_string(rdpdr->state), rdpdr_packetid_string(packetid)); rdpdr_client_state_to_string(rdpdr->state));
return FALSE; return FALSE;
} }

View File

@ -374,9 +374,9 @@ static BOOL pf_client_window_create(rdpContext* context, const WINDOW_ORDER_INFO
WINPR_ASSERT(ps->update->window->WindowCreate); WINPR_ASSERT(ps->update->window->WindowCreate);
WLog_DBG(TAG, __FUNCTION__); WLog_DBG(TAG, __FUNCTION__);
EnterCriticalSection(&ps->update->mux); rdp_update_lock(ps->update);
rc = ps->update->window->WindowCreate(ps, orderInfo, windowState); rc = ps->update->window->WindowCreate(ps, orderInfo, windowState);
LeaveCriticalSection(&ps->update->mux); rdp_update_unlock(ps->update);
return rc; return rc;
} }
@ -397,9 +397,9 @@ static BOOL pf_client_window_update(rdpContext* context, const WINDOW_ORDER_INFO
WINPR_ASSERT(ps->update->window->WindowUpdate); WINPR_ASSERT(ps->update->window->WindowUpdate);
WLog_DBG(TAG, __FUNCTION__); WLog_DBG(TAG, __FUNCTION__);
EnterCriticalSection(&ps->update->mux); rdp_update_lock(ps->update);
rc = ps->update->window->WindowUpdate(ps, orderInfo, windowState); rc = ps->update->window->WindowUpdate(ps, orderInfo, windowState);
LeaveCriticalSection(&ps->update->mux); rdp_update_unlock(ps->update);
return rc; return rc;
} }
@ -420,9 +420,9 @@ static BOOL pf_client_window_icon(rdpContext* context, const WINDOW_ORDER_INFO*
WINPR_ASSERT(ps->update->window->WindowIcon); WINPR_ASSERT(ps->update->window->WindowIcon);
WLog_DBG(TAG, __FUNCTION__); WLog_DBG(TAG, __FUNCTION__);
EnterCriticalSection(&ps->update->mux); rdp_update_lock(ps->update);
rc = ps->update->window->WindowIcon(ps, orderInfo, windowIcon); rc = ps->update->window->WindowIcon(ps, orderInfo, windowIcon);
LeaveCriticalSection(&ps->update->mux); rdp_update_unlock(ps->update);
return rc; return rc;
} }
@ -443,9 +443,9 @@ static BOOL pf_client_window_cached_icon(rdpContext* context, const WINDOW_ORDER
WINPR_ASSERT(ps->update->window->WindowCachedIcon); WINPR_ASSERT(ps->update->window->WindowCachedIcon);
WLog_DBG(TAG, __FUNCTION__); WLog_DBG(TAG, __FUNCTION__);
EnterCriticalSection(&ps->update->mux); rdp_update_lock(ps->update);
rc = ps->update->window->WindowCachedIcon(ps, orderInfo, windowCachedIcon); rc = ps->update->window->WindowCachedIcon(ps, orderInfo, windowCachedIcon);
LeaveCriticalSection(&ps->update->mux); rdp_update_unlock(ps->update);
return rc; return rc;
} }
@ -465,9 +465,9 @@ static BOOL pf_client_window_delete(rdpContext* context, const WINDOW_ORDER_INFO
WINPR_ASSERT(ps->update->window->WindowDelete); WINPR_ASSERT(ps->update->window->WindowDelete);
WLog_DBG(TAG, __FUNCTION__); WLog_DBG(TAG, __FUNCTION__);
EnterCriticalSection(&ps->update->mux); rdp_update_lock(ps->update);
rc = ps->update->window->WindowDelete(ps, orderInfo); rc = ps->update->window->WindowDelete(ps, orderInfo);
LeaveCriticalSection(&ps->update->mux); rdp_update_unlock(ps->update);
return rc; return rc;
} }
@ -488,9 +488,9 @@ static BOOL pf_client_notify_icon_create(rdpContext* context, const WINDOW_ORDER
WINPR_ASSERT(ps->update->window->NotifyIconCreate); WINPR_ASSERT(ps->update->window->NotifyIconCreate);
WLog_DBG(TAG, __FUNCTION__); WLog_DBG(TAG, __FUNCTION__);
EnterCriticalSection(&ps->update->mux); rdp_update_lock(ps->update);
rc = ps->update->window->NotifyIconCreate(ps, orderInfo, notifyIconState); rc = ps->update->window->NotifyIconCreate(ps, orderInfo, notifyIconState);
LeaveCriticalSection(&ps->update->mux); rdp_update_unlock(ps->update);
return rc; return rc;
} }
@ -511,9 +511,9 @@ static BOOL pf_client_notify_icon_update(rdpContext* context, const WINDOW_ORDER
WINPR_ASSERT(ps->update->window->NotifyIconUpdate); WINPR_ASSERT(ps->update->window->NotifyIconUpdate);
WLog_DBG(TAG, __FUNCTION__); WLog_DBG(TAG, __FUNCTION__);
EnterCriticalSection(&ps->update->mux); rdp_update_lock(ps->update);
rc = ps->update->window->NotifyIconUpdate(ps, orderInfo, notifyIconState); rc = ps->update->window->NotifyIconUpdate(ps, orderInfo, notifyIconState);
LeaveCriticalSection(&ps->update->mux); rdp_update_unlock(ps->update);
return rc; return rc;
} }
@ -534,9 +534,9 @@ static BOOL pf_client_notify_icon_delete(rdpContext* context, const WINDOW_ORDER
WINPR_ASSERT(ps->update->window->NotifyIconDelete); WINPR_ASSERT(ps->update->window->NotifyIconDelete);
WLog_DBG(TAG, __FUNCTION__); WLog_DBG(TAG, __FUNCTION__);
EnterCriticalSection(&ps->update->mux); rdp_update_lock(ps->update);
rc = ps->update->window->NotifyIconDelete(ps, orderInfo); rc = ps->update->window->NotifyIconDelete(ps, orderInfo);
LeaveCriticalSection(&ps->update->mux); rdp_update_unlock(ps->update);
return rc; return rc;
} }
@ -557,9 +557,9 @@ static BOOL pf_client_monitored_desktop(rdpContext* context, const WINDOW_ORDER_
WINPR_ASSERT(ps->update->window->MonitoredDesktop); WINPR_ASSERT(ps->update->window->MonitoredDesktop);
WLog_DBG(TAG, __FUNCTION__); WLog_DBG(TAG, __FUNCTION__);
EnterCriticalSection(&ps->update->mux); rdp_update_lock(ps->update);
rc = ps->update->window->MonitoredDesktop(ps, orderInfo, monitoredDesktop); rc = ps->update->window->MonitoredDesktop(ps, orderInfo, monitoredDesktop);
LeaveCriticalSection(&ps->update->mux); rdp_update_unlock(ps->update);
return rc; return rc;
} }
@ -579,9 +579,9 @@ static BOOL pf_client_non_monitored_desktop(rdpContext* context, const WINDOW_OR
WINPR_ASSERT(ps->update->window->NonMonitoredDesktop); WINPR_ASSERT(ps->update->window->NonMonitoredDesktop);
WLog_DBG(TAG, __FUNCTION__); WLog_DBG(TAG, __FUNCTION__);
EnterCriticalSection(&ps->update->mux); rdp_update_lock(ps->update);
rc = ps->update->window->NonMonitoredDesktop(ps, orderInfo); rc = ps->update->window->NonMonitoredDesktop(ps, orderInfo);
LeaveCriticalSection(&ps->update->mux); rdp_update_unlock(ps->update);
return rc; return rc;
} }