Author: akhaldi Date: Sat May 19 14:09:14 2012 New Revision: 56628
URL: http://svn.reactos.org/svn/reactos?rev=56628&view=rev Log: [SETUPAPI_WINETEST] * Sync to Wine 1.5.4. I excluded devinst tests from the sync until bug #7077 is fixed.
Added: trunk/rostests/winetests/setupapi/diskspace.c (with props) Modified: trunk/rostests/winetests/setupapi/CMakeLists.txt trunk/rostests/winetests/setupapi/install.c trunk/rostests/winetests/setupapi/misc.c trunk/rostests/winetests/setupapi/parser.c trunk/rostests/winetests/setupapi/query.c trunk/rostests/winetests/setupapi/stringtable.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/CMakeLi... ============================================================================== --- trunk/rostests/winetests/setupapi/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/setupapi/CMakeLists.txt [iso-8859-1] Sat May 19 14:09:14 2012 @@ -5,6 +5,7 @@ list(APPEND SOURCE devclass.c devinst.c + diskspace.c install.c misc.c parser.c
Added: trunk/rostests/winetests/setupapi/diskspace.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/diskspa... ============================================================================== --- trunk/rostests/winetests/setupapi/diskspace.c (added) +++ trunk/rostests/winetests/setupapi/diskspace.c [iso-8859-1] Sat May 19 14:09:14 2012 @@ -1,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(); +}
Propchange: trunk/rostests/winetests/setupapi/diskspace.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/rostests/winetests/setupapi/install.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/install... ============================================================================== --- trunk/rostests/winetests/setupapi/install.c [iso-8859-1] (original) +++ trunk/rostests/winetests/setupapi/install.c [iso-8859-1] Sat May 19 14:09:14 2012 @@ -120,12 +120,14 @@ { 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 @@ 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 @@ 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 @@ 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 @@ /* 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 @@ 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");
Modified: trunk/rostests/winetests/setupapi/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/misc.c?... ============================================================================== --- trunk/rostests/winetests/setupapi/misc.c [iso-8859-1] (original) +++ trunk/rostests/winetests/setupapi/misc.c [iso-8859-1] Sat May 19 14:09:14 2012 @@ -312,16 +312,41 @@
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';
Modified: trunk/rostests/winetests/setupapi/parser.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/parser.... ============================================================================== --- trunk/rostests/winetests/setupapi/parser.c [iso-8859-1] (original) +++ trunk/rostests/winetests/setupapi/parser.c [iso-8859-1] Sat May 19 14:09:14 2012 @@ -406,7 +406,7 @@ 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 @@ 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++)
Modified: trunk/rostests/winetests/setupapi/query.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/query.c... ============================================================================== --- trunk/rostests/winetests/setupapi/query.c [iso-8859-1] (original) +++ trunk/rostests/winetests/setupapi/query.c [iso-8859-1] Sat May 19 14:09:14 2012 @@ -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) {
Modified: trunk/rostests/winetests/setupapi/stringtable.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/stringt... ============================================================================== --- trunk/rostests/winetests/setupapi/stringtable.c [iso-8859-1] (original) +++ trunk/rostests/winetests/setupapi/stringtable.c [iso-8859-1] Sat May 19 14:09:14 2012 @@ -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 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};
Modified: trunk/rostests/winetests/setupapi/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/setupapi/testlis... ============================================================================== --- trunk/rostests/winetests/setupapi/testlist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/setupapi/testlist.c [iso-8859-1] Sat May 19 14:09:14 2012 @@ -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 @@ { { "devclass", func_devclass }, { "devinst", func_devinst }, + { "diskspace", func_diskspace }, { "install", func_install }, { "misc", func_misc }, { "parser", func_parser },