[KERNEL32_APITEST] Add test to show that we should not spoil TEB->StaticUnicodeString...
[reactos.git] / rostests / apitests / kernel32 / CreateProcess.c
1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Test spoiling of StaticUnicodeString by CreateProcessA
5 * PROGRAMMERS: Mark Jansen
6 */
7
8 #include <apitest.h>
9 #include <ndk/rtltypes.h>
10 #include <ndk/rtlfuncs.h>
11
12
13 START_TEST(CreateProcess)
14 {
15 PUNICODE_STRING StaticString;
16 UNICODE_STRING CompareString;
17 BOOL Process;
18 STARTUPINFO si = {0};
19 PROCESS_INFORMATION pi = {0};
20 LONG Result;
21
22 StaticString = &NtCurrentTeb()->StaticUnicodeString;
23 RtlInitUnicodeString(&CompareString, L"--sentinel--");
24 RtlCopyUnicodeString(StaticString, &CompareString);
25
26 si.cb = sizeof(si);
27 Process = CreateProcessA("ApplicationName", "CommandLine", NULL, NULL, FALSE, 0, NULL, "CurrentDir", &si, &pi);
28 ok_int(Process, 0);
29
30 Result = RtlCompareUnicodeString(StaticString, &CompareString, TRUE);
31 ok(!Result, "Expected %s to equal %s\n",
32 wine_dbgstr_wn(StaticString->Buffer, StaticString->Length / sizeof(WCHAR)),
33 wine_dbgstr_wn(CompareString.Buffer, CompareString.Length / sizeof(WCHAR)));
34 }