Commit Graph

165 Commits

Author SHA1 Message Date
Marc-André Lureau
fc1de85b49 Fix wrong size_t printf format
vdagent/desktop_layout.cpp:121:763: warning: format '%u' expects
argument of type 'unsigned int', but argument 8 has type
'std::vector<DisplayMode*>::size_type {aka long long unsigned int}'
[-Wformat=]
2013-07-17 20:49:19 +02:00
Marc-André Lureau
492ee05a6b Replace sscanf_s by sscanf
The _s functions need a recent msvcrt version, not shipped in XP by
default.

Furthermore, it appears that their sscanf_s usage was missing the extra
buffer size argument.
2013-07-17 20:45:22 +02:00
Marc-André Lureau
5129f33899 Add suggested parentheses
vdagent/vdagent.cpp: In member function 'void
VDAgent::on_clipboard_grab()':
vdagent/vdagent.cpp:951:52: warning: suggest parentheses around
assignment used as truth value [-Wparentheses]
2013-07-17 20:45:22 +02:00
Marc-André Lureau
b9d6baec2d Fix task could be used uninitialized 2013-07-17 20:45:21 +02:00
Marc-André Lureau
462295d9f8 Fix invalid print format for uint64_t values
format '%lu' expects argument of type 'long unsigned int', but argument
9 has type 'uint64_t
2013-07-17 20:45:21 +02:00
Marc-André Lureau
b52c9ddfa8 Fix wrong DWORD print fmt
format '%u' expects argument of type 'unsigned int', but argument 8 has type 'DWORD
2013-07-17 20:45:21 +02:00
Marc-André Lureau
3bf46bc2b2 dos2unix 2013-07-17 20:45:21 +02:00
Marc-André Lureau
846a787c9f Update spice-protocol 2013-07-17 20:45:17 +02:00
Arnon Gilboa
c751e8fda0 vdagent: add support for client -> guest file transfers
rhbz#956146
2013-06-27 14:23:49 +03:00
Arnon Gilboa
f7968d5035 cleanup dispatch_message() 2013-06-27 13:24:21 +03:00
Arnon Gilboa
631c8623e3 vdagent: advertise CRLF line-ending
rhbz#872252
2013-06-20 17:36:17 +03:00
Christophe Fergeau
859882c24b Update spice-protocol submodule to 0.12.5
This is needed to get the definition of VD_AGENT_CLIENT_DISCONNECTED
2013-05-14 12:42:24 +02:00
Uri Lublin
08a23eb45b vdagent: protect against NULL entry in _displays
rhbz#958051

It may be that a _displays entry will be NULL.
I encountered it when running with multiple QXL devices, for one of
which the driver failed to load since it was "out of resources".

Iterations over _displays should handle that case.
We found four such iterations, and fixed them in this patch.
2013-05-12 12:43:25 +03:00
Arnon Gilboa
b72b943309 vdagent: drop clipboard received after timeout
rhbz #951618
2013-05-09 14:19:11 +03:00
Arnon Gilboa
e55103589a vdagent: add support for VD_AGENT_CLIENT_DISCONNECTED
vdagent is stopped, so a new instance is to be launched by vdservice.
imho, this seems simpler than cleaning agent in/out msg state and
reseting the vio-serial device to cleanup pending msgs.

rhbz #956133
2013-05-09 14:19:11 +03:00
Arnon Gilboa
877ee81f81 vdagent: support sparse monitors config
rhbz #953973
2013-05-09 14:19:11 +03:00
Marc-André Lureau
4ca71770f2 build-sys: fix mingw build 2013-04-24 14:21:50 +02:00
Marc-André Lureau
de672f8cf2 Revert "Refresh monitor config only when needed"
This reverts commit 67c1bcf493.

Also add a comment why the refresh is necessary there. The original
issue, reentering call, doesn't seem reproducible...

https://bugzilla.redhat.com/show_bug.cgi?id=912793
2013-04-24 12:02:23 +03:00
Marc-André Lureau
8628ca2e09 Try harder to enable monitors
0ba6e2936 was trying to fix CreateDC() failing when the monitor is
disabled, unfortunately, enabling monitor with an arbitrary resolution
may still fail (the previous resolution, or the current one).

This patch address the issue by first trying the current resolution, and
falling back to a well-known resolution. This causes a temporary client
resolution change (bad), which is immediately adjusted to the arbitrary
resolution.

