Author: akhaldi
Date: Mon Nov 30 22:25:50 2015
New Revision: 70224
URL:
http://svn.reactos.org/svn/reactos?rev=70224&view=rev
Log:
[SETUPAPI_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536
Added:
trunk/rostests/winetests/setupapi/dialog.c (with props)
Modified:
trunk/rostests/winetests/setupapi/CMakeLists.txt
trunk/rostests/winetests/setupapi/install.c
trunk/rostests/winetests/setupapi/testlist.c
Modified: trunk/rostests/winetests/setupapi/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/CMakeL…
==============================================================================
--- trunk/rostests/winetests/setupapi/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/winetests/setupapi/CMakeLists.txt [iso-8859-1] Mon Nov 30 22:25:50
2015
@@ -1,6 +1,7 @@
list(APPEND SOURCE
devinst.c
+ dialog.c
diskspace.c
install.c
misc.c
Added: trunk/rostests/winetests/setupapi/dialog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/dialog…
==============================================================================
--- trunk/rostests/winetests/setupapi/dialog.c (added)
+++ trunk/rostests/winetests/setupapi/dialog.c [iso-8859-1] Mon Nov 30 22:25:50 2015
@@ -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 %u\n", ret);
+ ok(length == strlen(path)+1, "Expect length %u, got %u\n",
(DWORD)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 %u, got %u\n",
(DWORD)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
%u\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
%u\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 %u\n", ret);
+ ok(length == strlen(path)+1, "Expect length %u, got %u\n",
(DWORD)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 %u\n", ret);
+ ok(length == lstrlenW(path)+1, "Expect length %u, got %u\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 %u, got %u\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
%u\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
%u\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 %u\n", ret);
+ ok(length == lstrlenW(path)+1, "Expect length %u, got %u\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();
+}
Propchange: trunk/rostests/winetests/setupapi/dialog.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/winetests/setupapi/install.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/instal…
==============================================================================
--- trunk/rostests/winetests/setupapi/install.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/setupapi/install.c [iso-8859-1] Mon Nov 30 22:25:50 2015
@@ -63,10 +63,12 @@
static void create_inf_file(LPCSTR filename, const char *data)
{
DWORD res;
+ BOOL ret;
HANDLE handle = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
assert(handle != INVALID_HANDLE_VALUE);
- assert(WriteFile(handle, data, strlen(data), &res, NULL));
+ ret = WriteFile(handle, data, strlen(data), &res, NULL);
+ assert(ret != 0);
CloseHandle(handle);
}
@@ -718,6 +720,64 @@
RemoveDirectoryA(dirA);
}
+static const char dirid_inf[] = "[Version]\n"
+ "Signature=\"$Chicago$\"\n"
+ "[DefaultInstall]\n"
+ "AddReg=Add.Settings\n"
+ "[Add.Settings]\n"
+ "HKCU,Software\\Wine\\setupapitest,dirid,,%%%i%%\n";
+
+static void check_dirid(int dirid, LPCSTR expected)
+{
+ char buffer[sizeof(dirid_inf)+11];
+ char path[MAX_PATH], actual[MAX_PATH];
+ LONG ret;
+ DWORD size, type;
+ HKEY key;
+
+ sprintf(buffer, dirid_inf, dirid);
+
+ create_inf_file(inffile, buffer);
+
+ sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ run_cmdline("DefaultInstall", 128, path);
+
+ size = sizeof(actual);
+ actual[0] = '\0';
+ ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest",
&key);
+ if (ret == ERROR_SUCCESS)
+ {
+ ret = RegQueryValueExA(key, "dirid", NULL, &type,
(BYTE*)&actual, &size);
+ RegCloseKey(key);
+ if (type != REG_SZ)
+ ret = ERROR_FILE_NOT_FOUND;
+ }
+
+ ok(ret == ERROR_SUCCESS, "Failed getting value for dirid %i, err=%d\n",
dirid, ret);
+ ok(!strcmp(actual, expected), "Expected path for dirid %i was \"%s\",
got \"%s\"\n", dirid, expected, actual);
+
+ ok_registry(TRUE);
+ ret = DeleteFileA(inffile);
+ ok(ret, "Expected source inf to exist, last error was %d\n",
GetLastError());
+}
+
+/* Test dirid values */
+static void test_dirid(void)
+{
+ char expected[MAX_PATH];
+
+ check_dirid(DIRID_NULL, "");
+
+ GetWindowsDirectoryA(expected, MAX_PATH);
+ check_dirid(DIRID_WINDOWS, expected);
+
+ GetSystemDirectoryA(expected, MAX_PATH);
+ check_dirid(DIRID_SYSTEM, expected);
+
+ strcat(expected, "\\unknown");
+ check_dirid(40, expected);
+}
+
START_TEST(install)
{
HMODULE hsetupapi = GetModuleHandleA("setupapi.dll");
@@ -768,6 +828,7 @@
test_registry();
test_install_svc_from();
test_driver_install();
+ test_dirid();
UnhookWindowsHookEx(hhook);
Modified: trunk/rostests/winetests/setupapi/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/testli…
==============================================================================
--- trunk/rostests/winetests/setupapi/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/setupapi/testlist.c [iso-8859-1] Mon Nov 30 22:25:50 2015
@@ -4,6 +4,7 @@
#include <wine/test.h>
extern void func_devinst(void);
+extern void func_dialog(void);
extern void func_diskspace(void);
extern void func_install(void);
extern void func_misc(void);
@@ -15,6 +16,7 @@
const struct test winetest_testlist[] =
{
{ "devinst", func_devinst },
+ { "dialog", func_dialog },
{ "diskspace", func_diskspace },
{ "install", func_install },
{ "misc", func_misc },