# Visual C++ 11.0, _MSC_VER 1700, msvcr110.dll
#MSVC_VARIANT=MSVC2012
+# "Microsoft Visual Studio 2013"
+# Visual C++ 12.0, _MSC_VER 1800, msvcr120.dll
+#MSVC_VARIANT=MSVC2013
+
+# "Microsoft Visual Studio 2013 Express Edition"
+# Visual C++ 12.0, _MSC_VER 1800, msvcr120.dll
+#MSVC_VARIANT=MSVC2013EE
+
# The default if we haven't set a system environment variable or
# uncommented an entry above. We default to the version recommended
# in the Developer's Guide, namely MSVC++ 2010 Express Edition.
MSC_VER_REQUIRED=1600
!ELSEIF "$(MSVC_VARIANT)" == "MSVC2012" || "$(MSVC_VARIANT)" == "MSVC2012EE"
MSC_VER_REQUIRED=1700
+!ELSEIF "$(MSVC_VARIANT)" == "MSVC2013" || "$(MSVC_VARIANT)" == "MSVC2013EE"
+MSC_VER_REQUIRED=1800
!ELSE
!ERROR MSVC_VARIANT unknown
!ENDIF
"$(MSVC_VARIANT)" == "MSVC2010" || \
"$(MSVC_VARIANT)" == "MSVC2010EE" || \
"$(MSVC_VARIANT)" == "MSVC2012" || \
- "$(MSVC_VARIANT)" == "MSVC2012EE"
+ "$(MSVC_VARIANT)" == "MSVC2012EE" || \
+ "$(MSVC_VARIANT)" == "MSVC2013" || \
+ "$(MSVC_VARIANT)" == "MSVC2013EE"
LOCAL_CFLAGS=/Zi /W3 /MD /DWIN32_LEAN_AND_MEAN /DMSC_VER_REQUIRED=$(MSC_VER_REQUIRED) \
/D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DPSAPI_VERSION=1
"$(MSVC_VARIANT)" == "MSVC2010" || \
"$(MSVC_VARIANT)" == "MSVC2010EE" || \
"$(MSVC_VARIANT)" == "MSVC2012" || \
- "$(MSVC_VARIANT)" == "MSVC2012EE"
+ "$(MSVC_VARIANT)" == "MSVC2012EE" || \
+ "$(MSVC_VARIANT)" == "MSVC2013" || \
+ "$(MSVC_VARIANT)" == "MSVC2013EE"
LOCAL_CFLAGS= $(LOCAL_CFLAGS) /MP
!ENDIF
# with Visual Studio 2010.
#
MSVCR_DLL=$(PROGRAM_FILES)\Microsoft Visual Studio 11.0\VC\redist\$(TARGET_MACHINE)\Microsoft.VC110.CRT\*.*
-
+!ELSEIF "$(MSVC_VARIANT)" == "MSVC2013" || "$(MSVC_VARIANT)" == "MSVC2013EE"
+#
+# EE version added as per bug https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9227
+#
+# For MSVC 2013, we "Install a particular Visual C++
+# assembly as a private assembly for the application", by copying
+# the contents of the Microsoft.VC120.CRT folder to the target directory.
+# This is done to reduce the size of the installer; it also makes
+# a portable version work, as the C runtime doesn't have to be
+# installed on the target machine.
+#
+# Note: for what it's worth, Microsoft recommends "Using the Visual C++
+# Redistributable Package", rather than "Installing a particular Visual
+# C++ assembly as a private assembly for the application", starting
+# with Visual Studio 2010.
+#
+MSVCR_DLL=$(PROGRAM_FILES)\Microsoft Visual Studio 12.0\VC\redist\$(TARGET_MACHINE)\Microsoft.VC120.CRT\*.*
!ELSE
!ERROR MSVC_VARIANT unknown
!ENDIF
#if defined (_WIN32)
static SYSTEM_INFO sysinfo;
-static OSVERSIONINFO versinfo;
+static gboolean iswindowsplatform;
static int pagesize;
#elif defined(USE_GUARD_PAGES)
static intptr_t pagesize;
GetSystemInfo(&sysinfo);
pagesize = sysinfo.dwPageSize;
+#if (_MSC_VER >= 1800)
+ /*
+ * On VS2103, GetVersionEx is deprecated. Microsoft recommend to
+ * use VerifyVersionInfo instead
+ */
+ {
+ OSVERSIONINFOEX osvi;
+ DWORDLONG dwlConditionMask = 0;
+ int op = VER_EQUAL;
+
+ ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+ osvi.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
+ VER_SET_CONDITION(dwlConditionMask, VER_PLATFORMID, op);
+ iswindowsplatform = VerifyVersionInfo(&osvi, VER_PLATFORMID, dwlConditionMask);
+ }
+#else
/* calling GetVersionEx using the OSVERSIONINFO structure.
* OSVERSIONINFOEX requires Win NT4 with SP6 or newer NT Versions.
* OSVERSIONINFOEX will fail on Win9x and older NT Versions.
* http://msdn.microsoft.com/library/en-us/sysinfo/base/osversioninfo_str.asp
* http://msdn.microsoft.com/library/en-us/sysinfo/base/osversioninfoex_str.asp
*/
- versinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&versinfo);
+ {
+ OSVERSIONINFO versinfo;
+
+ ZeroMemory(&versinfo, sizeof(OSVERSIONINFO));
+ versinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&versinfo);
+ iswindowsplatform = (versinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
+ }
+#endif
#elif defined(USE_GUARD_PAGES)
pagesize = sysconf(_SC_PAGESIZE);
prot2 = (char *) ((((intptr_t) buf_end - (1 * pagesize)) / pagesize) * pagesize);
ret = VirtualProtect(prot1, pagesize, PAGE_NOACCESS, &oldprot);
- g_assert(ret != 0 || versinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
+ g_assert(ret != 0 || iswindowsplatform);
ret = VirtualProtect(prot2, pagesize, PAGE_NOACCESS, &oldprot);
- g_assert(ret != 0 || versinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
+ g_assert(ret != 0 || iswindowsplatform);
npc->amount_free_init = (unsigned int) (prot2 - prot1 - pagesize);
npc->free_offset_init = (unsigned int) (prot1 - npc->buf) + pagesize;
static HWND g_sf_hwnd = NULL;
static char *g_dfilter_str = NULL;
+static int
+win32_get_ofnsize()
+{
+ gboolean bVerGE5 = FALSE;
+ int ofnsize;
+ /* Remarks on OPENFILENAME_SIZE_VERSION_400:
+ *
+ * MSDN states that OPENFILENAME_SIZE_VERSION_400 should be used with
+ * WINVER and _WIN32_WINNT >= 0x0500.
+ * Unfortunately all these are compiler constants, while the underlying is a
+ * problem based is a length check of the runtime version used.
+ *
+ * Instead of using OPENFILENAME_SIZE_VERSION_400, just malloc
+ * the OPENFILENAME size plus 12 bytes.
+ * These 12 bytes are the difference between the two versions of this struct.
+ *
+ * Interestingly this fixes a bug, so the places bar e.g. "My Documents"
+ * is displayed - which wasn't the case with the former implementation.
+ *
+ * XXX - It's unclear if this length+12 works on all supported platforms,
+ * NT4 is the question here. However, even if it fails, we must calculate
+ * the length based on the runtime, not the compiler version anyway ...
+ */
+ /* This assumption does not work when compiling with MSVC2008EE as
+ * the open dialog window does not appear.
+ * Instead detect Windows version at runtime and choose size accordingly */
+#if (_MSC_VER >= 1500)
+ /*
+ * On VS2103, GetVersionEx is deprecated. Microsoft recommend to
+ * use VerifyVersionInfo instead
+ */
+#if (_MSC_VER >= 1800)
+ OSVERSIONINFOEX osvi;
+ DWORDLONG dwlConditionMask = 0;
+ int op = VER_GREATER_EQUAL;
+ /* Initialize the OSVERSIONINFOEX structure. */
+ SecureZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+ osvi.dwMajorVersion = 5;
+ /* Initialize the condition mask. */
+ VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, op);
+ /* Perform the test. */
+ bVerGE5=VerifyVersionInfo(
+ &osvi,
+ VER_MAJORVERSION,
+ dwlConditionMask);
+#else
+ OSVERSIONINFO osvi;
+ SecureZeroMemory(&osvi, sizeof(OSVERSIONINFO));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&osvi);
+ bVerGE5 = (osvi.dwMajorVersion >= 5);
+#endif /* _MSC_VER >= 1800 */
+ ofnsize = (bVerGE5)?sizeof(OPENFILENAME):OPENFILENAME_SIZE_VERSION_400;
+#else
+ ofnsize = sizeof(OPENFILENAME)+12;
+#endif /* _MSC_VER >= 1500 */
+ return ofnsize;
+}
/*
* According to http://msdn.microsoft.com/en-us/library/bb776913.aspx
* we should use IFileOpenDialog and IFileSaveDialog on Windows Vista
TCHAR file_name16[MAX_PATH] = _T("");
int ofnsize;
gboolean gofn_ok;
-#if (_MSC_VER >= 1500)
- OSVERSIONINFO osvi;
-#endif
if (!file_name || !display_filter)
return FALSE;
g_free(g_dfilter_str);
g_dfilter_str = NULL;
}
-
- /* Remarks on OPENFILENAME_SIZE_VERSION_400:
- *
- * MSDN states that OPENFILENAME_SIZE_VERSION_400 should be used with
- * WINVER and _WIN32_WINNT >= 0x0500.
- * Unfortunately all these are compiler constants, while the underlying is a
- * problem based is a length check of the runtime version used.
- *
- * Instead of using OPENFILENAME_SIZE_VERSION_400, just malloc
- * the OPENFILENAME size plus 12 bytes.
- * These 12 bytes are the difference between the two versions of this struct.
- *
- * Interestingly this fixes a bug, so the places bar e.g. "My Documents"
- * is displayed - which wasn't the case with the former implementation.
- *
- * XXX - It's unclear if this length+12 works on all supported platforms,
- * NT4 is the question here. However, even if it fails, we must calculate
- * the length based on the runtime, not the compiler version anyway ...
- */
- /* This assumption does not work when compiling with MSVC2008EE as
- * the open dialog window does not appear.
- * Instead detect Windows version at runtime and choose size accordingly */
-#if (_MSC_VER >= 1500)
- SecureZeroMemory(&osvi, sizeof(OSVERSIONINFO));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osvi);
- if (osvi.dwMajorVersion >= 5) {
- ofnsize = sizeof(OPENFILENAME);
- } else {
- ofnsize = OPENFILENAME_SIZE_VERSION_400;
- }
-#else
- ofnsize = sizeof(OPENFILENAME) + 12;
-#endif
+ ofnsize = win32_get_ofnsize();
ofn = g_malloc0(ofnsize);
ofn->lStructSize = ofnsize;
TCHAR file_name16[MAX_PATH] = _T("");
int ofnsize;
gboolean gsfn_ok;
-#if (_MSC_VER >= 1500)
- OSVERSIONINFO osvi;
-#endif
gboolean discard_comments = FALSE;
if (!file_name || !file_type || !compressed)
return FALSE; /* shouldn't happen - the "Save As..." item should be disabled if we can't save the file */
g_compressed = FALSE;
- /* see OPENFILENAME comment in win32_open_file */
-#if (_MSC_VER >= 1500)
- SecureZeroMemory(&osvi, sizeof(OSVERSIONINFO));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osvi);
- if (osvi.dwMajorVersion >= 5) {
- ofnsize = sizeof(OPENFILENAME);
- } else {
- ofnsize = OPENFILENAME_SIZE_VERSION_400;
- }
-#else
- ofnsize = sizeof(OPENFILENAME) + 12;
-#endif
+ ofnsize = win32_get_ofnsize();
ofn = g_malloc0(ofnsize);
ofn->lStructSize = ofnsize;
TCHAR file_name16[MAX_PATH] = _T("");
int ofnsize;
gboolean gsfn_ok;
-#if (_MSC_VER >= 1500)
- OSVERSIONINFO osvi;
-#endif
if (!file_name || !file_type || !compressed || !range)
return FALSE;
g_cf = cf;
g_compressed = FALSE;
- /* see OPENFILENAME comment in win32_open_file */
-#if (_MSC_VER >= 1500)
- SecureZeroMemory(&osvi, sizeof(OSVERSIONINFO));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osvi);
- if (osvi.dwMajorVersion >= 5) {
- ofnsize = sizeof(OPENFILENAME);
- } else {
- ofnsize = OPENFILENAME_SIZE_VERSION_400;
- }
-#else
- ofnsize = sizeof(OPENFILENAME) + 12;
-#endif
+ ofnsize = win32_get_ofnsize();
ofn = g_malloc0(ofnsize);
ofn->lStructSize = ofnsize;
TCHAR file_name16[MAX_PATH] = _T("");
int ofnsize;
gboolean gofn_ok;
-#if (_MSC_VER >= 1500)
- OSVERSIONINFO osvi;
-#endif
if (!file_name || !display_filter || !merge_type)
return FALSE;
g_dfilter_str = NULL;
}
- /* see OPENFILENAME comment in win32_open_file */
-#if (_MSC_VER >= 1500)
- SecureZeroMemory(&osvi, sizeof(OSVERSIONINFO));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osvi);
- if (osvi.dwMajorVersion >= 5) {
- ofnsize = sizeof(OPENFILENAME);
- } else {
- ofnsize = OPENFILENAME_SIZE_VERSION_400;
- }
-#else
- ofnsize = sizeof(OPENFILENAME) + 12;
-#endif
+ ofnsize = win32_get_ofnsize();
ofn = g_malloc0(ofnsize);
ofn->lStructSize = ofnsize;
char *dirname;
cf_print_status_t status;
int ofnsize;
-#if (_MSC_VER >= 1500)
- OSVERSIONINFO osvi;
-#endif
g_cf = cf;
- /* see OPENFILENAME comment in win32_open_file */
-#if (_MSC_VER >= 1500)
- SecureZeroMemory(&osvi, sizeof(OSVERSIONINFO));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osvi);
- if (osvi.dwMajorVersion >= 5) {
- ofnsize = sizeof(OPENFILENAME);
- } else {
- ofnsize = OPENFILENAME_SIZE_VERSION_400;
- }
-#else
- ofnsize = sizeof(OPENFILENAME) + 12;
-#endif
+ ofnsize = win32_get_ofnsize();
ofn = g_malloc0(ofnsize);
ofn->lStructSize = ofnsize;
char *file_name8;
int fd;
int ofnsize;
-#if (_MSC_VER >= 1500)
- OSVERSIONINFO osvi;
-#endif
if (!cf->finfo_selected) {
/* This shouldn't happen */
return;
}
- /* see OPENFILENAME comment in win32_open_file */
-#if (_MSC_VER >= 1500)
- SecureZeroMemory(&osvi, sizeof(OSVERSIONINFO));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osvi);
- if (osvi.dwMajorVersion >= 5) {
- ofnsize = sizeof(OPENFILENAME);
- } else {
- ofnsize = OPENFILENAME_SIZE_VERSION_400;
- }
-#else
- ofnsize = sizeof(OPENFILENAME) + 12;
-#endif
+ ofnsize = win32_get_ofnsize();
ofn = g_malloc0(ofnsize);
ofn->lStructSize = ofnsize;
int fd;
int ofnsize;
int keylist_size;
-#if (_MSC_VER >= 1500)
- OSVERSIONINFO osvi;
-#endif
keylist_size = ssl_session_key_count();
if (keylist_size==0) {
return;
}
- /* see OPENFILENAME comment in win32_open_file */
-#if (_MSC_VER >= 1500)
- SecureZeroMemory(&osvi, sizeof(OSVERSIONINFO));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osvi);
- if (osvi.dwMajorVersion >= 5) {
- ofnsize = sizeof(OPENFILENAME);
- } else {
- ofnsize = OPENFILENAME_SIZE_VERSION_400;
- }
-#else
- ofnsize = sizeof(OPENFILENAME) + 12;
-#endif
+ ofnsize = win32_get_ofnsize();
ofn = g_malloc0(ofnsize);
ofn->lStructSize = ofnsize;
TCHAR file_name[MAX_PATH] = _T("");
gchar *dirname;
int ofnsize;
-#if (_MSC_VER >= 1500)
- OSVERSIONINFO osvi;
-#endif
- /* see OPENFILENAME comment in win32_open_file */
-#if (_MSC_VER >= 1500)
- SecureZeroMemory(&osvi, sizeof(OSVERSIONINFO));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osvi);
- if (osvi.dwMajorVersion >= 5) {
- ofnsize = sizeof(OPENFILENAME);
- } else {
- ofnsize = OPENFILENAME_SIZE_VERSION_400;
- }
-#else
- ofnsize = sizeof(OPENFILENAME) + 12;
-#endif
+ ofnsize = win32_get_ofnsize();
ofn = g_malloc0(ofnsize);
ofn->lStructSize = ofnsize;
TCHAR file_name[MAX_PATH] = _T("");
gchar *dirname;
int ofnsize;
-#if (_MSC_VER >= 1500)
- OSVERSIONINFO osvi;
-#endif
- /* see OPENFILENAME comment in win32_open_file */
-#if (_MSC_VER >= 1500)
- SecureZeroMemory(&osvi, sizeof(OSVERSIONINFO));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osvi);
- if (osvi.dwMajorVersion >= 5) {
- ofnsize = sizeof(OPENFILENAME);
- } else {
- ofnsize = OPENFILENAME_SIZE_VERSION_400;
- }
-#else
- ofnsize = sizeof(OPENFILENAME) + 12;
-#endif
+ ofnsize = win32_get_ofnsize();
ofn = g_malloc0(ofnsize);
ofn->lStructSize = ofnsize;