summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)AuthorFilesLines
2015-02-06Remove MSVC++ strncpy/strcat fallbacksHEADmasterChristophe 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 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-4/+9
2015-02-06Add strcat_s/strcpy_s fallbacksChristophe Fergeau2-0/+57
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.
2014-12-30Fix Visual Studio compiler warning (strcat and sscanf)Uri Lublin1-0/+2
This is a follow-up to commits 492ee05a6b and 4b9e9b1d28 Visual Studio complains: .\file_xfer.cpp(90) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. And a similar complain for sscanf. Replace them with the secure function when compiling with Visual Studio. Note that the size provided is sizeof(d), which means all calls to sscanf and strcat must be done with the first param (destination) being an array and not a pointer.
2014-12-30Fix Visual Studio compiler warning (strncpy)Uri Lublin1-0/+1
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 (snprintf)Uri Lublin1-0/+4
This commit is an addition to 4b9e9b1d28ea7eaec44ff73e2f91c4064986b12a Building with Visual Studio breaks as snprintf is not implemented: vdagent\file_xfer.cpp(198) : error C3861: 'snprintf': identifier not found Replace it with sprintf_s for Visual Studio. Trying to use sprintf_s for both Visual Studio and mingw failed for mingw64 (build succeeds but runtime error appears).
2014-12-30vdcommon.h: consolidate defines under OLDMSVCRTUri Lublin1-3/+1
2014-12-30vdcommon.h: do not redefine _ftime_sUri Lublin1-0/+2
Fixes the following error: ==== In file included from vdagent/vdagent.cpp:18:0: ./common/vdcommon.h:51:0: warning: "_ftime_s" redefined #define _ftime_s(timeb) _ftime(timeb) ^ In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/sys/timeb.h:124:0, =====
2014-12-30vdcommon.h: add comment about OLDMSVCRTUri Lublin1-0/+17
2013-04-22Revert "vdagent: add vdagent_helper to support mouse when UAC dialog takes ↵Arnon Gilboa1-1/+0
focus" This reverts commit dd9d1f41cace5e73bfd847ff8d0cfa303e141b1c.
2013-03-18vdagent: add vdagent_helper to support mouse when UAC dialog takes focusArnon Gilboa1-0/+1
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-18vdservice: extract supported_system_version() to vdcommonArnon Gilboa2-0/+44
rhbz #919451 preparation
2013-01-31vdservice stops vdagent via eventArnon Gilboa1-0/+1
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-22Add OLDMSVCRT fallback for _ftime_sChristophe Fergeau2-14/+6
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-22vdlog: Get swprinft_s definition from vdcommon.hChristophe Fergeau1-4/+1
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.
2012-11-14vdagent: remove pipe common defsArnon Gilboa1-31/+0
2012-05-24mingw: don't use *_s msvcrt variantsMarc-André Lureau3-23/+42
Apparently, it comes with a recent version of C library (msvcrt90?), but I don't know if we can/should ship also a MS dll. Probably it used to work with an inlined version with VS headers. The build can be tweaked to use the -non-_s variant with -DOLDMSVCRT CFLAGS.
2012-03-01mingw: workaround _ftime_s bugChristophe Fergeau1-1/+7
mingw has a _ftime_s prototype in its headers, but no corresponding symbol available at link time. Workaround this issue for now by #defining it to _ftime. This is untested on win64 where the workaround may not be needed.
2012-02-23mingw: use gcc attributes for struct packingChristophe Fergeau1-2/+10
It automatically chooses between using the gcc construct or the visual-c++ construct at compile-time.
2012-02-23mingw: disable vc-specific #pragmaChristophe Fergeau1-0/+2
2012-02-23mingw: don't redefine SIZE_MAXChristophe Fergeau1-0/+2
mingw already has SIZE_MAX defined so don't try to redefine it to avoid a warning.
2012-02-23mingw: fix format string warningsChristophe Fergeau2-2/+2
Most of them are caused by not using %lu to print a DWORD (which is an unsigned long).
2011-11-21vdlog: change log times to human readable date & time rhbz#672828Arnon Gilboa2-19/+47
-use RHEV log format -add log levels & macros -remove LOG_ENABLED ifdefs
2011-01-11vdi_port refactor: introduce old pci_vdi_portAlon Levy1-0/+1
This patch is a little dirty due to EOL convertion to windows format. + add pci_vdi_port with PCIVDIPort taken from last commit before changing to virtio-serial (a17ccbf323768c3cb977f0f062366ba7cf7f19db) + move handle_error to VDIPort (identical in VIRTIOVDIPort and PCIVDIPort) + make VDService create first a virtio, then init, the pci, then init, stopping when the first init succeeds, and reporting to log which was created.
2010-11-09Revert "vdservice: add missing vdcommon.cpp"Arnon Gilboa1-19/+0
This reverts commit 53b32d4db33af4422382fbe629bb0314e252bdda which becomes irrelevant due to previous revert.
2010-11-09Revert "vdservice: don't start when no qxl device present"Arnon Gilboa1-2/+0
This reverts commit 349e6a5bf8804b25c3af6e1f439122a7cc269cc2 which breaks vsdervice on Windows 7
2010-08-29vdservice: add missing vdcommon.cppAlon Levy1-0/+19
2010-08-24vdservice: don't start when no qxl device presentAlon Levy1-0/+2
2010-08-24Controlling Windows display settings (e.g., wallpaper, UI effects and font ↵Yonit Halperin1-0/+2
smoothing) The configuration is received from Spice client. The main usage of this option is for disabling display features in order to accelerate Spice performance over limited network connections.
2010-08-23vdservice/vdagent: fixes leading to clipboard (aka large) message handlingArnon Gilboa1-0/+1
-add VDAgent::dispatch_message() -in VDAgent::read_completion() handle multi-chunk msgs -fix chunk size bug in VDService::handle_pipe_data() -add size to VDPipeMessage
2010-08-23include path fixes because of spice-protcol updatesAlon Levy1-1/+7
* mutex.h inlined into common/vdcommon.h * vdagent.h renamed to spice/vd_agent.h
2010-08-23spice: vdagent: support x64 archArnon Gilboa1-0/+4
2009-12-23vdagent: add win7 support to service for launching agentArnon Gilboa1-1/+2
2009-11-05fresh startArnon Gilboa4-0/+626