Author: mjansen Date: Tue May 30 20:55:15 2017 New Revision: 74701 URL: http://svn.reactos.org/svn/reactos?rev=74701&view=rev Log: [KERNEL32_APITEST] Add test to show that we should not spoil TEB->StaticUnicodeString in CreateProcessA. CORE-10368
Added: trunk/rostests/apitests/kernel32/CreateProcess.c (with props) Modified: trunk/rostests/apitests/kernel32/CMakeLists.txt trunk/rostests/apitests/kernel32/testlist.c Modified: trunk/rostests/apitests/kernel32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/CMakeLists.txt?rev=74701&r1=74700&r2=74701&view=diff ============================================================================== --- trunk/rostests/apitests/kernel32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/kernel32/CMakeLists.txt [iso-8859-1] Tue May 30 20:55:15 2017 @@ -3,6 +3,7 @@ list(APPEND SOURCE Console.c + CreateProcess.c DefaultActCtx.c DeviceIoControl.c dosdev.c Added: trunk/rostests/apitests/kernel32/CreateProcess.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/CreateProcess.c?rev=74701 ============================================================================== --- trunk/rostests/apitests/kernel32/CreateProcess.c (added) +++ trunk/rostests/apitests/kernel32/CreateProcess.c [iso-8859-1] Tue May 30 20:55:15 2017 @@ -0,0 +1,34 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Test spoiling of StaticUnicodeString by CreateProcessA + * PROGRAMMERS: Mark Jansen + */ + +#include <apitest.h> +#include <ndk/rtltypes.h> +#include <ndk/rtlfuncs.h> + + +START_TEST(CreateProcess) +{ + PUNICODE_STRING StaticString; + UNICODE_STRING CompareString; + BOOL Process; + STARTUPINFO si = {0}; + PROCESS_INFORMATION pi = {0}; + LONG Result; + + StaticString = &NtCurrentTeb()->StaticUnicodeString; + RtlInitUnicodeString(&CompareString, L"--sentinel--"); + RtlCopyUnicodeString(StaticString, &CompareString); + + si.cb = sizeof(si); + Process = CreateProcessA("ApplicationName", "CommandLine", NULL, NULL, FALSE, 0, NULL, "CurrentDir", &si, &pi); + ok_int(Process, 0); + + Result = RtlCompareUnicodeString(StaticString, &CompareString, TRUE); + ok(!Result, "Expected %s to equal %s\n", + wine_dbgstr_wn(StaticString->Buffer, StaticString->Length / sizeof(WCHAR)), + wine_dbgstr_wn(CompareString.Buffer, CompareString.Length / sizeof(WCHAR))); +} Propchange: trunk/rostests/apitests/kernel32/CreateProcess.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/kernel32/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/testlist.c?rev=74701&r1=74700&r2=74701&view=diff ============================================================================== --- trunk/rostests/apitests/kernel32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/kernel32/testlist.c [iso-8859-1] Tue May 30 20:55:15 2017 @@ -4,6 +4,7 @@ #include <apitest.h> extern void func_Console(void); +extern void func_CreateProcess(void); extern void func_DefaultActCtx(void); extern void func_DeviceIoControl(void); extern void func_dosdev(void); @@ -30,6 +31,7 @@ const struct test winetest_testlist[] = { { "ConsoleCP", func_Console }, + { "CreateProcess", func_CreateProcess }, { "DefaultActCtx", func_DefaultActCtx }, { "DeviceIoControl", func_DeviceIoControl }, { "dosdev", func_dosdev },