channels/server: Add APIs for DVCs to get notified of channel id
This allows server implementations to watch these channel ids for their creation statuses.
This commit is contained in:
parent
1f0b3c8004
commit
9d627e0df2
@ -120,7 +120,21 @@ static UINT ainput_server_open_channel(ainput_server* ainput)
|
|||||||
WTS_CHANNEL_OPTION_DYNAMIC);
|
WTS_CHANNEL_OPTION_DYNAMIC);
|
||||||
|
|
||||||
if (ainput->ainput_channel)
|
if (ainput->ainput_channel)
|
||||||
|
{
|
||||||
|
UINT32 channelId;
|
||||||
|
BOOL status = TRUE;
|
||||||
|
|
||||||
|
channelId = WTSChannelGetIdByHandle(ainput->ainput_channel);
|
||||||
|
|
||||||
|
IFCALLRET(ainput->context.ChannelIdAssigned, status, &ainput->context, channelId);
|
||||||
|
if (!status)
|
||||||
|
{
|
||||||
|
WLog_ERR(TAG, "context->ChannelIdAssigned failed!");
|
||||||
|
return ERROR_INTERNAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
Error = GetLastError();
|
Error = GetLastError();
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ static UINT audin_server_send_open(audin_server* audin, wStream* s)
|
|||||||
audin->opened = TRUE;
|
audin->opened = TRUE;
|
||||||
Stream_SetPosition(s, 0);
|
Stream_SetPosition(s, 0);
|
||||||
Stream_Write_UINT8(s, MSG_SNDIN_OPEN);
|
Stream_Write_UINT8(s, MSG_SNDIN_OPEN);
|
||||||
Stream_Write_UINT32(s, audin->context.frames_per_packet); /* FramesPerPacket (4 bytes) */
|
Stream_Write_UINT32(s, audin->context.frames_per_packet); /* FramesPerPacket (4 bytes) */
|
||||||
WINPR_ASSERT(audin->context.selected_client_format >= 0);
|
WINPR_ASSERT(audin->context.selected_client_format >= 0);
|
||||||
WINPR_ASSERT(audin->context.selected_client_format <= UINT32_MAX);
|
WINPR_ASSERT(audin->context.selected_client_format <= UINT32_MAX);
|
||||||
Stream_Write_UINT32(
|
Stream_Write_UINT32(
|
||||||
@ -578,6 +578,8 @@ static BOOL audin_server_open(audin_server_context* context)
|
|||||||
PULONG pSessionId = NULL;
|
PULONG pSessionId = NULL;
|
||||||
DWORD BytesReturned = 0;
|
DWORD BytesReturned = 0;
|
||||||
audin->SessionId = WTS_CURRENT_SESSION;
|
audin->SessionId = WTS_CURRENT_SESSION;
|
||||||
|
UINT32 channelId;
|
||||||
|
BOOL status = TRUE;
|
||||||
|
|
||||||
if (WTSQuerySessionInformationA(context->vcm, WTS_CURRENT_SESSION, WTSSessionId,
|
if (WTSQuerySessionInformationA(context->vcm, WTS_CURRENT_SESSION, WTSSessionId,
|
||||||
(LPSTR*)&pSessionId, &BytesReturned))
|
(LPSTR*)&pSessionId, &BytesReturned))
|
||||||
@ -595,6 +597,15 @@ static BOOL audin_server_open(audin_server_context* context)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channelId = WTSChannelGetIdByHandle(audin->audin_channel);
|
||||||
|
|
||||||
|
IFCALLRET(context->ChannelIdAssigned, status, context, channelId);
|
||||||
|
if (!status)
|
||||||
|
{
|
||||||
|
WLog_ERR(TAG, "context->ChannelIdAssigned failed!");
|
||||||
|
return ERROR_INTERNAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(audin->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
|
if (!(audin->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "CreateEvent failed!");
|
WLog_ERR(TAG, "CreateEvent failed!");
|
||||||
|
@ -392,6 +392,8 @@ static UINT disp_server_open(DispServerContext* context)
|
|||||||
DWORD BytesReturned = 0;
|
DWORD BytesReturned = 0;
|
||||||
PULONG pSessionId = NULL;
|
PULONG pSessionId = NULL;
|
||||||
void* buffer = NULL;
|
void* buffer = NULL;
|
||||||
|
UINT32 channelId;
|
||||||
|
BOOL status = TRUE;
|
||||||
|
|
||||||
WINPR_ASSERT(context);
|
WINPR_ASSERT(context);
|
||||||
|
|
||||||
@ -420,6 +422,16 @@ static UINT disp_server_open(DispServerContext* context)
|
|||||||
goto out_close;
|
goto out_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channelId = WTSChannelGetIdByHandle(priv->disp_channel);
|
||||||
|
|
||||||
|
IFCALLRET(context->ChannelIdAssigned, status, context, channelId);
|
||||||
|
if (!status)
|
||||||
|
{
|
||||||
|
WLog_ERR(TAG, "context->ChannelIdAssigned failed!");
|
||||||
|
rc = ERROR_INTERNAL_ERROR;
|
||||||
|
goto out_close;
|
||||||
|
}
|
||||||
|
|
||||||
/* Query for channel event handle */
|
/* Query for channel event handle */
|
||||||
if (!WTSVirtualChannelQuery(priv->disp_channel, WTSVirtualEventHandle, &buffer,
|
if (!WTSVirtualChannelQuery(priv->disp_channel, WTSVirtualEventHandle, &buffer,
|
||||||
&BytesReturned) ||
|
&BytesReturned) ||
|
||||||
|
@ -91,7 +91,21 @@ static UINT echo_server_open_channel(echo_server* echo)
|
|||||||
WTS_CHANNEL_OPTION_DYNAMIC);
|
WTS_CHANNEL_OPTION_DYNAMIC);
|
||||||
|
|
||||||
if (echo->echo_channel)
|
if (echo->echo_channel)
|
||||||
|
{
|
||||||
|
UINT32 channelId;
|
||||||
|
BOOL status = TRUE;
|
||||||
|
|
||||||
|
channelId = WTSChannelGetIdByHandle(echo->echo_channel);
|
||||||
|
|
||||||
|
IFCALLRET(echo->context.ChannelIdAssigned, status, &echo->context, channelId);
|
||||||
|
if (!status)
|
||||||
|
{
|
||||||
|
WLog_ERR(TAG, "context->ChannelIdAssigned failed!");
|
||||||
|
return ERROR_INTERNAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
Error = GetLastError();
|
Error = GetLastError();
|
||||||
|
|
||||||
|
@ -96,6 +96,8 @@ UINT rdpei_server_init(RdpeiServerContext* context)
|
|||||||
void* buffer = NULL;
|
void* buffer = NULL;
|
||||||
DWORD bytesReturned;
|
DWORD bytesReturned;
|
||||||
RdpeiServerPrivate* priv = context->priv;
|
RdpeiServerPrivate* priv = context->priv;
|
||||||
|
UINT32 channelId;
|
||||||
|
BOOL status = TRUE;
|
||||||
|
|
||||||
priv->channelHandle = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, RDPEI_DVC_CHANNEL_NAME,
|
priv->channelHandle = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, RDPEI_DVC_CHANNEL_NAME,
|
||||||
WTS_CHANNEL_OPTION_DYNAMIC);
|
WTS_CHANNEL_OPTION_DYNAMIC);
|
||||||
@ -105,6 +107,15 @@ UINT rdpei_server_init(RdpeiServerContext* context)
|
|||||||
return CHANNEL_RC_INITIALIZATION_ERROR;
|
return CHANNEL_RC_INITIALIZATION_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channelId = WTSChannelGetIdByHandle(priv->channelHandle);
|
||||||
|
|
||||||
|
IFCALLRET(context->onChannelIdAssigned, status, context, channelId);
|
||||||
|
if (!status)
|
||||||
|
{
|
||||||
|
WLog_ERR(TAG, "context->onChannelIdAssigned failed!");
|
||||||
|
goto out_close;
|
||||||
|
}
|
||||||
|
|
||||||
if (!WTSVirtualChannelQuery(priv->channelHandle, WTSVirtualEventHandle, &buffer,
|
if (!WTSVirtualChannelQuery(priv->channelHandle, WTSVirtualEventHandle, &buffer,
|
||||||
&bytesReturned) ||
|
&bytesReturned) ||
|
||||||
(bytesReturned != sizeof(HANDLE)))
|
(bytesReturned != sizeof(HANDLE)))
|
||||||
|
@ -1423,6 +1423,8 @@ static BOOL rdpgfx_server_open(RdpgfxServerContext* context)
|
|||||||
PULONG pSessionId = NULL;
|
PULONG pSessionId = NULL;
|
||||||
DWORD BytesReturned = 0;
|
DWORD BytesReturned = 0;
|
||||||
priv->SessionId = WTS_CURRENT_SESSION;
|
priv->SessionId = WTS_CURRENT_SESSION;
|
||||||
|
UINT32 channelId;
|
||||||
|
BOOL status = TRUE;
|
||||||
|
|
||||||
if (WTSQuerySessionInformationA(context->vcm, WTS_CURRENT_SESSION, WTSSessionId,
|
if (WTSQuerySessionInformationA(context->vcm, WTS_CURRENT_SESSION, WTSSessionId,
|
||||||
(LPSTR*)&pSessionId, &BytesReturned) == FALSE)
|
(LPSTR*)&pSessionId, &BytesReturned) == FALSE)
|
||||||
@ -1442,6 +1444,15 @@ static BOOL rdpgfx_server_open(RdpgfxServerContext* context)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channelId = WTSChannelGetIdByHandle(priv->rdpgfx_channel);
|
||||||
|
|
||||||
|
IFCALLRET(context->ChannelIdAssigned, status, context, channelId);
|
||||||
|
if (!status)
|
||||||
|
{
|
||||||
|
WLog_ERR(TAG, "context->ChannelIdAssigned failed!");
|
||||||
|
goto out_close;
|
||||||
|
}
|
||||||
|
|
||||||
/* Query for channel event handle */
|
/* Query for channel event handle */
|
||||||
if (!WTSVirtualChannelQuery(priv->rdpgfx_channel, WTSVirtualEventHandle, &buffer,
|
if (!WTSVirtualChannelQuery(priv->rdpgfx_channel, WTSVirtualEventHandle, &buffer,
|
||||||
&BytesReturned) ||
|
&BytesReturned) ||
|
||||||
|
@ -34,6 +34,8 @@ typedef enum AINPUT_SERVER_OPEN_RESULT
|
|||||||
|
|
||||||
typedef struct _ainput_server_context ainput_server_context;
|
typedef struct _ainput_server_context ainput_server_context;
|
||||||
|
|
||||||
|
typedef BOOL (*psAInputChannelIdAssigned)(ainput_server_context* context, UINT32 channelId);
|
||||||
|
|
||||||
typedef UINT (*psAInputServerInitialize)(ainput_server_context* context, BOOL externalThread);
|
typedef UINT (*psAInputServerInitialize)(ainput_server_context* context, BOOL externalThread);
|
||||||
typedef UINT (*psAInputServerPoll)(ainput_server_context* context);
|
typedef UINT (*psAInputServerPoll)(ainput_server_context* context);
|
||||||
typedef BOOL (*psAInputServerChannelHandle)(ainput_server_context* context, HANDLE* handle);
|
typedef BOOL (*psAInputServerChannelHandle)(ainput_server_context* context, HANDLE* handle);
|
||||||
@ -98,6 +100,11 @@ struct _ainput_server_context
|
|||||||
psAInputServerMouseEvent MouseEvent;
|
psAInputServerMouseEvent MouseEvent;
|
||||||
|
|
||||||
rdpContext* rdpcontext;
|
rdpContext* rdpcontext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback, when the channel got its id assigned.
|
||||||
|
*/
|
||||||
|
psAInputChannelIdAssigned ChannelIdAssigned;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
typedef struct s_audin_server_context audin_server_context;
|
typedef struct s_audin_server_context audin_server_context;
|
||||||
|
|
||||||
|
typedef BOOL (*psAudinServerChannelIdAssigned)(audin_server_context* context, UINT32 channelId);
|
||||||
|
|
||||||
typedef UINT (*psAudinServerSelectFormat)(audin_server_context* context,
|
typedef UINT (*psAudinServerSelectFormat)(audin_server_context* context,
|
||||||
size_t client_format_index);
|
size_t client_format_index);
|
||||||
typedef BOOL (*psAudinServerOpen)(audin_server_context* context);
|
typedef BOOL (*psAudinServerOpen)(audin_server_context* context);
|
||||||
@ -99,6 +101,11 @@ struct s_audin_server_context
|
|||||||
psAudinServerReceiveSamples ReceiveSamples;
|
psAudinServerReceiveSamples ReceiveSamples;
|
||||||
|
|
||||||
rdpContext* rdpcontext;
|
rdpContext* rdpcontext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback, when the channel got its id assigned.
|
||||||
|
*/
|
||||||
|
psAudinServerChannelIdAssigned ChannelIdAssigned;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
typedef struct s_disp_server_private DispServerPrivate;
|
typedef struct s_disp_server_private DispServerPrivate;
|
||||||
typedef struct s_disp_server_context DispServerContext;
|
typedef struct s_disp_server_context DispServerContext;
|
||||||
|
|
||||||
|
typedef BOOL (*psDispChannelIdAssigned)(DispServerContext* context, UINT32 channelId);
|
||||||
|
|
||||||
typedef UINT (*psDispMonitorLayout)(DispServerContext* context,
|
typedef UINT (*psDispMonitorLayout)(DispServerContext* context,
|
||||||
const DISPLAY_CONTROL_MONITOR_LAYOUT_PDU* pdu);
|
const DISPLAY_CONTROL_MONITOR_LAYOUT_PDU* pdu);
|
||||||
typedef UINT (*psDispCaps)(DispServerContext* context);
|
typedef UINT (*psDispCaps)(DispServerContext* context);
|
||||||
@ -53,6 +55,11 @@ struct s_disp_server_context
|
|||||||
|
|
||||||
DispServerPrivate* priv;
|
DispServerPrivate* priv;
|
||||||
rdpContext* rdpcontext;
|
rdpContext* rdpcontext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback, when the channel got its id assigned.
|
||||||
|
*/
|
||||||
|
psDispChannelIdAssigned ChannelIdAssigned;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -34,6 +34,8 @@ typedef enum ECHO_SERVER_OPEN_RESULT
|
|||||||
|
|
||||||
typedef struct s_echo_server_context echo_server_context;
|
typedef struct s_echo_server_context echo_server_context;
|
||||||
|
|
||||||
|
typedef BOOL (*psEchoServerChannelIdAssigned)(echo_server_context* context, UINT32 channelId);
|
||||||
|
|
||||||
typedef UINT (*psEchoServerOpen)(echo_server_context* context);
|
typedef UINT (*psEchoServerOpen)(echo_server_context* context);
|
||||||
typedef UINT (*psEchoServerClose)(echo_server_context* context);
|
typedef UINT (*psEchoServerClose)(echo_server_context* context);
|
||||||
typedef BOOL (*psEchoServerRequest)(echo_server_context* context, const BYTE* buffer,
|
typedef BOOL (*psEchoServerRequest)(echo_server_context* context, const BYTE* buffer,
|
||||||
@ -76,6 +78,11 @@ struct s_echo_server_context
|
|||||||
psEchoServerResponse Response;
|
psEchoServerResponse Response;
|
||||||
|
|
||||||
rdpContext* rdpcontext;
|
rdpContext* rdpcontext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback, when the channel got its id assigned.
|
||||||
|
*/
|
||||||
|
psEchoServerChannelIdAssigned ChannelIdAssigned;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -46,6 +46,11 @@ struct s_rdpei_server_context
|
|||||||
UINT (*onTouchReleased)(RdpeiServerContext* context, BYTE contactId);
|
UINT (*onTouchReleased)(RdpeiServerContext* context, BYTE contactId);
|
||||||
|
|
||||||
void* user_data; /* user data, useful for callbacks */
|
void* user_data; /* user data, useful for callbacks */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback, when the channel got its id assigned.
|
||||||
|
*/
|
||||||
|
BOOL (*onChannelIdAssigned)(RdpeiServerContext* context, UINT32 channelId);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -29,6 +29,8 @@ typedef struct s_rdpgfx_server_private RdpgfxServerPrivate;
|
|||||||
typedef BOOL (*psRdpgfxServerOpen)(RdpgfxServerContext* context);
|
typedef BOOL (*psRdpgfxServerOpen)(RdpgfxServerContext* context);
|
||||||
typedef BOOL (*psRdpgfxServerClose)(RdpgfxServerContext* context);
|
typedef BOOL (*psRdpgfxServerClose)(RdpgfxServerContext* context);
|
||||||
|
|
||||||
|
typedef BOOL (*psRdpgfxServerChannelIdAssigned)(RdpgfxServerContext* context, UINT32 channelId);
|
||||||
|
|
||||||
typedef UINT (*psRdpgfxResetGraphics)(RdpgfxServerContext* context,
|
typedef UINT (*psRdpgfxResetGraphics)(RdpgfxServerContext* context,
|
||||||
const RDPGFX_RESET_GRAPHICS_PDU* resetGraphics);
|
const RDPGFX_RESET_GRAPHICS_PDU* resetGraphics);
|
||||||
typedef UINT (*psRdpgfxStartFrame)(RdpgfxServerContext* context,
|
typedef UINT (*psRdpgfxStartFrame)(RdpgfxServerContext* context,
|
||||||
@ -112,6 +114,11 @@ struct s_rdpgfx_server_context
|
|||||||
|
|
||||||
RdpgfxServerPrivate* priv;
|
RdpgfxServerPrivate* priv;
|
||||||
rdpContext* rdpcontext;
|
rdpContext* rdpcontext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback, when the channel got its id assigned.
|
||||||
|
*/
|
||||||
|
psRdpgfxServerChannelIdAssigned ChannelIdAssigned;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
Reference in New Issue
Block a user