Add remark about including packet.h before tap.h
[obnox/wireshark/wip.git] / version_info.c
index a537b43bccd42eadce5fbb7a75ef836b37fee19b..065cbd2eae78f8c7a8cc5372132b90581c63246c 100644 (file)
 #include <string.h>
 #include <errno.h>
 
+#ifdef HAVE_PYTHON
+#include <Python.h> /* to get the Python version number (PY_VERSION) */
+#endif
+
 #ifdef HAVE_LIBZ
 #include <zlib.h>      /* to get the libz version number */
 #endif
 #include <pcre.h>      /* to get the libpcre version number */
 #endif /* HAVE_LIBPCRE */
 
-#if (defined(HAVE_LIBGCRYPT) || defined(HAVE_LIBGNUTLS)) && defined(_WIN32)
-#include <winposixtype.h>
-#endif
-
 #ifdef HAVE_LIBGCRYPT
 #include <gcrypt.h>
 #endif /* HAVE_LIBGCRYPT */
@@ -92,7 +92,7 @@
 #endif
 
 #ifdef SVNVERSION
-       const char *wireshark_svnversion = " (" SVNVERSION ")";
+       const char *wireshark_svnversion = " (" SVNVERSION " from " SVNPATH ")";
 #else
        const char *wireshark_svnversion = "";
 #endif
@@ -182,7 +182,7 @@ get_compiled_version_info(GString *str, void (*additional_info)(GString *))
                (*additional_info)(str);
        g_string_append(str, ".");
 
-#ifndef HAVE_LIBPCRE
+#if !defined(HAVE_LIBPCRE) && !GLIB_CHECK_VERSION(2,14,0)
        g_string_append(str,
        "\nNOTE: this build doesn't support the \"matches\" operator for Wireshark filter syntax");
        g_string_append(str, ".");
@@ -248,6 +248,16 @@ get_epan_compiled_version_info(GString *str)
        g_string_append(str, "without Lua");
 #endif /* HAVE_LUA_5_1 */
 
+       g_string_append(str, ", ");
+#ifdef HAVE_PYTHON
+       g_string_append(str, "with Python");
+#ifdef PY_VERSION
+       g_string_append(str, " " PY_VERSION);
+#endif /* PY_VERSION */
+#else
+       g_string_append(str, "without Python");
+#endif /* HAVE_PYTHON */
+
         /* GnuTLS */
        g_string_append(str, ", ");
 #ifdef HAVE_LIBGNUTLS
@@ -297,11 +307,12 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *))
 {
 #if defined(_WIN32)
        OSVERSIONINFOEX info;
+       SYSTEM_INFO system_info;
 #elif defined(HAVE_SYS_UTSNAME_H)
        struct utsname name;
 #endif
 #if HAVE_OS_X_FRAMEWORKS
-       long macosx_ver, macosx_major_ver, macosx_minor_ver, macosx_bugfix_ver;
+       SInt32 macosx_ver, macosx_major_ver, macosx_minor_ver, macosx_bugfix_ver;
 #endif
 
        g_string_append(str, "on ");
@@ -324,6 +335,8 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *))
         * not even be able to compile code that *uses* that structure with
         * older versions of the SDK.
         */
+
+       memset(&info, '\0', sizeof info);
        info.dwOSVersionInfoSize = sizeof info;
        if (!GetVersionEx((OSVERSIONINFO *)&info)) {
                /*
@@ -332,6 +345,10 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *))
                g_string_append(str, "unknown Windows version");
                return;
        }
+
+       memset(&system_info, '\0', sizeof system_info);
+       GetSystemInfo(&system_info);    /* only for W2K or greater .... (which is what we support) */
+
        switch (info.dwPlatformId) {
 
        case VER_PLATFORM_WIN32s:
@@ -396,33 +413,55 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *))
                                break;
 
                        case 2:
-                               g_string_append_printf(str, "Windows Server 2003");
+                               if ((info.wProductType == VER_NT_WORKSTATION) &&
+                                   (system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)) {
+                                       g_string_append_printf(str, "Windows XP Professional x64 Edition");
+                               } else {
+                                       g_string_append_printf(str, "Windows Server 2003");
+                                       if (system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
+                                               g_string_append_printf(str, " x64 Edition");
+                               }
                                break;
 
                        default:
                                g_string_append_printf(str, "Windows NT, unknown version %lu.%lu",
-                                   info.dwMajorVersion, info.dwMinorVersion);
+                                                      info.dwMajorVersion, info.dwMinorVersion);
                                break;
                        }
                        break;
 
-               case 6:
+               case 6: {
+                       gboolean is_nt_workstation;
+
+                       if (system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
+                               g_string_append(str, "64-bit ");
+                       else if (system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
+                               g_string_append(str, "32-bit ");
 #ifndef VER_NT_WORKSTATION
 #define VER_NT_WORKSTATION 0x01
-                       if ((info.wReserved[1] & 0xff) == VER_NT_WORKSTATION)
+                       is_nt_workstation = ((info.wReserved[1] & 0xff) == VER_NT_WORKSTATION);
 #else
-                       if (info.wProductType == VER_NT_WORKSTATION)
+                       is_nt_workstation = (info.wProductType == VER_NT_WORKSTATION);
 #endif
-                               g_string_append_printf(str, "Windows Vista");
-                       else
-                               g_string_append_printf(str, "Windows Server 2008");
+                       switch (info.dwMinorVersion) {
+                       case 0:
+                               g_string_append_printf(str, is_nt_workstation ? "Windows Vista" : "Windows Server 2008");
+                               break;
+                       case 1:
+                               g_string_append_printf(str, is_nt_workstation ? "Windows 7" : "Windows Server 2008 R2");
+                               break;
+                       default:
+                               g_string_append_printf(str, "Windows NT, unknown version %lu.%lu",
+                                                      info.dwMajorVersion, info.dwMinorVersion);
+                               break;
+                       }
                        break;
-
+               }  /* case 6 */
                default:
                        g_string_append_printf(str, "Windows NT, unknown version %lu.%lu",
                            info.dwMajorVersion, info.dwMinorVersion);
                        break;
-               }
+               } /* info.dwMajorVersion */
                break;
 
        default:
@@ -473,12 +512,12 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *))
                        Gestalt(gestaltSystemVersionBugFix, &macosx_bugfix_ver);
 
                        g_string_append_printf(str, " (MacOS %ld.%ld.%ld)",
-                                         macosx_major_ver,
-                                         macosx_minor_ver,
-                                         macosx_bugfix_ver);
+                                         (long)macosx_major_ver,
+                                         (long)macosx_minor_ver,
+                                         (long)macosx_bugfix_ver);
                } else {
                        g_string_append_printf(str, " (MacOS X < 10.4 [%lx])",
-                                         macosx_ver);
+                                         (long)macosx_ver);
                        /* See Apple's Gestalt Manager Reference for meanings
                         * of the macosx_ver values. */
                }
@@ -492,6 +531,16 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *))
        g_string_append(str, ", ");
        get_runtime_pcap_version(str);
 
+    /* GnuTLS */
+#ifdef HAVE_LIBGNUTLS
+       g_string_append_printf(str, ", GnuTLS %s", gnutls_check_version(NULL));
+#endif /* HAVE_LIBGNUTLS */
+
+        /* Gcrypt */
+#ifdef HAVE_LIBGCRYPT
+       g_string_append_printf(str, ", Gcrypt %s", gcry_check_version(NULL));
+#endif /* HAVE_LIBGCRYPT */
+
        /* Additional application-dependent information */
        if (additional_info)
                (*additional_info)(str);
@@ -573,7 +622,7 @@ const char *
 get_copyright_info(void)
 {
        return
-"Copyright 1998-2008 Gerald Combs <gerald@wireshark.org> and contributors.\n"
+"Copyright 1998-2010 Gerald Combs <gerald@wireshark.org> and contributors.\n"
 "This is free software; see the source for copying conditions. There is NO\n"
 "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
 }