kernel32/tests: Change file name to avoid collision with other tests.

Entries in IniFileMapping are persisted in Windows until the next
reboot, even if removed from the registry. This made the
function test_registry_mapping to cause other tests
that accessed the actual winetest.ini file to fail if the
profile test was run more than once on Windows without rebooting.

Signed-off-by: Carlos Rivera <carlos@superkaos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Carlos Rivera 2020-09-01 11:17:36 +02:00 committed by Alexandre Julliard
parent a350012240
commit 00a0e2cd8c
1 changed files with 91 additions and 91 deletions

View File

@ -1203,7 +1203,7 @@ static void test_registry_mapping(void)
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = RegCreateKeyExA(HKEY_LOCAL_MACHINE, ret = RegCreateKeyExA(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping\\winetest.ini", "Software\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping\\winetest_map.ini",
0, NULL, 0, KEY_READ | KEY_WRITE | KEY_WOW64_64KEY, NULL, &mapping_key, NULL); 0, NULL, 0, KEY_READ | KEY_WRITE | KEY_WOW64_64KEY, NULL, &mapping_key, NULL);
if (ret == ERROR_ACCESS_DENIED) if (ret == ERROR_ACCESS_DENIED)
{ {
@ -1214,16 +1214,16 @@ static void test_registry_mapping(void)
ret = RegSetValueExA(mapping_key, "section1", 0, REG_SZ, (BYTE *)"USR:winetest_map", sizeof("USR:winetest_map")); ret = RegSetValueExA(mapping_key, "section1", 0, REG_SZ, (BYTE *)"USR:winetest_map", sizeof("USR:winetest_map"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest.ini"); ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest_map.ini");
todo_wine ok(ret, "got error %u\n", GetLastError()); todo_wine ok(ret, "got error %u\n", GetLastError());
check_profile_string("section1", "name1", "winetest.ini", "default"); check_profile_string("section1", "name1", "winetest_map.ini", "default");
ret = WritePrivateProfileStringA("section1", "name1", "value1", "winetest.ini"); ret = WritePrivateProfileStringA("section1", "name1", "value1", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section1", "name1", "winetest.ini", "value1"); check_profile_string("section1", "name1", "winetest_map.ini", "value1");
check_profile_string("section1", "name1", "C:/fake/path/winetest.ini", "value1"); check_profile_string("section1", "name1", "C:/fake/path/winetest_map.ini", "value1");
ret = RegOpenKeyExA(HKEY_CURRENT_USER, "winetest_map", 0, KEY_READ | KEY_WRITE, &mapped_key); ret = RegOpenKeyExA(HKEY_CURRENT_USER, "winetest_map", 0, KEY_READ | KEY_WRITE, &mapped_key);
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
@ -1232,12 +1232,12 @@ static void test_registry_mapping(void)
ret = RegSetValueExA(mapped_key, "name2", 0, REG_SZ, (BYTE *)"value2", sizeof("value2")); ret = RegSetValueExA(mapped_key, "name2", 0, REG_SZ, (BYTE *)"value2", sizeof("value2"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
check_profile_string("section1", "name2", "winetest.ini", "value2"); check_profile_string("section1", "name2", "winetest_map.ini", "value2");
ret = GetFileAttributesA("C:/windows/winetest.ini"); ret = GetFileAttributesA("C:/windows/winetest_map.ini");
ok(ret == INVALID_FILE_ATTRIBUTES, "winetest.ini should not exist.\n"); ok(ret == INVALID_FILE_ATTRIBUTES, "winetest_map.ini should not exist.\n");
ret = WritePrivateProfileStringA("section1", "name2", NULL, "winetest.ini"); ret = WritePrivateProfileStringA("section1", "name2", NULL, "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = RegQueryValueExA(mapped_key, "name2", 0, NULL, NULL, NULL); ret = RegQueryValueExA(mapped_key, "name2", 0, NULL, NULL, NULL);
ok(ret == ERROR_FILE_NOT_FOUND, "got error %u\n", ret); ok(ret == ERROR_FILE_NOT_FOUND, "got error %u\n", ret);
@ -1246,35 +1246,35 @@ static void test_registry_mapping(void)
ret = RegSetValueExA(mapped_key, "name3", 0, REG_DWORD, (BYTE *)&ivalue, sizeof(ivalue)); ret = RegSetValueExA(mapped_key, "name3", 0, REG_DWORD, (BYTE *)&ivalue, sizeof(ivalue));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
check_profile_string("section1", "name3", "winetest.ini", "default"); check_profile_string("section1", "name3", "winetest_map.ini", "default");
ret = GetPrivateProfileIntA("section1", "name3", 0, "winetest.ini"); ret = GetPrivateProfileIntA("section1", "name3", 0, "winetest_map.ini");
ok(ret == 0, "got %#x\n", ret); ok(ret == 0, "got %#x\n", ret);
ret = RegSetValueExA(mapped_key, "name3", 0, REG_BINARY, (BYTE *)"value3", sizeof("value3")); ret = RegSetValueExA(mapped_key, "name3", 0, REG_BINARY, (BYTE *)"value3", sizeof("value3"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
check_profile_string("section1", "name3", "winetest.ini", "default"); check_profile_string("section1", "name3", "winetest_map.ini", "default");
ret = RegSetValueExA(mapped_key, "name3", 0, REG_MULTI_SZ, (BYTE *)"one\0two\0", sizeof("one\0two\0")); ret = RegSetValueExA(mapped_key, "name3", 0, REG_MULTI_SZ, (BYTE *)"one\0two\0", sizeof("one\0two\0"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
check_profile_string("section1", "name3", "winetest.ini", "default"); check_profile_string("section1", "name3", "winetest_map.ini", "default");
ret = RegSetValueExA(mapped_key, "name3", 0, REG_EXPAND_SZ, (BYTE *)"x%SystemRoot%", sizeof("x%SystemRoot%")); ret = RegSetValueExA(mapped_key, "name3", 0, REG_EXPAND_SZ, (BYTE *)"x%SystemRoot%", sizeof("x%SystemRoot%"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
check_profile_string("section1", "name3", "winetest.ini", "default"); check_profile_string("section1", "name3", "winetest_map.ini", "default");
/* Test WritePrivateProfileSection(). Unlike with .ini files, it doesn't /* Test WritePrivateProfileSection(). Unlike with .ini files, it doesn't
* remove existing entries. */ * remove existing entries. */
ret = WritePrivateProfileStringA("section1", "name4", "value4", "winetest.ini"); ret = WritePrivateProfileStringA("section1", "name4", "value4", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = WritePrivateProfileStringA("section1", "name5", "value5", "winetest.ini"); ret = WritePrivateProfileStringA("section1", "name5", "value5", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = WritePrivateProfileSectionA("section1", "name4=four\0name6=six\0", "winetest.ini"); ret = WritePrivateProfileSectionA("section1", "name4=four\0name6=six\0", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section1", "name4", "winetest.ini", "four"); check_profile_string("section1", "name4", "winetest_map.ini", "four");
check_profile_string("section1", "name5", "winetest.ini", "value5"); check_profile_string("section1", "name5", "winetest_map.ini", "value5");
check_profile_string("section1", "name6", "winetest.ini", "six"); check_profile_string("section1", "name6", "winetest_map.ini", "six");
/* Test deleting the section. */ /* Test deleting the section. */
@ -1284,17 +1284,17 @@ static void test_registry_mapping(void)
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
RegCloseKey(mapped_key); RegCloseKey(mapped_key);
ret = WritePrivateProfileStringA("section1", "name1", "value1", "winetest.ini"); ret = WritePrivateProfileStringA("section1", "name1", "value1", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = WritePrivateProfileStringA("section1", NULL, NULL, "winetest.ini"); ret = WritePrivateProfileStringA("section1", NULL, NULL, "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section1", "name1", "winetest.ini", "default"); check_profile_string("section1", "name1", "winetest_map.ini", "default");
ret = WritePrivateProfileStringA("section1", "name1", "value1", "winetest.ini"); ret = WritePrivateProfileStringA("section1", "name1", "value1", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = WritePrivateProfileSectionA("section1", NULL, "winetest.ini"); ret = WritePrivateProfileSectionA("section1", NULL, "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section1", "name1", "winetest.ini", "default"); check_profile_string("section1", "name1", "winetest_map.ini", "default");
ret = RegDeleteKeyA(HKEY_CURRENT_USER, "winetest_map\\subkey"); ret = RegDeleteKeyA(HKEY_CURRENT_USER, "winetest_map\\subkey");
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
@ -1304,44 +1304,44 @@ static void test_registry_mapping(void)
/* Test GetPrivateProfileSectionNames(). */ /* Test GetPrivateProfileSectionNames(). */
memset(buffer, 0xcc, sizeof(buffer)); memset(buffer, 0xcc, sizeof(buffer));
ret = GetPrivateProfileSectionNamesA(buffer, 5, "winetest.ini"); ret = GetPrivateProfileSectionNamesA(buffer, 5, "winetest_map.ini");
ok(ret == 3, "got %u\n", ret); ok(ret == 3, "got %u\n", ret);
ok(!memcmp(buffer, "sec\0", 5), "got %s\n", debugstr_an(buffer, ret)); ok(!memcmp(buffer, "sec\0", 5), "got %s\n", debugstr_an(buffer, ret));
memset(buffer, 0xcc, sizeof(buffer)); memset(buffer, 0xcc, sizeof(buffer));
ret = GetPrivateProfileSectionNamesA(buffer, sizeof(buffer), "winetest.ini"); ret = GetPrivateProfileSectionNamesA(buffer, sizeof(buffer), "winetest_map.ini");
ok(ret == 9, "got %u\n", ret); ok(ret == 9, "got %u\n", ret);
ok(!memcmp(buffer, "section1\0", 10), "got %s\n", debugstr_an(buffer, ret)); ok(!memcmp(buffer, "section1\0", 10), "got %s\n", debugstr_an(buffer, ret));
ret = WritePrivateProfileStringA("file_section", "name1", "value1", "winetest.ini"); ret = WritePrivateProfileStringA("file_section", "name1", "value1", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
memset(buffer, 0xcc, sizeof(buffer)); memset(buffer, 0xcc, sizeof(buffer));
ret = GetPrivateProfileSectionNamesA(buffer, 5, "winetest.ini"); ret = GetPrivateProfileSectionNamesA(buffer, 5, "winetest_map.ini");
ok(ret == 3, "got %u\n", ret); ok(ret == 3, "got %u\n", ret);
ok(!memcmp(buffer, "sec\0", 5), "got %s\n", debugstr_an(buffer, ret)); ok(!memcmp(buffer, "sec\0", 5), "got %s\n", debugstr_an(buffer, ret));
memset(buffer, 0xcc, sizeof(buffer)); memset(buffer, 0xcc, sizeof(buffer));
ret = GetPrivateProfileSectionNamesA(buffer, sizeof(buffer), "winetest.ini"); ret = GetPrivateProfileSectionNamesA(buffer, sizeof(buffer), "winetest_map.ini");
ok(ret == 22, "got %u\n", ret); ok(ret == 22, "got %u\n", ret);
ok(!memcmp(buffer, "section1\0file_section\0", 23), "got %s\n", debugstr_an(buffer, ret)); ok(!memcmp(buffer, "section1\0file_section\0", 23), "got %s\n", debugstr_an(buffer, ret));
ret = DeleteFileA("C:/windows/winetest.ini"); ret = DeleteFileA("C:/windows/winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
/* Test the SYS: prefix. */ /* Test the SYS: prefix. */
ret = RegSetValueExA(mapping_key, "section2", 0, REG_SZ, (BYTE *)"SYS:winetest_map", sizeof("SYS:winetest_map")); ret = RegSetValueExA(mapping_key, "section2", 0, REG_SZ, (BYTE *)"SYS:winetest_map", sizeof("SYS:winetest_map"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest.ini"); ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest_map.ini");
todo_wine ok(ret, "got error %u\n", GetLastError()); todo_wine ok(ret, "got error %u\n", GetLastError());
check_profile_string("section2", "name1", "winetest.ini", "default"); check_profile_string("section2", "name1", "winetest_map.ini", "default");
ret = WritePrivateProfileStringA("section2", "name1", "value1", "winetest.ini"); ret = WritePrivateProfileStringA("section2", "name1", "value1", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section2", "name1", "winetest.ini", "value1"); check_profile_string("section2", "name1", "winetest_map.ini", "value1");
ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\winetest_map", 0, KEY_READ | KEY_WRITE, &mapped_key); ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\winetest_map", 0, KEY_READ | KEY_WRITE, &mapped_key);
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
@ -1350,10 +1350,10 @@ static void test_registry_mapping(void)
ret = RegSetValueExA(mapped_key, "name2", 0, REG_SZ, (BYTE *)"value2", sizeof("value2")); ret = RegSetValueExA(mapped_key, "name2", 0, REG_SZ, (BYTE *)"value2", sizeof("value2"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
check_profile_string("section2", "name2", "winetest.ini", "value2"); check_profile_string("section2", "name2", "winetest_map.ini", "value2");
ret = GetFileAttributesA("C:/windows/winetest.ini"); ret = GetFileAttributesA("C:/windows/winetest_map.ini");
ok(ret == INVALID_FILE_ATTRIBUTES, "winetest.ini should not exist.\n"); ok(ret == INVALID_FILE_ATTRIBUTES, "winetest_map.ini should not exist.\n");
ret = RegDeleteKeyA(mapped_key, ""); ret = RegDeleteKeyA(mapped_key, "");
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
@ -1361,24 +1361,24 @@ static void test_registry_mapping(void)
/* Try writing directly to the .ini file on disk instead. */ /* Try writing directly to the .ini file on disk instead. */
ret = WritePrivateProfileStringA("section3", "name1", "value1", "winetest.ini"); ret = WritePrivateProfileStringA("section3", "name1", "value1", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section3", "name1", "winetest.ini", "value1"); check_profile_string("section3", "name1", "winetest_map.ini", "value1");
ret = RegSetValueExA(mapping_key, "section3", 0, REG_SZ, (BYTE *)"USR:winetest_map", sizeof("USR:winetest_map")); ret = RegSetValueExA(mapping_key, "section3", 0, REG_SZ, (BYTE *)"USR:winetest_map", sizeof("USR:winetest_map"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest.ini"); ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest_map.ini");
todo_wine ok(ret, "got error %u\n", GetLastError()); todo_wine ok(ret, "got error %u\n", GetLastError());
check_profile_string("section3", "name1", "winetest.ini", "default"); check_profile_string("section3", "name1", "winetest_map.ini", "default");
ret = RegOpenKeyExA(HKEY_CURRENT_USER, "winetest_section3", 0, KEY_READ | KEY_WRITE, &mapped_key); ret = RegOpenKeyExA(HKEY_CURRENT_USER, "winetest_section3", 0, KEY_READ | KEY_WRITE, &mapped_key);
ok(ret == ERROR_FILE_NOT_FOUND, "got error %u\n", ret); ok(ret == ERROR_FILE_NOT_FOUND, "got error %u\n", ret);
ret = WritePrivateProfileStringA("section3", "name1", "value2", "winetest.ini"); ret = WritePrivateProfileStringA("section3", "name1", "value2", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section3", "name1", "winetest.ini", "value2"); check_profile_string("section3", "name1", "winetest_map.ini", "value2");
ret = RegOpenKeyExA(HKEY_CURRENT_USER, "winetest_map", 0, KEY_READ | KEY_WRITE, &mapped_key); ret = RegOpenKeyExA(HKEY_CURRENT_USER, "winetest_map", 0, KEY_READ | KEY_WRITE, &mapped_key);
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
@ -1389,30 +1389,30 @@ static void test_registry_mapping(void)
ret = RegDeleteValueA(mapping_key, "section3"); ret = RegDeleteValueA(mapping_key, "section3");
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest.ini"); ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest_map.ini");
todo_wine ok(ret, "got error %u\n", GetLastError()); todo_wine ok(ret, "got error %u\n", GetLastError());
check_profile_string("section3", "name1", "winetest.ini", "value1"); check_profile_string("section3", "name1", "winetest_map.ini", "value1");
ret = DeleteFileA("C:/windows/winetest.ini"); ret = DeleteFileA("C:/windows/winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
/* Test default keys. */ /* Test default keys. */
ret = WritePrivateProfileStringA("section4", "name1", "value1", "winetest.ini"); ret = WritePrivateProfileStringA("section4", "name1", "value1", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section4", "name1", "winetest.ini", "value1"); check_profile_string("section4", "name1", "winetest_map.ini", "value1");
ret = DeleteFileA("C:/windows/winetest.ini"); ret = DeleteFileA("C:/windows/winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = RegSetValueExA(mapping_key, NULL, 0, REG_SZ, (BYTE *)"SYS:winetest_default", sizeof("SYS:winetest_default")); ret = RegSetValueExA(mapping_key, NULL, 0, REG_SZ, (BYTE *)"SYS:winetest_default", sizeof("SYS:winetest_default"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest.ini"); ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest_map.ini");
todo_wine ok(ret, "got error %u\n", GetLastError()); todo_wine ok(ret, "got error %u\n", GetLastError());
ret = WritePrivateProfileStringA("section4", "name1", "value1", "winetest.ini"); ret = WritePrivateProfileStringA("section4", "name1", "value1", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\winetest_default\\section4", 0, KEY_READ, &mapped_key); ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\winetest_default\\section4", 0, KEY_READ, &mapped_key);
@ -1427,10 +1427,10 @@ static void test_registry_mapping(void)
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
RegCloseKey(mapped_key); RegCloseKey(mapped_key);
check_profile_string("section5", "name2", "winetest.ini", "value2"); check_profile_string("section5", "name2", "winetest_map.ini", "value2");
ret = GetFileAttributesA("C:/windows/winetest.ini"); ret = GetFileAttributesA("C:/windows/winetest_map.ini");
ok(ret == INVALID_FILE_ATTRIBUTES, "winetest.ini should not exist.\n"); ok(ret == INVALID_FILE_ATTRIBUTES, "winetest_map.ini should not exist.\n");
ret = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "Software\\winetest_default\\Section4"); ret = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "Software\\winetest_default\\Section4");
ret = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "Software\\winetest_default\\Section5"); ret = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "Software\\winetest_default\\Section5");
@ -1447,12 +1447,12 @@ static void test_registry_mapping(void)
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
ret = RegSetValueExA(mapping_subkey, "name2", 0, REG_SZ, (BYTE *)"SYS:winetest_name2", sizeof("SYS:winetest_name2")); ret = RegSetValueExA(mapping_subkey, "name2", 0, REG_SZ, (BYTE *)"SYS:winetest_name2", sizeof("SYS:winetest_name2"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest.ini"); ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest_map.ini");
todo_wine ok(ret, "got error %u\n", GetLastError()); todo_wine ok(ret, "got error %u\n", GetLastError());
ret = WritePrivateProfileStringA("section6", "name1", "value1", "winetest.ini"); ret = WritePrivateProfileStringA("section6", "name1", "value1", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section6", "name1", "winetest.ini", "value1"); check_profile_string("section6", "name1", "winetest_map.ini", "value1");
ret = RegOpenKeyExA(HKEY_CURRENT_USER, "winetest_name1", 0, KEY_READ | KEY_WRITE, &mapped_key); ret = RegOpenKeyExA(HKEY_CURRENT_USER, "winetest_name1", 0, KEY_READ | KEY_WRITE, &mapped_key);
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
@ -1460,13 +1460,13 @@ static void test_registry_mapping(void)
ret = RegSetValueExA(mapped_key, "name1", 0, REG_SZ, (BYTE *)"one", sizeof("one")); ret = RegSetValueExA(mapped_key, "name1", 0, REG_SZ, (BYTE *)"one", sizeof("one"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
check_profile_string("section6", "name1", "winetest.ini", "one"); check_profile_string("section6", "name1", "winetest_map.ini", "one");
ret = RegDeleteKeyA(mapped_key, ""); ret = RegDeleteKeyA(mapped_key, "");
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
RegCloseKey(mapped_key); RegCloseKey(mapped_key);
ret = WritePrivateProfileStringA("section6", "name2", "value2", "winetest.ini"); ret = WritePrivateProfileStringA("section6", "name2", "value2", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\winetest_name2", 0, KEY_READ | KEY_WRITE, &mapped_key); ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\winetest_name2", 0, KEY_READ | KEY_WRITE, &mapped_key);
@ -1475,31 +1475,31 @@ static void test_registry_mapping(void)
ret = RegSetValueExA(mapped_key, "name2", 0, REG_SZ, (BYTE *)"two", sizeof("two")); ret = RegSetValueExA(mapped_key, "name2", 0, REG_SZ, (BYTE *)"two", sizeof("two"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
check_profile_string("section6", "name2", "winetest.ini", "two"); check_profile_string("section6", "name2", "winetest_map.ini", "two");
ret = RegDeleteKeyA(mapped_key, ""); ret = RegDeleteKeyA(mapped_key, "");
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
RegCloseKey(mapped_key); RegCloseKey(mapped_key);
ret = WritePrivateProfileStringA("section6", "name3", "value3", "winetest.ini"); ret = WritePrivateProfileStringA("section6", "name3", "value3", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section6", "name3", "winetest.ini", "value3"); check_profile_string("section6", "name3", "winetest_map.ini", "value3");
ret = DeleteFileA("C:/windows/winetest.ini"); ret = DeleteFileA("C:/windows/winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
/* Test name-specific mapping with Get/WritePrivateProfileSection(). */ /* Test name-specific mapping with Get/WritePrivateProfileSection(). */
ret = WritePrivateProfileStringA("section6", "name2", "value2", "winetest.ini"); ret = WritePrivateProfileStringA("section6", "name2", "value2", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = WritePrivateProfileStringA("section6", "name3", "value3", "winetest.ini"); ret = WritePrivateProfileStringA("section6", "name3", "value3", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = WritePrivateProfileSectionA("section6", "name1=one\0name3=three\0", "winetest.ini"); ret = WritePrivateProfileSectionA("section6", "name1=one\0name3=three\0", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section6", "name1", "winetest.ini", "one"); check_profile_string("section6", "name1", "winetest_map.ini", "one");
check_profile_string("section6", "name2", "winetest.ini", "value2"); check_profile_string("section6", "name2", "winetest_map.ini", "value2");
check_profile_string("section6", "name3", "winetest.ini", "value3"); check_profile_string("section6", "name3", "winetest_map.ini", "value3");
ret = RegOpenKeyExA(HKEY_CURRENT_USER, "winetest_name1", 0, KEY_READ | KEY_WRITE, &mapped_key); ret = RegOpenKeyExA(HKEY_CURRENT_USER, "winetest_name1", 0, KEY_READ | KEY_WRITE, &mapped_key);
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
@ -1508,38 +1508,38 @@ static void test_registry_mapping(void)
RegCloseKey(mapped_key); RegCloseKey(mapped_key);
memset(buffer, 0xcc, sizeof(buffer)); memset(buffer, 0xcc, sizeof(buffer));
ret = GetPrivateProfileSectionA("section6", buffer, 5, "winetest.ini"); ret = GetPrivateProfileSectionA("section6", buffer, 5, "winetest_map.ini");
ok(ret == 3, "got %u\n", ret); ok(ret == 3, "got %u\n", ret);
ok(!memcmp(buffer, "nam\0", 5), "got %s\n", debugstr_an(buffer, ret)); ok(!memcmp(buffer, "nam\0", 5), "got %s\n", debugstr_an(buffer, ret));
memset(buffer, 0xcc, sizeof(buffer)); memset(buffer, 0xcc, sizeof(buffer));
ret = GetPrivateProfileSectionA("section6", buffer, sizeof(buffer), "winetest.ini"); ret = GetPrivateProfileSectionA("section6", buffer, sizeof(buffer), "winetest_map.ini");
ok(ret == 26, "got %u\n", ret); ok(ret == 26, "got %u\n", ret);
ok(!memcmp(buffer, "name2=value2\0name3=value3\0", 27), "got %s\n", debugstr_an(buffer, ret)); ok(!memcmp(buffer, "name2=value2\0name3=value3\0", 27), "got %s\n", debugstr_an(buffer, ret));
ret = WritePrivateProfileStringA("section6", NULL, NULL, "winetest.ini"); ret = WritePrivateProfileStringA("section6", NULL, NULL, "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section6", "name1", "winetest.ini", "default"); check_profile_string("section6", "name1", "winetest_map.ini", "default");
check_profile_string("section6", "name2", "winetest.ini", "default"); check_profile_string("section6", "name2", "winetest_map.ini", "default");
check_profile_string("section6", "name3", "winetest.ini", "default"); check_profile_string("section6", "name3", "winetest_map.ini", "default");
ret = RegDeleteKeyA(HKEY_CURRENT_USER, "winetest_name1"); ret = RegDeleteKeyA(HKEY_CURRENT_USER, "winetest_name1");
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
ret = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "Software\\winetest_name2"); ret = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "Software\\winetest_name2");
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
ret = DeleteFileA("C:/windows/winetest.ini"); ret = DeleteFileA("C:/windows/winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
/* Test name-specific mapping with a default value. */ /* Test name-specific mapping with a default value. */
ret = RegSetValueExA(mapping_subkey, NULL, 0, REG_SZ, (BYTE *)"USR:winetest_default", sizeof("USR:winetest_default")); ret = RegSetValueExA(mapping_subkey, NULL, 0, REG_SZ, (BYTE *)"USR:winetest_default", sizeof("USR:winetest_default"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest.ini"); ret = WritePrivateProfileStringA(NULL, NULL, NULL, "winetest_map.ini");
todo_wine ok(ret, "got error %u\n", GetLastError()); todo_wine ok(ret, "got error %u\n", GetLastError());
ret = WritePrivateProfileStringA("section6", "name2", "value2", "winetest.ini"); ret = WritePrivateProfileStringA("section6", "name2", "value2", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = WritePrivateProfileStringA("section6", "name3", "value3", "winetest.ini"); ret = WritePrivateProfileStringA("section6", "name3", "value3", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = RegOpenKeyExA(HKEY_CURRENT_USER, "winetest_default", 0, KEY_READ | KEY_WRITE, &mapped_key); ret = RegOpenKeyExA(HKEY_CURRENT_USER, "winetest_default", 0, KEY_READ | KEY_WRITE, &mapped_key);
@ -1548,22 +1548,22 @@ static void test_registry_mapping(void)
ret = RegSetValueExA(mapped_key, "name3", 0, REG_SZ, (BYTE *)"three", sizeof("three")); ret = RegSetValueExA(mapped_key, "name3", 0, REG_SZ, (BYTE *)"three", sizeof("three"));
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
check_profile_string("section6", "name3", "winetest.ini", "three"); check_profile_string("section6", "name3", "winetest_map.ini", "three");
memset(buffer, 0xcc, sizeof(buffer)); memset(buffer, 0xcc, sizeof(buffer));
ret = GetPrivateProfileSectionA("section6", buffer, sizeof(buffer), "winetest.ini"); ret = GetPrivateProfileSectionA("section6", buffer, sizeof(buffer), "winetest_map.ini");
ok(ret == 25, "got %u\n", ret); ok(ret == 25, "got %u\n", ret);
todo_wine ok(!memcmp(buffer, "name2=value2\0name3=three\0", 26), "got %s\n", debugstr_an(buffer, ret)); todo_wine ok(!memcmp(buffer, "name2=value2\0name3=three\0", 26), "got %s\n", debugstr_an(buffer, ret));
ret = WritePrivateProfileSectionA("section6", "name2=duo\0name3=treis\0", "winetest.ini"); ret = WritePrivateProfileSectionA("section6", "name2=duo\0name3=treis\0", "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section6", "name2", "winetest.ini", "duo"); check_profile_string("section6", "name2", "winetest_map.ini", "duo");
check_profile_string("section6", "name3", "winetest.ini", "treis"); check_profile_string("section6", "name3", "winetest_map.ini", "treis");
ret = WritePrivateProfileStringA("section6", NULL, NULL, "winetest.ini"); ret = WritePrivateProfileStringA("section6", NULL, NULL, "winetest_map.ini");
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
check_profile_string("section6", "name2", "winetest.ini", "default"); check_profile_string("section6", "name2", "winetest_map.ini", "default");
check_profile_string("section6", "name3", "winetest.ini", "default"); check_profile_string("section6", "name3", "winetest_map.ini", "default");
ret = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "Software\\winetest_name2"); ret = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "Software\\winetest_name2");
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
@ -1581,7 +1581,7 @@ static void test_registry_mapping(void)
ok(!ret, "got error %u\n", ret); ok(!ret, "got error %u\n", ret);
RegCloseKey(mapping_key); RegCloseKey(mapping_key);
ret = DeleteFileA("C:/windows/winetest.ini"); ret = DeleteFileA("C:/windows/winetest_map.ini");
ok(!ret, "expected failure\n"); ok(!ret, "expected failure\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "got error %u\n", GetLastError()); ok(GetLastError() == ERROR_FILE_NOT_FOUND, "got error %u\n", GetLastError());
ret = RevertToSelf(); ret = RevertToSelf();