[4/9] setupapi: implement SetupPromptForDiskW with only the Cancel button active

Ricardo Filipe ricardo_barbano at hotmail.com
Wed Feb 18 17:50:40 CST 2009


start of the SetupPromptForDiskW implementation.
it checks the only required parameter and opens the dialog where only Cancel
button is working.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-patches/attachments/20090218/3bf5fb35/attachment-0001.htm 
-------------- next part --------------
From f4cfaa1f82af784450c198d9da229e53cc0e35bd Mon Sep 17 00:00:00 2001
From: Ricardo Filipe <ricardo_barbano at hotmail.com>
Date: Wed, 18 Feb 2009 03:32:23 +0000
Subject: setupapi: implement SetupPromptForDiskW with only Cancel button active

---
 dlls/setupapi/dialog.c |   71 ++++++++++++++++++++++++++++++++++++++++++++++++
 dlls/setupapi/stubs.c  |   14 ---------
 2 files changed, 71 insertions(+), 14 deletions(-)

diff --git a/dlls/setupapi/dialog.c b/dlls/setupapi/dialog.c
index 208fa0f..6ed0478 100644
--- a/dlls/setupapi/dialog.c
+++ b/dlls/setupapi/dialog.c
@@ -35,3 +35,74 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
 
+static HINSTANCE SETUPAPI_hInstance = 0;
+
+struct promptdisk_params {
+    PCWSTR DialogTitle;
+    PCWSTR DiskName;
+    PCWSTR PathToSource;
+    PCWSTR FileSought;
+    PCWSTR TagFile;
+    DWORD DiskPromptStyle;
+    PWSTR PathBuffer;
+    DWORD PathBufferSize;
+    PDWORD PathRequiredSize;
+};
+
+/* 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_COMMAND:
+            switch(wParam)
+            {
+                case IDCANCEL:
+                    EndDialog(hwnd, DPROMPT_CANCEL);
+                    return TRUE;
+            }
+    }
+    return FALSE;
+}
+
+/***********************************************************************
+ *      SetupPromptForDiskW (SETUPAPI.@)
+ */
+UINT WINAPI SetupPromptForDiskW(HWND hwndParent, PCWSTR DialogTitle, PCWSTR DiskName,
+        PCWSTR PathToSource, PCWSTR FileSought, PCWSTR TagFile, DWORD DiskPromptStyle,
+        PWSTR PathBuffer, DWORD PathBufferSize, PDWORD PathRequiredSize)
+{
+    struct promptdisk_params params;
+    UINT ret;
+
+    TRACE("%p, %s, %s, %s, %s, %s, 0x%08x, %p, %d, %p\n", hwndParent, debugstr_w(DialogTitle),
+          debugstr_w(DiskName), debugstr_w(PathToSource), debugstr_w(FileSought),
+          debugstr_w(TagFile), DiskPromptStyle, PathBuffer, PathBufferSize,
+          PathRequiredSize);
+
+    if(!FileSought)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return DPROMPT_CANCEL;
+    }
+    if (!SETUPAPI_hInstance)
+        SETUPAPI_hInstance = GetModuleHandleA("setupapi.dll");
+
+    params.DialogTitle = DialogTitle;
+    params.DiskName = DiskName;
+    params.PathToSource = PathToSource;
+    params.FileSought = FileSought;
+    params.TagFile = TagFile;
+    params.DiskPromptStyle = DiskPromptStyle;
+    params.PathBuffer = PathBuffer;
+    params.PathBufferSize = PathBufferSize;
+    params.PathRequiredSize = PathRequiredSize;
+
+    ret = DialogBoxParamW(SETUPAPI_hInstance, MAKEINTRESOURCEW(IDPROMPTFORDISK),
+        hwndParent, promptdisk_proc, (LPARAM)&params);
+
+    if(ret == DPROMPT_CANCEL)
+        SetLastError(ERROR_CANCELLED);
+    return ret;
+}
diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c
index 4db264b..287cb7e 100644
--- a/dlls/setupapi/stubs.c
+++ b/dlls/setupapi/stubs.c
@@ -261,20 +261,6 @@ UINT WINAPI SetupPromptForDiskA(HWND hwndParent, PCSTR DialogTitle, PCSTR DiskNa
 }
 
 /***********************************************************************
- *      SetupPromptForDiskW (SETUPAPI.@)
- */
-UINT WINAPI SetupPromptForDiskW(HWND hwndParent, PCWSTR DialogTitle, PCWSTR DiskName,
-        PCWSTR PathToSource, PCWSTR FileSought, PCWSTR TagFile, DWORD DiskPromptStyle,
-        PWSTR PathBuffer, DWORD PathBufferSize, PDWORD PathRequiredSize)
-{
-    FIXME("%p %s %s %s %s %s %d %p %d %p: stub\n", hwndParent, debugstr_w(DialogTitle),
-          debugstr_w(DiskName), debugstr_w(PathToSource), debugstr_w(FileSought),
-          debugstr_w(TagFile), DiskPromptStyle, PathBuffer, PathBufferSize,
-          PathRequiredSize);
-    return 0;
-}
-
-/***********************************************************************
  *      CM_Locate_DevNodeA (SETUPAPI.@)
  */
 CONFIGRET WINAPI CM_Locate_DevNodeA(PDEVINST pdnDevInst, DEVINSTID_A pDeviceID, ULONG ulFlags)
-- 
1.5.6.3


More information about the wine-patches mailing list