From 53c74beadcebbc4fe7caf01cb4a6d22939e59d13 Mon Sep 17 00:00:00 2001 From: David Fort Date: Tue, 29 Jan 2019 10:33:06 +0100 Subject: [PATCH] rdp: add a callback for ServerStatusInfo --- include/freerdp/update.h | 18 +++++++++++++++++- libfreerdp/core/info.c | 14 ++++++++++++++ libfreerdp/core/info.h | 4 ++-- libfreerdp/core/rdp.c | 4 ++++ libfreerdp/core/update.c | 8 ++++++-- 5 files changed, 43 insertions(+), 5 deletions(-) diff --git a/include/freerdp/update.h b/include/freerdp/update.h index 87c8656cc..b6d528324 100644 --- a/include/freerdp/update.h +++ b/include/freerdp/update.h @@ -139,6 +139,20 @@ enum SURFCMD_FRAMEACTION SURFACECMD_FRAMEACTION_END = 0x0001 }; +/** @brief status code as in 2.2.5.2 Server Status Info PDU */ +enum +{ + TS_STATUS_FINDING_DESTINATION = 0x00000401, + TS_STATUS_LOADING_DESTINATION = 0x00000402, + TS_STATUS_BRINGING_SESSION_ONLINE = 0x00000403, + TS_STATUS_REDIRECTING_TO_DESTINATION = 0x00000404, + TS_STATUS_VM_LOADING = 0x00000501, + TS_STATUS_VM_WAKING = 0x00000502, + TS_STATUS_VM_STARTING = 0x00000503, + TS_STATUS_VM_STARTING_MONITORING = 0x00000504, + TS_STATUS_VM_RETRYING_MONITORING = 0x00000505 +}; + struct _SURFACE_FRAME { UINT32 frameId; @@ -180,6 +194,7 @@ typedef BOOL (*pSurfaceFrameAcknowledge)(rdpContext* context, UINT32 frameId); typedef BOOL (*pSaveSessionInfo)(rdpContext* context, UINT32 type, void* data); typedef BOOL (*pSetKeyboardImeStatus)(rdpContext* context, UINT16 imeId, UINT32 imeState, UINT32 imeConvMode); +typedef BOOL (*pServerStatusInfo)(rdpContext* context, UINT32 status); struct rdp_update { @@ -216,7 +231,8 @@ struct rdp_update pSurfaceFrameBits SurfaceFrameBits; /* 67 */ pSurfaceFrameAcknowledge SurfaceFrameAcknowledge; /* 68 */ pSaveSessionInfo SaveSessionInfo; /* 69 */ - UINT32 paddingE[80 - 70]; /* 70 */ + pServerStatusInfo ServerStatusInfo; /* 70 */ + UINT32 paddingE[80 - 71]; /* 71 */ /* internal */ diff --git a/libfreerdp/core/info.c b/libfreerdp/core/info.c index e76af1370..4f54d78cf 100644 --- a/libfreerdp/core/info.c +++ b/libfreerdp/core/info.c @@ -1461,3 +1461,17 @@ BOOL rdp_send_save_session_info(rdpContext* context, UINT32 type, void* data) return status; } + +BOOL rdp_send_server_status_info(rdpContext* context, UINT32 status) +{ + wStream* s; + rdpRdp* rdp = context->rdp; + s = rdp_data_pdu_init(rdp); + + if (!s) + return FALSE; + + Stream_Write_UINT32(s, status); + + return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_STATUS_INFO, rdp->mcs->userId);; +} diff --git a/libfreerdp/core/info.h b/libfreerdp/core/info.h index 860ff69a8..dd6458ca5 100644 --- a/libfreerdp/core/info.h +++ b/libfreerdp/core/info.h @@ -62,8 +62,8 @@ FREERDP_LOCAL void rdp_write_auto_reconnect_cookie(rdpRdp* rdp, wStream* s); FREERDP_LOCAL BOOL rdp_recv_client_info(rdpRdp* rdp, wStream* s); FREERDP_LOCAL BOOL rdp_send_client_info(rdpRdp* rdp); FREERDP_LOCAL BOOL rdp_recv_save_session_info(rdpRdp* rdp, wStream* s); -FREERDP_LOCAL BOOL rdp_send_save_session_info(rdpContext* context, UINT32 type, - void* data); +FREERDP_LOCAL BOOL rdp_send_save_session_info(rdpContext* context, UINT32 type, void* data); +FREERDP_LOCAL BOOL rdp_send_server_status_info(rdpContext* context, UINT32 status); FREERDP_LOCAL char* rdp_info_package_flags_description(UINT32 flags); diff --git a/libfreerdp/core/rdp.c b/libfreerdp/core/rdp.c index ffb6c9b00..82666a1f9 100644 --- a/libfreerdp/core/rdp.c +++ b/libfreerdp/core/rdp.c @@ -765,6 +765,10 @@ static BOOL rdp_recv_server_status_info_pdu(rdpRdp* rdp, wStream* s) return FALSE; Stream_Read_UINT32(s, statusCode); /* statusCode (4 bytes) */ + + if (rdp->update->ServerStatusInfo) + return rdp->update->ServerStatusInfo(rdp->context, statusCode); + return TRUE; } diff --git a/libfreerdp/core/update.c b/libfreerdp/core/update.c index c2ca42cc4..82bdaa8aa 100644 --- a/libfreerdp/core/update.c +++ b/libfreerdp/core/update.c @@ -2094,6 +2094,8 @@ void update_register_server_callbacks(rdpUpdate* update) update->SetKeyboardIndicators = update_send_set_keyboard_indicators; update->SetKeyboardImeStatus = update_send_set_keyboard_ime_status; update->SaveSessionInfo = rdp_send_save_session_info; + update->ServerStatusInfo = rdp_send_server_status_info; + update->primary->DstBlt = update_send_dstblt; update->primary->PatBlt = update_send_patblt; update->primary->ScrBlt = update_send_scrblt; @@ -2101,6 +2103,7 @@ void update_register_server_callbacks(rdpUpdate* update) update->primary->LineTo = update_send_line_to; update->primary->MemBlt = update_send_memblt; update->primary->GlyphIndex = update_send_glyph_index; + update->secondary->CacheBitmap = update_send_cache_bitmap; update->secondary->CacheBitmapV2 = update_send_cache_bitmap_v2; update->secondary->CacheBitmapV3 = update_send_cache_bitmap_v3; @@ -2108,9 +2111,10 @@ void update_register_server_callbacks(rdpUpdate* update) update->secondary->CacheGlyph = update_send_cache_glyph; update->secondary->CacheGlyphV2 = update_send_cache_glyph_v2; update->secondary->CacheBrush = update_send_cache_brush; - update->altsec->CreateOffscreenBitmap = - update_send_create_offscreen_bitmap_order; + + update->altsec->CreateOffscreenBitmap = update_send_create_offscreen_bitmap_order; update->altsec->SwitchSurface = update_send_switch_surface_order; + update->pointer->PointerSystem = update_send_pointer_system; update->pointer->PointerPosition = update_send_pointer_position; update->pointer->PointerColor = update_send_pointer_color;