summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-05-18Use sprintf_s instead of sprintf to not crashJakub Janků1-2/+2
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-05-02Support file transfer for existing filesFrediano Ziglio1-5/+34
Previously, if the user attempted to transfer a file that had the same name as a file that already exists on the guest, we would just fail the transfer. This patch tries to match the behavior of the linux vdagent where we try to append an integer onto the name of the new file to make it unique. For example, if you tried to transfer 'file.doc' to the guest and that file already existed, it would try to create 'file (1).doc' instead. If that also failed, it would attempt 'file (2).doc', etc, up to 63. Resolves: rhbz#1410181 Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-04-05Don't exit vdagent when a client disconnectsJonathon Jongsma3-8/+26
Previously, when a client disconnects, the vdagent executable exited. The agent was restarted immediately in order to be ready for the next client to reconnect. This is generally fine, but there are certain situations where it causes issues. For example, if client A is connected to a guest and client B connects to the same guest, client A will be forcibly disconnected and causes the the vdagent to restart. This scenario is racy because the agent can take some time to exit and restart. Client B may think that the agent is connected at startup and may send agent messages to the guest. At some point the server will recieve notification that the agent has exited and send an AGENT_DISCONNECTED message to client B. After the agent has been fully restarted, an AGENT_CONNECTED message will be sent to the client, but any messages sent between client connection and the AGENT_DISCONNECTED message will be lost. This causes problems especially with fullscreen mode in virt-viewer. The solution is to not exit and restart the agent when a client disconnects. This is how the linux vdagent behaves. Instead, we simply cancel all ongoing file transfers and reset the clipboard when a client is disconnected. Fixes: rhbz#1064495 Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-12-22vdservice: drop "RHEV" from service nameUri Lublin1-1/+1
Signed-off-by: Uri Lublin <uril@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2016-11-17build: Package zip fileFrediano Ziglio1-1/+1
zip files are better supported under Windows, this make possible for instance to copy directly the file on a Windows machine without having to use additional tools. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-17build: Automatically update version/copyright in version.rcFrediano Ziglio3-7/+16
The versions/copyright in version.rc are very outdated. Updating them automatically at configure time should ensure they are updated more often. Looks a bit weird to distribute config.h file however in this case it contain only version information and the file is useful to compile under Windows. This patch is inspired by a work of Christophe Fergeau Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-17Move common resource code to a common fileFrediano Ziglio4-78/+74
Allows to reuse code. Differences between the two version information are managed using additional defines in the top rc files. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-11-17Convert resource information to EnglishFrediano Ziglio2-14/+14
They don't contain Hebrew so avoid to say so. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-10-28Update NEWS for 0.8.0 releaseChristophe Fergeau1-0/+8
2016-09-02Make CCD::load_api throw exception on its ownFrediano Ziglio2-13/+8
Avoid to use two different ways to handle errors. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Sameeh Jubran <sameeh@daynix.com>
2016-09-02Fails CCD initialisation if get_config_buffers detect WDDM is not presentFrediano Ziglio1-0/+4
There's no point continuing without WDDM as CCD cannot work without it. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Sameeh Jubran <sameeh@daynix.com>
2016-09-02Do not print function calling vd_printfFrediano Ziglio1-29/+28
vd_printf already print the current function Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-01Use simpler classes for mutex handlingFrediano Ziglio5-27/+45
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-01Use std::vector for agent capabilitiesFrediano Ziglio1-20/+11
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-01Make some members constantFrediano Ziglio1-6/+6
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-01Make static and constant some lookup arraysFrediano Ziglio1-6/+6
Make clipboard_formats and image_types static and constant. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-01Reuse SPICE_N_ELEMENTS macroFrediano Ziglio1-2/+2
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-01Make session_events static and constFrediano Ziglio1-1/+1
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-01Make DisplayMode setter methods constFrediano Ziglio1-6/+6
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-01Fix include syntaxFrediano Ziglio1-1/+1
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-01Remove small possible buffer overflowFrediano Ziglio1-1/+2
wcsncpy requires number of characters, not bytes. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-01Implementing WDDM interface to support multiple monitors and arbitrary ↵Sameeh Jubran2-2/+400
resolution The Direct3D 9 API operates on either the Windows XP display driver model (XPDM) or the Windows Vista display driver model (WDDM), depending on the operating system installed. This patch implements the WDDM interface while using the CCD API to do so. Moreover it introduces multiple monitors support and arbitrary resolution for Windows 10 while preserving backward compatiblity with previous versions of Windows. Based on a patch by Sandy Stutsman <sstutsma at redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma at redhat.com> Signed-off-by: Sameeh Jubran <sameeh@daynix.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-08-30Update the displays only when neededSameeh Jubran1-4/+14
This patch updates the display configurations only when needed. Currently vdagent updates the display configurations almost on every "VD_AGENT_MONITORS_CONFIG" request, this approach is redundant as some "VD_AGENT_MONITORS_CONFIG" requests don't apply any change to the display configurations. A good example of why this is needed, is the 'resize-guest' feature of the spice-widget which when enabled causes the client to send periodic "VD_AGENT_MONITORS_CONFIG" requests in order to resize the guest even when no change is required. Prior to this patch the screen would periodically flicker when using Virt-manager or Spicy due to this issue. Signed-off-by: Sameeh Jubran <sameeh@daynix.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-08-30Initialize buffers before querying display configSameeh Jubran1-2/+2
The buffers and buffer sizes should be initialized and allocated. This patch fixes a possible case where vdagent can get stuck, as the function _pfnQueryDisplayConfig can return ERROR_INVALID_PARAMETER if the buffers aren't intialized. The call to free_config_buffers is superfluous because it is called inside get_config_buffers. Signed-off-by: Sameeh Jubran <sameeh@daynix.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-08-16Avoid to use _singleton for VDServiceFrediano Ziglio1-23/+9
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2016-08-16Pass class pointer using thread parameterFrediano Ziglio1-3/+4
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2016-08-16Don't use _singleton if we already have the right this pointerFrediano Ziglio1-4/+3
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2016-08-16Pass class pointer using control contextFrediano Ziglio1-2/+2
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2016-08-16Encapsulating XPDM implementationSameeh Jubran4-126/+246
The Direct3D 9 API operates on either the Windows XP display driver model (XPDM) or the Windows Vista display driver model (WDDM), depending on the operating system installed. This patch encapsulates the current XPDM interface implementation into XPDMInterface class which inherits DisplayConfig class. This patch makes it easier to introduce WDDM interface to Vdagent in future patches. Based on a patch by Sandy Stutsman <sstutsma@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Signed-off-by: Sameeh Jubran <sameeh@daynix.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-08-16Introducing Windows CCD APISameeh Jubran3-0/+603
The Connecting and Configuring Displays (CCD) Win32 APIs provide more control over the desktop display setup. The CCD APIs move away from using Windows Graphics Device Interface (GDI) concepts like view name and toward Windows Display Driver Model (WDDM) concepts like adapter, source, and target identifiers. More info on the CCD API can be found here: https://msdn.microsoft.com/en-us/library/windows/hardware/ff539590(v=vs.85).aspx This patch introduces partial functionality from the CCD API needed by vdagent. It is needed by vdagent in order to support multiple monitors and arbitrary resolution on Windows 10. Based on a patch by Sandy Stutsman <sstutsma@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Signed-off-by: Sameeh Jubran <sameeh@daynix.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-08-16Update monitor state when it is detachedSameeh Jubran1-1/+4
The monitor detached state is being set but not updated, in order to update it we should call ChangeDisplaySettingsEx after setting the appropriate flags along with width and height that are set to 0. Signed-off-by: Sameeh Jubran <sameeh@daynix.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-08-13vdagent: rework on event_dispatcherVictor Toso1-11/+28
As _stop_event is not mandatory, we are initializing the events array with something that might be NULL. The problem is with the following patch as I'm introducing a new non mandatory event and logic starts to get a bit hard to follow. So this patch makes explicit if we are setting or receiving a _stop_event or not and uses an auxiliary enum and array 'actions' to work around this non mandatory events and the return value of MsgWaitForMultipleObjectsEx() Signed-off-by: Victor Toso <victortoso@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-08-12Use proper delete for _events memberFrediano Ziglio1-1/+1
Use delete[] to free an array. This could potentially lead to memory errors depending on compiler/library implementation. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2016-08-12vdagent: remove whitespacesVictor Toso4-11/+11
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-08-11file-transfer: fix typoVictor Toso1-1/+1
Signed-off-by: Victor Toso <victortoso@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-08-10Use enumeration for supported_system_version return typeFrediano Ziglio2-4/+4
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2016-08-10Fix swprintf_s call under MingWFrediano Ziglio2-2/+22
For some reason this call does not behave correctly. This was causing vdservice to fail to run the agent if compiled with MingW. Provide a proper swprintf_s replacement. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2016-08-01Fixing buffer overflow when reloading wallpaperSameeh Jubran1-1/+2
The function "SystemParametersInfo" expects the size of the buffer in characters. When wchar is used instead of char - two bytes instead of one byte per character -, then "sizeof" returns wrong number of characters (twice as much). A suitable solution would be to use SPICE_N_ELEMENTS. Based on patch by Sandy Stutsman <sstutsma@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
2016-05-09vdagent-win: check for locked sessionVictor Toso1-1/+19
>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. Tested on: Windows 7, Windows XP Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1323628 Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-05-05handle_mouse_event: fix off-by-one when normalizing mouse coordinatesUri Lublin1-4/+6
Mouse coordinates can be 0..(width-1) and 0..(height-1) Normalization of mouse coordinates (for SendInput) was done against w,h and thus right-most and down-most coordinates could never be reached. Fix it by normalizing against (w-1) and (h-1). Also added protection against a case of 0 or 1 (for any of w,h) Fixes rhbz#1032037
2015-08-06Check for set-monitors-position capability from client.Sandy Stutsman4-2/+11
If the client hasn't been updated to handle multi-monitor configurations that are not multi-head, vd_agent won't issue the MONITORS_CONFIG driver escape. These changes will ensure that the new MONITORS_CONFIG escape in commit: 6023630562fd129433aef1eaddcf6fbee3f03e50 will not break with an older client. This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1248196
2015-06-29Add monitors_config driver escape.Sandy Stutsman2-3/+31
When a Windows guest uses the "Set Resolution" applet to change resolutions and/or monitor positions, this escape sends the new monitor configurations to the client via a new QXL driver escape. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1202419
2015-06-10Use (0,0) for Windows Primary monitors.Sandy Stutsman2-5/+33
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1174129. Windows considers the monitor positioned at (0,0) to be primary. VDAgent normalizes the monitor positions so that there are no negative coordinates. If the normalized positions are passed to the Windows APIs, the leftmost monitor will always be set to primary. We need to keep track of the original primary monitor and its normalized position to be able to adjust the coordinates that are passed to Windows.
2015-04-30vdagent-win: Fix compile under MingWFrediano Ziglio1-0/+1
Including directly shlobj.h in some MingW environment lead to some missing definitions error. Including windows.h before fix the problem. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-04-30Use wide characters in drap&drop codeFrediano Ziglio2-25/+23
This allows username to contain any extended characters (username is embedded in the directory name). Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-04-20build-sys: Ship mingw-spice-vdagent.spec in tarballsChristophe Fergeau1-2/+2
Having this file pregenerated is useful if one wants to use it to generate a package from tarball with: tar xf vdagent-win-$version.tar.xz mingw-virt-viewer.spec rpmbuild mingw-virt-viewer.spec This is more convenient than extracting the whole tarball, and configuring it in order to generate mingw-virt-viewer.spec
2015-03-26Update NEWS for 0.7.3 releaseUri Lublin1-1/+10
2015-03-20Remove MSVC++ strncpy/strcat fallbacksChristophe Fergeau1-2/+0
We currently have macros silently replacing use of strncpy/strcat with strcpy_s/strcat_s when using MSVC++. However, these macros can have unexpected effects as they use sizeof to find out the maximum size of the destination string. This is a very significant difference from strncpy/strcat, which can lead to subtle bugs as the behaviour is different between mingw and MSVC++. Now that we have our implementation of strcpy_s/strcat_s, we don't need these #defines.
2015-03-20Use new vdagent_{strncpy,strcat}_s helpersChristophe Fergeau2-3/+3
2015-03-20Add strcat_s/strcpy_s fallbacksChristophe Fergeau2-0/+64
These security functions are available when building with MSVC++. With mingw, they can be used at build time, but their availability will depend on the version of MSVCRT the user has installed on their system. In particular, a default install of Windows XP will not have a new enough MSVCRT version, causing runtime failures as the binary built with mingw and using strcat_s will not be able to find the necessary entry point in the MSVCRT runtime. This commit adds some strcat_s/strcpy_s-like functions used with mingw which will always be available.