summaryrefslogtreecommitdiff
path: root/vdagent
AgeCommit message (Collapse)AuthorFilesLines
2022-11-08Add support for additional buttons (side and extra)HEADmasterFrediano Ziglio1-13/+30
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2022-06-16Remove warning compilingFrediano Ziglio1-1/+2
Remove an alignment warning vdagent/vdagent.cpp: In member function 'bool VDAgent::handle_announce_capabilities(const VDAgentAnnounceCapabilities*, uint32_t)': vdagent/vdagent.cpp:1048:48: warning: taking address of packed member of 'VDAgentAnnounceCapabilities' may result in an unaligned pointer value [-Waddress-of-packed-member] 1048 | _client_caps.assign(announce_capabilities->caps, announce_capabilities->caps + caps_size); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~ Not a real issue, just annoying. Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-07-31clipboard: enable copying files from client using webdavJakub Janků1-0/+191
When the user wants to copy files, new spice-gtk can share those files using the existing phodav server. In that case, it advertises the VD_AGENT_CLIPBOARD_FILE_LIST type in the clipboard grab message. Upon request of the clipboard data in the mentioned type, spice-gtk provides a list of absolute paths in the phodav server - these are the files that are supposed to be copied/moved. The role of the vdagent is to adjust this data given the drive letter of the mapped webdav share. Files can be both copied and moved, although move was tested only with Windows' File Explorer. Copying files from the vdagnet side to the client is not supported yet. Signed-off-by: Jakub Janků <jjanku@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-07-03desktop_layout: Update container iteration syntaxFrediano Ziglio1-6/+2
Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Julien Ropé <jrope@redhat.com>
2020-07-03Move set_display_depth from VDAgent to DesktopLayoutFrediano Ziglio3-21/+19
The function only change DesktopLayout. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Julien Ropé <jrope@redhat.com>
2020-07-03Minor style updateFrediano Ziglio1-1/+2
Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Julien Ropé <jrope@redhat.com>
2020-06-15desktop_layout: Ignore Citrix Workspace displaysFrediano Ziglio1-0/+3
Citrix Workspace add 8 additional displays for off-line usage. Ignore them like for mirrored displays. This fixes https://gitlab.freedesktop.org/spice/win32/vd_agent/-/issues/8. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Julien Ropé <jrope@redhat.com>
2020-06-15desktop_layout: Factor out a function to enumerate displaysFrediano Ziglio1-21/+21
Reduce code duplication, the enumeration happens 3 times. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Julien Ropé <jrope@redhat.com>
2020-05-29display_configuration: Update log stringsFrediano Ziglio1-2/+2
For other strings resolution is reported as "WxH", no spaces around "x". Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Francesco Giudici <fgiudici@redhat.com>
2020-05-25file_xfer: Return detailed error for invalid filenameFrediano Ziglio1-0/+4
A literal constant is used for error type as the project is not dependent on glib2 and that Visual Studio and CMake are supported so it would make the compilation on some environment more complicated than actually is just for a constant. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Kevin Pouget <kpouget@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2020-05-22desktop_layout: Use MutexLocker for lock/unlockFrediano Ziglio1-8/+3
Reduce code and avoids to forget to unlock() in the future. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-05-15vdagent: Reset properly state of pending large messages upon disconnectionFrediano Ziglio1-0/+1
If the client closes the connection while having pending large messages (split into multiple chunks) the state is not correctly reset causing next client messages to be not correctly handled. This can occur for instance if the client is closed (or killed) while transferring a large file. This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1548419. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Victor Toso <victortoso@redhat.com>
2020-05-15Use final capabilities to check client messagesFrediano Ziglio1-10/+24
The client is sending messages that are compatible with agent capabilities but also encoded with capabilities it knows of so to check them we need to consider final capabilities, not client ones. This fixes a regression introduced with "vdagent: Reuse agent_check_message" where some messages were wrongly interpreted as wrong (particularly some clipboard messages). Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Jakub Janků <jjanku@redhat.com>
2020-04-28vdagent: Reuse agent_check_messageFrediano Ziglio1-51/+15
That function does also more checks on the message. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jakub Janků <jjanku@redhat.com>
2020-04-24Use SPICE_N_ELEMENTS instead of a constant for file_path sizeFrediano Ziglio1-2/+4
Allows to easily change the size if needed Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-24file_xfer: Return detailed error for no spaceFrediano Ziglio1-0/+3
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-24vdagent: Return better error if lockedFrediano Ziglio1-1/+1
Use specific VD_AGENT_FILE_XFER_STATUS_SESSION_LOCKED error. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-24vdagent: Allow to return detailed message for file transferFrediano Ziglio3-23/+33
Reuse AgentFileXferStatusMessageFull and agent_prepare_filexfer_status Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-30Revert 3 last patchesFrediano Ziglio5-12/+11
Revert "try to remove other bugs", commit 57266085b9d68474f4006e09dece5945e5f8cc82. Revert "try to fix previous", commit 8e4037706841a89915ccb0db84e4b336433027eb. Revert "attempt to fix more warnings!", commit 66b6933a388b222cb9ffa510401bf2485d4e6f2e. I put by mistake on the MR due to some automatic scripts. Their state are pretty experimental. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-23try to remove other bugsFrediano Ziglio1-1/+1
2020-03-23try to fix previousFrediano Ziglio5-10/+10
2020-03-23attempt to fix more warnings!Frediano Ziglio4-10/+11
2020-03-23display_setting: Remove a warningFrediano Ziglio1-1/+1
Avoids: warning C4267: 'initializing': conversion from 'size_t' to 'DWORD', possible loss of data Value won't never be that huge to cause overflow (we are reading a string in a static buffer, we don't expect an encyclopedia). Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-23file_xfer: Remove a warningFrediano Ziglio1-1/+1
Avoids: warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-01-10Constification, does not make sense to change the messages processing themFrediano Ziglio1-19/+19
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-11Remove Visual Studio project filesFrediano Ziglio1-432/+0
These project files were not correctly tested and updated for a while. Now that CMake is present it can be used to generate proper updated Visual Studio projects instead. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-06file-xfer: handle_start: use snprintf instead of sprintf_sUri Lublin1-2/+2
When building with older mingw, sprintf_s does not always work as expected, but snprintf does. Also it's more consistent in the file. Note that when building with VS, snprintf becomes sprintf_s Related: rhbz#1410181 Signed-off-by: Uri Lublin <uril@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-18Add a test for filter_url functionFrediano Ziglio1-0/+48
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-18file_xfer: Open Download directory after a file transfer is finishedFrediano Ziglio4-0/+172
Have the same behaviour of Linux machines. The directory is not opened again and again, only is not already opened. This is done checking the directory opened in explorer. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-07file_xfer: Save files in Downloads directoryFrediano Ziglio1-2/+19
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-07file_xfer: Separate code to get download directory locationFrediano Ziglio1-3/+11
Allows to reuse code to get download directory. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-06display_configuration: Define WINVER to avoid some declarationFrediano Ziglio2-141/+0
Some declarations are available in MingW only defining a more recent version of WINVER. Set WINVER to 0x0601 (Windows 7) to enable these definitions. This allows to clean some files. The definition were already available in Fedora 22. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-08make display disconnection persistentYuri Benditovich1-1/+4
https://bugzilla.redhat.com/show_bug.cgi?id=1477191 Currently on Win10 when one of multiple displays is disconnected by the client, the qxl-wddm-dod driver does not receive any update, the system just stops using this adapter for rendering. As a result, the 'disconnected' state of the adapter is not saved anywhere. On further connect the client side recognize the adapter as active and opens window for it. Current commit fixes the problem by sending QXL_ESCAPE_MONITOR_CONFIG with zero area to disabled adapter. Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-08introduce turn_monitor_off method of WDDM interfaceYuri Benditovich2-0/+18
Adding method 'turn_monitor_off' to WDDM interface. It sends QXL_ESCAPE_MONITOR_CONFIG escape with zeroed display size to qxl-wddm-dod driver. Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-08construct WDDMMonitorConfigEscape also with NULL DisplayModeYuri Benditovich1-4/+4
Adding possibility to construct WDDMMonitorConfigEscape object with NULL parameter of DisplayMode. In this case all the fields depending on DisplayMode are set to zero. Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-03-05Don't exit when receiving unknown messagesJonathon Jongsma1-2/+1
In 8251fa25, a check on the minimum size of a message was introduced. For unsupported messages, the vdagent simply exited. This makes it inconsistent with previous behavior and inconsistent with the behavior of the linux vdagent. Instead, just print a warning indicating that an unsupported message was received and ignore it. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-02-27Fix indentationFrediano Ziglio1-1/+1
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2018-11-17Fix typo, change DeviceName to device_name谢 昆明1-1/+1
Signed-off-by: kunming.xie <kunming.xie@hotmail.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-19Use GetModuleHandle to get some functions from user32 libraryFrediano Ziglio1-5/+2
The library is surely already loaded as providing clipboard and other utilities we need. user32 is one of the main win32 libraries. Avoid using LoadLibrary that increment the reference so we don't need to call FreeLibrary to cleanly decrement the reference. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-19vdagent: Add a comment around WinSta0_DesktopSwitch event usageFrediano Ziglio1-0/+5
Multiple times while I was reading this code was not clear why the synchronization of this event was not done in the main event loop. Also document why we want to use it not relying just on WTSRegisterSessionNotification and WM_WTSSESSION_CHANGE. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-18vdagent: Stop correctly helper threadFrediano Ziglio1-3/+14
The thread launched to detect desktop switches events is not stopped correctly causing potentially dandling pointers. Queue a APC to make the loop exit and wait for thread termination from the main thread. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-18Use destructor instead of cleanup functionFrediano Ziglio1-13/+4
More C++ style. Also avoids missing cleanup calls. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-18Introduce an helper to close VirtIo deviceFrediano Ziglio1-1/+10
Do not assume we allocated the handle doing the cleanup. This utility will be reused in next patch. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe de Dinechin <dinechin@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-18Use proper invalid value for _vio_serialFrediano Ziglio1-1/+1
For some reason kernel handles in Windows have 2 invalid values depending on the type. Files/devices use INVALID_HANDLE_VALUE (-1), while others use NULL (0). As _vio_serial is a file, created with CreateFile, use INVALID_HANDLE_VALUE for consistency. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-05Avoids to call supported_system_version()Frediano Ziglio1-15/+15
The only reason we call this function is to check if the system should support some APIs. Instead just check directly if these APIs are supported calling GetProcAddress directly. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-05Avoid declaring _system_version memberFrediano Ziglio1-5/+3
The check can be done a single time, no reason to cache supported_system_version() value. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-05Avoid declaring event_thread_idFrediano Ziglio1-2/+1
As the value is never used we can pass NULL in CreateThread. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-05Allocate _control_event and _stop_event just onceFrediano Ziglio1-4/+9
Handle _control_event and _stop_event destruction in destructor. Allows to call VDAgent::run multiple time if needed. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-05Allow one more character reading strings from registryFrediano Ziglio1-7/+15
The strings in the registry are usually NUL-terminated but this is not a requirement. Handle the case when the string, considering the terminator, fit into the reading buffer. In this case accept the string. In the case the string fit into the buffer but is not terminated returns ERROR_MORE_DATA (the error that would be returned if the string didn't fit in the buffer as there is no place to add the terminator). Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-05Factor out an utility function to read strings from registryFrediano Ziglio1-45/+36
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>