Re: [vdagent-windows v1] vdagent-win: check for locked session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, May 06, 2016 at 05:49:03PM +0200, Fabiano Fidêncio wrote:
> On Fri, May 6, 2016 at 5:35 PM, Victor Toso <victortoso@xxxxxxxxxx> wrote:
> > Hi,
> >
> > On Fri, May 06, 2016 at 05:21:40PM +0200, Pavel Grunt wrote:
> >> 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
> >>
>
> Okay. OTOH you can find some documents mentioning the very same API
> when dealing specifically with Windows XP. Here is one example:
> https://support.microsoft.com/en-us/kb/310153 .. but you can find a
> few more if you google for it.
>
> >> Pavel
> >
> > Interesting, I did not see that. Thanks!
> >
> > I would still keep the patch as it is fairly simple and then make a
> > patch that could fix WinXP later on.
>
> Totally agreed. Actually, talking about _upstream_ _only_, makes no
> sense to try to find a solution for a dead OS.

Indeed.

> What I'd like to suggest is:
> - Test with Windows XP
> - Let us know about the result of your tests
> - In case there is an issue with Windows XP, just mention it in the commit log.

Sounds good, I'll do that.
Cheers,
  toso
>
> > The fix on WinXP could be done in
> > the vdservice, by parsing WTS_SESSION_LOCK/UNLOCK from
> > SERVICE_CONTROL_SESSIONCHANGE and then trying to avoid the file-xfer to
> > start in the vdagent.
> > What I'm missing is the communication between vdservice and vdagent
> > which is nothing like we have in the linux vdagent.
> >
> > Thanks for taking a look at this,
> >   toso
> >
> >>
> >> 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
> 
> Best Regards,
> --
> Fabiano Fidêncio
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]