[3/3] winedbg: Print out some information after saving the file

André Hentschel nerv at dawncrow.de
Wed Oct 5 16:15:24 CDT 2011


---
 programs/winedbg/crashdlg.c |   20 +++++++++++++++++---
 programs/winedbg/debugger.h |    1 +
 programs/winedbg/resource.h |    1 +
 programs/winedbg/winedbg.c  |    2 +-
 programs/winedbg/winedbg.rc |    2 ++
 5 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/programs/winedbg/crashdlg.c b/programs/winedbg/crashdlg.c
index 92f217f..a5cd636 100644
--- a/programs/winedbg/crashdlg.c
+++ b/programs/winedbg/crashdlg.c
@@ -31,6 +31,8 @@
 
 #define MAX_PROGRAM_NAME_LENGTH 80
 
+static HANDLE hFile;
+
 int msgbox_res_id(HWND hwnd, UINT textId, UINT captionId, UINT uType)
 {
     WCHAR caption[256];
@@ -107,10 +109,9 @@ static void set_message_with_filename(HWND hDlg)
     SetDlgItemTextW(hDlg, IDC_STATIC_TXT1, newText);
 }
 
-static BOOL save_to_file(HWND hDlg)
+static BOOL begin_save_to_file(HWND hDlg)
 {
     HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW(hDlg, GWLP_HINSTANCE);
-    HANDLE hFile;
     OPENFILENAMEW ofn;
     static const WCHAR txt_files[] = { '*', '.', 't', 'x', 't', 0 };
     static const WCHAR all_files[] = { '*', '.', '*', 0 };
@@ -144,6 +145,19 @@ static BOOL save_to_file(HWND hDlg)
     return TRUE;
 }
 
+void end_save_to_file(void)
+{
+    WCHAR attach_msg[256];
+    WCHAR caption[256];
+
+    if (dbg_houtput != hFile) return;
+
+    CloseHandle(dbg_houtput);
+    LoadStringW(NULL, IDS_ATTACH_MSG, attach_msg, sizeof(attach_msg)/sizeof(WCHAR));
+    LoadStringW(NULL, IDS_AUTO_CAPTION, caption, sizeof(caption)/sizeof(WCHAR));
+    MessageBoxW(NULL, attach_msg, caption, MB_OK | MB_ICONINFORMATION);
+}
+
 static INT_PTR WINAPI DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     switch (msg)
@@ -179,7 +193,7 @@ static INT_PTR WINAPI DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
         switch (LOWORD(wParam))
         {
             case ID_SAVEREPORT:
-                if (save_to_file(hwnd))
+                if (begin_save_to_file(hwnd))
                     EndDialog(hwnd, LOWORD(wParam));
                 return TRUE;
             case IDOK:
diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h
index d09a0e3..79cffdd 100644
--- a/programs/winedbg/debugger.h
+++ b/programs/winedbg/debugger.h
@@ -309,6 +309,7 @@ extern int              break_add_condition(int bpnum, struct expr* exp);
 
   /* crashdlg.c */
 extern BOOL             display_crash_dialog(void);
+extern void             end_save_to_file(void);
 extern int              msgbox_res_id(HWND hwnd, UINT textId, UINT captionId, UINT uType);
 
   /* dbg.y */
diff --git a/programs/winedbg/resource.h b/programs/winedbg/resource.h
index dea2784..8129e11 100644
--- a/programs/winedbg/resource.h
+++ b/programs/winedbg/resource.h
@@ -37,3 +37,4 @@
 #define IDS_UNIDENTIFIED      18
 #define IDS_ALL_FILES         19
 #define IDS_TEXT_FILES        20
+#define IDS_ATTACH_MSG        21
diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c
index 0a08109..7dc2702 100644
--- a/programs/winedbg/winedbg.c
+++ b/programs/winedbg/winedbg.c
@@ -676,7 +676,7 @@ int main(int argc, char** argv)
         switch (dbg_active_auto(argc, argv))
         {
         case start_ok:
-            CloseHandle(dbg_houtput);
+            end_save_to_file();
             return 0;
         case start_error_parse: return dbg_winedbg_usage(FALSE);
         case start_error_init:  return -1;
diff --git a/programs/winedbg/winedbg.rc b/programs/winedbg/winedbg.rc
index 1fac3d1..fbc794e 100644
--- a/programs/winedbg/winedbg.rc
+++ b/programs/winedbg/winedbg.rc
@@ -38,4 +38,6 @@ BEGIN
 
     IDS_TEXT_FILES       "Text files (*.txt)"
     IDS_ALL_FILES        "All files (*.*)"
+    IDS_ATTACH_MSG       "The file was saved, please check for duplicates at " \
+                         "http://bugs.winehq.org before attaching the file to a new bug report."
 END
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list