From 9a54d4a3a01264eb09be255aa48ed8af2c2922e6 Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Tue, 30 May 2017 20:55:15 +0000 Subject: [PATCH] [KERNEL32_APITEST] Add test to show that we should not spoil TEB->StaticUnicodeString in CreateProcessA. CORE-10368 svn path=/trunk/; revision=74701 --- rostests/apitests/kernel32/CMakeLists.txt | 1 + rostests/apitests/kernel32/CreateProcess.c | 34 ++++++++++++++++++++++ rostests/apitests/kernel32/testlist.c | 2 ++ 3 files changed, 37 insertions(+) create mode 100644 rostests/apitests/kernel32/CreateProcess.c diff --git a/rostests/apitests/kernel32/CMakeLists.txt b/rostests/apitests/kernel32/CMakeLists.txt index c6e2f489431..e6386003be8 100644 --- a/rostests/apitests/kernel32/CMakeLists.txt +++ b/rostests/apitests/kernel32/CMakeLists.txt @@ -3,6 +3,7 @@ add_subdirectory(redirptest) list(APPEND SOURCE Console.c + CreateProcess.c DefaultActCtx.c DeviceIoControl.c dosdev.c diff --git a/rostests/apitests/kernel32/CreateProcess.c b/rostests/apitests/kernel32/CreateProcess.c new file mode 100644 index 00000000000..a9ef26fd7d6 --- /dev/null +++ b/rostests/apitests/kernel32/CreateProcess.c @@ -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 +#include +#include + + +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))); +} diff --git a/rostests/apitests/kernel32/testlist.c b/rostests/apitests/kernel32/testlist.c index 10dafa525f9..9db3a68c020 100644 --- a/rostests/apitests/kernel32/testlist.c +++ b/rostests/apitests/kernel32/testlist.c @@ -4,6 +4,7 @@ #include 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 @@ extern void func_WideCharToMultiByte(void); const struct test winetest_testlist[] = { { "ConsoleCP", func_Console }, + { "CreateProcess", func_CreateProcess }, { "DefaultActCtx", func_DefaultActCtx }, { "DeviceIoControl", func_DeviceIoControl }, { "dosdev", func_dosdev }, -- 2.17.1