[WINESYNC] setupapi/tests: Don't test function directly when reporting GetLastError().

wine commit id 4b09ed1486b4c880c7ed1cbbfd3d9b1335f4d4ab by André Zwing <nerv@dawncrow.de>

[WINESYNC] setupapi/tests: Add tests for FLG_ADDREG_APPEND.

wine commit id d7c8279c08c25e2afddb33184522386e928d5497 by Zebediah Figura <zfigura@codeweavers.com>

[WINESYNC] setupapi: Fail installation when trying to append to a registry value of the wrong type.

wine commit id 0ab56b88dfdca442ab0820eacc14f6397f628924 by Zebediah Figura <zfigura@codeweavers.com>

[WINESYNC] setupapi: Create the registry value if it doesn't exist in append_multi_sz_value().

wine commit id 38e36e8fdaf6dc682ce5af7b5b00cb795fffd967 by Zebediah Figura <zfigura@codeweavers.com>

[WINESYNC] setupapi: Use standard va_list instead of __ms_va_list.

wine commit id d3a9fa181cbf81f6b920d6ddc3760e78d1d18601 by Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
winesync 2023-09-14 22:08:41 +02:00 committed by Hermès Bélusca-Maïto
parent a2e8fba9b1
commit 24d5860370
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 103 additions and 4 deletions

View file

@ -60,7 +60,7 @@ static void promptdisk_init(HWND hwnd, struct promptdisk_params *params)
args[1] = (DWORD_PTR)unknown;
}
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
format, 0, 0, message, ARRAY_SIZE(message), (__ms_va_list*)args);
format, 0, 0, message, ARRAY_SIZE(message), (va_list *)args);
SetDlgItemTextW(hwnd, IDC_FILENEEDED, message);
LoadStringW(SETUPAPI_hInstance, IDS_INFO, message, ARRAY_SIZE(message));

View file

