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>
This commit is contained in:
Michael Müller 2020-01-11 21:06:39 +01:00 committed by Alexandre Julliard
parent 6babdb5508
commit 0422c6c4d0
1 changed files with 27 additions and 0 deletions

View File

@ -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;