Michael Müller : setupapi: Add support for IDF_CHECKFIRST flag in SetupPromptForDiskW.

Alexandre Julliard julliard at winehq.org
Mon Jan 13 16:11:52 CST 2020


Module: wine
Branch: master
Commit: 0422c6c4d0224c4e619771a0d22f4a5a1575f3f3
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0422c6c4d0224c4e619771a0d22f4a5a1575f3f3

Author: Michael Müller <michael at fds-team.de>
Date:   Sat Jan 11 21:06:39 2020 +0100

setupapi: Add support for IDF_CHECKFIRST flag in SetupPromptForDiskW.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=20465
Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/dialog.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/dlls/setupapi/dialog.c b/dlls/setupapi/dialog.c
index fdabf887b0..494525f11a 100644
--- a/dlls/setupapi/dialog.c
+++ b/dlls/setupapi/dialog.c
@@ -241,6 +241,33 @@ UINT WINAPI SetupPromptForDiskW(HWND hwndParent, PCWSTR DialogTitle, PCWSTR Disk
         SetLastError(ERROR_INVALID_PARAMETER);
         return DPROMPT_CANCEL;
     }
+
+    if (PathToSource && (DiskPromptStyle & IDF_CHECKFIRST))
+    {
+        WCHAR filepath[MAX_PATH];
+
+        if (lstrlenW(PathToSource) + 1 + lstrlenW(FileSought) < ARRAY_SIZE(filepath))
+        {
+            swprintf(filepath, ARRAY_SIZE(filepath), L"%s\\%s", PathToSource, FileSought);
+            if (GetFileAttributesW(filepath) != INVALID_FILE_ATTRIBUTES)
+            {
+                if (PathRequiredSize)
+                    *PathRequiredSize = lstrlenW(PathToSource) + 1;
+
+                if (!PathBuffer)
+                    return DPROMPT_SUCCESS;
+
+                if (PathBufferSize >= lstrlenW(PathToSource) + 1)
+                {
+                    lstrcpyW(PathBuffer, PathToSource);
+                    return DPROMPT_SUCCESS;
+                }
+                else
+                    return DPROMPT_BUFFERTOOSMALL;
+            }
+        }
+    }
+
     params.DialogTitle = DialogTitle;
     params.DiskName = DiskName;
     params.PathToSource = PathToSource;




More information about the wine-cvs mailing list