core: add support for set keyboard indicators PDU

Server Set Keyboard Indicators PDU MS-RDPBCGR 2.2.8.2.1

* add server side code
* add support for client callback
This commit is contained in:
Bernhard Miklautz 2014-09-30 18:18:29 +02:00
parent ee2626b670
commit f40053577f
6 changed files with 36 additions and 1 deletions

View File

@ -54,6 +54,7 @@
#define Update_SurfaceBits 12
#define Update_SurfaceFrameMarker 13
#define Update_SurfaceFrameAcknowledge 14
#define Update_SetKeyboardIndicators 15
#define FREERDP_UPDATE_BEGIN_PAINT MakeMessageId(Update, BeginPaint)
#define FREERDP_UPDATE_ END_PAINT MakeMessageId(Update, EndPaint)
@ -69,6 +70,7 @@
#define FREERDP_UPDATE_SURFACE_BITS MakeMessageId(Update, SurfaceBits)
#define FREERDP_UPDATE_SURFACE_FRAME_MARKER MakeMessageId(Update, SurfaceFrameMarker)
#define FREERDP_UPDATE_SURFACE_FRAME_ACKNOWLEDGE MakeMessageId(Update, SurfaceFrameAcknowledge)
#define FREERDP_UPDATE_SET_KEYBOARD_INDICATORS MakeMessageId(Update, SetKeyboardIndicators)
/* Primary Update */

View File

@ -142,6 +142,7 @@ typedef void (*pDesktopResize)(rdpContext* context);
typedef void (*pBitmapUpdate)(rdpContext* context, BITMAP_UPDATE* bitmap);
typedef void (*pPalette)(rdpContext* context, PALETTE_UPDATE* palette);
typedef void (*pPlaySound)(rdpContext* context, PLAY_SOUND_UPDATE* play_sound);
typedef void (*pSetKeyboardIndicators)(rdpContext* context, UINT16 led_flags);
typedef void (*pRefreshRect)(rdpContext* context, BYTE count, RECTANGLE_16* areas);
typedef void (*pSuppressOutput)(rdpContext* context, BYTE allow, RECTANGLE_16* area);
@ -165,7 +166,8 @@ struct rdp_update
pBitmapUpdate BitmapUpdate; /* 21 */
pPalette Palette; /* 22 */
pPlaySound PlaySound; /* 23 */
UINT32 paddingB[32 - 24]; /* 24 */
pSetKeyboardIndicators SetKeyboardIndicators; /* 24 */
UINT32 paddingB[32 - 25]; /* 25 */
rdpPointerUpdate* pointer; /* 32 */
rdpPrimaryUpdate* primary; /* 33 */

View File

@ -127,6 +127,12 @@ static void update_message_PlaySound(rdpContext* context, PLAY_SOUND_UPDATE* pla
MakeMessageId(Update, PlaySound), (void*) wParam, NULL);
}
static void update_message_SetKeyboardIndicators(rdpContext* context, UINT16 led_flags)
{
MessageQueue_Post(context->update->queue, (void*) context,
MakeMessageId(Update, SetKeyboardIndicators), (void*)(size_t)led_flags, NULL);
}
static void update_message_RefreshRect(rdpContext* context, BYTE count, RECTANGLE_16* areas)
{
RECTANGLE_16* lParam;
@ -1061,6 +1067,7 @@ static int update_message_free_update_class(wMessage* msg, int type)
break;
case Update_SurfaceFrameAcknowledge:
case Update_SetKeyboardIndicators:
break;
default:
@ -1136,6 +1143,10 @@ static int update_message_process_update_class(rdpUpdateProxy* proxy, wMessage*
IFCALL(proxy->SurfaceFrameAcknowledge, msg->context, (UINT32) (size_t) msg->wParam);
break;
case Update_SetKeyboardIndicators:
IFCALL(proxy->SetKeyboardIndicators, msg->context, (UINT16) (size_t) msg->wParam);
break;
default:
status = -1;
break;
@ -2006,6 +2017,7 @@ void update_message_register_interface(rdpUpdateProxy* message, rdpUpdate* updat
message->BitmapUpdate = update->BitmapUpdate;
message->Palette = update->Palette;
message->PlaySound = update->PlaySound;
message->SetKeyboardIndicators = update->SetKeyboardIndicators;
message->RefreshRect = update->RefreshRect;
message->SuppressOutput = update->SuppressOutput;
message->SurfaceCommand = update->SurfaceCommand;
@ -2021,6 +2033,7 @@ void update_message_register_interface(rdpUpdateProxy* message, rdpUpdate* updat
update->BitmapUpdate = update_message_BitmapUpdate;
update->Palette = update_message_Palette;
update->PlaySound = update_message_PlaySound;
update->SetKeyboardIndicators = update_message_SetKeyboardIndicators;
update->RefreshRect = update_message_RefreshRect;
update->SuppressOutput = update_message_SuppressOutput;
update->SurfaceCommand = update_message_SurfaceCommand;

View File

@ -43,6 +43,7 @@ struct rdp_update_proxy
pBitmapUpdate BitmapUpdate;
pPalette Palette;
pPlaySound PlaySound;
pSetKeyboardIndicators SetKeyboardIndicators;
pRefreshRect RefreshRect;
pSuppressOutput SuppressOutput;
pSurfaceCommand SurfaceCommand;

View File

@ -595,12 +595,16 @@ BOOL rdp_recv_server_set_keyboard_indicators_pdu(rdpRdp* rdp, wStream* s)
{
UINT16 unitId;
UINT16 ledFlags;
rdpContext* context = rdp->instance->context;
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
Stream_Read_UINT16(s, unitId); /* unitId (2 bytes) */
Stream_Read_UINT16(s, ledFlags); /* ledFlags (2 bytes) */
IFCALL(context->update->SetKeyboardIndicators, context, ledFlags);
return TRUE;
}

View File

@ -1612,6 +1612,18 @@ BOOL update_read_suppress_output(rdpUpdate* update, wStream* s)
return TRUE;
}
static void update_send_set_keyboard_indicators(rdpContext* context, UINT16 led_flags)
{
wStream* s;
rdpRdp* rdp = context->rdp;
s = rdp_data_pdu_init(rdp);
Stream_Write_UINT16(s, 0); /* unitId should be 0 according to MS-RDPBCGR 2.2.8.2.1.1 */
Stream_Write_UINT16(s, led_flags); /* ledFlags (2 bytes) */
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SET_KEYBOARD_INDICATORS, rdp->mcs->userId);
Stream_Release(s);
}
void update_register_server_callbacks(rdpUpdate* update)
{
update->BeginPaint = update_begin_paint;
@ -1625,6 +1637,7 @@ void update_register_server_callbacks(rdpUpdate* update)
update->SurfaceCommand = update_send_surface_command;
update->SurfaceFrameBits = update_send_surface_frame_bits;
update->PlaySound = update_send_play_sound;
update->SetKeyboardIndicators = update_send_set_keyboard_indicators;
update->primary->DstBlt = update_send_dstblt;
update->primary->PatBlt = update_send_patblt;
update->primary->ScrBlt = update_send_scrblt;