From 43db1ac585f6716d35bff062af23431b1fb908a3 Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Fri, 23 Oct 2015 05:09:24 -0500 Subject: [PATCH] Fix a couple of typos, reword a test comment, add a TODO comment. --- agent/Win32Console.cc | 2 +- misc/buffer-tests/HandleTests_Common.cc | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/agent/Win32Console.cc b/agent/Win32Console.cc index 2a0a1d3..b9ca194 100644 --- a/agent/Win32Console.cc +++ b/agent/Win32Console.cc @@ -180,7 +180,7 @@ void Win32Console::write(const SmallRect &rect, const CHAR_INFO *data) std::wstring Win32Console::title() { while (true) { - // Calling GetConsoleTitleW is tricky, because it's behavior changed + // Calling GetConsoleTitleW is tricky, because its behavior changed // from XP->Vista, then again from Win7->Win8. The Vista+Win7 behavior // is especially broken. // diff --git a/misc/buffer-tests/HandleTests_Common.cc b/misc/buffer-tests/HandleTests_Common.cc index 8ed9061..9ff75b4 100755 --- a/misc/buffer-tests/HandleTests_Common.cc +++ b/misc/buffer-tests/HandleTests_Common.cc @@ -96,7 +96,7 @@ static void Test_CreateProcess_STARTUPINFOEX() { auto ph4 = std::get<1>(pipe2); // Add an extra console handle so we can verify that a child's console - // handles didn't reverted to the original default, but were inherited. + // handles didn't revert to the original default, but were inherited. p.openConout(true); // Verify that ntHandlePointer is working... @@ -214,7 +214,7 @@ static void Test_CreateProcess_STARTUPINFOEX() { } if (!isAtLeastWin8()) { - // Make a final valiant effort to test + // Make a final valiant effort to find a // PROC_THREAD_ATTRIBUTE_HANDLE_LIST and console handle interaction. // We'll set all the standard handles to pipes. Nevertheless, all // console handles are inherited. @@ -386,6 +386,23 @@ static void Test_GetStdHandle_SetStdHandle() { } } + + +// MSDN's CreateProcess page currently has this note in it: +// +// Important The caller is responsible for ensuring that the standard +// handle fields in STARTUPINFO contain valid handle values. These fields +// are copied unchanged to the child process without validation, even when +// the dwFlags member specifies STARTF_USESTDHANDLES. Incorrect values can +// cause the child process to misbehave or crash. Use the Application +// Verifier runtime verification tool to detect invalid handles. +// +// XXX: The word "even" here sticks out. Verify that the standard handle +// fields in STARTUPINFO are ignored when STARTF_USESTDHANDLES is not +// specified. + + + void runCommonTests() { Test_IntrinsicInheritFlags(); Test_CreateProcess_ModeCombos();