[Spice-devel] [vdagent-windows v1] vdagent-win: check for locked session
Victor Toso
lists at victortoso.com
Mon May 9 08:31:51 UTC 2016
Hi,
On Fri, May 06, 2016 at 01:50:31PM +0200, Victor Toso wrote:
> From WTSRegisterSessionNotification() we are aware of session changes
> (WM_WTSSESSION_CHANGE) such as Lock/Unlock events.
>
> We can use that to disable features such as drag-and-drop.
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1323628
So, this works on windows xp! I'll update the commit log with
"Tested on: Windows 7, Windows XP"
Let me know if any other changes are necessary.
Cheers,
toso
> ---
> vdagent/vdagent.cpp | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
> index c976665..a01bc70 100644
> --- a/vdagent/vdagent.cpp
> +++ b/vdagent/vdagent.cpp
> @@ -146,6 +146,7 @@ private:
> uint32_t _in_msg_pos;
> bool _pending_input;
> bool _running;
> + bool _session_is_locked;
> bool _desktop_switch;
> DesktopLayout* _desktop_layout;
> bool _updating_display_config;
> @@ -205,6 +206,7 @@ VDAgent::VDAgent()
> , _in_msg_pos (0)
> , _pending_input (false)
> , _running (false)
> + , _session_is_locked (false)
> , _desktop_switch (false)
> , _desktop_layout (NULL)
> , _display_setting (VD_AGENT_REGISTRY_KEY)
> @@ -1282,7 +1284,19 @@ void VDAgent::dispatch_message(VDAgentMessage* msg, uint32_t port)
> case VD_AGENT_ANNOUNCE_CAPABILITIES:
> res = handle_announce_capabilities((VDAgentAnnounceCapabilities*)msg->data, msg->size);
> break;
> - case VD_AGENT_FILE_XFER_START:
> + case VD_AGENT_FILE_XFER_START: {
> + VDAgentFileXferStatusMessage status;
> + if (_session_is_locked) {
> + VDAgentFileXferStartMessage *s = (VDAgentFileXferStartMessage *)msg->data;
> + status.id = s->id;
> + status.result = VD_AGENT_FILE_XFER_STATUS_ERROR;
> + vd_printf("Fail to start file-xfer %u due: Locked session", status.id);
> + write_message(VD_AGENT_FILE_XFER_STATUS, sizeof(status), &status);
> + } else if (_file_xfer.dispatch(msg, &status)) {
> + write_message(VD_AGENT_FILE_XFER_STATUS, sizeof(status), &status);
> + }
> + break;
> + }
> case VD_AGENT_FILE_XFER_STATUS:
> case VD_AGENT_FILE_XFER_DATA: {
> VDAgentFileXferStatusMessage status;
> @@ -1489,6 +1503,10 @@ LRESULT CALLBACK VDAgent::wnd_proc(HWND hwnd, UINT message, WPARAM wparam, LPARA
> case WM_WTSSESSION_CHANGE:
> if (wparam == WTS_SESSION_LOGON) {
> a->set_control_event(CONTROL_LOGON);
> + } else if (wparam == WTS_SESSION_LOCK) {
> + a->_session_is_locked = true;
> + } else if (wparam == WTS_SESSION_UNLOCK) {
> + a->_session_is_locked = false;
> }
> break;
> default:
> --
> 2.5.5
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list