@ -2291,8 +2291,106 @@ static void test_rename(void)
ok(delete_file("a/six.txt"), "File should exist.\n");
SetupCloseFileQueue(queue);
ok(delete_file("a/"), "Failed to delete directory, error %lu.\n", GetLastError());
ok(delete_file("b/"), "Failed to delete directory, error %lu.\n", GetLastError());
ret = delete_file("a/");
ok(ret, "Failed to delete directory, error %lu.\n", GetLastError());
ret = delete_file("b/");
ok(ret, "Failed to delete directory, error %lu.\n", GetLastError());
}
static void test_append_reg(void)
{
static const char inf_data[] = "[Version]\n"
"Signature=\"$Chicago$\"\n"
"[DefaultInstall]\n"
"AddReg=reg_section\n"
"[reg_section]\n"
"HKCU,Software\\winetest_setupapi,value,0x10008,\"data\"\n";
void *context = SetupInitDefaultQueueCallbackEx(NULL, INVALID_HANDLE_VALUE, 0, 0, 0);
char path[MAX_PATH];
DWORD type, size;
char value[20];
HINF hinf;
BOOL ret;
HKEY key;
LONG l;
create_inf_file("test.inf", inf_data);
sprintf(path, "%s\\test.inf", CURR_DIR);
hinf = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL);
ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#lx.\n", GetLastError());
/* Key doesn't exist yet. */
RegDeleteKeyA(HKEY_CURRENT_USER, "winetest_setupapi");
ret = SetupInstallFromInfSectionA(NULL, hinf, "DefaultInstall", SPINST_REGISTRY,
NULL, "C:\\", 0, SetupDefaultQueueCallbackA, context, NULL, NULL);
ok(ret, "Failed to install, error %#lx.\n", GetLastError());
l = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\winetest_setupapi", &key);
ok(!l, "Got error %lu.\n", l);
size = sizeof(value);
l = RegQueryValueExA(key, "value", NULL, &type, (BYTE *)value, &size);
ok(!l, "Got error %lu.\n", l);
ok(type == REG_MULTI_SZ, "Got type %#lx.\n", type);
ok(size == sizeof("data\0"), "Got size %lu.\n", size);
ok(!memcmp(value, "data\0", size), "Got data %s.\n", debugstr_an(value, size));
/* Key exists and already has a value. */
l = RegSetValueExA(key, "value", 0, REG_MULTI_SZ, (const BYTE *)"foo\0bar\0", sizeof("foo\0bar\0"));
ok(!l, "Got error %lu.\n", l);
ret = SetupInstallFromInfSectionA(NULL, hinf, "DefaultInstall", SPINST_REGISTRY,
NULL, "C:\\", 0, SetupDefaultQueueCallbackA, context, NULL, NULL);
ok(ret, "Failed to install, error %#lx.\n", GetLastError());
size = sizeof(value);
l = RegQueryValueExA(key, "value", NULL, &type, (BYTE *)value, &size);
ok(!l, "Got error %lu.\n", l);
ok(type == REG_MULTI_SZ, "Got type %#lx.\n", type);
ok(size == sizeof("foo\0bar\0data\0"), "Got size %lu.\n", size);
ok(!memcmp(value, "foo\0bar\0data\0", size), "Got data %s.\n", debugstr_an(value, size));
/* Key exists and already has the value to be added. */
ret = SetupInstallFromInfSectionA(NULL, hinf, "DefaultInstall", SPINST_REGISTRY,
NULL, "C:\\", 0, SetupDefaultQueueCallbackA, context, NULL, NULL);
ok(ret, "Failed to install, error %#lx.\n", GetLastError());
size = sizeof(value);
l = RegQueryValueExA(key, "value", NULL, &type, (BYTE *)value, &size);
ok(!l, "Got error %lu.\n", l);
ok(type == REG_MULTI_SZ, "Got type %#lx.\n", type);
ok(size == sizeof("foo\0bar\0data\0"), "Got size %lu.\n", size);
ok(!memcmp(value, "foo\0bar\0data\0", size), "Got data %s.\n", debugstr_an(value, size));
/* Key exists and already has a value of the wrong type. */
l = RegSetValueExA(key, "value", 0, REG_SZ, (const BYTE *)"string", sizeof("string"));
ok(!l, "Got error %lu.\n", l);
ret = SetupInstallFromInfSectionA(NULL, hinf, "DefaultInstall", SPINST_REGISTRY,
NULL, "C:\\", 0, SetupDefaultQueueCallbackA, context, NULL, NULL);
ok(!ret, "Expected failure.\n");
ok(GetLastError() == ERROR_INVALID_DATA, "Got error %#lx.\n", GetLastError());
size = sizeof(value);
l = RegQueryValueExA(key, "value", NULL, &type, (BYTE *)value, &size);
ok(!l, "Got error %lu.\n", l);
ok(type == REG_SZ, "Got type %#lx.\n", type);
ok(size == sizeof("string"), "Got size %lu.\n", size);
ok(!memcmp(value, "string", size), "Got data %s.\n", debugstr_an(value, size));
RegCloseKey(key);
l = RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\winetest_setupapi");
ok(!l, "Got error %lu.\n", l);
SetupCloseInfFile(hinf);
ret = DeleteFileA("test.inf");
ok(ret, "Failed to delete INF file, error %lu.\n", GetLastError());
}
static WCHAR service_name[] = L"Wine Test Service";
@ -2404,6 +2502,7 @@ START_TEST(install)
test_start_copy();
test_register_dlls();
test_rename();
test_append_reg();
UnhookWindowsHookEx(hhook);

View file

@ -10,4 +10,4 @@ files:
dlls/setupapi/setupcab.c: dll/win32/setupapi/setupcab.c
dlls/setupapi/stringtable.c: dll/win32/setupapi/stringtable_wine.c
tags:
wine: 1172e66e5b7fa96decf89f8866e71b77e5773ec7
wine: d3a9fa181cbf81f6b920d6ddc3760e78d1d18601