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

Alexandre Julliard julliard at winehq.org
Mon Apr 20 15:01:55 CDT 2020


Module: wine
Branch: oldstable
Commit: 501eb50defda5aa1a014d0433f9ac011c83e89fd
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=501eb50defda5aa1a014d0433f9ac011c83e89fd

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>
(cherry picked from commit 0422c6c4d0224c4e619771a0d22f4a5a1575f3f3)
Conflicts:
        dlls/setupapi/dialog.c
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

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

diff --git a/dlls/setupapi/dialog.c b/dlls/setupapi/dialog.c
index fc74cfc172..645b82f129 100644
--- a/dlls/setupapi/dialog.c
+++ b/dlls/setupapi/dialog.c
@@ -243,6 +243,34 @@ 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))
+        {
+            static const WCHAR fmtW[] = {'%','s','\\','%','s','\0'};
+            snprintfW(filepath, ARRAY_SIZE(filepath), fmtW, 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