summaryrefslogtreecommitdiff
path: root/vdagent
AgeCommit message (Collapse)AuthorFilesLines
2015-02-06Remove MSVC++ strncpy/strcat fallbacksHEADmasterChristophe Fergeau1-1/+1
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 behaviour 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-02-06Use new vdagent_{strncpy,strcat}_s helpersChristophe Fergeau2-3/+3
2015-01-19Update version/copyright in vdagent resource fileChristophe Fergeau1-5/+5
2014-12-30g_key_get_string: use size_t for pointer differenceUri Lublin1-1/+1
The 64 bit Visual Studio build complains that: .\file_xfer.cpp(223) : warning C4244: '=' : conversion from '__int64' to 'unsigned int', possible loss of data
2014-12-30Fix Visual Studio compiler warning (strncpy)Uri Lublin1-0/+2
Visual Studio complains: vdagent\file_xfer.h(28) : warning C4996: 'strncpy': This function or variable may Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. Replace strncpy with strcpy_s when building with Visual Studio. Adjust parameter order and difference in meaning of length: - length param is last in strncpy and second in strcpy_s - many calls to strncpy are given length param n-1, as strncpy does not guarantee that destination ends with '\0' - it's safer to set length param not larger than sizeof(d) (assuming d is an array not a pointer) Trying to use strcpy_s for both Visual Studio and mingw failed as strcpy_s is missing from the default msvcrt.dll on WinXP (See OLDMSVCRT in common/vdcommon.h).
2014-12-30Fix building with Visual Studio (inttypes.h)Uri Lublin1-0/+7
As a followup of commit 462295d9f84658aa7. Building with Visual Studio, fails as there is no inttypes.h file: vdagent\file_xfer.cpp(21) : fatal error C1083: Cannot open include file: 'inttypes.h': No such file or directory This commit prevents including inttypes.h when building with Visual Studio, and defines PRIu64 that is defined in inttypes.h for mingw compiler.
2014-12-30vdagent::handle_max_clipboard fix vd_printf formatUri Lublin1-2/+2
Using unsigned long to print a size_t.
2014-12-30vdagent: as_user: reorder initialization to make mingw-gcc happyUri Lublin1-2/+2
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;
2014-12-30Fix compiler warning (missing backslash in FileXfer::handle_start)Uri Lublin1-1/+1
Visual Studio complains: vdagent\file_xfer.cpp(85) : warning C4129: '%' : unrecognized character escape sequence Replace "%s\%s" with "%s\\%s"
2014-11-13Fix g_key_get_string() failure when string contains '['Cody Chan1-1/+1
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!
2014-11-13Fix dragging of files with CJK characters in nameCody Chan1-1/+13
I submitted a patch several months ago about this issue, here http://lists.freedesktop.org/archives/spice-devel/2014-February/016158.html I check it again, and find that the value of g_key_file_to_data(keyfile,...) is always utf-8, for the value of g_uri_list_extract_uris() is utf8 urlencode. So the display problem is caused by vd_agent, but how it displays depends on the language of system, the following two screenshots show the difference: http://int64ago-tmp.qiniudn.com/guest-Chinese.png http://int64ago-tmp.qiniudn.com/guest-English.png
2014-06-19Don't refresh displays config when updatingMarc-André Lureau1-1/+10
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
2014-03-09vdagent: clipboard: Add VD_AGENT_CAP_MAX_CLIPBOARD supportUri Lublin1-0/+24
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.
2014-03-09vdagent: clipboard: GlobalUnlock on handle_request failureUri Lublin1-4/+14
Moved clipboard definition to the beginning of the function, as mingw-gcc complains about gotos that jump over definitions.
2013-11-13vdagent: file_xfer: make g_key_get_string saferUri Lublin2-7/+21
By providing the size of the destination string buffer.
2013-11-13vdagent: file-xfer: make user desktop the target directoryUri Lublin1-1/+1
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.
2013-11-13file_xfer: create file with user privilegesUri Lublin1-0/+7
2013-11-13vdagent: add as_user to run tasks with user privilegesUri Lublin3-0/+119
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
2013-07-17Remove usage of more _s functionsMarc-André Lureau2-5/+14
Even before this change, it should have handled error conditions. We'd be better off allocating those strings and failing on io op later on.
2013-07-17Fix cast BOOL->PVOID warningMarc-André Lureau1-1/+1
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)) {
2013-07-17Fix wrong size_t printf formatMarc-André Lureau1-1/+1
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-17Replace sscanf_s by sscanfMarc-André Lureau1-2/+2
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-17Add suggested parenthesesMarc-André Lureau1-1/+1
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-17Fix task could be used uninitializedMarc-André Lureau1-6/+10
2013-07-17Fix invalid print format for uint64_t valuesMarc-André Lureau1-2/+6
format '%lu' expects argument of type 'long unsigned int', but argument 9 has type 'uint64_t
2013-07-17Fix wrong DWORD print fmtMarc-André Lureau2-3/+3
format '%u' expects argument of type 'unsigned int', but argument 8 has type 'DWORD
2013-07-17dos2unixMarc-André Lureau2-35/+35
2013-06-27vdagent: add support for client -> guest file transfersArnon Gilboa4-0/+256
rhbz#956146
2013-06-27cleanup dispatch_message()Arnon Gilboa1-12/+11
2013-06-20vdagent: advertise CRLF line-endingArnon Gilboa1-0/+1
rhbz#872252
2013-05-12vdagent: protect against NULL entry in _displaysUri Lublin2-5/+11
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-09vdagent: drop clipboard received after timeoutArnon Gilboa1-3/+10
rhbz #951618
2013-05-09vdagent: add support for VD_AGENT_CLIENT_DISCONNECTEDArnon Gilboa1-0/+4
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-09vdagent: support sparse monitors configArnon Gilboa1-0/+6
rhbz #953973
2013-04-24build-sys: fix mingw buildMarc-André Lureau1-0/+5
2013-04-24Revert "Refresh monitor config only when needed"Marc-André Lureau1-1/+3
This reverts commit 67c1bcf49367d1726033b298a8ab016b4e22cf23. 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-24Try harder to enable monitorsMarc-André Lureau1-9/+26
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-22Revert "vdagent: add vdagent_helper to support mouse when UAC dialog takes ↵Arnon Gilboa1-50/+1
focus" This reverts commit dd9d1f41cace5e73bfd847ff8d0cfa303e141b1c.
2013-03-18vdagent: add vdagent_helper to support mouse when UAC dialog takes focusArnon Gilboa1-1/+50
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-18vdagent: don't terminate if stop event cannot be openedArnon Gilboa1-13/+9
so vdagent can keep running as standalone without dependency on vdservice. Regression was due to commit c1807e. rhbz #903379
2013-03-18vdagent: log unsupported grabbed clipboard formatsArnon Gilboa1-3/+8
rhbz #919451 debugging, useful anyway
2013-03-18vdagent: for Win7 class, use ClipboardFormatListener apiArnon Gilboa2-2/+42
(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-18vdagent: on encoding only, use HBITMAP to keep the correct paletteArnon Gilboa1-1/+5
for decoding, keep using CF_DIB and CxImage.CopyToHandle() as before. Regression was due to commit da07ce (rhbz #919150) rhbz #921980
2013-03-16Reattach monitorsMarc-André Lureau1-0/+6
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-16Refresh monitor config only when neededMarc-André Lureau1-1/+1
Somehow wnd_proc()->get_display() may be reentered during ChangeDisplaySettings
2013-03-12vdagent: use HBITMAP instead of DIB for image encodingArnon Gilboa1-3/+8
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-01-31vdservice stops vdagent via eventArnon Gilboa1-1/+15
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
2012-12-09vdagent: git rm *vdi_port*Arnon Gilboa6-576/+0
2012-12-09vdagent: remove vdi_port from vcprojArnon Gilboa1-24/+0
2012-12-09vdagent: remove vdi_port, use vio_serial directlyArnon Gilboa1-130/+109