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 0422c6c4d0)
Conflicts:
        dlls/setupapi/dialog.c
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
oldstable
Michael Müller 2020-01-11 21:06:39 +01:00 committed by Michael Stefaniuc
parent 6520a17987
commit 501eb50def
1 changed files with 28 additions and 0 deletions

View File

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