We may want to improve agent->driver communication of arbitrary
resolution before the driver is loaded, perhaps using registry or via
the spice server. Any of these solution will unfortunately take some more
time which we are missing.

https://bugzilla.redhat.com/show_bug.cgi?id=922394

(seem to solve related bugs, like mouse offset, or flashing monitors)
2013-04-24 12:00:18 +03:00
Arnon Gilboa
661e18fcf4 vdservice: add quotes to service path
for the case path contains a space, see CreateService() doc:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682450.aspx

rhbz #918635
2013-04-22 11:17:42 +03:00
Arnon Gilboa
0074ebcfb1 Revert "vdagent: add vdagent_helper to support mouse when UAC dialog takes focus"
This reverts commit dd9d1f41ca.
2013-04-22 11:17:40 +03:00
Arnon Gilboa
dd9d1f41ca vdagent: add vdagent_helper to support mouse when UAC dialog takes focus
Running the helper with ShellExecute(..."runas"...) is the way to SendInput()
to the UAC dialog in Windows Vista and above.

http://stackoverflow.com/questions/2426594/starting-a-uac-elevated-process-
from-a-non-interactive-service-win32-net-power

http://www.microsoft-questions.com/microsoft/Platform-SDK-Security/29620442/
how-to-proper-use-sendinput-to-a-elevated-window-from-a-service.aspx

rhbz #908422
2013-03-18 15:38:20 +02:00
Arnon Gilboa
136c8d3c94 vdagent: don't terminate if stop event cannot be opened
so vdagent can keep running as standalone without dependency on vdservice.

Regression was due to commit c1807e.

rhbz #903379
2013-03-18 14:13:04 +02:00
Arnon Gilboa
e364fa7799 vdagent: log unsupported grabbed clipboard formats
rhbz #919451 debugging, useful anyway
2013-03-18 13:21:14 +02:00
Arnon Gilboa
482a4980f4 vdagent: for Win7 class, use ClipboardFormatListener api
(Win7 class includes Win8/Vista/Server2012/Server2008/R2)

This new api was introduced in Vista/2K8 to keep track of clipboard changes,
without the need to trust the (mis)behavior of other applications registered
to the clipboard.

If the issue is reproduced on XP as well, it can be hacked by a periodic call
to ChangeClipboardChain & SetClipboardViewer as described in
http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/
521183dc-7872-472e-8104-8c0d75b1bf53

rhbz #919451
2013-03-18 13:16:22 +02:00
Arnon Gilboa
877e52386e vdservice: extract supported_system_version() to vdcommon
rhbz #919451 preparation
2013-03-18 12:54:04 +02:00
Arnon Gilboa
9b05b948fc vdagent: on encoding only, use HBITMAP to keep the correct palette
for decoding, keep using CF_DIB and CxImage.CopyToHandle() as before.

