[PATCH 1/2] setupapi: Add support for IDF_CHECKFIRST flag in SetupPromptForDiskW.

Gijs Vermeulen gijsvrm at gmail.com
Sat Jan 11 14:06:39 CST 2020


From: Michael Müller <michael at fds-team.de>

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=20465
Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
---
 dlls/setupapi/dialog.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/dlls/setupapi/dialog.c b/dlls/setupapi/dialog.c
index fdabf887b0..cdc739490b 100644
--- a/dlls/setupapi/dialog.c
+++ b/dlls/setupapi/dialog.c
@@ -241,6 +241,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) < sizeof(filepath))
+        {
+            _snwprintf(filepath, MAX_PATH, 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;
-- 
2.24.1




More information about the wine-devel mailing list