Skip to content

Commit 8aafd04

Browse files
committed
[KERNEL32_WINETEST] Handle Windows -> ReactOS folder differences
1 parent ddfdb0d commit 8aafd04

5 files changed

Lines changed: 215 additions & 2 deletions

File tree

‎modules/rostests/winetests/kernel32/actctx.c‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3063,16 +3063,23 @@ todo_wine {
30633063
actctx.cbSize = sizeof(actctx);
30643064
actctx.lpResourceName = MAKEINTRESOURCEA(1);
30653065
actctx.dwFlags = ACTCTX_FLAG_HMODULE_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID;
3066+
#ifdef __REACTOS__
3067+
char path_explorer[MAX_PATH];
3068+
GetWindowsDirectoryA(path_explorer, sizeof(path_explorer));
3069+
strcat(path_explorer, "\\explorer.exe");
3070+
#endif
30663071
for (i = 0; i < ARRAY_SIZE(flags); ++i)
30673072
{
30683073
winetest_push_context("%lu", flags[i]);
30693074

3075+
/* use explorer.exe because using modules already loaded has a different behavior */
30703076
#ifdef __REACTOS__
30713077
if (GetNTVersion() < _WIN32_WINNT_VISTA && i > 0)
30723078
break; // Only the first test is valid for WS03.
3073-
#endif
3074-
/* use explorer.exe because using modules already loaded has a different behavior */
3079+
actctx.hModule = LoadLibraryExA(path_explorer, NULL, flags[i]);
3080+
#else
30753081
actctx.hModule = LoadLibraryExA("C:\\windows\\explorer.exe", NULL, flags[i]);
3082+
#endif
30763083
ok(actctx.hModule != NULL, "LoadLibraryExA failed, error %lu\n", GetLastError());
30773084
handle = CreateActCtxA(&actctx);
30783085
ok(handle == INVALID_HANDLE_VALUE, "CreateActCtxA succeeded\n");
@@ -3834,7 +3841,13 @@ static void test_builtin_sxs(void)
38343841
ULONG_PTR cookie;
38353842
HANDLE handle_context;
38363843
BOOL success;
3844+
#ifdef __REACTOS__
3845+
static char expected_path[MAX_PATH];
3846+
GetWindowsDirectoryA(expected_path, sizeof(expected_path));
3847+
strcat(expected_path, "\\WinSxS");
3848+
#else
38373849
static const char *expected_path = "C:\\Windows\\WinSxS";
3850+
#endif
38383851

38393852
GetTempPathA(sizeof(path_tmp), path_tmp);
38403853

‎modules/rostests/winetests/kernel32/debugger.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,14 @@ static void doChild(int argc, char **argv)
970970
}
971971
else if (is_wow64)
972972
{
973+
#ifdef __REACTOS__
974+
static wchar_t expected_path[MAX_PATH];
975+
GetWindowsDirectoryW(expected_path, MAX_PATH);
976+
wcscat(expected_path, L"\\sysnative\\oleacc.dll");
977+
wcscpy( path, expected_path );
978+
#else
973979
wcscpy( path, L"c:\\windows\\sysnative\\oleacc.dll" );
980+
#endif
974981
}
975982
else goto done;
976983

‎modules/rostests/winetests/kernel32/file.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5917,7 +5917,11 @@ static void test_file_readonly_access(void)
59175917

59185918
static void test_find_file_stream(void)
59195919
{
5920+
#ifdef __REACTOS__
5921+
WCHAR path[MAX_PATH];
5922+
#else
59205923
WCHAR path[] = {'C',':','\\','w','i','n','d','o','w','s',0};
5924+
#endif
59215925
HANDLE handle;
59225926
int error;
59235927
WIN32_FIND_STREAM_DATA data;
@@ -5928,6 +5932,9 @@ static void test_find_file_stream(void)
59285932
return;
59295933
}
59305934

5935+
#ifdef __REACTOS__
5936+
GetWindowsDirectoryW(path, ARRAY_SIZE(path));
5937+
#endif
59315938
SetLastError(0xdeadbeef);
59325939
handle = pFindFirstStreamW(path, FindStreamInfoStandard, &data, 0);
59335940
error = GetLastError();

‎modules/rostests/winetests/kernel32/profile.c‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,16 @@ static void test_registry_mapping(void)
12191219
HKEY mapping_key, mapped_key, mapping_subkey;
12201220
char buffer[30];
12211221
LSTATUS ret;
1222+
#ifdef __REACTOS__
1223+
char path[MAX_PATH];
1224+
1225+
/* Get the real system root, use forward slashes, and lowercase everything other than "C:\" */
1226+
GetWindowsDirectoryA(path, sizeof(path));
1227+
for (char *p = path; *p; p++)
1228+
if (*p == '\\') *p = '/';
1229+
else if (p != path) *p = (char)tolower((unsigned char)*p);
1230+
strcat(path, "/winetest_map.ini");
1231+
#endif
12221232

12231233
/* impersonate ourselves to prevent registry virtualization */
12241234
ret = ImpersonateSelf(SecurityImpersonation);
@@ -1256,7 +1266,11 @@ static void test_registry_mapping(void)
12561266

12571267
check_profile_string("section1", "name2", "winetest_map.ini", "value2");
12581268

1269+
#ifdef __REACTOS__
1270+
ret = GetFileAttributesA(path);
1271+
#else
12591272
ret = GetFileAttributesA("C:/windows/winetest_map.ini");
1273+
#endif
12601274
ok(ret == INVALID_FILE_ATTRIBUTES, "winetest_map.ini should not exist.\n");
12611275

12621276
ret = WritePrivateProfileStringA("section1", "name2", NULL, "winetest_map.ini");
@@ -1348,7 +1362,11 @@ static void test_registry_mapping(void)
13481362
ok(ret == 22, "got %lu\n", ret);
13491363
ok(!memcmp(buffer, "section1\0file_section\0", 23), "got %s\n", debugstr_an(buffer, ret));
13501364

1365+
#ifdef __REACTOS__
1366+
ret = DeleteFileA(path);
1367+
#else
13511368
ret = DeleteFileA("C:/windows/winetest_map.ini");
1369+
#endif
13521370
ok(ret, "got error %lu\n", GetLastError());
13531371

13541372
/* Test the SYS: prefix. */
@@ -1374,7 +1392,11 @@ static void test_registry_mapping(void)
13741392

13751393
check_profile_string("section2", "name2", "winetest_map.ini", "value2");
13761394

1395+
#ifdef __REACTOS__
1396+
ret = GetFileAttributesA(path);
1397+
#else
13771398
ret = GetFileAttributesA("C:/windows/winetest_map.ini");
1399+
#endif
13781400
ok(ret == INVALID_FILE_ATTRIBUTES, "winetest_map.ini should not exist.\n");
13791401

13801402
ret = RegDeleteKeyA(mapped_key, "");
@@ -1416,7 +1438,11 @@ static void test_registry_mapping(void)
14161438

14171439
check_profile_string("section3", "name1", "winetest_map.ini", "value1");
14181440

1441+
#ifdef __REACTOS__
1442+
ret = DeleteFileA(path);
1443+
#else
14191444
ret = DeleteFileA("C:/windows/winetest_map.ini");
1445+
#endif
14201446
ok(ret, "got error %lu\n", GetLastError());
14211447

14221448
/* Test default keys. */
@@ -1426,7 +1452,11 @@ static void test_registry_mapping(void)
14261452

14271453
check_profile_string("section4", "name1", "winetest_map.ini", "value1");
14281454

1455+
#ifdef __REACTOS__
1456+
ret = DeleteFileA(path);
1457+
#else
14291458
ret = DeleteFileA("C:/windows/winetest_map.ini");
1459+
#endif
14301460
ok(ret, "got error %lu\n", GetLastError());
14311461

14321462
ret = RegSetValueExA(mapping_key, NULL, 0, REG_SZ, (BYTE *)"SYS:winetest_default", sizeof("SYS:winetest_default"));
@@ -1451,7 +1481,11 @@ static void test_registry_mapping(void)
14511481

14521482
check_profile_string("section5", "name2", "winetest_map.ini", "value2");
14531483

1484+
#ifdef __REACTOS__
1485+
ret = GetFileAttributesA(path);
1486+
#else
14541487
ret = GetFileAttributesA("C:/windows/winetest_map.ini");
1488+
#endif
14551489
ok(ret == INVALID_FILE_ATTRIBUTES, "winetest_map.ini should not exist.\n");
14561490

14571491
ret = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "Software\\winetest_default\\Section4");
@@ -1506,7 +1540,11 @@ static void test_registry_mapping(void)
15061540
ret = WritePrivateProfileStringA("section6", "name3", "value3", "winetest_map.ini");
15071541
ok(ret, "got error %lu\n", GetLastError());
15081542
check_profile_string("section6", "name3", "winetest_map.ini", "value3");
1543+
#ifdef __REACTOS__
1544+
ret = DeleteFileA(path);
1545+
#else
15091546
ret = DeleteFileA("C:/windows/winetest_map.ini");
1547+
#endif
15101548
ok(ret, "got error %lu\n", GetLastError());
15111549

15121550
/* Test name-specific mapping with Get/WritePrivateProfileSection(). */
@@ -1549,7 +1587,11 @@ static void test_registry_mapping(void)
15491587
ok(!ret, "got error %lu\n", ret);
15501588
ret = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "Software\\winetest_name2");
15511589
ok(!ret, "got error %lu\n", ret);
1590+
#ifdef __REACTOS__
1591+
ret = DeleteFileA(path);
1592+
#else
15521593
ret = DeleteFileA("C:/windows/winetest_map.ini");
1594+
#endif
15531595
ok(ret, "got error %lu\n", GetLastError());
15541596

15551597
/* Test name-specific mapping with a default value. */
@@ -1603,7 +1645,11 @@ static void test_registry_mapping(void)
16031645
ok(!ret, "got error %lu\n", ret);
16041646
RegCloseKey(mapping_key);
16051647

1648+
#ifdef __REACTOS__
1649+
ret = DeleteFileA(path);
1650+
#else
16061651
ret = DeleteFileA("C:/windows/winetest_map.ini");
1652+
#endif
16071653
ok(!ret, "expected failure\n");
16081654
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "got error %lu\n", GetLastError());
16091655
ret = RevertToSelf();

0 commit comments

Comments
 (0)