[Spice-devel] [vdagent-win PATCH] Update project URL

2017-07-07 Thread Frediano Ziglio
Uses secure version https://www.spice-space.org.
Avoid not secure and use same full name.

Signed-off-by: Frediano Ziglio 
---
 mingw-spice-vdagent.spec.in | 2 +-
 spice-vdagent.wxs.in| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-spice-vdagent.spec.in b/mingw-spice-vdagent.spec.in
index b55e8d5..8cfd01a 100644
--- a/mingw-spice-vdagent.spec.in
+++ b/mingw-spice-vdagent.spec.in
@@ -8,7 +8,7 @@ Release:1%{?dist}%{?extra_release}
 Summary:MinGW Windows SPICE guest agent
 
 License:GPLv2+
-URL:http://spice-space.org/
+URL:https://www.spice-space.org/
 Source0:vdagent-win-%{version}%{?_version_suffix}.tar.xz
 
 BuildRequires:  mingw32-filesystem >= 23
diff --git a/spice-vdagent.wxs.in b/spice-vdagent.wxs.in
index 060f33d..452f995 100644
--- a/spice-vdagent.wxs.in
+++ b/spice-vdagent.wxs.in
@@ -23,7 +23,7 @@
 
 
 
-http://www.spice-space.org"/>
+https://www.spice-space.org"/>
 
 
 
-- 
2.9.4

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [vdagent-win PATCH v2] RFC: Add test for PNG files

2017-07-07 Thread Frediano Ziglio
Signed-off-by: Frediano Ziglio 
---
 Makefile.am   | 20 +
 test-png  | 41 +++
 vdagent/imagetest.cpp | 78 +++
 3 files changed, 139 insertions(+)
 create mode 100755 test-png
 create mode 100644 vdagent/imagetest.cpp

Changes since v2:
- add a script to do a proper "make check" (wine required);
- do not install test utility;
- fix argument count check on test utility.

diff --git a/Makefile.am b/Makefile.am
index 175d8f7..ba1ab61 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,6 +22,7 @@ endif
 LIBS = -lversion
 
 bin_PROGRAMS = vdagent vdservice
+noinst_PROGRAMS = imagetest
 
 vdagent_LDADD = $(LIBPNG_LIBS) $(ZLIB_LIBS) -lwtsapi32 -lgdi32 
vdagent_rc.$(OBJEXT)
 vdagent_CXXFLAGS = $(AM_CXXFLAGS) $(LIBPNG_CFLAGS)
@@ -68,6 +69,25 @@ vdservice_rc.$(OBJEXT): vdservice/vdservice.rc
 
 MAINTAINERCLEANFILES += vdservice_rc.$(OBJEXT)
 
+imagetest_LDADD = $(LIBPNG_LIBS) $(ZLIB_LIBS) -lwtsapi32 -lgdi32
+imagetest_CXXFLAGS = $(AM_CXXFLAGS) $(LIBPNG_CFLAGS)
+imagetest_LDFLAGS = $(AM_LDFLAGS) -Wl,--subsystem,console
+imagetest_SOURCES =\
+   common/vdcommon.cpp \
+   common/vdcommon.h   \
+   common/vdlog.cpp\
+   common/vdlog.h  \
+   vdagent/imagetest.cpp   \
+   vdagent/image.cpp   \
+   vdagent/image.h \
+   vdagent/imagepng.cpp\
+   vdagent/imagepng.h  \
+   $(NULL)
+
+TESTS = test-png
+EXTRA_DIST += test-png
+test-png: imagetest$(EXEEXT)
+
 deps.txt:
$(AM_V_GEN)rpm -qa | grep $(host_os) | sort | unix2dos > $@
 
