diff options
author | Gerald Combs <gerald@wireshark.org> | 2008-08-04 23:05:32 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2008-08-04 23:05:32 +0000 |
commit | 7d8e29f50173a90dbf9e4dafe7d16c0dea2724b9 (patch) | |
tree | e075825ae64f0b14cb8dd595f7d0eb13744e9a56 /gtk/file_dlg_win32.c | |
parent | da85c3dfab63630c4370d8d4c9104d4a6c2550b2 (diff) |
From Pascal Quantin via bug 2719: Fix support for Microsoft Visual C++ 2008.
From me:
Instead of adding adns_config.h, place it a custom adns package in
wireshark-win32-libs. Update tools/win32-setup.sh accordingly.
Split the MSVC2008EE variant into MSVC2008 and MSVC2008EE, similar to
MSVC2005 and MSVC2005EE. We have to worry about vcredist_x86.exe in
both cases.
Add Pascal to AUTHORS.
Update the Developer's Guide.
svn path=/trunk/; revision=25921
Diffstat (limited to 'gtk/file_dlg_win32.c')
-rw-r--r-- | gtk/file_dlg_win32.c | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/gtk/file_dlg_win32.c b/gtk/file_dlg_win32.c index bb5a35605f..5afcafd92f 100644 --- a/gtk/file_dlg_win32.c +++ b/gtk/file_dlg_win32.c @@ -136,6 +136,9 @@ win32_open_file (HWND h_wnd) { char *dirname; dfilter_t *dfp; int ofnsize; +#if (_MSC_VER >= 1500) + OSVERSIONINFO osvi; +#endif /* Remarks on OPENFILENAME_SIZE_VERSION_400: * @@ -155,7 +158,21 @@ win32_open_file (HWND h_wnd) { * 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) + ZeroMemory(&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 ofn = g_malloc0(ofnsize); ofn->lStructSize = ofnsize; @@ -220,9 +237,23 @@ win32_save_as_file(HWND h_wnd, action_after_save_e action_after_save, gpointer a gchar *dirname; int save_index; int ofnsize; +#if (_MSC_VER >= 1500) + OSVERSIONINFO osvi; +#endif /* see OPENFILENAME comment in win32_open_file */ +#if (_MSC_VER >= 1500) + ZeroMemory(&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 ofn = g_malloc0(ofnsize); ofn->lStructSize = ofnsize; @@ -329,9 +360,23 @@ win32_merge_file (HWND h_wnd) { char *tmpname; dfilter_t *dfp; int ofnsize; +#if (_MSC_VER >= 1500) + OSVERSIONINFO osvi; +#endif /* see OPENFILENAME comment in win32_open_file */ +#if (_MSC_VER >= 1500) + ZeroMemory(&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 ofn = g_malloc0(ofnsize); ofn->lStructSize = ofnsize; @@ -434,9 +479,23 @@ win32_export_file(HWND h_wnd, export_type_e export_type) { char *dirname; cf_print_status_t status; int ofnsize; +#if (_MSC_VER >= 1500) + OSVERSIONINFO osvi; +#endif /* see OPENFILENAME comment in win32_open_file */ +#if (_MSC_VER >= 1500) + ZeroMemory(&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 ofn = g_malloc0(ofnsize); ofn->lStructSize = ofnsize; @@ -534,6 +593,9 @@ win32_export_raw_file(HWND h_wnd) { const char *file = NULL; int fd; int ofnsize; +#if (_MSC_VER >= 1500) + OSVERSIONINFO osvi; +#endif if (!cfile.finfo_selected) { /* This shouldn't happen */ @@ -542,7 +604,18 @@ win32_export_raw_file(HWND h_wnd) { } /* see OPENFILENAME comment in win32_open_file */ +#if (_MSC_VER >= 1500) + ZeroMemory(&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 ofn = g_malloc0(ofnsize); ofn->lStructSize = ofnsize; @@ -604,9 +677,23 @@ win32_export_color_file(HWND h_wnd, gpointer filter_list) { 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) + ZeroMemory(&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 ofn = g_malloc0(ofnsize); ofn->lStructSize = ofnsize; @@ -651,9 +738,23 @@ win32_import_color_file(HWND h_wnd, gpointer color_filters) { 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) + ZeroMemory(&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 ofn = g_malloc0(ofnsize); ofn->lStructSize = ofnsize; |