Index: modules/rostests/winetests/setupapi/CMakeLists.txt =================================================================== --- modules/rostests/winetests/setupapi/CMakeLists.txt (revision 55183) +++ modules/rostests/winetests/setupapi/CMakeLists.txt (working copy) @@ -5,6 +5,7 @@ list(APPEND SOURCE devclass.c devinst.c + diskspace.c install.c misc.c parser.c Index: devinst.c =================================================================== --- modules/rostests/winetests/setupapi/devinst.c (revision 55183) +++ modules/rostests/winetests/setupapi/devinst.c (working copy) @@ -31,8 +31,9 @@ #include "wine/test.h" +static BOOL is_wow64; + /* function pointers */ -static HMODULE hSetupAPI; static HDEVINFO (WINAPI *pSetupDiCreateDeviceInfoList)(GUID*,HWND); static HDEVINFO (WINAPI *pSetupDiCreateDeviceInfoListExW)(GUID*,HWND,PCWSTR,PVOID); static BOOL (WINAPI *pSetupDiCreateDeviceInterfaceA)(HDEVINFO, PSP_DEVINFO_DATA, const GUID *, PCSTR, DWORD, PSP_DEVICE_INTERFACE_DATA); @@ -40,6 +41,7 @@ static BOOL (WINAPI *pSetupDiDestroyDeviceInfoList)(HDEVINFO); static BOOL (WINAPI *pSetupDiEnumDeviceInfo)(HDEVINFO, DWORD, PSP_DEVINFO_DATA); static BOOL (WINAPI *pSetupDiEnumDeviceInterfaces)(HDEVINFO, PSP_DEVINFO_DATA, const GUID *, DWORD, PSP_DEVICE_INTERFACE_DATA); +static BOOL (WINAPI *pSetupDiGetINFClassA)(PCSTR, LPGUID, PSTR, DWORD, PDWORD); static BOOL (WINAPI *pSetupDiInstallClassA)(HWND, PCSTR, DWORD, HSPFILEQ); static HKEY (WINAPI *pSetupDiOpenClassRegKeyExA)(GUID*,REGSAM,DWORD,PCSTR,PVOID); static HKEY (WINAPI *pSetupDiOpenDevRegKey)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, DWORD, DWORD, REGSAM); @@ -56,13 +58,15 @@ static BOOL (WINAPI *pSetupDiSetDeviceRegistryPropertyW)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, const BYTE *, DWORD); static BOOL (WINAPI *pSetupDiGetDeviceRegistryPropertyA)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD); static BOOL (WINAPI *pSetupDiGetDeviceRegistryPropertyW)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD); +static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); /* This is a unique guid for testing purposes */ static GUID guid = {0x6a55b5a4, 0x3f65, 0x11db, {0xb7,0x04,0x00,0x11,0x95,0x5c,0x2b,0xdb}}; static void init_function_pointers(void) { - hSetupAPI = GetModuleHandleA("setupapi.dll"); + HMODULE hSetupAPI = GetModuleHandleA("setupapi.dll"); + HMODULE hKernel32 = GetModuleHandleA("kernel32.dll"); pSetupDiCreateDeviceInfoA = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoA"); pSetupDiCreateDeviceInfoW = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoW"); @@ -83,10 +87,12 @@ pSetupDiRegisterDeviceInfo = (void *)GetProcAddress(hSetupAPI, "SetupDiRegisterDeviceInfo"); pSetupDiGetClassDevsA = (void *)GetProcAddress(hSetupAPI, "SetupDiGetClassDevsA"); pSetupDiGetClassDevsW = (void *)GetProcAddress(hSetupAPI, "SetupDiGetClassDevsW"); + pSetupDiGetINFClassA = (void *)GetProcAddress(hSetupAPI, "SetupDiGetINFClassA"); pSetupDiSetDeviceRegistryPropertyA = (void *)GetProcAddress(hSetupAPI, "SetupDiSetDeviceRegistryPropertyA"); pSetupDiSetDeviceRegistryPropertyW = (void *)GetProcAddress(hSetupAPI, "SetupDiSetDeviceRegistryPropertyW"); pSetupDiGetDeviceRegistryPropertyA = (void *)GetProcAddress(hSetupAPI, "SetupDiGetDeviceRegistryPropertyA"); pSetupDiGetDeviceRegistryPropertyW = (void *)GetProcAddress(hSetupAPI, "SetupDiGetDeviceRegistryPropertyW"); + pIsWow64Process = (void *)GetProcAddress(hKernel32, "IsWow64Process"); } static void change_reg_permissions(const WCHAR *regkey) @@ -126,7 +132,7 @@ { HDEVINFO set; SP_DEVINFO_DATA devInfo = { sizeof(devInfo), { 0 } }; - BOOL ret; + BOOL ret, retval; SetLastError(0xdeadbeef); set = pSetupDiGetClassDevsA(&guid, NULL, 0, 0); @@ -134,19 +140,23 @@ GetLastError()); SetLastError(0xdeadbeef); - ok(pSetupDiEnumDeviceInfo(set, 0, &devInfo), - "SetupDiEnumDeviceInfo failed: %08x\n", GetLastError()); + ret = pSetupDiEnumDeviceInfo(set, 0, &devInfo); + ok(ret, "SetupDiEnumDeviceInfo failed: %08x\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pSetupDiCallClassInstaller(DIF_REMOVE, set, &devInfo); - todo_wine - ok(ret, "SetupDiCallClassInstaller(DIF_REMOVE...) failed: %08x\n", GetLastError()); + retval = pSetupDiCallClassInstaller(DIF_REMOVE, set, &devInfo); + if(is_wow64) + todo_wine ok(!retval && GetLastError() == ERROR_IN_WOW64, + "SetupDiCallClassInstaller(DIF_REMOVE...) succeeded: %08x\n", GetLastError()); + else + todo_wine ok(retval, + "SetupDiCallClassInstaller(DIF_REMOVE...) failed: %08x\n", GetLastError()); SetLastError(0xdeadbeef); - ok(pSetupDiDestroyDeviceInfoList(set), - "SetupDiDestroyDeviceInfoList failed: %08x\n", GetLastError()); + ret = pSetupDiDestroyDeviceInfoList(set); + ok(ret, "SetupDiDestroyDeviceInfoList failed: %08x\n", GetLastError()); - return ret; + return retval; } /* RegDeleteTreeW from dlls/advapi32/registry.c */ @@ -251,6 +261,7 @@ DWORD error; static CHAR notnull[] = "NotNull"; static const WCHAR machine[] = { 'd','u','m','m','y',0 }; + static const WCHAR empty[] = { 0 }; SetLastError(0xdeadbeef); /* create empty DeviceInfoList, but set Reserved to a value, which is not NULL */ @@ -280,6 +291,14 @@ /* destroy DeviceInfoList */ ret = pSetupDiDestroyDeviceInfoList(devlist); ok(ret, "SetupDiDestroyDeviceInfoList failed : %d\n", error); + + /* create empty DeviceInfoList with empty machine name */ + devlist = pSetupDiCreateDeviceInfoListExW(NULL, NULL, empty, NULL); + ok(devlist && devlist != INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %d (expected != %p)\n", devlist, error, INVALID_HANDLE_VALUE); + + /* destroy DeviceInfoList */ + ret = pSetupDiDestroyDeviceInfoList(devlist); + ok(ret, "SetupDiDestroyDeviceInfoList failed : %d\n", error); } static void test_SetupDiOpenClassRegKeyExA(void) @@ -955,7 +974,6 @@ key = pSetupDiOpenDevRegKey(set, &devInfo, DICS_FLAG_GLOBAL, 0, DIREG_DRV, 0); /* The software key isn't created by default */ - todo_wine ok(key == INVALID_HANDLE_VALUE && GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Expected ERROR_KEY_DOES_NOT_EXIST, got %08x\n", GetLastError()); @@ -1005,8 +1023,8 @@ /* Cleanup */ ret = remove_device(); - todo_wine - ok(ret, "Expected the device to be removed: %08x\n", GetLastError()); + if(!is_wow64) + todo_wine ok(ret, "Expected the device to be removed: %08x\n", GetLastError()); /* FIXME: Only do the RegDeleteKey, once Wine is fixed */ if (!ret) @@ -1089,8 +1107,10 @@ { static const char path[] = "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}"; + static const char path_wow64[] = + "\\\\?\\root#legacy_bogus#0001#{6a55b5a4-3f65-11db-b704-0011955c2bdb}"; static const char path_w2k[] = - "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\"; + "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\"; PSP_DEVICE_INTERFACE_DETAIL_DATA_A detail = NULL; detail = HeapAlloc(GetProcessHeap(), 0, dwSize); @@ -1104,10 +1124,13 @@ /* FIXME: This one only worked because old data wasn't removed properly. As soon * as all the tests are cleaned up correctly this has to be (or should be) fixed */ - todo_wine - ok(!lstrcmpiA(path, detail->DevicePath) || - !lstrcmpiA(path_w2k, detail->DevicePath), "Unexpected path %s\n", - detail->DevicePath); + if(is_wow64) + ok(!lstrcmpiA(path_wow64, detail->DevicePath), + "Unexpected path %s\n", detail->DevicePath); + else + todo_wine ok(!lstrcmpiA(path, detail->DevicePath) || + !lstrcmpiA(path_w2k, detail->DevicePath), + "Unexpected path %s\n", detail->DevicePath); HeapFree(GetProcessHeap(), 0, detail); } } @@ -1116,8 +1139,8 @@ /* Cleanup */ ret = remove_device(); - todo_wine - ok(ret, "Expected the device to be removed: %08x\n", GetLastError()); + if(!is_wow64) + todo_wine ok(ret, "Expected the device to be removed: %08x\n", GetLastError()); /* FIXME: Only do the RegDeleteKey, once Wine is fixed */ if (!ret) @@ -1226,8 +1249,8 @@ pSetupDiDestroyDeviceInfoList(set); res = RegOpenKeyA(HKEY_LOCAL_MACHINE, bogus, &key); - todo_wine - ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n"); + if(!is_wow64) + todo_wine ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n"); /* FIXME: Remove when Wine is fixed */ if (res == ERROR_SUCCESS) { @@ -1332,8 +1355,8 @@ pSetupDiDestroyDeviceInfoList(set); res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key); - todo_wine - ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n"); + if(!is_wow64) + todo_wine ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n"); /* FIXME: Remove when Wine is fixed */ if (res == ERROR_SUCCESS) { @@ -1343,24 +1366,183 @@ } } -START_TEST(devinst) +static void testSetupDiGetINFClassA(void) { - HDEVINFO set; + static const char inffile[] = "winetest.inf"; + static const char content[] = "[Version]\r\n\r\n"; - init_function_pointers(); + char cn[MAX_PATH]; + char filename[MAX_PATH]; + DWORD count; + BOOL retval; + GUID guid; + HANDLE h; - /* Win9x/WinMe does things totally different so we skip all the tests - * - * We don't want to exclude NT4 so hence this check. - */ + if(!pSetupDiGetINFClassA) + { + win_skip("SetupDiGetINFClassA not present\n"); + return; + } + + count = GetTempPathA(MAX_PATH, filename); + if(!count) + { + win_skip("GetTempPathA failed\n"); + return; + } + + strcat(filename, inffile); + DeleteFileA(filename); + + /* not existing file */ SetLastError(0xdeadbeef); - set = pSetupDiGetClassDevsW(NULL, NULL, 0, 0); - if (set == INVALID_HANDLE_VALUE && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + if (ERROR_CALL_NOT_IMPLEMENTED == GetLastError()) { - win_skip("Win9x/WinMe has totally different behavior\n"); + skip("SetupDiGetINFClassA is not implemented\n"); return; } + ok(ERROR_FILE_NOT_FOUND == GetLastError(), + "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError()); + /* missing file wins against other invalid parameter */ + SetLastError(0xdeadbeef); + retval = SetupDiGetINFClassA(filename, NULL, cn, MAX_PATH, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + ok(ERROR_FILE_NOT_FOUND == GetLastError(), + "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + retval = SetupDiGetINFClassA(filename, &guid, NULL, MAX_PATH, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + ok(ERROR_FILE_NOT_FOUND == GetLastError(), + "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + retval = SetupDiGetINFClassA(filename, &guid, cn, 0, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + ok(ERROR_FILE_NOT_FOUND == GetLastError(), + "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, NULL); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + ok(ERROR_FILE_NOT_FOUND == GetLastError(), + "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError()); + + /* test file content */ + h = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + if(h == INVALID_HANDLE_VALUE) + { + win_skip("failed to create file %s (error %u)\n", filename, GetLastError()); + return; + } + CloseHandle( h); + + retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + + h = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + if(h == INVALID_HANDLE_VALUE) + { + win_skip("failed to create file %s (error %u)\n", filename, GetLastError()); + return; + } + WriteFile( h, content, sizeof(content), &count, NULL); + CloseHandle( h); + + retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + + WritePrivateProfileStringA("Version", "Signature", "\"$CHICAGO$\"", filename); + + retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + + WritePrivateProfileStringA("Version", "Class", "WINE", filename); + + count = 0xdeadbeef; + retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count); + ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError()); + ok(count == 5, "expected count==5, got %u\n", count); + + count = 0xdeadbeef; + retval = SetupDiGetINFClassA(filename, &guid, cn, 5, &count); + ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError()); + ok(count == 5, "expected count==5, got %u\n", count); + + count = 0xdeadbeef; + SetLastError(0xdeadbeef); + retval = SetupDiGetINFClassA(filename, &guid, cn, 4, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + ok(ERROR_INSUFFICIENT_BUFFER == GetLastError(), + "expected error ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError()); + ok(count == 5, "expected count==5, got %u\n", count); + + /* invalid parameter */ + SetLastError(0xdeadbeef); + retval = SetupDiGetINFClassA(NULL, &guid, cn, MAX_PATH, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + ok(ERROR_INVALID_PARAMETER == GetLastError(), + "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + retval = SetupDiGetINFClassA(filename, NULL, cn, MAX_PATH, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + ok(ERROR_INVALID_PARAMETER == GetLastError(), + "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + retval = SetupDiGetINFClassA(filename, &guid, NULL, MAX_PATH, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + ok(ERROR_INVALID_PARAMETER == GetLastError(), + "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + retval = SetupDiGetINFClassA(filename, &guid, cn, 0, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + ok(ERROR_INSUFFICIENT_BUFFER == GetLastError() || + ERROR_INVALID_PARAMETER == GetLastError(), + "expected error ERROR_INSUFFICIENT_BUFFER or ERROR_INVALID_PARAMETER, " + "got %u\n", GetLastError()); + + DeleteFileA(filename); + + WritePrivateProfileStringA("Version", "Signature", "\"$CHICAGO$\"", filename); + WritePrivateProfileStringA("Version", "ClassGUID", "WINE", filename); + + SetLastError(0xdeadbeef); + retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count); + ok(!retval, "expected SetupDiGetINFClassA to fail!\n"); + ok(RPC_S_INVALID_STRING_UUID == GetLastError() || + ERROR_INVALID_PARAMETER == GetLastError(), + "expected error RPC_S_INVALID_STRING_UUID or ERROR_INVALID_PARAMETER, " + "got %u\n", GetLastError()); + + /* network adapter guid */ + WritePrivateProfileStringA("Version", "ClassGUID", + "{4d36e972-e325-11ce-bfc1-08002be10318}", filename); + + /* this test succeeds only if the guid is known to the system */ + count = 0xdeadbeef; + retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count); + ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError()); + todo_wine + ok(count == 4, "expected count==4, got %u(%s)\n", count, cn); + + DeleteFileA(filename); +} + +START_TEST(devinst) +{ + init_function_pointers(); + + if (pIsWow64Process) + pIsWow64Process(GetCurrentProcess(), &is_wow64); + if (pSetupDiCreateDeviceInfoListExW) test_SetupDiCreateDeviceInfoListEx(); else @@ -1381,4 +1563,5 @@ testRegisterAndGetDetail(); testDeviceRegistryPropertyA(); testDeviceRegistryPropertyW(); + testSetupDiGetINFClassA(); } Index: modules/rostests/winetests/setupapi/diskspace.c =================================================================== --- modules/rostests/winetests/setupapi/diskspace.c (revision 0) +++ modules/rostests/winetests/setupapi/diskspace.c (working copy) @@ -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 + +#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: modules/rostests/winetests/setupapi/diskspace.c =================================================================== --- modules/rostests/winetests/setupapi/diskspace.c (revision 0) +++ modules/rostests/winetests/setupapi/diskspace.c (working copy) Property changes on: modules/rostests/winetests/setupapi/diskspace.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native Index: modules/rostests/winetests/setupapi/install.c =================================================================== --- modules/rostests/winetests/setupapi/install.c (revision 55183) +++ modules/rostests/winetests/setupapi/install.c (working copy) @@ -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"); Index: modules/rostests/winetests/setupapi/misc.c =================================================================== --- modules/rostests/winetests/setupapi/misc.c (revision 55183) +++ modules/rostests/winetests/setupapi/misc.c (working copy) @@ -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'; Index: modules/rostests/winetests/setupapi/parser.c =================================================================== --- modules/rostests/winetests/setupapi/parser.c (revision 55183) +++ modules/rostests/winetests/setupapi/parser.c (working copy) @@ -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++) Index: modules/rostests/winetests/setupapi/query.c =================================================================== --- modules/rostests/winetests/setupapi/query.c (revision 55183) +++ modules/rostests/winetests/setupapi/query.c (working copy) @@ -23,8 +23,8 @@ #include #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: modules/rostests/winetests/setupapi/stringtable.c =================================================================== --- modules/rostests/winetests/setupapi/stringtable.c (revision 55183) +++ modules/rostests/winetests/setupapi/stringtable.c (working copy) @@ -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}; Index: modules/rostests/winetests/setupapi/testlist.c =================================================================== --- modules/rostests/winetests/setupapi/testlist.c (revision 55183) +++ modules/rostests/winetests/setupapi/testlist.c (working copy) @@ -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 },