[Spice-devel] [vdagent-win PATCH 2/4] Move common resource code to a common file

Frediano Ziglio fziglio at redhat.com
Thu Nov 17 12:15:02 UTC 2016


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 at redhat.com>
---
 Makefile.am            |  1 +
 common/version.rc      | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
 vdagent/vdagent.rc     | 51 ++++++++++++--------------------------------------
 vdservice/vdservice.rc | 51 ++++++++++++--------------------------------------
 4 files changed, 74 insertions(+), 78 deletions(-)
 create mode 100644 common/version.rc

diff --git a/Makefile.am b/Makefile.am
index 84507e8..92e51e9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -87,6 +87,7 @@ CLEANFILES = spice-vdagent-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi
 
 EXTRA_DIST +=			\
 	$(top_srcdir)/.version	\
+	common/version.rc	\
 	tests/clipboard.py	\
 	vdagent.sln		\
 	vdagent/resource.h	\
diff --git a/common/version.rc b/common/version.rc
new file mode 100644
index 0000000..e78a7ef
--- /dev/null
+++ b/common/version.rc
@@ -0,0 +1,49 @@
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 0,5,1,0
+ PRODUCTVERSION 0,5,1,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "CompanyName", "Red Hat Inc."
+            VALUE "FileDescription", FILE_DESCRIPTION
+            VALUE "FileVersion", "0, 5, 1, 0"
+            VALUE "InternalName", INTERNAL_NAME
+            VALUE "LegalCopyright", "Copyright (c) 2009  Red Hat Inc. and/or its affiliates"
+            VALUE "OriginalFilename", ORIGINAL_FILENAME
+            VALUE "ProductName", "Red Hat Spice"
+            VALUE "ProductVersion", "0, 5, 1, 0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
diff --git a/vdagent/vdagent.rc b/vdagent/vdagent.rc
index 7746756..66c2e6f 100644
--- a/vdagent/vdagent.rc
+++ b/vdagent/vdagent.rc
@@ -9,6 +9,12 @@
 //
 #include "afxres.h"
 
+#define FILE_DESCRIPTION "Spice agent"
+#define INTERNAL_NAME "vdagent"
+#define ORIGINAL_FILENAME "vdagent.exe"
+
+#include "../common/version.rc"
+
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
 
@@ -35,6 +41,12 @@ END
 2 TEXTINCLUDE 
 BEGIN
     "#include ""afxres.h""\r\n"
+    "\r\n"
+    "#define FILE_DESCRIPTION ""Spice agent""\r\n"
+    "#define INTERNAL_NAME ""vdagent""\r\n"
+    "#define ORIGINAL_FILENAME ""vdagent.exe""\r\n"
+    "\r\n"
+    "#include ""../common/version.rc""\r\n"
     "\0"
 END
 
@@ -46,45 +58,6 @@ END
 
 #endif    // APSTUDIO_INVOKED
 
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,5,1,0
- PRODUCTVERSION 0,5,1,0
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-            VALUE "CompanyName", "Red Hat Inc."
-            VALUE "FileDescription", "Spice agent"
-            VALUE "FileVersion", "0, 5, 1, 0"
-            VALUE "InternalName", "vdagent"
-            VALUE "LegalCopyright", "Copyright (c) 2009  Red Hat Inc. and/or its affiliates"
-            VALUE "OriginalFilename", "vdagent.exe"
-            VALUE "ProductName", "Red Hat Spice"
-            VALUE "ProductVersion", "0, 5, 1, 0"
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1200
-    END
-END
-
 #endif    // English (U.S.) resources
 /////////////////////////////////////////////////////////////////////////////
 
diff --git a/vdservice/vdservice.rc b/vdservice/vdservice.rc
index 4eda50d..329008b 100644
--- a/vdservice/vdservice.rc
+++ b/vdservice/vdservice.rc
@@ -9,6 +9,12 @@
 //
 #include "afxres.h"
 
+#define FILE_DESCRIPTION "Spice service"
+#define INTERNAL_NAME "vdservice"
+#define ORIGINAL_FILENAME "vdservice.exe"
+
+#include "../common/version.rc"
+
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
 
@@ -35,6 +41,12 @@ END
 2 TEXTINCLUDE 
 BEGIN
     "#include ""afxres.h""\r\n"
+    "\r\n"
+    "#define FILE_DESCRIPTION ""Spice service""\r\n"
+    "#define INTERNAL_NAME ""vdservice""\r\n"
+    "#define ORIGINAL_FILENAME ""vdservice.exe""\r\n"
+    "\r\n"
+    "#include ""../common/version.rc""\r\n"
     "\0"
 END
 
@@ -46,45 +58,6 @@ END
 
 #endif    // APSTUDIO_INVOKED
 
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,5,1,0
- PRODUCTVERSION 0,5,1,0
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904b0"
-        BEGIN
-            VALUE "CompanyName", "Red Hat Inc."
-            VALUE "FileDescription", "Spice service"
-            VALUE "FileVersion", "0, 5, 1, 0"
-            VALUE "InternalName", "vdservice"
-            VALUE "LegalCopyright", "Copyright (c) 2009  Red Hat Inc. and/or its affiliates"
-            VALUE "OriginalFilename", "vdservice.exe"
-            VALUE "ProductName", "Red Hat Spice"
-            VALUE "ProductVersion", "0, 5, 1, 0"
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1200
-    END
-END
-
 #endif    // English (U.S.) resources
 /////////////////////////////////////////////////////////////////////////////
 
-- 
2.7.4



More information about the Spice-devel mailing list