Regression was due to commit da07ce (rhbz #919150)

rhbz #921980
2013-03-18 12:45:25 +02:00
Marc-André Lureau
0ba6e29363 Reattach monitors
Teach vdagent to attach monitors. A monitor needs to be enabled before
we can set the custom resolution. Fortunately, the client doesn't seem
to have time to catch that, so things are smooth.

This is require to allow the virt-viewer display menu to work properly
and enable extra monitors: https://bugzilla.redhat.com/show_bug.cgi?id=919530
2013-03-16 01:02:47 +01:00
Marc-André Lureau
67c1bcf493 Refresh monitor config only when needed
Somehow wnd_proc()->get_display() may be reentered during ChangeDisplaySettings
2013-03-16 00:55:15 +01:00
Arnon Gilboa
da07ced71c vdagent: use HBITMAP instead of DIB for image encoding
CxImage DIB to PNG encoding seems to ignore pallete in some scenarios.
This issue happens when copying a png from FireFox, but with IE it's ok.

rhbz #919150
2013-03-12 13:09:50 +02:00
Arnon Gilboa
c1807e8040 vdservice: reset vdagent stop event after wait
vdagent terminates when the global event is set by vdservice. vdservice is also
responsible to reset the event in any case, without trusting vdagent to do so.
Otherwise, it may terminate the following vdagent instance immediately as well.

Regression was due to commit 2d03cc.

rhbz #868254
2013-02-26 17:58:44 +02:00
Christophe Fergeau
0399b98158 spec: Automatically substitute version
This commit generates a .spec file with the right version number
when configure is run.
2013-02-15 20:06:32 +01:00
Christophe Fergeau
9a08d00fd2 spec: Add missing call to %mingw_debug_packages
This automatically generates the needed debug packages for .debug
files. Without this, the rpm build fails.
2013-02-15 20:06:32 +01:00
Arnon Gilboa
2d03cc5c2c vdservice stops vdagent via event
Terminate agent politely instead of ugly TerminateProcess(), so now
VD_AGENT_CLIPBOARD_RELEASE is sent (if guest owned the clipboard),
followed by cleanup.

rhbz #903379
2013-01-31 11:34:14 +02:00
Christophe Fergeau
05af7a9786 Add OLDMSVCRT fallback for _ftime_s
Aliasing _ftime_s to _ftime when OLDMSVCRT is defined makes it
possible to remove the timestamp-less implementation of LOG()
while still getting a binary working on Windows XP. I've tested
this with a MinGW build, hopefully this won't break VC++ builds...
2013-01-22 12:43:51 +01:00
Christophe Fergeau
1e543873ea vdlog: Get swprinft_s definition from vdcommon.h
vdlog.cpp has an #ifdef check for OLDMSVC to choose between using
swprintf or swprintf_s. Since vdcommon.h provides a compat #define
for swprintf_s when OLDMSVC is set, it's better to use this one.
2013-01-22 12:43:44 +01:00
Arnon Gilboa
9a0b939de1 build-sys: remove *vdi_port* from Makefile.am 2012-12-09 11:40:34 +02:00
Arnon Gilboa
cd4baafb03 vdagent: git rm *vdi_port* 2012-12-09 11:33:25 +02:00
Arnon Gilboa
f79485aeee vdagent: remove vdi_port from vcproj 2012-12-09 11:33:25 +02:00
Arnon Gilboa
f1873dfa9b vdagent: remove vdi_port, use vio_serial directly 2012-12-09 11:33:25 +02:00
Arnon Gilboa
9b5954165d vdagent: when SetClipboardData fails, set clipboard control event to stop wait
Currently, a SetClipboardData failure is followed by useless wait for timeout
(VD_CLIPBOARD_TIMEOUT_MS).

In addition, we remove the clipboard open-empty-set-close retry, which became
irrelevant with the current on_clipboard_request().
2012-12-09 11:24:27 +02:00
Arnon Gilboa
c18859ff35 vdservice: set process handle for vdagent launched on session>0
The problem on XP was failing to terminate agent running on session>0,
since during agent process creation, a handle was not set, so it was NULL.
Therefore, the new agent created (at the session we switched to) was unable
to open vitio-serial which was still used by the other running agent instance.

rhbz#868254
2012-11-25 17:11:39 +02:00
Arnon Gilboa
e5c363b841 vdservice: support Windows 8 & Server 2012
vdagent was ok, but vdservice required adding these to the version check.
Both are handled as the rest of the Win7 class.
Tested on Win8x64.
2012-11-25 10:11:59 +02:00
Arnon Gilboa
7330f5132a vdagent: remove a wrong return 2012-11-18 12:13:40 +02:00
Christophe Fergeau
50d9542671 Fix mingw compilation
This got broken with the recent code moves from vdservice to vdagent.
2012-11-15 12:28:11 +01:00
Arnon Gilboa
a69af07da3 vdagent: set timeout for next clipboard chunk instead of complete reception
currently:
-handling client disconnect during clipboard data trasfer is buggy
-agent also timeouts on large paste from client (>10sec)

therfore:
-reduce VD_CLIPBOARD_TIMEOUT_MS to 3sec from previous clipboard chunk
-remove _clipboard_event and use _control_event(CONTROL_CLIPBOARD) instead
-use _clipboard_tick for clipboard timeout, updated on each clipboard chunk
-use cleanup_in_msg() to reset incoming message state

rhbz#833835
2012-11-14 10:50:52 +02:00
Arnon Gilboa
f71197330c vdagent: extract event_dispatcher from input_desktop_message_loop 2012-11-14 10:50:51 +02:00
Arnon Gilboa
5f1e7630ae vdagent: remove pipe common defs 2012-11-14 10:50:51 +02:00
Arnon Gilboa
22d25256fd vdagent: use virtio-serial, remove pipe usage 2012-11-14 10:50:51 +02:00
Arnon Gilboa
3f7d4da4bc vdagent: mv vdi_port files from vdservice 2012-11-14 10:50:50 +02:00