diff --git a/test-png b/test-png
new file mode 100755
index 000..48e1ea9
--- /dev/null
+++ b/test-png
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+VERBOSE=${VERBOSE:-0}
+
+IN=in.png
+OUT=out.png
+OUT_BMP=out.bmp
+
+error() {
+echo "$*" >&2
+exit 1
+}
+
+verbose() {
+if [ $VERBOSE != 0 ]; then
+"$@"
+fi
+}
+
+do_test() {
+echo "Running test with $*..."
+convert rose: "$@" $IN
+wine imagetest.exe $IN $OUT_BMP $OUT
+verbose ls -lh $IN
+verbose identify $IN
+verbose identify $OUT_BMP
+DIFF=$(compare -metric AE $IN $OUT - 2>&1 > /dev/null)
+if [ "$DIFF" != "0" ]; then
+error "Images are too different, diff $DIFF"
+fi
+}
+
+set -e
+do_test
+do_test -type Palette
+do_test -type Palette -colors 14
+do_test -type TrueColor
+do_test -type Grayscale
+rm -f $IN $OUT $OUT_BMP
+
+verbose echo Finish
diff --git a/vdagent/imagetest.cpp b/vdagent/imagetest.cpp
new file mode 100644
index 000..3ea244e
--- /dev/null
+++ b/vdagent/imagetest.cpp
@@ -0,0 +1,78 @@
+/*
+   Copyright (C) 2016 Red Hat, Inc.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of
+   the License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see .
+*/
+
+#undef NDEBUG
+#include "vdcommon.h"
+#include "image.h"
+#include "imagepng.h"
+#include 
+#include 
+
+int main(int argc, char **argv)
+{
+ImageCoder *coder = create_png_coder();
+
+assert(coder);
+assert(argc > 1);
+
+// read all file into memory
+FILE *f = fopen(argv[1], "rb");
+assert(f);
+assert(fseek(f, 0, SEEK_END) == 0);
+long len = ftell(f);
+assert(len > 0);
+assert(fseek(f, 0, SEEK_SET) == 0);
+
+std::vector data(len);
+assert(fread(&data[0], 1, len, f) == (unsigned long) len);
+fclose(f);
+
+size_t dib_size = coder->get_dib_size(&data[0], len);
+assert(dib_size);
+std::vector out(dib_size);
+memset(&out[0], 0xcc, dib_size);
+coder->get_dib_data(&out[0], &data[0], len);
+
+// looks like many tools wants this header so craft it
+BITMAPFILEHEADER head;
+memset(&head, 0, sizeof(head));
+head.bfType = 'B'+'M'*256u;
+head.bfSize = sizeof(head) + dib_size;
+BITMAPINFOHEADER& info(*(BITMAPINFOHEADER*)&out[0]);
+head.bfOffBits = sizeof(head) + sizeof(BITMAPINFOHEADER) + 4 * 
info.biClrUsed;
+
+f = fopen(argc > 2 ? argv[2] : "out.bmp", "wb");
+assert(f);
+assert(fwrite(&head, 1, sizeof(head), f) == sizeof(head));
+assert(fwrite(&out[0], 1, dib_size, f) == dib_size);
+fclose(f);
+
+// convert back to PNG
+long png_size = 0;
+uint8_t *png = coder->from_bitmap(*((BITMAPINFO*)&out[0]), 
&out[sizeof(BITMAPINFOHEADER) + 4 * info.biClrUsed], png_size);
+assert(png && png_size > 0);
+
+f = fopen(argc

Re: [Spice-devel] [vdagent-win PATCH] Update project URL

2017-07-07 Thread Pavel Grunt
On Fri, 2017-07-07 at 09:16 +0100, Frediano Ziglio wrote:
> Uses secure version https://www.spice-space.org.
> Avoid not secure and use same full name.
> 
> Signed-off-by: Frediano Ziglio 
Acked-by: Pavel Grunt 

> ---
>  mingw-spice-vdagent.spec.in | 2 +-
>  spice-vdagent.wxs.in| 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mingw-spice-vdagent.spec.in b/mingw-spice-vdagent.spec.in
> index b55e8d5..8cfd01a 100644
> --- a/mingw-spice-vdagent.spec.in
> +++ b/mingw-spice-vdagent.spec.in
> @@ -8,7 +8,7 @@ Release:1%{?dist}%{?extra_release}
>  Summary:MinGW Windows SPICE guest agent
>  
>  License:GPLv2+
> -URL:http://spice-space.org/
> +URL:https://www.spice-space.org/
>  Source0:vdagent-win-%{version}%{?_version_suffix}.tar.xz
>  
>  BuildRequires:  mingw32-filesystem >= 23
> diff --git a/spice-vdagent.wxs.in b/spice-vdagent.wxs.in
> index 060f33d..452f995 100644
> --- a/spice-vdagent.wxs.in
> +++ b/spice-vdagent.wxs.in
> @@ -23,7 +23,7 @@
>  
>  
>  
> -http://www.spice-space.org"/>;
> +https://www.spice-space.org"/>;
>  
>  
>  
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [spice-common] log: Define G_LOG_DOMAIN as early as possible

2017-07-07 Thread Christophe Fergeau
"log: Forbid the usage of obsolete SPICE_LOG_DOMAIN" introduced a small
regression, if G_LOG_DOMAIN is not set when glib.h is included, the
header will set it to a default value. Redefining it later in log.c is
going to cause a compile-time warning.
This commit adds the definition to SPICE_COMMON_CFLAGS so that it's
defined before any inclusion of glib.h is possible. This is similar to
what is done in spice/configure.ac.

This avoids this warning:
CC   log.lo
log.c:44:0: warning: "G_LOG_DOMAIN" redefined
 #define G_LOG_DOMAIN "Spice"

In file included from /usr/include/glib-2.0/glib.h:62:0,
 from log.c:22:
/usr/include/glib-2.0/glib/gmessages.h:280:0: note: this is the location of the 
previous definition
 #define G_LOG_DOMAIN((gchar*) 0)

Signed-off-by: Christophe Fergeau 
---
 common/log.c | 2 --
 configure.ac | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/common/log.c b/common/log.c
index 9b4757b..69ac63e 100644
--- a/common/log.c
+++ b/common/log.c
@@ -41,8 +41,6 @@ static int abort_mask = 0;
 #endif
 #endif
 
-#define G_LOG_DOMAIN "Spice"
-
 typedef enum {
 SPICE_LOG_LEVEL_ERROR,
 SPICE_LOG_LEVEL_CRITICAL,
diff --git a/configure.ac b/configure.ac
index efd7317..f9b3f96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,7 @@ SPICE_CHECK_OPENSSL
 
 SPICE_COMMON_CFLAGS='$(PIXMAN_CFLAGS) $(SMARTCARD_CFLAGS) $(CELT051_CFLAGS) 
$(GLIB2_CFLAGS) $(OPUS_CFLAGS) $(OPENSSL_CFLAGS)'
 SPICE_COMMON_LIBS='$(PIXMAN_LIBS) $(CELT051_LIBS) $(GLIB2_LIBS) $(OPUS_LIBS) 
$(OPENSSL_LIBS)'
+SPICE_COMMON_CFLAGS+=' -DG_LOG_DOMAIN=\"Spice\"'
 AC_SUBST(SPICE_COMMON_CFLAGS)
 AC_SUBST(SPICE_COMMON_LIBS)
 
-- 
2.13.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [RFC spice-vdagent_win] Add initial seamless mode support

2017-07-07 Thread Jakub Janků
---
Demo: https://youtu.be/IX49z8VbD-c

VDAgent: https://github.com/jjanku/win32-vd_agent/tree/seamless-mode
Protocol: https://gitlab.com/xerus/spice-protocol/tree/seamless-mode
Gtk: https://github.com/jjanku/spice-gtk/tree/seamless-mode

This patch adds very basic implementation of seamless mode for Windows, that 
was partialy implemented for linux by Ondrej Holy and Lukas Venhoda earlier.

It's just a proof of concept as it's very buggy at the moment:
-occasional screen tearing (can be seen in the demo with MineSweeper, Gtk issue 
maybe?)
-tested just on Win7 & Win10
-EnumWindows doesn't work for Win10 ModernUI apps
 (possible fix: 
https://wj32.org/wp/2012/12/12/enumwindows-no-longer-finds-metromodern-ui-windows-a-workaround-2/)
-narrow black bar on top in Win10
-weird behaviour with multiple screens
-other...
---
 spice-protocol  |   2 +-
 vdagent/vdagent.cpp | 148 
 2 files changed, 149 insertions(+), 1 deletion(-)

diff --git a/spice-protocol b/spice-protocol
index 666b5c5..d52016e 16
--- a/spice-protocol
+++ b/spice-protocol
@@ -1 +1 @@
-Subproject commit 666b5c5780acf3176a9cff61ad549d30bb1b9824
+Subproject commit d52016e727e48f6eb214becafa9103e6d4fb7f64
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index cd49755..4d445c0 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -28,6 +28,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #define VD_AGENT_LOG_PATH   TEXT("%svdagent.log")
 #define VD_AGENT_WINCLASS_NAME  TEXT("VDAGENT")
@@ -64,6 +66,7 @@ typedef struct ALIGN_VC VDIChunk {
 #define VD_READ_BUF_SIZE   (sizeof(VDIChunk) + VD_AGENT_MAX_DATA_SIZE)
 
 typedef BOOL (WINAPI *PCLIPBOARD_OP)(HWND);
+typedef HRESULT (WINAPI *DWM_GET_PROC)(HWND hwnd, DWORD, PVOID, DWORD);
 
 class VDAgent {
 public:
@@ -92,6 +95,12 @@ private:
 DWORD get_buttons_change(DWORD last_buttons_state, DWORD new_buttons_state,
  DWORD mask, DWORD down_flag, DWORD up_flag);
 static HGLOBAL utf8_alloc(LPCSTR data, int size);
+void send_seamless_mode_list();
+void set_seamless_mode(uint8_t enabled);
+static void CALLBACK wnd_event_proc(HWINEVENTHOOK hWinEventHook, DWORD 
event,HWND hwnd,
+LONG idObject, LONG idChild, DWORD 
dwEventThread,
+DWORD dwmsEventTime);
+static BOOL CALLBACK enum_wnd_proc(HWND hwnd, LPARAM lparam);
 static LRESULT CALLBACK wnd_proc(HWND hwnd, UINT message, WPARAM wparam, 
LPARAM lparam);
 static DWORD WINAPI event_thread_proc(LPVOID param);
 static VOID CALLBACK read_completion(DWORD err, DWORD bytes, LPOVERLAPPED 
overlapped);
@@ -168,6 +177,10 @@ private:
 
 std::set _grab_types;
 
+HWINEVENTHOOK _seamless_window_change_hooks[2];
+HMODULE _dwm_lib;
+DWM_GET_PROC _dwm_get_wnd_attr;
+
 VDLog* _log;
 };
 
@@ -339,6 +352,7 @@ bool VDAgent::run()
 }
 vd_printf("Agent stopped");
 CloseHandle(event_thread);
+set_seamless_mode(FALSE);
 cleanup();
 return true;
 }
@@ -833,6 +847,7 @@ bool VDAgent::send_announce_capabilities(bool request)
 VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG);
 VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_GUEST_LINEEND_CRLF);
 VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_MAX_CLIPBOARD);
+VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_SEAMLESS_MODE);
 vd_printf("Sending capabilities:");
 for (uint32_t i = 0 ; i < caps_size; ++i) {
 vd_printf("%X", caps->caps[i]);
@@ -1292,6 +1307,11 @@ void VDAgent::dispatch_message(VDAgentMessage* msg, 
uint32_t port)
 case VD_AGENT_MAX_CLIPBOARD:
 res = handle_max_clipboard((VDAgentMaxClipboard*)msg->data, msg->size);
 break;
+case VD_AGENT_SEAMLESS_MODE: {
+VDAgentSeamlessMode *seamless_msg = (VDAgentSeamlessMode*)msg->data;
+set_seamless_mode(seamless_msg->enabled);
+break;
+}
 default:
 vd_printf("Unsupported message type %u size %u", msg->type, msg->size);
 }
@@ -1301,6 +1321,134 @@ void VDAgent::dispatch_message(VDAgentMessage* msg, 
uint32_t port)
 }
 }
 
+void VDAgent::set_seamless_mode(uint8_t enabled)
+{
+if (enabled) {
+if (IsWindows8OrGreater()) {
+_dwm_lib = LoadLibrary(L"Dwmapi.dll");
+if (_dwm_lib) {
+_dwm_get_wnd_attr = (DWM_GET_PROC)GetProcAddress(_dwm_lib, 
"DwmGetWindowAttribute");
+if (!_dwm_get_wnd_attr) {
+vd_printf("GetProcAddress for DwmGetWindowAttribute failed 
with error %lu", GetLastError());
+}
+} else {
+vd_printf("Loading Dwmapi.dll failed with error %lu", 
GetLastError());
+}
+}
+
+//TODO maybe the range of events is too large?
+//TODO check that we don't create new hooks when the old ones haven't 
been removed yet
+_seamless_win

Re: [Spice-devel] [spice-common] log: Define G_LOG_DOMAIN as early as possible

2017-07-07 Thread Frediano Ziglio

> 
> "log: Forbid the usage of obsolete SPICE_LOG_DOMAIN" introduced a small
> regression, if G_LOG_DOMAIN is not set when glib.h is included, the
> header will set it to a default value. Redefining it later in log.c is
> going to cause a compile-time warning.
> This commit adds the definition to SPICE_COMMON_CFLAGS so that it's
> defined before any inclusion of glib.h is possible. This is similar to
> what is done in spice/configure.ac.
> 
> This avoids this warning:
> CC   log.lo
> log.c:44:0: warning: "G_LOG_DOMAIN" redefined
>  #define G_LOG_DOMAIN "Spice"
> 
> In file included from /usr/include/glib-2.0/glib.h:62:0,
>  from log.c:22:
> /usr/include/glib-2.0/glib/gmessages.h:280:0: note: this is the location of
> the previous definition
>  #define G_LOG_DOMAIN((gchar*) 0)
> 
> Signed-off-by: Christophe Fergeau 
> ---
>  common/log.c | 2 --
>  configure.ac | 1 +
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/common/log.c b/common/log.c
> index 9b4757b..69ac63e 100644
> --- a/common/log.c
> +++ b/common/log.c
> @@ -41,8 +41,6 @@ static int abort_mask = 0;
>  #endif
>  #endif
>  
> -#define G_LOG_DOMAIN "Spice"
> -
>  typedef enum {
>  SPICE_LOG_LEVEL_ERROR,
>  SPICE_LOG_LEVEL_CRITICAL,
> diff --git a/configure.ac b/configure.ac
> index efd7317..f9b3f96 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -50,6 +50,7 @@ SPICE_CHECK_OPENSSL
>  
>  SPICE_COMMON_CFLAGS='$(PIXMAN_CFLAGS) $(SMARTCARD_CFLAGS) $(CELT051_CFLAGS)
>  $(GLIB2_CFLAGS) $(OPUS_CFLAGS) $(OPENSSL_CFLAGS)'
>  SPICE_COMMON_LIBS='$(PIXMAN_LIBS) $(CELT051_LIBS) $(GLIB2_LIBS) $(OPUS_LIBS)
>  $(OPENSSL_LIBS)'
> +SPICE_COMMON_CFLAGS+=' -DG_LOG_DOMAIN=\"Spice\"'

This is not standard shell compatible. The configure uses /bin/sh which
in some Linux systems is not even bash.

Is a weird mix of shell/Makefile which may be hard to quote correctly.

Something that simulate bash is

SPICE_COMMON_CFLAGS="$SPICE_COMMON_CFLAGS -DG_LOG_DOMAIN=\\\"Spice\\\""

>  AC_SUBST(SPICE_COMMON_CFLAGS)
>  AC_SUBST(SPICE_COMMON_LIBS)
>  

Frediano
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-common] log: Define G_LOG_DOMAIN as early as possible

2017-07-07 Thread Christophe Fergeau
On Fri, Jul 07, 2017 at 06:07:33AM -0400, Frediano Ziglio wrote:
> 
> > 
> > "log: Forbid the usage of obsolete SPICE_LOG_DOMAIN" introduced a small
> > regression, if G_LOG_DOMAIN is not set when glib.h is included, the
> > header will set it to a default value. Redefining it later in log.c is
> > going to cause a compile-time warning.
> > This commit adds the definition to SPICE_COMMON_CFLAGS so that it's
> > defined before any inclusion of glib.h is possible. This is similar to
> > what is done in spice/configure.ac.
> > 
> > This avoids this warning:
> > CC   log.lo
> > log.c:44:0: warning: "G_LOG_DOMAIN" redefined
> >  #define G_LOG_DOMAIN "Spice"
> > 
> > In file included from /usr/include/glib-2.0/glib.h:62:0,
> >  from log.c:22:
> > /usr/include/glib-2.0/glib/gmessages.h:280:0: note: this is the location of
> > the previous definition
> >  #define G_LOG_DOMAIN((gchar*) 0)
> > 
> > Signed-off-by: Christophe Fergeau 
> > ---
> >  common/log.c | 2 --
> >  configure.ac | 1 +
> >  2 files changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/common/log.c b/common/log.c
> > index 9b4757b..69ac63e 100644
> > --- a/common/log.c
> > +++ b/common/log.c
> > @@ -41,8 +41,6 @@ static int abort_mask = 0;
> >  #endif
> >  #endif
> >  
> > -#define G_LOG_DOMAIN "Spice"
> > -
> >  typedef enum {
> >  SPICE_LOG_LEVEL_ERROR,
> >  SPICE_LOG_LEVEL_CRITICAL,
> > diff --git a/configure.ac b/configure.ac
> > index efd7317..f9b3f96 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -50,6 +50,7 @@ SPICE_CHECK_OPENSSL
> >  
> >  SPICE_COMMON_CFLAGS='$(PIXMAN_CFLAGS) $(SMARTCARD_CFLAGS) $(CELT051_CFLAGS)
> >  $(GLIB2_CFLAGS) $(OPUS_CFLAGS) $(OPENSSL_CFLAGS)'
> >  SPICE_COMMON_LIBS='$(PIXMAN_LIBS) $(CELT051_LIBS) $(GLIB2_LIBS) 
> > $(OPUS_LIBS)
> >  $(OPENSSL_LIBS)'
> > +SPICE_COMMON_CFLAGS+=' -DG_LOG_DOMAIN=\"Spice\"'
> 
> This is not standard shell compatible. The configure uses /bin/sh which
> in some Linux systems is not even bash.
> 
> Is a weird mix of shell/Makefile which may be hard to quote correctly.
> 
> Something that simulate bash is
> 
> SPICE_COMMON_CFLAGS="$SPICE_COMMON_CFLAGS -DG_LOG_DOMAIN=\\\"Spice\\\""

I just reused what is done in spice/configure.ac, I can change it to
what you suggest, test and push if that's fine with you.

Christophe


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [spice-common v2] log: Define G_LOG_DOMAIN as early as possible

2017-07-07 Thread Christophe Fergeau
"log: Forbid the usage of obsolete SPICE_LOG_DOMAIN" introduced a small
regression, if G_LOG_DOMAIN is not set when glib.h is included, the
header will set it to a default value. Redefining it later in log.c is
going to cause a compile-time warning.
This commit adds the definition to SPICE_COMMON_CFLAGS so that it's
defined before any inclusion of glib.h is possible. This is similar to
what is done in spice/configure.ac.

This avoids this warning:
CC   log.lo
log.c:44:0: warning: "G_LOG_DOMAIN" redefined
 #define G_LOG_DOMAIN "Spice"

In file included from /usr/include/glib-2.0/glib.h:62:0,
 from log.c:22:
/usr/include/glib-2.0/glib/gmessages.h:280:0: note: this is the location of the 
previous definition
 #define G_LOG_DOMAIN((gchar*) 0)

Signed-off-by: Christophe Fergeau 
---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index b66d879..1f2ecc0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,7 @@ SPICE_CHECK_OPENSSL
 SPICE_CHECK_GDK_PIXBUF
 
 SPICE_COMMON_CFLAGS='$(PIXMAN_CFLAGS) $(SMARTCARD_CFLAGS) $(CELT051_CFLAGS) 
$(GLIB2_CFLAGS) $(OPUS_CFLAGS) $(OPENSSL_CFLAGS)'
+SPICE_COMMON_CFLAGS="$SPICE_COMMON_CFLAGS -DG_LOG_DOMAIN=\\\"Spice\\\""
 SPICE_COMMON_LIBS='$(PIXMAN_LIBS) $(CELT051_LIBS) $(GLIB2_LIBS) $(OPUS_LIBS) 
$(OPENSSL_LIBS)'
 AC_SUBST(SPICE_COMMON_CFLAGS)
 AC_SUBST(SPICE_COMMON_LIBS)
-- 
2.13.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [spice-server] build-sys: Improve portability of appending to COMMON_CFLAGS

2017-07-07 Thread Christophe Fergeau
This is currently done through += in configure.ac, this commit switches
to using COMMON_CFLAGS="$COMMON_CFLAGS ..." for better portability.

Signed-off-by: Christophe Fergeau 
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 9ebcfd04f..95985a68d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,7 +139,7 @@ dnl Check deps
 
 AC_CONFIG_SUBDIRS([spice-common])
 COMMON_CFLAGS='-I ${top_srcdir}/spice-common/ -I ${top_builddir}/spice-common/'
-COMMON_CFLAGS+=' -DG_LOG_DOMAIN=\"Spice\"'
+COMMON_CFLAGS="$COMMON_CFLAGS -DG_LOG_DOMAIN=\\\"Spice\\\""
 AC_SUBST(COMMON_CFLAGS)
 
 AC_CHECK_LIBM
-- 
2.13.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH v2 4/4] qxl-wddm-dod: Add scripts for ETW recording and parsing

2017-07-07 Thread Christophe Fergeau
On Thu, Jul 06, 2017 at 01:22:58AM +0300, Yuri Benditovich wrote:
> QxlDodCollectTrace.bat intended for recording of binary traces
> in end-user environment (end-user runs it when instructed).
> It uses built-in Windows ability of collecting ETW data.
> QxlDodParseTrace.bat is to be used by developer to convert
> received binary traces to formatted text.
> 
> Signed-off-by: Yuri Benditovich 
> ---
>  QxlDodCollectTrace.bat | 31 +++
>  QxlDodParseTrace.bat   | 10 ++
>  2 files changed, 41 insertions(+)
>  create mode 100644 QxlDodCollectTrace.bat
>  create mode 100644 QxlDodParseTrace.bat
> 
> diff --git a/QxlDodCollectTrace.bat b/QxlDodCollectTrace.bat
> new file mode 100644
> index 000..29ccde5
> --- /dev/null
> +++ b/QxlDodCollectTrace.bat
> @@ -0,0 +1,31 @@
> +:: Place this script to any writable directory
> +:: on the machine and run it as administrator
> +:: recorded binary file qxldod.etl will be created in the same directory
> +:: 
> +:: parameter "4" in 'logman update' sets logging level to INFO
> +:: change it to "5" for VERBOSE
> +:: 
> +
> +@echo off
> +
> +net session >nul 2>&1
> +if %errorlevel% equ 0 goto :admin_ok
> +echo This script shall run with administrator rights
> +pause
> +goto :eof
> +
> +
> +:admin_ok
> +pushd "%~dp0"
> +logman stop qxldod -ets >nul 2>&1
> +logman delete qxldod -ets >nul 2>&1
> +logman create trace qxldod -o qxldod.etl -ow -ets 
> +logman update qxldod -p {756ABE50-54E3-4A05-B5BB-F0112C75B18A} 0x7fff 4 
> -ets
> +echo Recording started.
> +echo Reproduce the problem, then press ENTER
> +pause > nul
> +logman stop qxldod -ets
> +dir qxldod.etl
> +echo Please collect qxldod.etl file now
> +pause
> +popd
> diff --git a/QxlDodParseTrace.bat b/QxlDodParseTrace.bat
> new file mode 100644
> index 000..8237ec0
> --- /dev/null
> +++ b/QxlDodParseTrace.bat
> @@ -0,0 +1,10 @@
> +@echo off
> +set tmpname=%temp%\%RANDOM%%RANDOM%%RANDOM%.tmp
> +if "%~1" equ "" goto :usage
> +if "%~2" equ "" goto :usage
> +"C:\Program Files (x86)\Windows Kits\10\tools\x86\traceview.exe" -process 
> "%~1" -o %tmpname% -pdb "~2" -nosummary

Fwiw, fairly hardcoded path here.

> +start notepad %tmpname%

Why is this going through notepad? Quick search for traceview showed
some nice GUI
https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/trace-message-lists
is that a different tool/purpose?
If this script is meant for developers, is it really useful to have it,
rather than having some link explaining how to work with trace files?

Christophe


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH v2 4/4] qxl-wddm-dod: Add scripts for ETW recording and parsing

2017-07-07 Thread Frediano Ziglio
> 
> QxlDodCollectTrace.bat intended for recording of binary traces
> in end-user environment (end-user runs it when instructed).
> It uses built-in Windows ability of collecting ETW data.
> QxlDodParseTrace.bat is to be used by developer to convert
> received binary traces to formatted text.
> 
> Signed-off-by: Yuri Benditovich 
> ---
>  QxlDodCollectTrace.bat | 31 +++
>  QxlDodParseTrace.bat   | 10 ++
>  2 files changed, 41 insertions(+)
>  create mode 100644 QxlDodCollectTrace.bat
>  create mode 100644 QxlDodParseTrace.bat
> 
> diff --git a/QxlDodCollectTrace.bat b/QxlDodCollectTrace.bat
> new file mode 100644
> index 000..29ccde5
> --- /dev/null
> +++ b/QxlDodCollectTrace.bat
> @@ -0,0 +1,31 @@
> +:: Place this script to any writable directory
> +:: on the machine and run it as administrator
> +:: recorded binary file qxldod.etl will be created in the same directory
> +::
> +:: parameter "4" in 'logman update' sets logging level to INFO
> +:: change it to "5" for VERBOSE
> +::
> +
> +@echo off
> +
> +net session >nul 2>&1
> +if %errorlevel% equ 0 goto :admin_ok
> +echo This script shall run with administrator rights
> +pause
> +goto :eof
> +
> +
> +:admin_ok
> +pushd "%~dp0"
> +logman stop qxldod -ets >nul 2>&1
> +logman delete qxldod -ets >nul 2>&1
> +logman create trace qxldod -o qxldod.etl -ow -ets
> +logman update qxldod -p {756ABE50-54E3-4A05-B5BB-F0112C75B18A} 0x7fff 4
> -ets
> +echo Recording started.
> +echo Reproduce the problem, then press ENTER
> +pause > nul
> +logman stop qxldod -ets
> +dir qxldod.etl
> +echo Please collect qxldod.etl file now
> +pause
> +popd
> diff --git a/QxlDodParseTrace.bat b/QxlDodParseTrace.bat
> new file mode 100644
> index 000..8237ec0
> --- /dev/null
> +++ b/QxlDodParseTrace.bat
> @@ -0,0 +1,10 @@
> +@echo off
> +set tmpname=%temp%\%RANDOM%%RANDOM%%RANDOM%.tmp
> +if "%~1" equ "" goto :usage
> +if "%~2" equ "" goto :usage
> +"C:\Program Files (x86)\Windows Kits\10\tools\x86\traceview.exe" -process 
> "%~1" -o %tmpname% -pdb "~2" -nosummary

Should not be -pdb "%~2" ?

> +start notepad %tmpname%
> +goto :eof
> +:usage
> +echo %~n0 ^ ^
> +goto :eof

Frediano
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH v2 3/4] qxl-wddm-dod: Support ETW for release version

2017-07-07 Thread Frediano Ziglio
> 
> Add ability to produce ETW (Event Tracing for Windows) to release
> version of the driver to be able to record binary traces in case
> of problem in customer environment for further analysis.
> Logging of debug build is not changed.
> 

Why you decided to not change debug build?

Frediano

> Signed-off-by: Yuri Benditovich 
> ---
>  qxldod/QxlDod.cpp | 3 +++
>  qxldod/driver.cpp | 6 ++
>  qxldod/driver.h   | 2 +-
>  qxldod/qxldod.vcxproj | 5 +
>  4 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
> index b97301a..4f508bd 100755
> --- a/qxldod/QxlDod.cpp
> +++ b/qxldod/QxlDod.cpp
> @@ -12,6 +12,9 @@
>  #include "qxldod.h"
>  #include "qxl_windows.h"
>  #include "compat.h"
> +#if !DBG
> +#include "qxldod.tmh"
> +#endif
>  
>  #pragma code_seg("PAGE")
>  
> diff --git a/qxldod/driver.cpp b/qxldod/driver.cpp
> index 1ff2abb..aa245c8 100755
> --- a/qxldod/driver.cpp
> +++ b/qxldod/driver.cpp
> @@ -10,6 +10,9 @@
>  
>  #include "driver.h"
>  #include "QxlDod.h"
> +#if !DBG
> +#include "driver.tmh"
> +#endif
>  
>  #pragma code_seg(push)
>  #pragma code_seg("INIT")
> @@ -62,6 +65,8 @@ DriverEntry(
>  {
>  PAGED_CODE();
>  
> +WPP_INIT_TRACING(NULL, NULL);
> +
>  DbgPrint(TRACE_LEVEL_FATAL, ("---> KMDOD build on on %s %s\n", __DATE__,
>  __TIME__));
>  
>  RTL_OSVERSIONINFOW versionInfo;
> @@ -157,6 +162,7 @@ DodUnload(VOID)
>  {
>  PAGED_CODE();
>  DbgPrint(TRACE_LEVEL_INFORMATION, ("<--> %s\n", __FUNCTION__));
> +WPP_CLEANUP(NULL);
>  }
>  
>  NTSTATUS
> diff --git a/qxldod/driver.h b/qxldod/driver.h
> index a70b0e7..df5fb9f 100755
> --- a/qxldod/driver.h
> +++ b/qxldod/driver.h
> @@ -10,7 +10,7 @@
>  
>  #pragma once
>  #include "BaseObject.h"
> -
> +#include "WppTrace.h"
>  
>  extern "C"
>  DRIVER_INITIALIZE DriverEntry;
> diff --git a/qxldod/qxldod.vcxproj b/qxldod/qxldod.vcxproj
> index 1766a61..15e36d9 100755
> --- a/qxldod/qxldod.vcxproj
> +++ b/qxldod/qxldod.vcxproj
> @@ -185,6 +185,8 @@
>  
>
> %(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH);.\Include
>Level3
> +  WppTrace.h
> +  true
>  
>  
>Inf2Cat /driver:$(OutDir) /os:8_X86,6_3_X86
> @@ -255,6 +257,8 @@
>  
>
> %(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH);.\Include
>Level3
> +  WppTrace.h
> +  true
>  
>  
>Inf2Cat /driver:$(OutDir)
>/os:8_X64,Server8_X64,Server6_3_X64,6_3_X64
> @@ -277,6 +281,7 @@
>  
>  
>  
> +
>
>
>  

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-common v2] log: Define G_LOG_DOMAIN as early as possible

2017-07-07 Thread Frediano Ziglio
> 
> "log: Forbid the usage of obsolete SPICE_LOG_DOMAIN" introduced a small
> regression, if G_LOG_DOMAIN is not set when glib.h is included, the
> header will set it to a default value. Redefining it later in log.c is
> going to cause a compile-time warning.
> This commit adds the definition to SPICE_COMMON_CFLAGS so that it's
> defined before any inclusion of glib.h is possible. This is similar to
> what is done in spice/configure.ac.
> 
> This avoids this warning:
> CC   log.lo
> log.c:44:0: warning: "G_LOG_DOMAIN" redefined
>  #define G_LOG_DOMAIN "Spice"
> 
> In file included from /usr/include/glib-2.0/glib.h:62:0,
>  from log.c:22:
> /usr/include/glib-2.0/glib/gmessages.h:280:0: note: this is the location of
> the previous definition
>  #define G_LOG_DOMAIN((gchar*) 0)
> 
> Signed-off-by: Christophe Fergeau 
> ---
>  configure.ac | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configure.ac b/configure.ac
> index b66d879..1f2ecc0 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -50,6 +50,7 @@ SPICE_CHECK_OPENSSL
>  SPICE_CHECK_GDK_PIXBUF
>  
>  SPICE_COMMON_CFLAGS='$(PIXMAN_CFLAGS) $(SMARTCARD_CFLAGS) $(CELT051_CFLAGS)
>  $(GLIB2_CFLAGS) $(OPUS_CFLAGS) $(OPENSSL_CFLAGS)'
> +SPICE_COMMON_CFLAGS="$SPICE_COMMON_CFLAGS -DG_LOG_DOMAIN=\\\"Spice\\\""
>  SPICE_COMMON_LIBS='$(PIXMAN_LIBS) $(CELT051_LIBS) $(GLIB2_LIBS) $(OPUS_LIBS)
>  $(OPENSSL_LIBS)'
>  AC_SUBST(SPICE_COMMON_CFLAGS)
>  AC_SUBST(SPICE_COMMON_LIBS)

Acked-by: Frediano Ziglio 

Frediano

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-server] build-sys: Improve portability of appending to COMMON_CFLAGS

2017-07-07 Thread Frediano Ziglio
> 
> This is currently done through += in configure.ac, this commit switches
> to using COMMON_CFLAGS="$COMMON_CFLAGS ..." for better portability.
> 
> Signed-off-by: Christophe Fergeau 

Maybe for spice-server is not needed but does not hurt,

Acked-by: Frediano Ziglio 

Frediano

> ---
>  configure.ac | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 9ebcfd04f..95985a68d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -139,7 +139,7 @@ dnl Check deps
>  
>  AC_CONFIG_SUBDIRS([spice-common])
>  COMMON_CFLAGS='-I ${top_srcdir}/spice-common/ -I
>  ${top_builddir}/spice-common/'
> -COMMON_CFLAGS+=' -DG_LOG_DOMAIN=\"Spice\"'
> +COMMON_CFLAGS="$COMMON_CFLAGS -DG_LOG_DOMAIN=\\\"Spice\\\""
>  AC_SUBST(COMMON_CFLAGS)
>  
>  AC_CHECK_LIBM
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk] Use designated struct initializer

2017-07-07 Thread Pavel Grunt
Silence -Wmissing-field-initializers warnings.
---
imo it also makes the code more readable (especially tests/session.c)
---
 src/channel-display-gst.c |   3 +-
 src/channel-main.c|   4 +-
 src/channel-record.c  |  16 +++--
 src/spice-channel.c   |  12 ++--
 src/spice-gtk-session.c   |  14 ++---
 src/spice-pulse.c |  18 +++---
 src/spice-session.c   |   2 +-
 tests/session.c   | 156 +-
 8 files changed, 118 insertions(+), 107 deletions(-)

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 9b79403..807ff85 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -306,7 +306,7 @@ static gboolean create_pipeline(SpiceGstDecoder *decoder)
 gchar *desc;
 gboolean auto_enabled;
 guint opt;
-GstAppSinkCallbacks appsink_cbs = { NULL };
+GstAppSinkCallbacks appsink_cbs = { .new_sample = new_sample };
 GError *err = NULL;
 GstBus *bus;
 
@@ -344,7 +344,6 @@ static gboolean create_pipeline(SpiceGstDecoder *decoder)
 decoder->appsrc = 
GST_APP_SRC(gst_bin_get_by_name(GST_BIN(decoder->pipeline), "src"));
 decoder->appsink = 
GST_APP_SINK(gst_bin_get_by_name(GST_BIN(decoder->pipeline), "sink"));
 
-appsink_cbs.new_sample = new_sample;
 gst_app_sink_set_callbacks(decoder->appsink, &appsink_cbs, decoder, NULL);
 bus = gst_pipeline_get_bus(GST_PIPELINE(decoder->pipeline));
 gst_bus_add_watch(bus, handle_pipeline_message, decoder);
diff --git a/src/channel-main.c b/src/channel-main.c
index 4edd575..104b18a 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1275,7 +1275,7 @@ static void agent_sync_audio_record(SpiceMainChannel 
*main_channel)
 static void agent_display_config(SpiceMainChannel *channel)
 {
 SpiceMainChannelPrivate *c = channel->priv;
-VDAgentDisplayConfig config = { 0, };
+VDAgentDisplayConfig config = { .flags = 0, .depth = 0};
 
 if (c->display_disable_wallpaper) {
 config.flags |= VD_AGENT_DISPLAY_CONFIG_FLAG_DISABLE_WALLPAPER;
@@ -2334,7 +2334,7 @@ static void main_migrate_connect(SpiceChannel *channel,
 {
 SpiceMainChannelPrivate *main_priv = SPICE_MAIN_CHANNEL(channel)->priv;
 int reply_type = SPICE_MSGC_MAIN_MIGRATE_CONNECT_ERROR;
-spice_migrate mig = { 0, };
+spice_migrate mig = { .from = NULL, };
 SpiceMsgOut *out;
 SpiceSession *session;
 
diff --git a/src/channel-record.c b/src/channel-record.c
index 9834e85..2023bb4 100644
--- a/src/channel-record.c
+++ b/src/channel-record.c
@@ -255,18 +255,18 @@ static void 
spice_record_channel_class_init(SpiceRecordChannelClass *klass)
 static void spice_record_mode(SpiceRecordChannel *channel, uint32_t time,
   uint32_t mode, uint8_t *data, uint32_t data_size)
 {
-SpiceMsgcRecordMode m = {0, };
+SpiceMsgcRecordMode m = {
+.time = time,
+.mode = mode,
+.data = data,
+.data_size = data_size,
+};
 SpiceMsgOut *msg;
 
 g_return_if_fail(channel != NULL);
 if (spice_channel_get_read_only(SPICE_CHANNEL(channel)))
 return;
 
-m.mode = mode;
-m.time = time;
-m.data = data;
-m.data_size = data_size;
-
 msg = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_RECORD_MODE);
 msg->marshallers->msgc_record_mode(msg->marshaller, &m);
 spice_msg_out_send(msg);
@@ -317,7 +317,7 @@ void spice_record_send_data(SpiceRecordChannel *channel, 
gpointer data,
 gsize bytes, uint32_t time)
 {
 SpiceRecordChannelPrivate *rc;
-SpiceMsgcRecordPacket p = {0, };
+SpiceMsgcRecordPacket p = { .time = time };
 
 g_return_if_fail(SPICE_IS_RECORD_CHANNEL(channel));
 rc = channel->priv;
@@ -339,8 +339,6 @@ void spice_record_send_data(SpiceRecordChannel *channel, 
gpointer data,
 if (rc->mode != SPICE_AUDIO_DATA_MODE_RAW)
 encode_buf = g_alloca(SND_CODEC_MAX_COMPRESSED_BYTES);
 
-p.time = time;
-
 while (bytes > 0) {
 gsize n;
 int frame_size;
diff --git a/src/spice-channel.c b/src/spice-channel.c
index 4c3db9d..3e88d7a 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -928,12 +928,17 @@ static void spice_channel_write_msg(SpiceChannel 
*channel, SpiceMsgOut *out)
 #ifdef G_OS_UNIX
 static ssize_t read_fd(int fd, int *msgfd)
 {
-struct msghdr msg = { NULL, };
 struct iovec iov[1];
 union {
 struct cmsghdr cmsg;
 char control[CMSG_SPACE(sizeof(int))];
 } msg_control;
+struct msghdr msg = {
+.msg_iov = iov,
+.msg_iovlen = 1,
+.msg_control = &msg_control,
+.msg_controllen = sizeof(msg_control),
+};
 struct cmsghdr *cmsg;
 ssize_t ret;
 char c;
@@ -941,11 +946,6 @@ static ssize_t read_fd(int fd, int *msgfd)
 iov[0].iov_base = &c;
 iov[0].iov_len = 1;
 
-msg.msg_iov = iov;
-msg.msg_iovlen = 1;
-msg.msg_control = &msg_control;
-msg.msg_controllen = sizeof(m

Re: [Spice-devel] [spice-common] Some steps toward quic_tmpl.c and quic_rgb_tmpl.c 'unification'

2017-07-07 Thread Christophe Fergeau
On Wed, Jul 05, 2017 at 10:27:18AM -0400, Frediano Ziglio wrote:
> The problem of point 4) is that is worth but if we are not sure we are
> not breaking stuff is not that great. We should have a test that test only
> image compression/decompression.

I now have such a test at
https://cgit.freedesktop.org/~teuf/spice-common/commit/?h=quic&id=b328606eca02a450da70b5fb0418bdcb226292f4
but given its limitations, not sure it's worth submitting it for
inclusing yet (and quic seems fairly slow at compressing images...)

Christophe


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [vdagent-win PATCH 4/4] Store agent process handle instead of using PROCESS_INFORMATION

2017-07-07 Thread Christophe Fergeau
On Fri, Jul 07, 2017 at 06:31:12AM +0100, Frediano Ziglio wrote:
> @@ -695,20 +695,22 @@ bool VDService::launch_agent()
>  {
>  STARTUPINFO startup_info;
>  BOOL ret = FALSE;
> +PROCESS_INFORMATION agent_proc_info;
>  
>  ZeroMemory(&startup_info, sizeof(startup_info));
>  startup_info.cb = sizeof(startup_info);
>  startup_info.lpDesktop = const_cast(TEXT("Winsta0\\winlogon"));
> -ZeroMemory(&_agent_proc_info, sizeof(_agent_proc_info));
> +_agent_process = NULL;
> +ZeroMemory(&agent_proc_info, sizeof(agent_proc_info));

Minor comment, maybe
+PROCESS_INFORMATION agent_proc_info = { 0, };
or something like that rather than the explicit ZeroMemory call?

Christophe


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [vdagent-win PATCH 1/4] Make some functions static

2017-07-07 Thread Christophe Fergeau
Minor nit in patch 4/4, for the series
Acked-by: Christophe Fergeau 


On Fri, Jul 07, 2017 at 06:31:09AM +0100, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio 
> ---
>  vdservice/vdservice.cpp | 32 +---
>  1 file changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
> index dc49ec5..e9bf1a2 100644
> --- a/vdservice/vdservice.cpp
> +++ b/vdservice/vdservice.cpp
> @@ -444,7 +444,7 @@ bool VDService::execute()
>  return true;
>  }
>  
> -DWORD64 marshall_string(LPCWSTR str, DWORD max_size, LPBYTE* next_buf, 
> DWORD* used_bytes)
> +static DWORD64 marshall_string(LPCWSTR str, DWORD max_size, LPBYTE* 
> next_buf, DWORD* used_bytes)
>  {
>  DWORD offset = *used_bytes;
>  
> @@ -486,14 +486,15 @@ typedef struct CreateProcessRet {
>  PROCESS_INFORMATION process_information;
>  } CreateProcessRet;
>  
> -BOOL create_session_process_as_user(IN DWORD session_id, IN BOOL 
> use_default_token, IN HANDLE token,
> -IN LPCWSTR application_name, IN LPWSTR 
> command_line,
> -IN LPSECURITY_ATTRIBUTES 
> process_attributes,
> -IN LPSECURITY_ATTRIBUTES 
> thread_attributes,
> -IN BOOL inherit_handles, IN DWORD 
> creation_flags,
> -IN LPVOID environment, IN LPCWSTR 
> current_directory,
> -IN LPSTARTUPINFOW startup_info,
> -OUT LPPROCESS_INFORMATION 
> process_information)
> +static BOOL
> +create_session_process_as_user(IN DWORD session_id, IN BOOL 
> use_default_token, IN HANDLE token,
> +   IN LPCWSTR application_name, IN LPWSTR 
> command_line,
> +   IN LPSECURITY_ATTRIBUTES process_attributes,
> +   IN LPSECURITY_ATTRIBUTES thread_attributes,
> +   IN BOOL inherit_handles, IN DWORD 
> creation_flags,
> +   IN LPVOID environment, IN LPCWSTR 
> current_directory,
> +   IN LPSTARTUPINFOW startup_info,
> +   OUT LPPROCESS_INFORMATION process_information)
>  {
>  WCHAR win_sta_path[MAX_PATH];
>  HINSTANCE win_sta_handle;
> @@ -624,12 +625,13 @@ BOOL create_session_process_as_user(IN DWORD 
> session_id, IN BOOL use_default_tok
>  return ret;
>  }
>  
> -BOOL create_process_as_user(IN DWORD session_id, IN LPCWSTR application_name,
> -IN LPWSTR command_line, IN LPSECURITY_ATTRIBUTES 
> process_attributes,
> -IN LPSECURITY_ATTRIBUTES thread_attributes, IN 
> BOOL inherit_handles,
> -IN DWORD creation_flags, IN LPVOID environment,
> -IN LPCWSTR current_directory, IN LPSTARTUPINFOW 
> startup_info,
> -OUT LPPROCESS_INFORMATION process_information)
> +static BOOL
> +create_process_as_user(IN DWORD session_id, IN LPCWSTR application_name,
> +   IN LPWSTR command_line, IN LPSECURITY_ATTRIBUTES 
> process_attributes,
> +   IN LPSECURITY_ATTRIBUTES thread_attributes, IN BOOL 
> inherit_handles,
> +   IN DWORD creation_flags, IN LPVOID environment,
> +   IN LPCWSTR current_directory, IN LPSTARTUPINFOW 
> startup_info,
> +   OUT LPPROCESS_INFORMATION process_information)
>  {
>  PROCESSENTRY32 proc_entry;
>  DWORD winlogon_pid = 0;
> -- 
> 2.9.4
> 
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel