Hey, it looks good. But according to docs, it will not work on WinXP https://msdn.microsoft.com/en-us/library/windows/desktop/aa383828%28v=vs.85%29.a spx Pavel On Fri, 2016-05-06 at 13:50 +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 > --- > 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: _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel