Ricardo Filipe : setupapi: Enable Browse action on SetupPromptForDisk dialog.

Alexandre Julliard julliard at winehq.org
Mon Feb 23 10:00:40 CST 2009


Module: wine
Branch: master
Commit: d80e24b8baf5c43b1a80564ba03dacd23e797de9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d80e24b8baf5c43b1a80564ba03dacd23e797de9

Author: Ricardo Filipe <ricardo_barbano at hotmail.com>
Date:   Wed Feb 18 03:40:15 2009 +0000

setupapi: Enable Browse action on SetupPromptForDisk dialog.

---

 dlls/setupapi/dialog.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/dlls/setupapi/dialog.c b/dlls/setupapi/dialog.c
index 826f0f8..28c8e9f 100644
--- a/dlls/setupapi/dialog.c
+++ b/dlls/setupapi/dialog.c
@@ -90,6 +90,30 @@ static void promptdisk_init(HWND hwnd, struct promptdisk_params *params)
         ShowWindow(GetDlgItem(hwnd, IDC_RUNDLG_BROWSE), SW_HIDE);
 }
 
+/* When the user clicks the browse button in SetupPromptForDisk dialog
+ * it copies the path of the selected file to the dialog path field
+ */
+static void promptdisk_browse(HWND hwnd, struct promptdisk_params *params)
+{
+    OPENFILENAMEW ofn;
+    ZeroMemory(&ofn, sizeof(ofn));
+
+    ofn.lStructSize = sizeof(ofn);
+    ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
+    ofn.hwndOwner = hwnd;
+    ofn.nMaxFile = MAX_PATH;
+    ofn.lpstrFile = HeapAlloc(GetProcessHeap(), 0, MAX_PATH*sizeof(WCHAR));
+    strcpyW(ofn.lpstrFile, params->FileSought);
+
+    if(GetOpenFileNameW(&ofn))
+    {
+        WCHAR* last_slash = strrchrW(ofn.lpstrFile, '\\');
+        if (last_slash) *last_slash = 0;
+        SetDlgItemTextW(hwnd, IDC_PATH, ofn.lpstrFile);
+    }
+    HeapFree(GetProcessHeap(), 0, ofn.lpstrFile);
+}
+
 /* Handles the messages sent to the SetupPromptForDisk dialog
 */
 static INT_PTR CALLBACK promptdisk_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -105,6 +129,13 @@ static INT_PTR CALLBACK promptdisk_proc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
                 case IDCANCEL:
                     EndDialog(hwnd, DPROMPT_CANCEL);
                     return TRUE;
+                case IDC_RUNDLG_BROWSE:
+                {
+                    struct promptdisk_params *params =
+                        (struct promptdisk_params *)GetWindowLongPtrW(hwnd, DWLP_USER);
+                    promptdisk_browse(hwnd, params);
+                    return TRUE;
+                }
             }
     }
     return FALSE;




More information about the wine-cvs mailing list