Fixes compiler warning that starts with:
In file included from vdagent/as_user.cpp:19:0:
vdagent/as_user.h: In constructor 'AsUser::AsUser(DWORD)':
vdagent/as_user.h:35:10: warning: 'AsUser::_started' will be initialized after [-Wreorder]
bool _started;
In vd_agent/file_xfer.cpp is implemented a simple g_key_get_string,
but when dragging a file with a name containing '[' (like te[st.txt),
it will fail.
From source code,
>next_group_pos = strstr(group_pos + strlen(group_pfx), "[");
> if (next_group_pos && key_pos > next_group_pos) return false;
we know that it tries to find the end of current group by '[' label,
if we drag a file named te[st.txt, the key_string will be like:
[vdagent-file-xfer]
name=te[st.txt
size=10
so, it will fail when meta parsing and returns the
VD_AGENT_FILE_XFER_STATUS_ERROR message.
Here's the elegant method Christophe proposed and test ok, thanks to
him again!
wnd_proc() is called during ChangeDisplaySettings(), when handling
monitors config. However, calling get_displays() will overwrite the
desired config.
So, while updating from 1 to 4 enabled monitors, when the 2nd monitor
config is enabled, the current config is read, and overwrite the rest of
the config, so first time only 2nd monitor is enabled, second time, 3rd
monitor etc.
https://bugzilla.redhat.com/show_bug.cgi?id=1111144
Do not send clipboard data bigger than last received
VDAgentMaxClipboard.
If a larger amount of data needs to be transferred between client and guest,
a different mechanism should be used, not clipboard.
The spice-protocol git-submodule is updated to include VD_AGENT_MAX_CLIPBOARD
and related definitions.
Before, the target directory was a public one (for all users),
as file creation was not done with user privileges.
Now that the file is created with user privileges, it's
better to make the user desktop the target directory.
The class calls Impersonate upon begin(), and Revert
upon end() or destruction.
The user is the current user that is logged in.
create mode 100644 vdagent/as_user.cpp
create mode 100644 vdagent/as_user.h
vdagent/display_setting.cpp:469:50: warning: cast to pointer from
integer of different size [-Wint-to-pointer-cast]
if (!SystemParametersInfo(action, 0, (PVOID)param, 0)) {
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=]
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.
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]
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.
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
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)
(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
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
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
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