Export the dissect_mscldap_string() that is used to dissect
[obnox/wireshark/wip.git] / version_info.c
index 440bb6cb9f2826fb6673b9cc5b418a4783b00e0a..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,6 +307,7 @@ 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
@@ -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:
@@ -583,7 +622,7 @@ const char *
 get_copyright_info(void)
 {
        return
-"Copyright 1998-2009 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";
 }