diff options
Diffstat (limited to 'ui/win32')
-rw-r--r-- | ui/win32/file_dlg_win32.c | 87 | ||||
-rw-r--r-- | ui/win32/file_dlg_win32.h | 11 |
2 files changed, 98 insertions, 0 deletions
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c index 7b4d829ed2..187e38eff8 100644 --- a/ui/win32/file_dlg_win32.c +++ b/ui/win32/file_dlg_win32.c @@ -95,6 +95,7 @@ static UINT_PTR CALLBACK open_file_hook_proc(HWND of_hwnd, UINT ui_msg, WPARAM w_param, LPARAM l_param); static UINT_PTR CALLBACK save_as_file_hook_proc(HWND of_hwnd, UINT ui_msg, WPARAM w_param, LPARAM l_param); +static UINT_PTR CALLBACK save_as_statstree_hook_proc(HWND of_hwnd, UINT ui_msg, WPARAM w_param, LPARAM l_param); static UINT_PTR CALLBACK export_specified_packets_file_hook_proc(HWND of_hwnd, UINT ui_msg, WPARAM w_param, LPARAM l_param); static UINT_PTR CALLBACK merge_file_hook_proc(HWND mf_hwnd, UINT ui_msg, WPARAM w_param, LPARAM l_param); static UINT_PTR CALLBACK export_file_hook_proc(HWND of_hwnd, UINT ui_msg, WPARAM w_param, LPARAM l_param); @@ -426,6 +427,72 @@ win32_save_as_file(HWND h_wnd, capture_file *cf, GString *file_name, int *file_t return gsfn_ok; } +gboolean win32_save_as_statstree(HWND h_wnd, GString *file_name, int *file_type) +{ + OPENFILENAME *ofn; + TCHAR file_name16[MAX_PATH] = _T(""); + int ofnsize; + gboolean gsfn_ok; +#if (_MSC_VER >= 1500) + OSVERSIONINFO osvi; +#endif + + if (!file_name || !file_type) + return FALSE; + + if (file_name->len > 0) { + StringCchCopy(file_name16, MAX_PATH, utf_8to16(file_name->str)); + } + + /* 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 + ofn = g_malloc0(ofnsize); + + ofn->lStructSize = ofnsize; + ofn->hwndOwner = h_wnd; + ofn->hInstance = (HINSTANCE) GetWindowLongPtr(h_wnd, GWLP_HINSTANCE); + ofn->lpstrFilter = _T("Plain text file (.txt)\0*.txt\0Comma separated values (.csv)\0*.csv\0XML document (.xml)\0*.xml\0"); + ofn->lpstrCustomFilter = NULL; + ofn->nMaxCustFilter = 0; + ofn->nFilterIndex = 1; /* the first entry is the best match; 1-origin indexing */ + ofn->lpstrFile = file_name16; + ofn->nMaxFile = MAX_PATH; + ofn->lpstrFileTitle = NULL; + ofn->nMaxFileTitle = 0; + ofn->lpstrInitialDir = utf_8to16(get_last_open_dir()); + ofn->lpstrTitle = _T("Wireshark: Save stats tree as ..."); + ofn->Flags = OFN_ENABLESIZING | OFN_ENABLETEMPLATE | OFN_EXPLORER | + OFN_NOCHANGEDIR | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | + OFN_PATHMUSTEXIST | OFN_ENABLEHOOK; + ofn->lpstrDefExt = NULL; + ofn->lpfnHook = save_as_statstree_hook_proc; + ofn->lpTemplateName = _T("WIRESHARK_SAVEASSTATSTREENAME_TEMPLATE"); + + gsfn_ok = GetSaveFileName(ofn); + + if (gsfn_ok) { + g_string_printf(file_name, "%s", utf_16to8(file_name16)); + /* What file format was specified? */ + *file_type = ofn->nFilterIndex - 1; + } + + g_sf_hwnd = NULL; + g_free( (void *) ofn); + return gsfn_ok; +} + + gboolean win32_export_specified_packets_file(HWND h_wnd, capture_file *cf, GString *file_name, @@ -1705,6 +1772,26 @@ save_as_file_hook_proc(HWND sf_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) { return 0; } +static UINT_PTR CALLBACK +save_as_statstree_hook_proc(HWND sf_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) { + + switch(msg) { + case WM_INITDIALOG: + g_sf_hwnd = sf_hwnd; + break; + + case WM_COMMAND: + break; + + case WM_NOTIFY: + break; + + default: + break; + } + return 0; +} + #define RANGE_TEXT_MAX 128 static UINT_PTR CALLBACK export_specified_packets_file_hook_proc(HWND sf_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) { diff --git a/ui/win32/file_dlg_win32.h b/ui/win32/file_dlg_win32.h index a317f49d9e..94662ee6e6 100644 --- a/ui/win32/file_dlg_win32.h +++ b/ui/win32/file_dlg_win32.h @@ -122,6 +122,17 @@ void win32_export_color_file(HWND h_wnd, capture_file *cf, gpointer filter_list) */ void win32_import_color_file(HWND h_wnd, gpointer color_filters); +/** Open the "Save As" dialog box for stats_tree statistics window. + * + * @param h_wnd HWND of the parent window. + * @param file_name File name. May be empty. + * @param file_type stats_tree file type. + * + * @return FALSE if the dialog was cancelled + */ +gboolean win32_save_as_statstree(HWND h_wnd, GString *file_name, + int *file_type); + void file_set_save_marked_sensitive(); /* Open dialog defines */ |