Add patch to support IDF_CHECKFIRST in SetupPromptForDisk.

This commit is contained in:
Michael Müller 2014-10-06 00:29:49 +02:00
parent 05fbac8c95
commit 541cc8d086
5 changed files with 222 additions and 0 deletions

View File

@ -35,6 +35,11 @@ Wine. All those differences are also documented on the
Included bugfixes and improvements
==================================
**Bugfixes and features included in the next upcoming release [1]:**
* Wine ignores IDF_CHECKFIRST flag in SetupPromptForDisk ([Wine Bug #20465](http://bugs.winehq.org/show_bug.cgi?id=20465))
**Bugs fixed in Wine-Compholio 1.7.28 [73]:**
* ATL IOCS data should not be stored in GWLP_USERDATA ([Wine Bug #21767](http://bugs.winehq.org/show_bug.cgi?id=21767))

View File

@ -62,6 +62,7 @@ PATCHLIST := \
server-Misc_ACL.ok \
server-OpenProcess.ok \
server-Stored_ACLs.ok \
setupapi-SetupPromptForDisk.ok \
shell32-Default_Folder_ACLs.ok \
shell32-Default_Path.ok \
shell32-Icons.ok \
@ -1003,6 +1004,25 @@ server-Stored_ACLs.ok: ntdll-DOS_Attributes.ok
echo '+ { "server-Stored_ACLs", "Erich E. Hoover", "Store and return security attributes with extended file attributes. [rev 7]" },'; \
) > server-Stored_ACLs.ok
# Patchset setupapi-SetupPromptForDisk
# |
# | Included patches:
# | * Add support for IDF_CHECKFIRST flag in SetupPromptForDiskW. [by Michael Müller]
# |
# | This patchset fixes the following Wine bugs:
# | * [#20465] Wine ignores IDF_CHECKFIRST flag in SetupPromptForDisk
# |
# | Modified files:
# | * dlls/setupapi/dialog.c, dlls/setupapi/tests/Makefile.in, dlls/setupapi/tests/dialog.c
# |
.INTERMEDIATE: setupapi-SetupPromptForDisk.ok
setupapi-SetupPromptForDisk.ok:
$(call APPLY_FILE,setupapi-SetupPromptForDisk/0001-setupapi-Add-support-for-IDF_CHECKFIRST-flag-in-Setu.patch)
$(call APPLY_FILE,setupapi-SetupPromptForDisk/0002-setupapi-tests-Add-test-for-IDF_CHECKFIRST-and-Setup.patch)
@( \
echo '+ { "setupapi-SetupPromptForDisk", "Michael Müller", "Add support for IDF_CHECKFIRST flag in SetupPromptForDiskW." },'; \
) > setupapi-SetupPromptForDisk.ok
# Patchset shell32-Default_Folder_ACLs
# |
# | Included patches:

View File

@ -0,0 +1,52 @@
From 627cb8f9cd6853de1f711fc8100b1e4deecbce99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 5 Oct 2014 23:29:18 +0200
Subject: setupapi: Add support for IDF_CHECKFIRST flag in SetupPromptForDiskW.
---
dlls/setupapi/dialog.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/dlls/setupapi/dialog.c b/dlls/setupapi/dialog.c
index 24a46e8..daacaf5 100644
--- a/dlls/setupapi/dialog.c
+++ b/dlls/setupapi/dialog.c
@@ -248,6 +248,35 @@ UINT WINAPI SetupPromptForDiskW(HWND hwndParent, PCWSTR DialogTitle, PCWSTR Disk
SetLastError(ERROR_INVALID_PARAMETER);
return DPROMPT_CANCEL;
}
+
+ if (PathToSource && (DiskPromptStyle & IDF_CHECKFIRST))
+ {
+ static const WCHAR format[] = {'%', 's', '\\', '%', 's', '\0'};
+ WCHAR filepath[MAX_PATH];
+
+ if (strlenW(PathToSource) + 1 + strlenW(FileSought) < sizeof(filepath))
+ {
+ snprintfW(filepath, MAX_PATH, format, PathToSource, FileSought);
+
+ if (GetFileAttributesW(filepath) != INVALID_FILE_ATTRIBUTES)
+ {
+ if (PathRequiredSize)
+ *PathRequiredSize = strlenW(PathToSource) + 1;
+
+ if (!PathBuffer)
+ return DPROMPT_SUCCESS;
+
+ if (PathBufferSize >= strlenW(PathToSource) + 1)
+ {
+ strcpyW(PathBuffer, PathToSource);
+ return DPROMPT_SUCCESS;
+ }
+ else
+ return DPROMPT_BUFFERTOOSMALL;
+ }
+ }
+ }
+
params.DialogTitle = DialogTitle;
params.DiskName = DiskName;
params.PathToSource = PathToSource;
--
1.9.1

View File

@ -0,0 +1,141 @@
From 9e0151529b75e31633273f08fe627f322955bf53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 5 Oct 2014 23:53:39 +0200
Subject: setupapi/tests: Add test for IDF_CHECKFIRST and
SetupPromptForDiskA/W.
---
dlls/setupapi/tests/Makefile.in | 1 +
dlls/setupapi/tests/dialog.c | 107 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 108 insertions(+)
create mode 100644 dlls/setupapi/tests/dialog.c
diff --git a/dlls/setupapi/tests/Makefile.in b/dlls/setupapi/tests/Makefile.in
index 30902e7..3531381 100644
--- a/dlls/setupapi/tests/Makefile.in
+++ b/dlls/setupapi/tests/Makefile.in
@@ -3,6 +3,7 @@ IMPORTS = setupapi user32 advapi32
C_SRCS = \
devinst.c \
+ dialog.c \
diskspace.c \
install.c \
misc.c \
diff --git a/dlls/setupapi/tests/dialog.c b/dlls/setupapi/tests/dialog.c
new file mode 100644
index 0000000..4cb0bea
--- /dev/null
+++ b/dlls/setupapi/tests/dialog.c
@@ -0,0 +1,107 @@
+/*
+ * Unit tests for SetupPromptForDisk
+ *
+ * Copyright 2014 Michael Müller
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "winreg.h"
+#include "guiddef.h"
+#include "setupapi.h"
+
+#include "wine/test.h"
+
+static void test_SetupPromptForDiskA(void)
+{
+ char path[] = "C:\\windows\\system32";
+ char file[] = "kernel32.dll";
+ char buffer[MAX_PATH];
+ UINT ret;
+ DWORD length;
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, sizeof(buffer)-1, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
+ ok(length == strlen(path)+1, "Expect length %d, got %d\n", strlen(path)+1, length);
+ ok(strcmp(path, buffer) == 0, "Expected path %s, got %s\n", path, buffer);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, 0, 0, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
+ ok(length == strlen(path)+1, "Expect length %d, got %d\n", strlen(path)+1, length);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, 1, &length);
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %d\n", ret);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, strlen(path), &length);
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %d\n", ret);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, file, 0, IDF_CHECKFIRST, buffer, strlen(path)+1, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
+ ok(length == strlen(path)+1, "Expect length %d, got %d\n", strlen(path)+1, length);
+ ok(strcmp(path, buffer) == 0, "Expected path %s, got %s\n", path, buffer);
+}
+
+static void test_SetupPromptForDiskW(void)
+{
+ WCHAR path[] = {'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m','3','2','\0'};
+ WCHAR file[] = {'k','e','r','n','e','l','3','2','.','d','l','l','\0'};
+ WCHAR title[] = {'T','e','s','t','\0'};
+ WCHAR disk[] = {'T','e','s','t','d','i','s','k','\0'};
+ WCHAR buffer[MAX_PATH];
+ UINT ret;
+ DWORD length;
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, MAX_PATH-1, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
+ ok(length == lstrlenW(path)+1, "Expect length %d, got %d\n", lstrlenW(path)+1, length);
+ ok(lstrcmpW(path, buffer) == 0, "Expected path %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(buffer));
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, 0, 0, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
+ ok(length == lstrlenW(path)+1, "Expect length %d, got %d\n", lstrlenW(path)+1, length);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, 1, &length);
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %d\n", ret);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, lstrlenW(path), &length);
+ ok(ret == DPROMPT_BUFFERTOOSMALL, "Expected DPROMPT_BUFFERTOOSMALL, got %d\n", ret);
+
+ memset(buffer, 0, sizeof(buffer));
+ ret = SetupPromptForDiskW(0, title, disk, path, file, 0, IDF_CHECKFIRST, buffer, lstrlenW(path)+1, &length);
+ ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
+ ok(length == lstrlenW(path)+1, "Expect length %d, got %d\n", lstrlenW(path)+1, length);
+ ok(lstrcmpW(path, buffer) == 0, "Expected path %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(buffer));
+}
+
+START_TEST(dialog)
+{
+ test_SetupPromptForDiskA();
+ test_SetupPromptForDiskW();
+}
\ No newline at end of file
--
1.9.1

View File

@ -0,0 +1,4 @@
Author: Michael Müller
Subject: Add support for IDF_CHECKFIRST flag in SetupPromptForDiskW.
Revision: 1
Fixes: [20465] Wine ignores IDF_CHECKFIRST flag in SetupPromptForDisk