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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Error = GetLastError();
|
||||
|
||||
|
@ -578,6 +578,8 @@ static BOOL audin_server_open(audin_server_context* context)
|
||||
PULONG pSessionId = NULL;
|
||||
DWORD BytesReturned = 0;
|
||||
audin->SessionId = WTS_CURRENT_SESSION;
|
||||
UINT32 channelId;
|
||||
BOOL status = TRUE;
|
||||
|
||||
if (WTSQuerySessionInformationA(context->vcm, WTS_CURRENT_SESSION, WTSSessionId,
|
||||
(LPSTR*)&pSessionId, &BytesReturned))
|
||||
@ -595,6 +597,15 @@ static BOOL audin_server_open(audin_server_context* context)
|
||||
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)))
|
||||
{
|
||||
WLog_ERR(TAG, "CreateEvent failed!");
|
||||
|
@ -392,6 +392,8 @@ static UINT disp_server_open(DispServerContext* context)
|
||||
DWORD BytesReturned = 0;
|
||||
PULONG pSessionId = NULL;
|
||||
void* buffer = NULL;
|
||||
UINT32 channelId;
|
||||
BOOL status = TRUE;
|
||||
|
||||
WINPR_ASSERT(context);
|
||||
|
||||
@ -420,6 +422,16 @@ static UINT disp_server_open(DispServerContext* context)
|
||||
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 */
|
||||
if (!WTSVirtualChannelQuery(priv->disp_channel, WTSVirtualEventHandle, &buffer,
|
||||
&BytesReturned) ||
|
||||
|
@ -91,7 +91,21 @@ static UINT echo_server_open_channel(echo_server* echo)
|
||||
WTS_CHANNEL_OPTION_DYNAMIC);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Error = GetLastError();
|
||||
|
||||
|
@ -96,6 +96,8 @@ UINT rdpei_server_init(RdpeiServerContext* context)
|
||||
void* buffer = NULL;
|
||||
DWORD bytesReturned;
|
||||
RdpeiServerPrivate* priv = context->priv;
|
||||
UINT32 channelId;
|
||||
BOOL status = TRUE;
|
||||
|
||||
priv->channelHandle = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, RDPEI_DVC_CHANNEL_NAME,
|
||||
WTS_CHANNEL_OPTION_DYNAMIC);
|
||||
@ -105,6 +107,15 @@ UINT rdpei_server_init(RdpeiServerContext* context)
|
||||
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,
|
||||
&bytesReturned) ||
|
||||
(bytesReturned != sizeof(HANDLE)))
|
||||
|
@ -1423,6 +1423,8 @@ static BOOL rdpgfx_server_open(RdpgfxServerContext* context)
|
||||
PULONG pSessionId = NULL;
|
||||
DWORD BytesReturned = 0;
|
||||
priv->SessionId = WTS_CURRENT_SESSION;
|
||||
UINT32 channelId;
|
||||
BOOL status = TRUE;
|
||||
|
||||
if (WTSQuerySessionInformationA(context->vcm, WTS_CURRENT_SESSION, WTSSessionId,
|
||||
(LPSTR*)&pSessionId, &BytesReturned) == FALSE)
|
||||
@ -1442,6 +1444,15 @@ static BOOL rdpgfx_server_open(RdpgfxServerContext* context)
|
||||
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 */
|
||||
if (!WTSVirtualChannelQuery(priv->rdpgfx_channel, WTSVirtualEventHandle, &buffer,
|
||||
&BytesReturned) ||
|
||||
|
@ -34,6 +34,8 @@ typedef enum AINPUT_SERVER_OPEN_RESULT
|
||||
|
||||
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 (*psAInputServerPoll)(ainput_server_context* context);
|
||||
typedef BOOL (*psAInputServerChannelHandle)(ainput_server_context* context, HANDLE* handle);
|
||||
@ -98,6 +100,11 @@ struct _ainput_server_context
|
||||
psAInputServerMouseEvent MouseEvent;
|
||||
|
||||
rdpContext* rdpcontext;
|
||||
|
||||
/**
|
||||
* Callback, when the channel got its id assigned.
|
||||
*/
|
||||
psAInputChannelIdAssigned ChannelIdAssigned;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
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,
|
||||
size_t client_format_index);
|
||||
typedef BOOL (*psAudinServerOpen)(audin_server_context* context);
|
||||
@ -99,6 +101,11 @@ struct s_audin_server_context
|
||||
psAudinServerReceiveSamples ReceiveSamples;
|
||||
|
||||
rdpContext* rdpcontext;
|
||||
|
||||
/**
|
||||
* Callback, when the channel got its id assigned.
|
||||
*/
|
||||
psAudinServerChannelIdAssigned ChannelIdAssigned;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -29,6 +29,8 @@
|
||||
typedef struct s_disp_server_private DispServerPrivate;
|
||||
typedef struct s_disp_server_context DispServerContext;
|
||||
|
||||
typedef BOOL (*psDispChannelIdAssigned)(DispServerContext* context, UINT32 channelId);
|
||||
|
||||
typedef UINT (*psDispMonitorLayout)(DispServerContext* context,
|
||||
const DISPLAY_CONTROL_MONITOR_LAYOUT_PDU* pdu);
|
||||
typedef UINT (*psDispCaps)(DispServerContext* context);
|
||||
@ -53,6 +55,11 @@ struct s_disp_server_context
|
||||
|
||||
DispServerPrivate* priv;
|
||||
rdpContext* rdpcontext;
|
||||
|
||||
/**
|
||||
* Callback, when the channel got its id assigned.
|
||||
*/
|
||||
psDispChannelIdAssigned ChannelIdAssigned;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -34,6 +34,8 @@ typedef enum ECHO_SERVER_OPEN_RESULT
|
||||
|
||||
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 (*psEchoServerClose)(echo_server_context* context);
|
||||
typedef BOOL (*psEchoServerRequest)(echo_server_context* context, const BYTE* buffer,
|
||||
@ -76,6 +78,11 @@ struct s_echo_server_context
|
||||
psEchoServerResponse Response;
|
||||
|
||||
rdpContext* rdpcontext;
|
||||
|
||||
/**
|
||||
* Callback, when the channel got its id assigned.
|
||||
*/
|
||||
psEchoServerChannelIdAssigned ChannelIdAssigned;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -46,6 +46,11 @@ struct s_rdpei_server_context
|
||||
UINT (*onTouchReleased)(RdpeiServerContext* context, BYTE contactId);
|
||||
|
||||
void* user_data; /* user data, useful for callbacks */
|
||||
|
||||
/**
|
||||
* Callback, when the channel got its id assigned.
|
||||
*/
|
||||
BOOL (*onChannelIdAssigned)(RdpeiServerContext* context, UINT32 channelId);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -29,6 +29,8 @@ typedef struct s_rdpgfx_server_private RdpgfxServerPrivate;
|
||||
typedef BOOL (*psRdpgfxServerOpen)(RdpgfxServerContext* context);
|
||||
typedef BOOL (*psRdpgfxServerClose)(RdpgfxServerContext* context);
|
||||
|
||||
typedef BOOL (*psRdpgfxServerChannelIdAssigned)(RdpgfxServerContext* context, UINT32 channelId);
|
||||
|
||||
typedef UINT (*psRdpgfxResetGraphics)(RdpgfxServerContext* context,
|
||||
const RDPGFX_RESET_GRAPHICS_PDU* resetGraphics);
|
||||
typedef UINT (*psRdpgfxStartFrame)(RdpgfxServerContext* context,
|
||||
@ -112,6 +114,11 @@ struct s_rdpgfx_server_context
|
||||
|
||||
RdpgfxServerPrivate* priv;
|
||||
rdpContext* rdpcontext;
|
||||
|
||||
/**
|
||||
* Callback, when the channel got its id assigned.
|
||||
*/
|
||||
psRdpgfxServerChannelIdAssigned ChannelIdAssigned;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user