[SETUPAPI_WINETEST]
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 19 May 2012 14:09:14 +0000 (14:09 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 19 May 2012 14:09:14 +0000 (14:09 +0000)
* Sync to Wine 1.5.4. I excluded devinst tests from the sync until bug #7077 is fixed.

svn path=/trunk/; revision=56628

rostests/winetests/setupapi/CMakeLists.txt
rostests/winetests/setupapi/diskspace.c [new file with mode: 0644]
rostests/winetests/setupapi/install.c
rostests/winetests/setupapi/misc.c
rostests/winetests/setupapi/parser.c
rostests/winetests/setupapi/query.c
rostests/winetests/setupapi/stringtable.c
rostests/winetests/setupapi/testlist.c

index 2f3ff6e..9676bed 100644 (file)
@@ -5,6 +5,7 @@ add_definitions(
 list(APPEND SOURCE
     devclass.c
     devinst.c
+    diskspace.c
     install.c
     misc.c
     parser.c
diff --git a/rostests/winetests/setupapi/diskspace.c b/rostests/winetests/setupapi/diskspace.c
new file mode 100644 (file)
index 0000000..573eb73
--- /dev/null
@@ -0,0 +1,485 @@
+/*
+ * Unit tests for disk space functions
+ *
+ * Copyright 2010 Andrew Nguyen
+ *
+ * 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 "winnls.h"
+#include "winuser.h"
+#include "winreg.h"
+#include "setupapi.h"
+
+#include "wine/test.h"
+
+static void test_SetupCreateDiskSpaceListA(void)
+{
+    HDSKSPC ret;
+
+    ret = SetupCreateDiskSpaceListA(NULL, 0, 0);
+    ok(ret != NULL,
+       "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
+
+    ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
+
+    ret = SetupCreateDiskSpaceListA(NULL, 0, SPDSL_IGNORE_DISK);
+    ok(ret != NULL,
+       "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
+
+    ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
+
+    SetLastError(0xdeadbeef);
+    ret = SetupCreateDiskSpaceListA(NULL, 0, ~0U);
+    ok(ret == NULL ||
+       broken(ret != NULL), /* NT4/Win9x/Win2k */
+       "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
+    if (!ret)
+        ok(GetLastError() == ERROR_INVALID_PARAMETER,
+           "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+           GetLastError());
+    else
+        ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
+
+    SetLastError(0xdeadbeef);
+    ret = SetupCreateDiskSpaceListA(NULL, 0xdeadbeef, 0);
+    ok(ret == NULL,
+       "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER ||
+       broken(GetLastError() == 0xdeadbeef), /* NT4/Win9x/Win2k */
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ret = SetupCreateDiskSpaceListA((void *)0xdeadbeef, 0, 0);
+    ok(ret == NULL,
+       "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER ||
+       broken(GetLastError() == 0xdeadbeef), /* NT4/Win9x/Win2k */
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ret = SetupCreateDiskSpaceListA((void *)0xdeadbeef, 0xdeadbeef, 0);
+    ok(ret == NULL,
+       "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER ||
+       broken(GetLastError() == 0xdeadbeef), /* NT4/Win9x/Win2k */
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+}
+
+static void test_SetupCreateDiskSpaceListW(void)
+{
+    HDSKSPC ret;
+
+    ret = SetupCreateDiskSpaceListW(NULL, 0, 0);
+    if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+    {
+        win_skip("SetupCreateDiskSpaceListW is not implemented\n");
+        return;
+    }
+    ok(ret != NULL,
+       "Expected SetupCreateDiskSpaceListW to return a valid handle, got NULL\n");
+
+    ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
+
+    ret = SetupCreateDiskSpaceListW(NULL, 0, SPDSL_IGNORE_DISK);
+    ok(ret != NULL,
+       "Expected SetupCreateDiskSpaceListW to return a valid handle, got NULL\n");
+
+    ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
+
+    SetLastError(0xdeadbeef);
+    ret = SetupCreateDiskSpaceListW(NULL, 0, ~0U);
+    ok(ret == NULL ||
+       broken(ret != NULL), /* NT4/Win2k */
+       "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
+    if (!ret)
+        ok(GetLastError() == ERROR_INVALID_PARAMETER,
+           "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+           GetLastError());
+    else
+        ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
+
+    SetLastError(0xdeadbeef);
+    ret = SetupCreateDiskSpaceListW(NULL, 0xdeadbeef, 0);
+    ok(ret == NULL,
+       "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER ||
+       broken(GetLastError() == 0xdeadbeef), /* NT4/Win2k */
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ret = SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0, 0);
+    ok(ret == NULL,
+       "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER ||
+       broken(GetLastError() == 0xdeadbeef), /* NT4/Win2k */
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ret = SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0xdeadbeef, 0);
+    ok(ret == NULL,
+       "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER ||
+       broken(GetLastError() == 0xdeadbeef), /* NT4/Win2k */
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+}
+
+static void test_SetupDuplicateDiskSpaceListA(void)
+{
+    HDSKSPC handle, duplicate;
+    int is_win9x = !SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0xdeadbeef, 0) &&
+                    GetLastError() == ERROR_CALL_NOT_IMPLEMENTED;
+
+    if (is_win9x)
+        win_skip("SetupDuplicateDiskSpaceListA crashes with NULL disk space handle on Win9x\n");
+    else
+    {
+        SetLastError(0xdeadbeef);
+        duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0, 0);
+        ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+        ok(GetLastError() == ERROR_INVALID_HANDLE,
+           "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n", GetLastError());
+
+        SetLastError(0xdeadbeef);
+        duplicate = SetupDuplicateDiskSpaceListA(NULL, (void *)0xdeadbeef, 0, 0);
+        ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+        ok(GetLastError() == ERROR_INVALID_PARAMETER,
+           "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+        SetLastError(0xdeadbeef);
+        duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0xdeadbeef, 0);
+        ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+        ok(GetLastError() == ERROR_INVALID_PARAMETER,
+           "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+        SetLastError(0xdeadbeef);
+        duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0, ~0U);
+        ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+        ok(GetLastError() == ERROR_INVALID_PARAMETER,
+           "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+    }
+
+    handle = SetupCreateDiskSpaceListA(NULL, 0, 0);
+    ok(handle != NULL,
+       "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
+
+    if (!handle)
+    {
+        skip("Failed to create a disk space handle\n");
+        return;
+    }
+
+    SetLastError(0xdeadbeef);
+    duplicate = SetupDuplicateDiskSpaceListA(handle, (void *)0xdeadbeef, 0, 0);
+    ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0xdeadbeef, 0);
+    ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, SPDSL_IGNORE_DISK);
+    ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, ~0U);
+    ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+    duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, 0);
+    ok(duplicate != NULL, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(duplicate != handle,
+       "Expected new handle (%p) to be different from the old handle (%p)\n", duplicate, handle);
+
+    ok(SetupDestroyDiskSpaceList(duplicate), "Expected SetupDestroyDiskSpaceList to succeed\n");
+    ok(SetupDestroyDiskSpaceList(handle), "Expected SetupDestroyDiskSpaceList to succeed\n");
+}
+
+static void test_SetupDuplicateDiskSpaceListW(void)
+{
+    HDSKSPC handle, duplicate;
+
+    SetLastError(0xdeadbeef);
+    duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0, 0);
+    if (!duplicate && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+    {
+        win_skip("SetupDuplicateDiskSpaceListW is not available\n");
+        return;
+    }
+    ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(GetLastError() == ERROR_INVALID_HANDLE,
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    duplicate = SetupDuplicateDiskSpaceListW(NULL, (void *)0xdeadbeef, 0, 0);
+    ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0xdeadbeef, 0);
+    ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0, ~0U);
+    ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+    handle = SetupCreateDiskSpaceListW(NULL, 0, 0);
+    ok(handle != NULL,
+       "Expected SetupCreateDiskSpaceListW to return a valid handle, got NULL\n");
+
+    if (!handle)
+    {
+        skip("Failed to create a disk space handle\n");
+        return;
+    }
+
+    SetLastError(0xdeadbeef);
+    duplicate = SetupDuplicateDiskSpaceListW(handle, (void *)0xdeadbeef, 0, 0);
+    ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0xdeadbeef, 0);
+    ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, SPDSL_IGNORE_DISK);
+    ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, ~0U);
+    ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+
+    duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, 0);
+    ok(duplicate != NULL, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
+    ok(duplicate != handle,
+       "Expected new handle (%p) to be different from the old handle (%p)\n", duplicate, handle);
+
+    ok(SetupDestroyDiskSpaceList(duplicate), "Expected SetupDestroyDiskSpaceList to succeed\n");
+    ok(SetupDestroyDiskSpaceList(handle), "Expected SetupDestroyDiskSpaceList to succeed\n");
+}
+
+static void test_SetupQuerySpaceRequiredOnDriveA(void)
+{
+    BOOL ret;
+    HDSKSPC handle;
+    LONGLONG space;
+    int is_win9x = !SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0xdeadbeef, 0) &&
+                    GetLastError() == ERROR_CALL_NOT_IMPLEMENTED;
+
+    if (is_win9x)
+        win_skip("SetupQuerySpaceRequiredOnDriveA crashes with NULL disk space handle on Win9x\n");
+    else
+    {
+        SetLastError(0xdeadbeef);
+        ret = SetupQuerySpaceRequiredOnDriveA(NULL, NULL, NULL, NULL, 0);
+        ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
+        ok(GetLastError() == ERROR_INVALID_PARAMETER,
+           "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+           GetLastError());
+
+        SetLastError(0xdeadbeef);
+        space = 0xdeadbeef;
+        ret = SetupQuerySpaceRequiredOnDriveA(NULL, NULL, &space, NULL, 0);
+        ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
+        ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
+        ok(GetLastError() == ERROR_INVALID_PARAMETER,
+           "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+           GetLastError());
+
+        SetLastError(0xdeadbeef);
+        ret = SetupQuerySpaceRequiredOnDriveA(NULL, "", NULL, NULL, 0);
+        ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
+        ok(GetLastError() == ERROR_INVALID_HANDLE,
+           "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
+           GetLastError());
+
+        SetLastError(0xdeadbeef);
+        space = 0xdeadbeef;
+        ret = SetupQuerySpaceRequiredOnDriveA(NULL, "", &space, NULL, 0);
+        ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
+        ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
+        ok(GetLastError() == ERROR_INVALID_HANDLE,
+           "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
+           GetLastError());
+    }
+
+    handle = SetupCreateDiskSpaceListA(NULL, 0, 0);
+    ok(handle != NULL,
+       "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
+
+    SetLastError(0xdeadbeef);
+    ret = SetupQuerySpaceRequiredOnDriveA(handle, NULL, NULL, NULL, 0);
+    ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER ||
+       GetLastError() == ERROR_INVALID_DRIVE, /* Win9x */
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    space = 0xdeadbeef;
+    ret = SetupQuerySpaceRequiredOnDriveA(handle, NULL, &space, NULL, 0);
+    ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
+    ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
+    ok(GetLastError() == ERROR_INVALID_PARAMETER ||
+       GetLastError() == ERROR_INVALID_DRIVE, /* Win9x */
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ret = SetupQuerySpaceRequiredOnDriveA(handle, "", NULL, NULL, 0);
+    ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_DRIVE,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    space = 0xdeadbeef;
+    ret = SetupQuerySpaceRequiredOnDriveA(handle, "", &space, NULL, 0);
+    ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
+    ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
+    ok(GetLastError() == ERROR_INVALID_DRIVE,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+
+    ok(SetupDestroyDiskSpaceList(handle),
+       "Expected SetupDestroyDiskSpaceList to succeed\n");
+}
+
+static void test_SetupQuerySpaceRequiredOnDriveW(void)
+{
+    static const WCHAR emptyW[] = {0};
+
+    BOOL ret;
+    HDSKSPC handle;
+    LONGLONG space;
+
+    SetLastError(0xdeadbeef);
+    ret = SetupQuerySpaceRequiredOnDriveW(NULL, NULL, NULL, NULL, 0);
+    if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+    {
+        win_skip("SetupQuerySpaceRequiredOnDriveW is not available\n");
+        return;
+    }
+    ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_HANDLE,
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    space = 0xdeadbeef;
+    ret = SetupQuerySpaceRequiredOnDriveW(NULL, NULL, &space, NULL, 0);
+    ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
+    ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
+    ok(GetLastError() == ERROR_INVALID_HANDLE,
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ret = SetupQuerySpaceRequiredOnDriveW(NULL, emptyW, NULL, NULL, 0);
+    ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_HANDLE,
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    space = 0xdeadbeef;
+    ret = SetupQuerySpaceRequiredOnDriveW(NULL, emptyW, &space, NULL, 0);
+    ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
+    ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
+    ok(GetLastError() == ERROR_INVALID_HANDLE,
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
+       GetLastError());
+
+    handle = SetupCreateDiskSpaceListA(NULL, 0, 0);
+    ok(handle != NULL,
+       "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
+
+    SetLastError(0xdeadbeef);
+    ret = SetupQuerySpaceRequiredOnDriveW(handle, NULL, NULL, NULL, 0);
+    ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER ||
+       GetLastError() == ERROR_INVALID_DRIVE, /* NT4/Win2k/XP/Win2k3 */
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    space = 0xdeadbeef;
+    ret = SetupQuerySpaceRequiredOnDriveW(handle, NULL, &space, NULL, 0);
+    ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
+    ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
+    ok(GetLastError() == ERROR_INVALID_PARAMETER ||
+       GetLastError() == ERROR_INVALID_DRIVE, /* NT4/Win2k/XP/Win2k3 */
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ret = SetupQuerySpaceRequiredOnDriveW(handle, emptyW, NULL, NULL, 0);
+    ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_DRIVE,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+
+    SetLastError(0xdeadbeef);
+    space = 0xdeadbeef;
+    ret = SetupQuerySpaceRequiredOnDriveW(handle, emptyW, &space, NULL, 0);
+    ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
+    ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
+    ok(GetLastError() == ERROR_INVALID_DRIVE,
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       GetLastError());
+
+    ok(SetupDestroyDiskSpaceList(handle),
+       "Expected SetupDestroyDiskSpaceList to succeed\n");
+}
+
+START_TEST(diskspace)
+{
+    test_SetupCreateDiskSpaceListA();
+    test_SetupCreateDiskSpaceListW();
+    test_SetupDuplicateDiskSpaceListA();
+    test_SetupDuplicateDiskSpaceListW();
+    test_SetupQuerySpaceRequiredOnDriveA();
+    test_SetupQuerySpaceRequiredOnDriveW();
+}
index f5df3df..1c204b5 100644 (file)
@@ -120,12 +120,14 @@ static void test_cmdline(void)
 {
     static const char infwithspaces[] = "test file.inf";
     char path[MAX_PATH];
+    BOOL ret;
 
     create_inf_file(inffile, cmdline_inf);
     sprintf(path, "%s\\%s", CURR_DIR, inffile);
     run_cmdline("DefaultInstall", 128, path);
     ok_registry(TRUE);
-    ok(DeleteFile(inffile), "Expected source inf to exist, last error was %d\n", GetLastError());
+    ret = DeleteFile(inffile);
+    ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
 
     /* Test handling of spaces in path, unquoted and quoted */
     create_inf_file(infwithspaces, cmdline_inf);
@@ -138,7 +140,8 @@ static void test_cmdline(void)
     run_cmdline("DefaultInstall", 128, path);
     ok_registry(FALSE);
 
-    ok(DeleteFile(infwithspaces), "Expected source inf to exist, last error was %d\n", GetLastError());
+    ret = DeleteFile(infwithspaces);
+    ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
 }
 
 static const char *cmdline_inf_reg = "[Version]\n"
@@ -153,6 +156,7 @@ static void test_registry(void)
     HKEY key;
     LONG res;
     char path[MAX_PATH];
+    BOOL ret;
 
     /* First create a registry structure we would like to be deleted */
     ok(!RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest\\setupapitest", &key),
@@ -176,7 +180,8 @@ static void test_registry(void)
         RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest\\setupapitest");
         RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest");
     }
-    ok(DeleteFile(inffile), "Expected source inf to exist, last error was %d\n", GetLastError());
+    ret = DeleteFile(inffile);
+    ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
 }
 
 static void test_install_svc_from(void)
@@ -724,6 +729,7 @@ START_TEST(install)
         /* Check if pInstallHinfSectionA sets last error or is a stub (as on WinXP) */
         static const char *minimal_inf = "[Version]\nSignature=\"$Chicago$\"\n";
         char cmdline[MAX_PATH*2];
+        BOOL ret;
         create_inf_file(inffile, minimal_inf);
         sprintf(cmdline, "DefaultInstall 128 %s\\%s", CURR_DIR, inffile);
         SetLastError(0xdeadbeef);
@@ -733,7 +739,8 @@ START_TEST(install)
             skip("InstallHinfSectionA is broken (stub)\n");
             pInstallHinfSectionA = NULL;
         }
-        ok(DeleteFile(inffile), "Expected source inf to exist, last error was %d\n", GetLastError());
+        ret = DeleteFile(inffile);
+        ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
     }
     if (!pInstallHinfSectionW && !pInstallHinfSectionA)
         win_skip("InstallHinfSectionA and InstallHinfSectionW are not available\n");
index f2d885d..493e6cb 100644 (file)
@@ -312,16 +312,41 @@ static void test_SetupCopyOEMInf(void)
 
     if (pSetupUninstallOEMInfA)
     {
+        char pnf[MAX_PATH];
+        char *pnffile;
         char *destfile = strrchr(dest, '\\') + 1;
 
+        strcpy(pnf, dest);
+        *(strrchr(pnf, '.') + 1) = 'p';
+        pnffile = strrchr(pnf, '\\') + 1;
+
         SetLastError(0xdeadbeef);
-        ok(pSetupUninstallOEMInfA(destfile, 0, NULL), "Failed to uninstall '%s' : %d\n", destfile, GetLastError());
+        res = pSetupUninstallOEMInfA(destfile, 0, NULL);
+        if(!res)
+            res = pSetupUninstallOEMInfA(pnffile, 0, NULL);
+        ok(res, "Failed to uninstall '%s'/'%s' : %d\n", destfile,
+           pnffile, GetLastError());
+        todo_wine ok(!file_exists(dest), "Expected inf '%s' to not exist\n", dest);
+        if(file_exists(dest))
+        {
+            SetLastError(0xdeadbeef);
+            res = DeleteFileA(dest);
+            ok(res, "Failed to delete file '%s' : %d\n", dest, GetLastError());
+        }
+        ok(!file_exists(pnf), "Expected pnf '%s' to not exist\n", pnf);
+        if(file_exists(pnf))
+        {
+            SetLastError(0xdeadbeef);
+            res = DeleteFileA(pnf);
+            ok(res, "Failed to delete file '%s' : %d\n", pnf, GetLastError());
+        }
     }
     else
     {
         /* Win9x/WinMe */
         SetLastError(0xdeadbeef);
-        ok(DeleteFileA(dest), "Failed to delete file '%s' : %d\n", dest, GetLastError());
+        res = DeleteFileA(dest);
+        ok(res, "Failed to delete file '%s' : %d\n", dest, GetLastError());
 
         /* On WinMe we also need to remove the .pnf file */
         *(strrchr(dest, '.') + 1) = 'p';
index 072ac97..53f7cc0 100644 (file)
@@ -406,7 +406,7 @@ static const char *check_key( INFCONTEXT *context, const char *wanted )
 static void test_key_names(void)
 {
     char buffer[MAX_INF_STRING_LENGTH+32];
-    const char *key, *line;
+    const char *line;
     unsigned int i, index, count;
     UINT err_line;
     HINF hinf;
@@ -426,7 +426,7 @@ static void test_key_names(void)
         ret = SetupFindFirstLineA( hinf, "Test", 0, &context );
         assert( ret );
 
-        key = check_key( &context, key_names[i].key );
+        check_key( &context, key_names[i].key );
 
         buffer[0] = buffer[1] = 0;  /* build the full line */
         for (index = 0; ; index++)
index 6e956a2..b77827c 100644 (file)
@@ -23,8 +23,8 @@
 #include <setupapi.h>
 #include "wine/test.h"
 
-CHAR CURR_DIR[MAX_PATH];
-CHAR WIN_DIR[MAX_PATH];
+static CHAR CURR_DIR[MAX_PATH];
+static CHAR WIN_DIR[MAX_PATH];
 
 static void get_directories(void)
 {
index fbe1037..ab152c2 100644 (file)
@@ -33,6 +33,9 @@
 
 #include "wine/test.h"
 
+
+//DECLARE_HANDLE(HSTRING_TABLE);
+
 /* Flags for StringTableAddString and StringTableLookUpString */
 #define ST_CASE_SENSITIVE_COMPARE      0x00000001
 
@@ -50,7 +53,7 @@ static BOOL     (WINAPI *pStringTableStringFromIdEx)(HSTRING_TABLE, DWORD, LPWST
 static VOID     (WINAPI *pStringTableTrim)(HSTRING_TABLE);
 #endif
 
-HMODULE hdll;
+static HMODULE hdll;
 static WCHAR string[] = {'s','t','r','i','n','g',0};
 static WCHAR String[] = {'S','t','r','i','n','g',0};
 static WCHAR foo[] = {'f','o','o',0};
index bfa1f9c..7e6ceea 100644 (file)
@@ -8,6 +8,7 @@
 
 extern void func_devclass(void);
 extern void func_devinst(void);
+extern void func_diskspace(void);
 extern void func_install(void);
 extern void func_misc(void);
 extern void func_parser(void);
@@ -19,6 +20,7 @@ const struct test winetest_testlist[] =
 {
     { "devclass", func_devclass },
     { "devinst", func_devinst },
+    { "diskspace", func_diskspace },
     { "install", func_install },
     { "misc", func_misc },
     { "parser", func_parser },