mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 13:34:53 +00:00
[SETUPAPI_WINETEST] Sync with Wine Staging 4.0. CORE-15682
This commit is contained in:
parent
aee77bdeee
commit
6828353ace
|
@ -13,5 +13,6 @@ list(APPEND SOURCE
|
||||||
|
|
||||||
add_executable(setupapi_winetest ${SOURCE} setupapi.rc)
|
add_executable(setupapi_winetest ${SOURCE} setupapi.rc)
|
||||||
set_module_type(setupapi_winetest win32cui)
|
set_module_type(setupapi_winetest win32cui)
|
||||||
|
target_link_libraries(setupapi_winetest uuid)
|
||||||
add_importlibs(setupapi_winetest advapi32 setupapi user32 shell32 msvcrt kernel32 ntdll)
|
add_importlibs(setupapi_winetest advapi32 setupapi user32 shell32 msvcrt kernel32 ntdll)
|
||||||
add_rostests_file(TARGET setupapi_winetest)
|
add_rostests_file(TARGET setupapi_winetest)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -174,6 +174,45 @@ static void test_registry(void)
|
||||||
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
|
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_install_from(void)
|
||||||
|
{
|
||||||
|
char path[MAX_PATH];
|
||||||
|
HINF infhandle;
|
||||||
|
HKEY key;
|
||||||
|
LONG res;
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
|
/* First create a registry structure we would like to be deleted */
|
||||||
|
ok(!RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest\\setupapitest", &key),
|
||||||
|
"Expected RegCreateKeyA to succeed\n");
|
||||||
|
|
||||||
|
/* Doublecheck if the registry key is present */
|
||||||
|
ok(!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest\\setupapitest", &key),
|
||||||
|
"Expected registry key to exist\n");
|
||||||
|
|
||||||
|
create_inf_file(inffile, cmdline_inf_reg);
|
||||||
|
sprintf(path, "%s\\%s", CURR_DIR, inffile);
|
||||||
|
infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL);
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = SetupInstallFromInfSectionA(NULL, infhandle, "DefaultInstall", SPINST_REGISTRY, key,
|
||||||
|
"A:\\", 0, NULL, NULL, NULL, NULL);
|
||||||
|
ok(ret, "Unexpected failure\n");
|
||||||
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
|
||||||
|
|
||||||
|
/* Check if the registry key is recursively deleted */
|
||||||
|
res = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest", &key);
|
||||||
|
ok(res == ERROR_FILE_NOT_FOUND, "Didn't expect the registry key to exist\n");
|
||||||
|
/* Just in case */
|
||||||
|
if (res == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest\\setupapitest");
|
||||||
|
RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest");
|
||||||
|
}
|
||||||
|
|
||||||
|
SetupCloseInfFile(infhandle);
|
||||||
|
DeleteFileA(inffile);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_install_svc_from(void)
|
static void test_install_svc_from(void)
|
||||||
{
|
{
|
||||||
char inf[2048];
|
char inf[2048];
|
||||||
|
@ -742,6 +781,7 @@ START_TEST(install)
|
||||||
|
|
||||||
test_cmdline();
|
test_cmdline();
|
||||||
test_registry();
|
test_registry();
|
||||||
|
test_install_from();
|
||||||
test_install_svc_from();
|
test_install_svc_from();
|
||||||
test_driver_install();
|
test_driver_install();
|
||||||
test_dirid();
|
test_dirid();
|
||||||
|
|
|
@ -594,7 +594,7 @@ static void test_SetupDecompressOrCopyFile(void)
|
||||||
|
|
||||||
create_source_file(source, uncompressed, sizeof(uncompressed));
|
create_source_file(source, uncompressed, sizeof(uncompressed));
|
||||||
|
|
||||||
for (i = 0; i < sizeof(invalid_parameters)/sizeof(invalid_parameters[0]); i++)
|
for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++)
|
||||||
{
|
{
|
||||||
type = FILE_COMPRESSION_NONE;
|
type = FILE_COMPRESSION_NONE;
|
||||||
ret = SetupDecompressOrCopyFileA(invalid_parameters[i].source,
|
ret = SetupDecompressOrCopyFileA(invalid_parameters[i].source,
|
||||||
|
@ -697,7 +697,7 @@ static void test_SetupDecompressOrCopyFile(void)
|
||||||
|
|
||||||
p = strrchr(target, '\\');
|
p = strrchr(target, '\\');
|
||||||
|
|
||||||
for (i = 0; i < sizeof(zip_multi_tests)/sizeof(zip_multi_tests[0]); i++)
|
for (i = 0; i < ARRAY_SIZE(zip_multi_tests); i++)
|
||||||
{
|
{
|
||||||
lstrcpyA(p + 1, zip_multi_tests[i].filename);
|
lstrcpyA(p + 1, zip_multi_tests[i].filename);
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,8 @@ static const char tmpfilename[] = ".\\tmp.inf";
|
||||||
"aaaaaaaaaaaaaaaa" A256
|
"aaaaaaaaaaaaaaaa" A256
|
||||||
#define A1200 A400 A400 A400
|
#define A1200 A400 A400 A400
|
||||||
#define A511 A255 A256
|
#define A511 A255 A256
|
||||||
#define A4097 "a" A256 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256
|
#define A4096 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256 A256
|
||||||
|
#define A4097 "a" A4096
|
||||||
|
|
||||||
#define STD_HEADER "[Version]\r\nSignature=\"$CHICAGO$\"\r\n"
|
#define STD_HEADER "[Version]\r\nSignature=\"$CHICAGO$\"\r\n"
|
||||||
|
|
||||||
|
@ -154,7 +155,7 @@ static void test_invalid_files(void)
|
||||||
HINF hinf;
|
HINF hinf;
|
||||||
DWORD err;
|
DWORD err;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(invalid_files)/sizeof(invalid_files[0]); i++)
|
for (i = 0; i < ARRAY_SIZE(invalid_files); i++)
|
||||||
{
|
{
|
||||||
SetLastError( 0xdeadbeef );
|
SetLastError( 0xdeadbeef );
|
||||||
err_line = 0xdeadbeef;
|
err_line = 0xdeadbeef;
|
||||||
|
@ -229,7 +230,7 @@ static void test_section_names(void)
|
||||||
DWORD err;
|
DWORD err;
|
||||||
LONG ret;
|
LONG ret;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(section_names)/sizeof(section_names[0]); i++)
|
for (i = 0; i < ARRAY_SIZE(section_names); i++)
|
||||||
{
|
{
|
||||||
SetLastError( 0xdeadbeef );
|
SetLastError( 0xdeadbeef );
|
||||||
hinf = test_file_contents( section_names[i].data, &err_line );
|
hinf = test_file_contents( section_names[i].data, &err_line );
|
||||||
|
@ -418,7 +419,7 @@ static void test_key_names(void)
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
INFCONTEXT context;
|
INFCONTEXT context;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(key_names)/sizeof(key_names[0]); i++)
|
for (i = 0; i < ARRAY_SIZE(key_names); i++)
|
||||||
{
|
{
|
||||||
strcpy( buffer, STD_HEADER "[Test]\n" );
|
strcpy( buffer, STD_HEADER "[Test]\n" );
|
||||||
strcat( buffer, key_names[i].data );
|
strcat( buffer, key_names[i].data );
|
||||||
|
@ -452,6 +453,11 @@ static void test_key_names(void)
|
||||||
!strcmp( field, A1200), /* Vista, W2K8 */
|
!strcmp( field, A1200), /* Vista, W2K8 */
|
||||||
"line %u: bad field %s/%s\n",
|
"line %u: bad field %s/%s\n",
|
||||||
i, field, key_names[i].fields[index] );
|
i, field, key_names[i].fields[index] );
|
||||||
|
else if (i == 52)
|
||||||
|
ok( !strcmp( field, key_names[i].fields[index] ) ||
|
||||||
|
!strcmp( field, A4096), /* Win10 >= 1709 */
|
||||||
|
"line %u: bad field %s/%s\n",
|
||||||
|
i, field, key_names[i].fields[index] );
|
||||||
else /* don't compare drive letter of paths */
|
else /* don't compare drive letter of paths */
|
||||||
if (field[0] && field[1] == ':' && field[2] == '\\')
|
if (field[0] && field[1] == ':' && field[2] == '\\')
|
||||||
ok( !strcmp( field + 1, key_names[i].fields[index] + 1 ),
|
ok( !strcmp( field + 1, key_names[i].fields[index] + 1 ),
|
||||||
|
@ -622,7 +628,7 @@ static void test_SetupGetIntField(void)
|
||||||
};
|
};
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(keys)/sizeof(keys[0]); i++)
|
for (i = 0; i < ARRAY_SIZE(keys); i++)
|
||||||
{
|
{
|
||||||
HINF hinf;
|
HINF hinf;
|
||||||
char buffer[MAX_INF_STRING_LENGTH];
|
char buffer[MAX_INF_STRING_LENGTH];
|
||||||
|
|
|
@ -109,7 +109,7 @@ static void test_invalid_parametersA(void)
|
||||||
|
|
||||||
create_source_fileA(source, NULL, 0);
|
create_source_fileA(source, NULL, 0);
|
||||||
|
|
||||||
for (i = 0; i < sizeof(invalid_parameters)/sizeof(invalid_parameters[0]); i++)
|
for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++)
|
||||||
{
|
{
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = SetupIterateCabinetA(invalid_parameters[i].CabinetFile, 0,
|
ret = SetupIterateCabinetA(invalid_parameters[i].CabinetFile, 0,
|
||||||
|
@ -170,12 +170,12 @@ static void test_invalid_parametersW(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetTempPathW(sizeof(temp)/sizeof(WCHAR), temp);
|
GetTempPathW(ARRAY_SIZE(temp), temp);
|
||||||
GetTempFileNameW(temp, docW, 0, source);
|
GetTempFileNameW(temp, docW, 0, source);
|
||||||
|
|
||||||
create_source_fileW(source, NULL, 0);
|
create_source_fileW(source, NULL, 0);
|
||||||
|
|
||||||
for (i = 0; i < sizeof(invalid_parameters)/sizeof(invalid_parameters[0]); i++)
|
for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++)
|
||||||
{
|
{
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = SetupIterateCabinetW(invalid_parameters[i].CabinetFile, 0,
|
ret = SetupIterateCabinetW(invalid_parameters[i].CabinetFile, 0,
|
||||||
|
@ -275,7 +275,7 @@ static void test_invalid_callbackW(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetTempPathW(sizeof(temp)/sizeof(WCHAR), temp);
|
GetTempPathW(ARRAY_SIZE(temp), temp);
|
||||||
GetTempFileNameW(temp, docW, 0, source);
|
GetTempFileNameW(temp, docW, 0, source);
|
||||||
|
|
||||||
create_source_fileW(source, comp_cab_zip_multi, sizeof(comp_cab_zip_multi));
|
create_source_fileW(source, comp_cab_zip_multi, sizeof(comp_cab_zip_multi));
|
||||||
|
@ -331,7 +331,7 @@ static UINT CALLBACK simple_callbackA(PVOID Context, UINT Notification,
|
||||||
|
|
||||||
ctx->count++;
|
ctx->count++;
|
||||||
|
|
||||||
if (index < sizeof(expected_files)/sizeof(char *))
|
if (index < ARRAY_SIZE(expected_files))
|
||||||
{
|
{
|
||||||
ok(!strcmp(expected_files[index], info->NameInCabinet),
|
ok(!strcmp(expected_files[index], info->NameInCabinet),
|
||||||
"[%d] Expected file \"%s\", got \"%s\"\n",
|
"[%d] Expected file \"%s\", got \"%s\"\n",
|
||||||
|
@ -389,8 +389,7 @@ static void test_simple_enumerationA(void)
|
||||||
ctx.target = target;
|
ctx.target = target;
|
||||||
ret = SetupIterateCabinetA(source, 0, simple_callbackA, &ctx);
|
ret = SetupIterateCabinetA(source, 0, simple_callbackA, &ctx);
|
||||||
ok(ret == 1, "Expected SetupIterateCabinetA to return 1, got %d\n", ret);
|
ok(ret == 1, "Expected SetupIterateCabinetA to return 1, got %d\n", ret);
|
||||||
ok(ctx.count == sizeof(expected_files)/sizeof(char *),
|
ok(ctx.count == ARRAY_SIZE(expected_files), "Unexpectedly enumerated %d files\n", ctx.count);
|
||||||
"Unexpectedly enumerated %d files\n", ctx.count);
|
|
||||||
|
|
||||||
DeleteFileA(source);
|
DeleteFileA(source);
|
||||||
DeleteFileA(target);
|
DeleteFileA(target);
|
||||||
|
@ -434,7 +433,7 @@ static UINT CALLBACK simple_callbackW(PVOID Context, UINT Notification,
|
||||||
|
|
||||||
ctx->count++;
|
ctx->count++;
|
||||||
|
|
||||||
if (index < sizeof(expected_filesW)/sizeof(WCHAR *))
|
if (index < ARRAY_SIZE(expected_filesW))
|
||||||
{
|
{
|
||||||
ok(!lstrcmpW(expected_filesW[index], info->NameInCabinet),
|
ok(!lstrcmpW(expected_filesW[index], info->NameInCabinet),
|
||||||
"[%d] Expected file %s, got %s\n",
|
"[%d] Expected file %s, got %s\n",
|
||||||
|
@ -488,7 +487,7 @@ static void test_simple_enumerationW(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetTempPathW(sizeof(temp)/sizeof(WCHAR), temp);
|
GetTempPathW(ARRAY_SIZE(temp), temp);
|
||||||
GetTempFileNameW(temp, docW, 0, source);
|
GetTempFileNameW(temp, docW, 0, source);
|
||||||
GetTempFileNameW(temp, docW, 0, target);
|
GetTempFileNameW(temp, docW, 0, target);
|
||||||
|
|
||||||
|
@ -499,8 +498,7 @@ static void test_simple_enumerationW(void)
|
||||||
ctx.target = target;
|
ctx.target = target;
|
||||||
ret = SetupIterateCabinetW(source, 0, simple_callbackW, &ctx);
|
ret = SetupIterateCabinetW(source, 0, simple_callbackW, &ctx);
|
||||||
ok(ret == 1, "Expected SetupIterateCabinetW to return 1, got %d\n", ret);
|
ok(ret == 1, "Expected SetupIterateCabinetW to return 1, got %d\n", ret);
|
||||||
ok(ctx.count == sizeof(expected_files)/sizeof(WCHAR *),
|
ok(ctx.count == ARRAY_SIZE(expected_files), "Unexpectedly enumerated %d files\n", ctx.count);
|
||||||
"Unexpectedly enumerated %d files\n", ctx.count);
|
|
||||||
|
|
||||||
DeleteFileW(source);
|
DeleteFileW(source);
|
||||||
DeleteFileW(target);
|
DeleteFileW(target);
|
||||||
|
|
Loading…
Reference in a new issue