ReactOS 0.4.16-dev-2104-gb84fa49
_wsystem.c File Reference
#include <apitest.h>
#include <apitest_guard.h>
Include dependency graph for _wsystem.c:

Go to the source code of this file.

Functions

 START_TEST (_wsystem)
 

Function Documentation

◆ START_TEST()

START_TEST ( _wsystem  )

Definition at line 11 of file _wsystem.c.

12{
13 int ret;
14 WCHAR szCmdExe[MAX_PATH];
15
16 /* ReactOS behaves like Vista here */
18
19 GetSystemDirectoryW(szCmdExe, _countof(szCmdExe));
20 lstrcatW(szCmdExe, L"\\cmd.exe");
21
23 errno = 0xDEADBEEF;
24 ret = _wsystem(NULL);
25 ok_int(errno, 0xDEADBEEF);
26 ok_int(ret, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0 : 1);
27
28 SetEnvironmentVariableW(L"COMSPEC", L"InvalidComSpec");
29 errno = 0xDEADBEEF;
30 ret = _wsystem(NULL);
31 ok_int(errno, 0xDEADBEEF);
32 ok_int(ret, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0 : 1);
33
34 SetEnvironmentVariableW(L"COMSPEC", szCmdExe);
35 errno = 0xDEADBEEF;
36 ret = _wsystem(NULL);
37 ok_int(errno, 0xDEADBEEF);
38 ok_int(ret, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0 : 1);
39
41 errno = 0xDEADBEEF;
42 ret = _wsystem(L"echo This is a test");
43 ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
44 ok_int(ret, 0);
45
46 SetEnvironmentVariableW(L"COMSPEC", L"InvalidComSpec");
47 errno = 0xDEADBEEF;
48 ret = _wsystem(L"echo This is a test");
49 ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
50 ok_int(ret, 0);
51
52 SetEnvironmentVariableW(L"COMSPEC", szCmdExe);
53 errno = 0xDEADBEEF;
54 ret = _wsystem(L"echo This is a test");
55 ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
56 ok_int(ret, 0);
57
59 errno = 0xDEADBEEF;
60 ret = _wsystem(L"InvalidCommandLine");
61 ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
62 ok_int(ret, 1);
63
64 SetEnvironmentVariableW(L"COMSPEC", L"InvalidComSpec");
65 errno = 0xDEADBEEF;
66 ret = _wsystem(L"InvalidCommandLine");
67 ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
68 ok_int(ret, 1);
69
70 SetEnvironmentVariableW(L"COMSPEC", szCmdExe);
71 errno = 0xDEADBEEF;
72 ret = _wsystem(L"InvalidCommandLine");
73 ok_int(errno, (dwOsVer >= _WIN32_WINNT_VISTA) ? 0xdeadbeef : 0);
74 ok_int(ret, 1);
75}
#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 SetEnvironmentVariableW(IN LPCWSTR lpName, IN LPCWSTR lpValue)
Definition: environ.c:259
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
_ACRTIMP int __cdecl _wsystem(const wchar_t *)
Definition: process.c:1254
#define errno
Definition: errno.h:120
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define is_reactos()
Definition: test.h:1041
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
#define _countof(array)
Definition: sndvol32.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180