Module: wine Branch: oldstable Commit: 501eb50defda5aa1a014d0433f9ac011c83e89fd URL: https://source.winehq.org/git/wine.git/?a=commit;h=501eb50defda5aa1a014d0433...
Author: Michael Müller michael@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@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 0422c6c4d0224c4e619771a0d22f4a5a1575f3f3) Conflicts: dlls/setupapi/dialog.c Signed-off-by: Michael Stefaniuc mstefani@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;