Skip to content

Commit f19b8a2

Browse files
committed
[CRT_APITEST] Fix version check for (_w)system on ReactOS
ReactOS behaves like Vista+ now.
1 parent 6a92a40 commit f19b8a2

2 files changed

Lines changed: 25 additions & 15 deletions

File tree

modules/rostests/apitests/crt/_wsystem.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,60 +13,63 @@ START_TEST(_wsystem)
1313
int ret;
1414
WCHAR szCmdExe[MAX_PATH];
1515

16+
/* ReactOS behaves like Vista here */
17+
DWORD dwOsVer = is_reactos() ? _WIN32_WINNT_VISTA : GetNTVersion();
18+
1619
GetSystemDirectoryW(szCmdExe, _countof(szCmdExe));
1720
lstrcatW(szCmdExe, L"\\cmd.exe");
1821

1922
SetEnvironmentVariableW(L"COMSPEC", NULL);
2023
errno = 0xDEADBEEF;
2124
ret = _wsystem(NULL);
2225
ok_int(errno, 0xDEADBEEF);
23-
ok_int(ret, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0 : 1);
26+
ok_int(ret, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0 : 1);
2427

2528
SetEnvironmentVariableW(L"COMSPEC", L"InvalidComSpec");
2629
errno = 0xDEADBEEF;
2730
ret = _wsystem(NULL);
2831
ok_int(errno, 0xDEADBEEF);
29-
ok_int(ret, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0 : 1);
32+
ok_int(ret, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0 : 1);
3033

3134
SetEnvironmentVariableW(L"COMSPEC", szCmdExe);
3235
errno = 0xDEADBEEF;
3336
ret = _wsystem(NULL);
3437
ok_int(errno, 0xDEADBEEF);
35-
ok_int(ret, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0 : 1);
38+
ok_int(ret, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0 : 1);
3639

3740
SetEnvironmentVariableW(L"COMSPEC", NULL);
3841
errno = 0xDEADBEEF;
3942
ret = _wsystem(L"echo This is a test");
40-
ok_int(errno, (_winver >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
43+
ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
4144
ok_int(ret, 0);
4245

4346
SetEnvironmentVariableW(L"COMSPEC", L"InvalidComSpec");
4447
errno = 0xDEADBEEF;
4548
ret = _wsystem(L"echo This is a test");
46-
ok_int(errno, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
49+
ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
4750
ok_int(ret, 0);
4851

4952
SetEnvironmentVariableW(L"COMSPEC", szCmdExe);
5053
errno = 0xDEADBEEF;
5154
ret = _wsystem(L"echo This is a test");
52-
ok_int(errno, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
55+
ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
5356
ok_int(ret, 0);
5457

5558
SetEnvironmentVariableW(L"COMSPEC", NULL);
5659
errno = 0xDEADBEEF;
5760
ret = _wsystem(L"InvalidCommandLine");
58-
ok_int(errno, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
61+
ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
5962
ok_int(ret, 1);
6063

6164
SetEnvironmentVariableW(L"COMSPEC", L"InvalidComSpec");
6265
errno = 0xDEADBEEF;
6366
ret = _wsystem(L"InvalidCommandLine");
64-
ok_int(errno, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
67+
ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
6568
ok_int(ret, 1);
6669

6770
SetEnvironmentVariableW(L"COMSPEC", szCmdExe);
6871
errno = 0xDEADBEEF;
6972
ret = _wsystem(L"InvalidCommandLine");
70-
ok_int(errno, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
73+
ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
7174
ok_int(ret, 1);
7275
}

modules/rostests/apitests/crt/system.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ START_TEST(system)
1313
int ret;
1414
CHAR szCmdExe[MAX_PATH];
1515

16+
#ifdef TEST_CRTDLL
17+
DWORD dwOsVer = _WIN32_WINNT_WIN2K;
18+
#else
19+
/* ReactOS behaves like Vista here */
20+
DWORD dwOsVer = is_reactos() ? _WIN32_WINNT_VISTA : GetNTVersion();
21+
#endif
22+
1623
GetSystemDirectoryA(szCmdExe, _countof(szCmdExe));
1724
lstrcatA(szCmdExe, "\\cmd.exe");
1825

@@ -37,36 +44,36 @@ START_TEST(system)
3744
SetEnvironmentVariableA("COMSPEC", NULL);
3845
errno = 0xDEADBEEF;
3946
ret = system("echo This is a test");
40-
ok_int(errno, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
47+
ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
4148
ok_int(ret, 0);
4249

4350
SetEnvironmentVariableA("COMSPEC", "InvalidComSpec");
4451
errno = 0xDEADBEEF;
4552
ret = system("echo This is a test");
46-
ok_int(errno, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
53+
ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
4754
ok_int(ret, 0);
4855

4956
SetEnvironmentVariableA("COMSPEC", szCmdExe);
5057
errno = 0xDEADBEEF;
5158
ret = system("echo This is a test");
52-
ok_int(errno, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
59+
ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
5360
ok_int(ret, 0);
5461

5562
SetEnvironmentVariableA("COMSPEC", NULL);
5663
errno = 0xDEADBEEF;
5764
ret = system("InvalidCommandLine");
58-
ok_int(errno, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
65+
ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
5966
ok_int(ret, 1);
6067

6168
SetEnvironmentVariableA("COMSPEC", "InvalidComSpec");
6269
errno = 0xDEADBEEF;
6370
ret = system("InvalidCommandLine");
64-
ok_int(errno, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
71+
ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
6572
ok_int(ret, 1);
6673

6774
SetEnvironmentVariableA("COMSPEC", szCmdExe);
6875
errno = 0xDEADBEEF;
6976
ret = system("InvalidCommandLine");
70-
ok_int(errno, (GetNTVersion() >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
77+
ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
7178
ok_int(ret, 1);
7279
}

0 commit comments

Comments
 (0)