[5/9] setupapi: initiate resources of SetupPromptForDisk dialog

Ricardo Filipe ricardo_barbano at hotmail.com
Wed Feb 18 17:52:09 CST 2009


implemented the dialog resources as per MSDN instructions and visual testing
on windows.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-patches/attachments/20090218/f491f2fb/attachment.htm 
-------------- next part --------------
From 07e4c5ec1db6d5ed87edbc574e669b7a0aea1ca4 Mon Sep 17 00:00:00 2001
From: Ricardo Filipe <ricardo_barbano at hotmail.com>
Date: Wed, 18 Feb 2009 03:35:26 +0000
Subject: setupapi: initiate resources of SetupPromptForDisk dialog accordingly

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

diff --git a/dlls/setupapi/dialog.c b/dlls/setupapi/dialog.c
index 6ed0478..3f31bd1 100644
--- a/dlls/setupapi/dialog.c
+++ b/dlls/setupapi/dialog.c
@@ -49,12 +49,58 @@ struct promptdisk_params {
     PDWORD PathRequiredSize;
 };
 
+/* initiates the fields of the SetupPromptForDisk dialog according to the parameters
+*/
+static void promptdisk_init(HWND hwnd, struct promptdisk_params *params)
+{
+    WCHAR format[256];
+    WCHAR message[256];
+
+    SetWindowLongPtrW(hwnd, DWLP_USER, (LONG_PTR)params);
+
+    if(params->DialogTitle)
+        SetWindowTextW(hwnd, params->DialogTitle);
+    if(params->PathToSource)
+        SetDlgItemTextW(hwnd, IDC_PATH, params->PathToSource);
+
+    if(!(params->DiskPromptStyle & IDF_OEMDISK))
+    {
+        LoadStringW(SETUPAPI_hInstance, IDS_PROMPTDISK, format,
+            sizeof(format)/sizeof(format[0]));
+
+        if(params->DiskName)
+            snprintfW(message, sizeof(message)/sizeof(message[0]), format,
+                params->FileSought, params->DiskName);
+        else
+        {
+            WCHAR unknown[256];
+            LoadStringW(SETUPAPI_hInstance, IDS_UNKNOWN, unknown,
+                sizeof(unknown)/sizeof(unknown[0]));
+            snprintfW(message, sizeof(message)/sizeof(message[0]), format,
+                params->FileSought, unknown);
+        }
+        SetDlgItemTextW(hwnd, IDC_FILENEEDED, message);
+
+        LoadStringW(SETUPAPI_hInstance, IDS_INFO, message,
+            sizeof(message)/sizeof(message[0]));
+        SetDlgItemTextW(hwnd, IDC_INFO, message);
+        LoadStringW(SETUPAPI_hInstance, IDS_COPYFROM, message,
+            sizeof(message)/sizeof(message[0]));
+        SetDlgItemTextW(hwnd, IDC_COPYFROM, message);
+    }
+    if(params->DiskPromptStyle & IDF_NOBROWSE)
+        ShowWindow(GetDlgItem(hwnd, IDC_RUNDLG_BROWSE), SW_HIDE);
+}
+
 /* Handles the messages sent to the SetupPromptForDisk dialog
 */
 static INT_PTR CALLBACK promptdisk_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     switch(msg)
     {
+        case WM_INITDIALOG:
+            promptdisk_init(hwnd, (struct promptdisk_params *)lParam);
+            return TRUE;
         case WM_COMMAND:
             switch(wParam)
             {
-- 
1.5.6.3


More information about the wine-patches mailing list