ReactOS 0.4.16-dev-2110-ge3521eb
system.c File Reference
#include <apitest.h>
#include <apitest_guard.h>
Include dependency graph for system.c:

Go to the source code of this file.

Functions

 START_TEST (system)
 

Function Documentation

◆ START_TEST()

START_TEST ( system  )

Definition at line 11 of file system.c.

12{
13 int ret;
14 CHAR szCmdExe[MAX_PATH];
15
16#ifdef TEST_CRTDLL
17 DWORD dwOsVer = _WIN32_WINNT_WIN2K;
18#else
19 /* ReactOS behaves like Vista here */
21#endif
22
23 GetSystemDirectoryA(szCmdExe, _countof(szCmdExe));
24 lstrcatA(szCmdExe, "\\cmd.exe");
25
26 SetEnvironmentVariableA("COMSPEC", NULL);
27 errno = 0xDEADBEEF;
28 ret = system(NULL);
29 ok_int(errno, 0xDEADBEEF);
30 ok_int(ret, 1);
31
32 SetEnvironmentVariableA("COMSPEC", "InvalidComSpec");
33 errno = 0xDEADBEEF;
34 ret = system(NULL);
35 ok_int(errno, 0xDEADBEEF);
36 ok_int(ret, 1);
37
38 SetEnvironmentVariableA("COMSPEC", szCmdExe);
39 errno = 0xDEADBEEF;
40 ret = system(NULL);
41 ok_int(errno, 0xDEADBEEF);
42 ok_int(ret, 1);
43
44 SetEnvironmentVariableA("COMSPEC", NULL);
45 errno = 0xDEADBEEF;
46 ret = system("echo This is a test");
47 ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
48 ok_int(ret, 0);
49
50 SetEnvironmentVariableA("COMSPEC", "InvalidComSpec");
51 errno = 0xDEADBEEF;
52 ret = system("echo This is a test");
53 ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
54 ok_int(ret, 0);
55
56 SetEnvironmentVariableA("COMSPEC", szCmdExe);
57 errno = 0xDEADBEEF;
58 ret = system("echo This is a test");
59 ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
60 ok_int(ret, 0);
61
62 SetEnvironmentVariableA("COMSPEC", NULL);
63 errno = 0xDEADBEEF;
64 ret = system("InvalidCommandLine");
65 ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
66 ok_int(ret, 1);
67
68 SetEnvironmentVariableA("COMSPEC", "InvalidComSpec");
69 errno = 0xDEADBEEF;
70 ret = system("InvalidCommandLine");
71 ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
72 ok_int(ret, 1);
73
74 SetEnvironmentVariableA("COMSPEC", szCmdExe);
75 errno = 0xDEADBEEF;
76 ret = system("InvalidCommandLine");
77 ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
78 ok_int(ret, 1);
79}
#define GetNTVersion()
Definition: apitest.h:17
#define ok_int(expression, result)
Definition: atltest.h:134
#define NULL
Definition: types.h:112
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(IN LPCSTR lpName, IN LPCSTR lpValue)
Definition: environ.c:218
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2283
#define errno
Definition: errno.h:120
_ACRTIMP int __cdecl system(const char *)
Definition: process.c:1297
return ret
Definition: mutex.c:146
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define is_reactos()
Definition: test.h:1041
#define _WIN32_WINNT_WIN2K
Definition: sdkddkver.h:21
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
#define _countof(array)
Definition: sndvol32.h:70
char CHAR
Definition: xmlstorage.h:175