PATH:
opt
/
bitninja-threat-hunting
/
node_modules
/
node-pty
/
deps
/
winpty
/
misc
/* * Demonstrates that console clearing sets each cell's character to SP, not * NUL, and it sets the attribute of each cell to the current text attribute. * * This confirms the MSDN instruction in the "Clearing the Screen" article. * https://msdn.microsoft.com/en-us/library/windows/desktop/ms682022(v=vs.85).aspx * It advises using GetConsoleScreenBufferInfo to get the current text * attribute, then FillConsoleOutputCharacter and FillConsoleOutputAttribute to * write to the console buffer. */ #include <windows.h> #include <cassert> #include <cstdio> #include <cstdlib> #include "TestUtil.cc" int main(int argc, char *argv[]) { if (argc == 1) { startChildProcess(L"CHILD"); return 0; } const HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(conout, 0x24); system("cls"); setWindowPos(0, 0, 1, 1); setBufferSize(80, 25); setWindowPos(0, 0, 80, 25); CHAR_INFO buf; COORD bufSize = { 1, 1 }; COORD bufCoord = { 0, 0 }; SMALL_RECT rect = { 5, 5, 5, 5 }; BOOL ret; DWORD actual; COORD writeCoord = { 5, 5 }; // After cls, each cell's character is a space, and its attributes are the // default text attributes. ret = ReadConsoleOutputW(conout, &buf, bufSize, bufCoord, &rect); assert(ret && buf.Char.UnicodeChar == L' ' && buf.Attributes == 0x24); // Nevertheless, it is possible to change a cell to NUL. ret = FillConsoleOutputCharacterW(conout, L'\0', 1, writeCoord, &actual); assert(ret && actual == 1); ret = ReadConsoleOutputW(conout, &buf, bufSize, bufCoord, &rect); assert(ret && buf.Char.UnicodeChar == L'\0' && buf.Attributes == 0x24); // As well as a 0 attribute. (As one would expect, the cell is // black-on-black.) ret = FillConsoleOutputAttribute(conout, 0, 1, writeCoord, &actual); assert(ret && actual == 1); ret = ReadConsoleOutputW(conout, &buf, bufSize, bufCoord, &rect); assert(ret && buf.Char.UnicodeChar == L'\0' && buf.Attributes == 0); ret = FillConsoleOutputCharacterW(conout, L'X', 1, writeCoord, &actual); assert(ret && actual == 1); ret = ReadConsoleOutputW(conout, &buf, bufSize, bufCoord, &rect); assert(ret && buf.Char.UnicodeChar == L'X' && buf.Attributes == 0); // The 'X' is invisible. countDown(3); ret = FillConsoleOutputAttribute(conout, 0x42, 1, writeCoord, &actual); assert(ret && actual == 1); countDown(5); }
[-] DebugServer.py
[edit]
[+]
Font-Report-June2016
[-] Win32Echo1.cc
[edit]
[-] font-notes.txt
[edit]
[-] ShowArgv.cc
[edit]
[-] SetCursorPos.cc
[edit]
[-] UnicodeDoubleWidthTest.cc
[edit]
[-] SetBufferSize.cc
[edit]
[-] GetFont.cc
[edit]
[-] FreezePerfTest.cc
[edit]
[-] color-test.sh
[edit]
[+]
..
[-] ShowConsoleInput.cc
[edit]
[-] MouseInputNotes.txt
[edit]
[-] DebugClient.py
[edit]
[-] ScreenBufferTest2.cc
[edit]
[-] Win10WrapTest1.cc
[edit]
[-] VeryLargeRead.cc
[edit]
[-] FormatChar.h
[edit]
[-] ChangeScreenBuffer.cc
[edit]
[-] IdentifyConsoleWindow.ps1
[edit]
[-] DumpLines.py
[edit]
[-] EnableExtendedFlags.txt
[edit]
[-] TestUtil.cc
[edit]
[-] MoveConsoleWindow.cc
[edit]
[-] ClearConsole.cc
[edit]
[-] IsNewConsole.cc
[edit]
[-] ConoutMode.cc
[edit]
[-] SetWindowRect.cc
[edit]
[-] ConinMode.cc
[edit]
[-] WindowsBugCrashReader.cc
[edit]
[-] WriteConsole.cc
[edit]
[-] UnicodeWideTest1.cc
[edit]
[-] Notes.txt
[edit]
[-] Win32Test2.cc
[edit]
[-] ScreenBufferFreezeInactive.cc
[edit]
[-] GetConsolePos.cc
[edit]
[-] VkEscapeTest.cc
[edit]
[-] Win32Test1.cc
[edit]
[-] winbug-15048.cc
[edit]
[-] Win32Write1.cc
[edit]
[-] ScreenBufferTest.cc
[edit]
[-] OSVersion.cc
[edit]
[-] BufferResizeTests.cc
[edit]
[-] Spew.py
[edit]
[-] build32.sh
[edit]
[-] build64.sh
[edit]
[-] SetFont.cc
[edit]
[-] SelectAllTest.cc
[edit]
[-] UnixEcho.cc
[edit]
[-] ConinMode.ps1
[edit]
[-] Utf16Echo.cc
[edit]
[-] UnicodeWideTest2.cc
[edit]
[-] FontSurvey.cc
[edit]
[-] GetCh.cc
[edit]
[-] Win10WrapTest2.cc
[edit]
[-] Win32Echo2.cc
[edit]
[-] Win32Test3.cc
[edit]
[-] Win10ResizeWhileFrozen.cc
[edit]