Compare commits

..

260 Commits

Author SHA1 Message Date
Dustin Howett
00db8704b6 HACK: Add Version to the propsheet 2019-05-30 17:59:26 -07:00
Ian Frosst
71e19cd825 "Color scheme" is two words (#1054)
* Update ColorTool comments

* Update profile key

* Add ability to load settings from old key
2019-05-30 13:32:05 -05:00
Nicholas Baron
dadd74c3c6 Improvements to TerminalInput (#690)
* Specified the destructor of TerminalInput as default

* Simplified GetKeymappingLength

* Simplified GetKeyMapping

* Removed a redundant assignment

* Added auto deduction to some variables

* Merged the public sections of TerminalInput

* Implied the destructor for TerminalInput

* Removed GetKeyMappingLength and GetKeyMapping from public interface

Rearranged public section to be above private.

* Deleted or defaulted all six special member functions.

* Removed extraneous newlines

* Deleted all move and copy operations.

The default constructor is also deleted.
The destructor is defaulted.

* Converted tabs to 4 spaces
2019-05-30 11:15:37 -07:00
MelulekiDube
1c16b2c06b Removed using namespace directive from header files (#955)
* Removed using namespace directive from header files and put these in cpp files where they are used

* Fixed tabbing issues by replacing them with spaces.
Also regrouped the using directives.

* Update src/host/exemain.cpp

Co-Authored-By: Mike Griese <migrie@microsoft.com>

* Update src/interactivity/win32/find.cpp

Co-Authored-By: Mike Griese <migrie@microsoft.com>
2019-05-30 11:14:21 -07:00
fghzxm
c3e32eb1ca Highlight the default profile in new-tab flyout (#888)
* Highlight the default profile in new-tab flyout

This commit makes the default profile in the new-tab flyout to show up
at the top and gives it bold text.
2019-05-30 09:24:34 -07:00
Shawn Walker-Salas
e52170e2cf Apply [[nodiscard]] to functions returning error codes (#953)
* Apply [[nodiscard]] to functions returning error codes

- applied [[nodiscard]] for all HRESULT, LRESULT, and NTSTATUS functions
- fixed IntelliSense declaration complaints leading to function not
  implemented warnings
- deleted declared but never implemented functions
- fixed unused parameter warnings

How verified:
- bcz dbg
- opencon
- testcon
- VS2019 debug build

* - use LOG_IF_FAILED where applicable
- remove use of goto
- make MakeAltRasterFont return void

* - add missing [[nodiscard]]
- remove vestigal function declarations
- fix inconsistent function declaration
2019-05-30 16:20:42 +00:00
Kyle Sabo
3d7160d731 Use a ComPtr to avoid leaking font. (#1063)
Fixes #768
2019-05-30 15:54:46 +00:00
Michael Ratanapintha
d24d647c0d Turn on Text Buffer unit tests in Azure DevOps CI build (#1057)
* rename TextBuffer.UnitTests.dll -> TextBuffer.Unit.Tests.dll

* renamed the project file as well
2019-05-29 19:51:17 -07:00
Flo56958
e2b5fecd48 Some Typo-Fixes in Comments (#1049)
* Typo fixes
2019-05-29 14:27:30 -07:00
d-bingham
097f7d32a6 Background image support (#853)
* Initial code check in for background images

* Cleaning up whitespace

* Whitespace cleanup

* Added/fixed comments

* Fixing tabs

* Reverting erroneous file add

* Removing custom enum for image stretching mode and using Windows::UI::Xaml::Media::Stretch instead.

* Removing now-superfluous static_cast when setting stretch mode.

* Updating code to use wstring_view (per #925)

* One last set of wstring -> wstring_view changes

* Split off brush-intialization function from TermControl::_BackgroundColorChanged and added code to prevent flicker on resetting acrylic or image backgrounds.
2019-05-29 13:35:46 -05:00
Michael Ratanapintha
2f88c46350 Allow tools\razzle & nuget restore to work with NuGet 5 and later (#1046)
Since version 5.0.2, NuGet has used the PATH environment variable
to find MSBuild.exe before looking in other file paths.
See NuGet change
21f2b07f2c
(https://github.com/NuGet/NuGet.Client/pull/2687 ).

Unfortunately, in PR
https://github.com/microsoft/terminal/pull/606 ,
`tools\razzle.cmd` was changed to add the MSBuild.exe folder path
in _quotes_ to the PATH environment variable.
Windows itself is fine with this (you can type `msbuild` and
MSBuild runs), but some tools are not, including NuGet itself,
so you would get errors like this:

```
D:\GitHub\metathinker\console> where nuget
C:\ProgramData\chocolatey\bin\nuget.exe
D:\GitHub\metathinker\console\dep\nuget\nuget.exe

D:\GitHub\metathinker\console> nuget restore OpenConsole.sln
Illegal characters in path.
```

`razzle.cmd` runs NuGet itself, but does so before adding
the MSBuild folder to the PATH, so it was not affected by this
problem.

This change fixes the issue by dequotifying the PATH,
so that if you already had a newer version of NuGet on your PATH
before running `tools\razzle.cmd`, that version will continue
to work should you need to run `nuget restore` again
(such as after a `git clean -dx`).
2019-05-29 10:02:48 -07:00
Michael Niksa
8baba4b46c Guard try_query calls with a null check on the pointer we're QI-ing from (#1044)
Even wil::com_ptr_nothrow can still inadvertantly throw an 'access violation exception' when null pointer deref-ing (WIL won't check if it's null before attempting, CComQIPtr apparently didn't care.
2019-05-28 16:03:22 -07:00
Summon528
cfc72cee5d Make sure cursor blinks after opening new tab (#1030) 2019-05-28 11:18:28 -07:00
Michael Ratanapintha
9ad2544033 Fix #936: misuse of uninitialized objects causes AppVerifier breaks on Windows Terminal startup (#1015)
* move the render thread init up; gets rid of verifier stops

* s/INVALID_HANDLE_VALUE/NULL/g since CreateEvent() and CreateThread() return a NULL HANDLE on failure; resolves another cause of AppVerifier breaks
2019-05-28 16:56:36 +00:00
nathan-castlehow
5f938a0465 Update Terminal.cpp (#1034) 2019-05-28 16:53:03 +00:00
subhasan
4c47631bf4 Cleanup - termDispatch.hpp & adaptDispatch.hpp overrides (#1004)
* Fix for https://github.com/microsoft/terminal/issues/896

* Fixing spaces

* Base Class destructor is virtual, derived class destructor shouldn't be declared vitual or override

* Update src/terminal/adapter/termDispatch.hpp

nit: remove space

Co-Authored-By: Mike Griese <migrie@microsoft.com>
2019-05-24 15:29:12 -07:00
adiviness
cc30475955 add audit mode to ci (#948)
* add audit mode to ci
2019-05-24 14:48:10 -07:00
Mike Griese
80f107965d Fix the bell sound when Alt+key is pressed. (#1006) 2019-05-24 16:43:46 -05:00
Mike Griese
42e87ed3e3 fix build break from using await instead of co_await (#1009) 2019-05-24 21:27:45 +00:00
Michael Niksa
40b557a4b6 Update manifest to correct 1903 version, unref param fix (#1008)
* Update manifest to correct 1903 version

While messing around with building with VS2019/14.2/etc, I noticed that the version we're using in the compatibility manifest doesn't match guidance for XAML Islands. This puts the version information from the public guidance into the manifest and leaves a link back to the page where I got this idea from.

* comment out unused params in IslandWindow::OnResize
2019-05-24 14:26:40 -07:00
Mike Griese
0f62ec81d8 Eat all tap keypresses no matter what. (#985)
Fixes #744
2019-05-24 15:04:00 -05:00
Dustin L. Howett (MSFT)
ce0eaab9ac inbox: Merge accumulated build fixes from RS_ONECORE_DEP_ACIOSS (#1002)
* Merged PR 3302855

[Git2Git] Git Train: Merge of building/rs_onecore_dep_acioss/190523-1700 into official/rs_onecore_dep_acioss Retrieved from official/rs_onecore_dep_acioss 3fceea90bee761aa93d91c0184a7217d1e2d404b

Related work items: #18974333
2019-05-24 12:28:30 -07:00
Benjamin Staneck
1c50968333 add .editorconfig file (#585)
* add .editorconfig file

* drop charset from editorconfig

* Update .editorconfig

Co-Authored-By: Michael Niksa <miniksa@microsoft.com>
2019-05-24 18:20:17 +00:00
Joel Bennett
efd69990c6 Add support for OSC 10 and 11 to set the default colors (#891)
* Support OSC to set default background and foreground colors

* Update the Terminal theme when the background changes

* Fix whitespace per code-review

* Add Documentation Comments

Also fix a few outdated comments and whitespace

* Update Telemetry codes per code review

* Add Unit Tests for OSC ForegroundColor and BackgroundColor

* Add a couple additional test cases

* Minor doc and whitespace change per PR review

* Update comment help per code review

* Add another OSC 10 & 11 test case, improve output

* Comments and syntax cleanup per code reviews
2019-05-24 09:53:00 -07:00
Mike Griese
2fdcb679ab Update the default settings (#918)
* Update the default settings

  * [x] `alwaysShowTabs` -> `true`
  * [x] `experimental_showTabsInTitlebar` -> `true`
  * [x] always include Windows Powershell (`background`: `#012456`)
  * [x] include PowerShell Core separately (`background`: unset)
  * [x] drop `Courier New` for powershell
  * [x] drop `experimental_` for `experimental_showTabsInTitlebar`
  * [x] reduce default font size to 10pt.

  Fixes #869
2019-05-23 17:02:32 -05:00
Kapperchino
1191a59681 Update scroll bar with scroll (#920)
* added another method to scroll with keyboard

* set lastscrolloffset to 0

* fixed unused variable

* renamed ViewPort to Viewport

* changed keyBoard to keyboard in the functions, and added expliantion for function
2019-05-23 13:39:29 -07:00
Mike Griese
8dab297bd1 Add an error dialog when we fail to parse settings (#903)
* Load messages from the Resources.resw file
  * Display a message when we fail to parse the settings on an initial parse, or
    on a reload.
2019-05-23 15:09:35 -05:00
Dustin L. Howett (MSFT)
3f95d58805 Remove ATL from .vsconfig! (#954)
🎉
2019-05-23 17:46:29 +00:00
Anirudh Rayabharam
2d4eca7f4f Added support for DECSCUSR sequences (#941)
* Falling back to legacy cursor for higher values of CursorStyle

Co-Authored-By: Michael Niksa <miniksa@microsoft.com>
2019-05-23 10:44:27 -07:00
Ilya Shipitsin
547cba968c fix couple of null pointer dereferences (#927)
found by cppcheck

[src/propsheet/OptionsPage.cpp:216] -> [src/propsheet/OptionsPage.cpp:242]: (warning) Either the condition 'lParam' is redundant or there is possible null pointer dereference: pshn.
[src/propsheet/TerminalPage.cpp:352] -> [src/propsheet/TerminalPage.cpp:378]: (warning) Either the condition 'lParam' is redundant or there is possible null pointer dereference: pshn.
2019-05-23 12:42:39 -05:00
Dustin L. Howett (MSFT)
798912c2f4 Enable C++/WinRT Optimizations for local component builds (#949)
Fixes #945.
2019-05-23 10:36:29 -07:00
Eric Budai
06a5583c86 Fix a bunch of static analysis issues (#553)
* static analysis fixes
* using C++ style casts
* explicit delete changed to reset(nullptr)
* fix for null apiMsg.OtherId during tracing in Compare()
* changed INVALID_ID macro to constexpr
* properly handle null ReplyMsg in ConsoleIoThread()
* Fixed wrong static_cast for State.InputBuffer
* compensate for null reply message to fix deref problem of ReplyMsg in srvinit.cpp by changing signature in DeviceComm.h
2019-05-23 10:35:30 -07:00
Maks Naumov
82e75ce3e2 Utf8ToWideCharParser: Fix memory leak in case of error (#836) 2019-05-23 11:05:57 -05:00
Juris Bogusevs
5ec7c0325e Closing the tab shifts focus to the right (#767)
* On closing the tab - the focus is shifted to the right.
2019-05-23 08:24:40 -05:00
Dustin L. Howett
bbbd3e0323 Use the right Windows PowerShell icon
Fixes #952.
2019-05-22 22:15:02 -07:00
Shawn Walker-Salas
1d9cdb3d31 set identifying environment variable for new connections (#897)
* set identifying environment variable for new connections

Set a new 'WT_SESSION' environment variable when creating new terminal
connections to allow shells to detect a unique Windows Terminal session.
The value of the variable is a stringified GUID as returned by
CoCreateGuid.

How verified:
- "razzle" & vs debug build
- runut
- manual inspection

* * use winrt::guid type for connection guid
* use Utils::GuidToString for guid stringification
* expose guid parameter in ITerminalConnection idl

* - poke guid through ITerminalConnection
- misc. review fixes
- throw if CreateConPty fails in ConhostConnection::Start
- apply [[nodiscard]] and noexcept in various places

* - simplify environment variable extraction in UpdateEnvironmentMapW

* - use Utils::CreateGuid instead of CoCreateGuid in ConHostConnection()
2019-05-22 13:24:22 -07:00
Dustin L. Howett (MSFT)
8c3af2d066 Add default icons for the default profiles (#934)
This commit introduces a handful of default icons whose paths will be
emitted into the default profiles.

Icons are named after the profile GUIDs, which for the default profiles
are stable v5 UUIDs based on the name of the profile. The plan is that
we'll never have a duplicate default profile, and if the user wants to
duplicate it they'll need to issue it a new GUID.

Eventually, when icons can be inserted through the settings UI, we can
keep the GUID name (to unique them among all icons for all profiles) and
move them into ms-appdata:///roaming/.

The currently included icons are named for the following profiles:

"cmd" `{0caa0dad-35be-5f56-a8ff-afceeeaa6101}`
"PowerShell Core" `{574e775e-4f2a-5b96-ac1e-a2962a402336}`
"Windows PowerShell" `{61c54bbd-c2c6-5271-96e7-009a87ff44bf}`
"WSL" `{9acb9455-ca41-5af7-950f-6bca1bc9722f}`

The PowerShell profile names aren't being used yet, but this is in
preparation for #918 merging.

Fixes #933.
2019-05-22 13:03:10 -07:00
Tim Heuer
e9a3d16286 Adding auto-UI shortcuts to menu based on keymappings (#924)
* Adding vsconfig file for VS2019 help to prompt for missing components requried.

* Adding a keybinding for launching the settings.  Suggested fix for #683

* Modified to comma per PR feedback

* Implements 791 for profile and settings shortcuts (most frequent and have shortcuts)

* Quick change for consistency (missed in first checkin due to using ENUM) on using 'Ctrl' instead of 'Control'

* Adding UI shortcut generation to new keybinding mappings.  Resolving #791

* Making a few changes on reviewer feedback for shortcut UI.

* Additional reviewer feedback on variable name change (not a member var)
2019-05-22 15:01:33 -05:00
Dustin L. Howett (MSFT)
83b139596f Re-enable ARM64 in CI (#931)
Fixes #722.
2019-05-22 10:28:50 -07:00
Carlos Zamora
6a79025027 Bugfix: padding offsets selection (#906)
Closes #660.
2019-05-22 09:34:20 -07:00
The Oddball
20359d40e4 Remove satement about 1903 being available only on Insider (#928) 2019-05-22 11:14:02 -05:00
Mikael Olenfalk
6c7dfd2ce4 Use wstring_view for constants instead of wstring (#925) 2019-05-21 15:39:26 -07:00
Mike Skowronek
080843f826 Update README.md - Build the Code section (#899)
* Update README.md

Fix readme to show correct path of build tools

* Update README.md

Add mention about recommended cli tool for building.

* Update README.md

Cover powershell in build section
2019-05-21 21:44:22 +00:00
Dreamer
db637021fd Fix memory leak, use unique_ptr for Core::Terminal object (#914) 2019-05-21 14:07:03 -07:00
Dustin L. Howett (MSFT)
8da6737d64 Switch to v5 UUIDs as profile GUIDs for the default profiles (#913)
This commit switches the GUIDs for default profiles from being randomly generated to being version 5 UUIDs. More info in #870.

## PR Checklist
* [x] Closes #870
* [x] CLA signed
* [x] Tests added/passed
* [x] Requires documentation to be updated (#883)
* [x] I've discussed this with core contributors already.

## Detailed Description of the Pull Request / Additional comments
This commit has a number of changes that seem ancillary, but they're general goodness. Let me explain:

* I've added a whole new Types test library with only two tests in
* Since UUIDv5 generation requires SHA1, we needed to take a dependency on bcrypt
* I honestly don't think we should have to link bcrypt in conhost, but LTO should take care of that
  * I considered adding a new Terminal-specific Utils/Types library, but that seemed like a waste
* The best way to link bcrypt turned out to be in line with a discussion @miniksa and I had, where we decided we both love APISets and think that the console should link against them exclusively... so I've added `onecore_apiset.lib` to the front of the link line, where it will deflect the linker away from most of the other libs automagically.

```
StartGroup: UuidTests::TestV5UuidU8String
Verify: AreEqual(uuidExpected, uuidActual)
EndGroup: UuidTests::TestV5UuidU8String [Passed]

StartGroup: UuidTests::TestV5UuidU16String
Verify: AreEqual(uuidExpected, uuidActual)
EndGroup: UuidTests::TestV5UuidU16String [Passed]
```
2019-05-21 13:29:16 -07:00
Richard Yu
fd2fb07bcf Remove ATL dependencies (#676) (#719)
* Remove CComBSTR dependency.
* Replace CStructureArray with std::vector.
* Remove CComPtr dependency.
* Add try blocks.
* Remove CString dependency.
* Add comments for string helper functions.
* Remove CComAllocator dependency.

Fixes #676.
2019-05-21 10:32:43 -07:00
Heiko Voigt
68d0c23246 make copying of files windows localization agnostic (#741)
* make copying of files windows localization agnostic

On a german Windows when building I get the following error:

(D = Datei, V = Verzeichnis)? Ist das Ziel ...\Terminal\x64\Debug\TerminalSettings.pdb ein Dateiname
oder ein Verzeichnisname
(D = Datei, V = Verzeichnis)? f

The trick with piping 'f' for file into stdin does not work here, since
in german file is called 'Datei'. Due to the fact that the UI is
translated a 'd' is expected.

Lets use '*' at the end of the target filename which is a hack to trick
'xcopy' into assuming it is a filename her a target is a folder, if the
target does not exist.

* start fixing commandline tools to run new windows terminal

  * opencas should do the same as openterm.
  * correct the filename in openterm

openterm is able to start the terminal again, but it does not start
properly because of a missing dependency.

* remove openterm command

There is currently no plan on fixing this, because WindowsTerminal.exe
does not support unpackaged activation. Let's remove them for now.
2019-05-21 16:25:54 +00:00
Mike Griese
29e380824f Support remapping keybindings (#748)
* Add support for serializing keybindings
2019-05-21 09:26:04 -05:00
Hermès BÉLUSCA - MAÏTO
acabbe0459 Fix it's versus its typo. (#911) 2019-05-21 06:15:44 +00:00
Heath Stewart
461c8b53fa Add behavior of .vsconfig to README (#907) 2019-05-21 05:00:43 +00:00
Dustin L. Howett (MSFT)
dd9bc6ee45 inbox PR 3285709: Add chafa resource into the DLL built by Windows Razzle (#912)
[Git2Git] Merged PR 3285709: Add chafa resource into the DLL built by Windows Razzle #21439265
2019-05-20 17:06:21 -07:00
Gabriele
0060614173 Added requestedTheme option into terminal settings (#710)
* added requestedTheme option into terminal settings

* fix tabs to 4 spaces

* removed newline

* fix option requestedTheme not shown in profiles.json

* fix indentation

* fix indentation part 2

Co-Authored-By: Dustin L. Howett (MSFT) <duhowett@microsoft.com>
2019-05-20 20:54:19 +00:00
Oscar Calvo
37ea2dce48 Simplify DPI logic (#829)
* Simply DPI logic

* Apply PR comments

* Update src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp

Co-Authored-By: Dustin L. Howett (MSFT) <duhowett@microsoft.com>

* Add comments

* Update src/cascadia/WindowsTerminal/BaseWindow.h

Co-Authored-By: Dustin L. Howett (MSFT) <duhowett@microsoft.com>

* Apply PR feedback
2019-05-20 19:49:28 +00:00
Mitchell Blowey
9f4ad6d1ce Fix #670: Terminal selects a char when bringing window to foreground (#856)
* Added focus tracking to TermControl to prevent clicks which refocus the terminal window from selecting text.

* Moved open brace to a new line per repo code style.

* Moved the TermControl's _MouseClickHandler's focus check into the Mouse specific block of code. This lets any touch and drag events scroll the terminal's contents.

Fixes #670.
2019-05-20 12:05:58 -07:00
Michael Niksa
a0ebd2ed1b Create Bot.md (#884)
* Create Bot.md

#882

* Update Bot.md

* Rename Bot.md to bot.md

* Update doc/bot.md

Co-Authored-By: Dustin L. Howett (MSFT) <duhowett@microsoft.com>

* Update bot.md

* Update bot.md
2019-05-20 14:27:36 +00:00
Donghyeok Tak
67f68ebf62 doc: Fix non-grammatical sentence (#895)
Replace `your` with `you` as the word `your` doesn't fit this context.
2019-05-18 13:37:00 -07:00
Neil McAlister
41a6d8ed3a Add GUIConsole sample (#285)
* Add GUIConsole sample

* Remove acrylic native functions, add a title bar

* Fix WPF app namespaces

* Respond to PR feedback

* Removed unused native calls, and fix up some stray spaces

* Switch pwsh to powershell

* Missed a spot.

* Fix typo, add newlines
2019-05-18 18:17:36 +00:00
Michael Ratanapintha
7533b31cbd Fix #453: Setting historySize=32767 causes WindowsTerminal to hang (#843)
* fix for historySize=32767 hang (except for historySize=0 case); tests still in progress

* tests run and almost pass - failure is a real bug in my change

* fixed bug that caused tests to fail, but it seems another bug causes the app to crash with a zero row count

* fix the additional bug (at a higher layer) mentioned in previous commit description

* Fix chk build assertion failures in new tests

It seems C++/WinRT doesn't like it when you implement a Windows Runtime
interface but then create instances of the implementing class
with function-call lifetime (aka stack allocation). That makes sense
given that WinRT objects are COM objects, but in my defense I was following
this example where they are just fine instantiating the `App` object
on the stack:
https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/author-apis#if-youre-not-authoring-a-runtime-class

* tabs to spaces

* CR feedback

* fix minor CR feedback (incorrect test log message)
2019-05-18 03:57:34 +00:00
Bartosz Brachaczek
73ad742c12 Fix signatures of some callback functions (#871)
* Fix signatures of callback functions

* Fix calling conventions of callback functions

* Remove now-unnecessary casts of pointers to callback functions
2019-05-17 20:32:51 +00:00
Mario Kneidinger
fd98145af2 Delete the keybinding for NewTabProfile9 and SwitchToTab9 (#831)
* Deleted keybinding for NewTabProfile0

* Readded NewTabProfile9 with unbounded shortcut

* Untabify

* Deleted NewTabProfile9 and SwitchToTab9
2019-05-17 15:52:01 +00:00
ChristianBoehm
2b41fad198 fixed on build error xcopy on localized machines (#847)
* fixed on build error xcopy on localized machines

echo ( f | xcopy ) will not work, can get around with putting an '*' at the end, xcopy will treat then as file. This solutions builds 
fine on DE German machine.

* removed echo | f it's not longer needed 

set cmd switch to capital /Y from lower
2019-05-17 00:48:00 +00:00
Christian Aashamar
251505b96b doc: Changed "docs" to "doc" (#862) 2019-05-16 17:32:28 -07:00
Dustin Howett
723ff47789 inbox: Reflect Windows inbox changes from 20190516 2019-05-16 16:21:33 -07:00
Dustin L. Howett (MSFT)
7291121112 doc: add some new issue templates (#838)
Co-Authored-By: Michael Niksa <miniksa@microsoft.com>
Co-Authored-By: Kayla Cinnamon <48369326+cinnamon-msft@users.noreply.github.com>

Fixes #751.
2019-05-16 11:24:14 -07:00
Dustin L. Howett (MSFT)
22103ff9c6 ci: Restore Taef.TestAdapter before build (#811)
Fixes #775
2019-05-16 11:22:22 -07:00
Jamie
e0f131121b Fixed typo's and improved consistency. (#704) 2019-05-15 21:02:42 -07:00
Mikhail Paulyshka
bc925d8909 tools: search for MSBuild in prerelease versions of MSVS (#795) 2019-05-15 20:57:26 -07:00
Kayla Cinnamon
e3764b2081 Added documentation policy to README.md (#834)
* Added documentation policy to README.md

* Update README.md

Co-Authored-By: Dustin L. Howett (MSFT) <duhowett@microsoft.com>
2019-05-15 14:09:58 -07:00
Mario Kneidinger
a12521ffd3 Changed "Windows Internal Library" to "Windows Implementation Library" (#827) 2019-05-15 12:28:22 -07:00
Bharat Raghunathan
f867a2d4a4 Added a pull request template (#762)
* Close microsoft#752 by adding a pull request template

* Apply suggestions from code review by @miniksa and @bitcrazed

Co-Authored-By: Michael Niksa <miniksa@microsoft.com>
Co-Authored-By: Rich Turner <rich@bitcrazed.com>

* Fixed checkboxes

* Make placeholder uniform

[skip ci]
2019-05-15 12:27:31 -07:00
Fergal Reilly
3a27b29afc Amend Color array to typed values (#742)
* Amend Color array to typed values

* Re-add the original deserialization code.

* Re-added original deserialization

* Update comment spacing

Co-Authored-By: Michael Niksa <miniksa@microsoft.com>

* Replace tabs with spaces

* Replace array definition and update for loops.

* swapped _table calls to use .at()
2019-05-15 11:12:00 -07:00
Kapperchino
781d779b37 Added Keybindings for go up and go down page (#747)
* added keybindings

* untabfied the files

* fixed spacing issues and renamed termheight

* changed function names and other improvements

* made some auto variables const auto

* fixed tabs

* another try for the broken spacing
2019-05-15 08:21:14 -05:00
woachk
bc69d1a99a Changes to be able to quit the application via exit inside a CLI prompt. (#746)
* Changes to be able to quit the application via exit inside a CLI prompt.
2019-05-15 07:22:16 -05:00
Jef LeCompte
de24334898 Make's README list consistent (#790)
Made bullets consistent with other bullets.

[skip ci]
2019-05-14 16:19:54 -07:00
Dustin L. Howett (MSFT)
507d787fe8 inbox: reflect incoming changes from Windows 2019-05-14 16:16:43 -07:00
fghzxm
ad27906db7 Convert copy to move (#717)
This commit converts 3 spots of copy construction into move
construction.

`return data` was not converted to a move because it should be easily
RVO'able.

Signed-off-by: Fred Miller <fghzxm@outlook.com>
2019-05-14 15:05:07 -07:00
Michael Niksa
fb72dca939 Add link to related console-docs GH repository (#784)
The console-docs repository is very related to this one. I feel it should be linked somewhere prominently in this one.
[skip ci]
2019-05-14 15:04:01 -07:00
Gil Mishal
ea5270e563 added quotes to commands (#785)
thanks!
2019-05-14 14:27:39 -07:00
Mike Griese
b5eeddfb0f Change the Feedback link to take you to github (#789)
Fixes #787.

  Considering we're just duping all feedback hub issues to github, lets cut out
  the middleman and take them straight here.
2019-05-14 13:16:40 -07:00
Michael Niksa
7c6278de44 Fix WIL doc summary (#786)
- "Windows Internal Library" got named "Windows Implementation Library" for its GH release
- Fixed the links to point to the files in the WIL GH instead of the local copies.
- Left the rest of this as general guidance to how we use it.
2019-05-14 13:11:41 -07:00
Tim Heuer
303e227f44 Updating readme for more explicit VS2019 Instructions (#560)
* Updating readme for more explicit VS2019 Instructions

Added some more explicit and correct terms for the VS 2019 components that are needed.

* Update Install Instructions

I put the components in sub bullets and reworded some things.
2019-05-14 12:44:46 -07:00
sebastian gomez
a8cf3d6f4a Update README.md (#777)
Solution Platform must match the computer architecture
2019-05-14 13:51:17 -05:00
Keith Hill
71229239d4 Add one half color schemes (#466)
* Add One Half Dark & Light color schemes

* WIP: Add One Half Dark/Lite schemes to settings

* Address PR feedback - use gsl::narrow()

* Fix reversed OneHalfLight fg/bg colors

Added in customized colortool scheme colors for last 8 colors
2019-05-14 11:01:15 -07:00
Summon528
639d5f3f93 Reflect new AppNameDev in readme (#765)
due to #558, app that is built from source will be named "Windows Terminal (Dev Build)” instead of "Windows Terminal (Preview)”
2019-05-14 08:51:19 -07:00
Dustin L. Howett (MSFT)
df789a4e75 Exclude Windows Terminal sources and some other files from git2git (#749)
* Remove Windows Terminal sources from git2git

This will remove Windows Terminal sources from any replications driven by git2git.

* Exclude .nuget and .github as well.

[skip ci]
2019-05-14 08:33:46 -07:00
Hao
ef8e20af51 fix tab control and tabs is not synced after focused tab is removed (#737)
* trim duplicated github627

* fix tab control and tabs is not synced after focused tab is removed
2019-05-14 08:14:23 -05:00
David Teresi
8c177fab4f Add cursor blinking (#686)
It even respects the user's cursor blink speed setting!
2019-05-13 18:25:54 -07:00
pythias
2c1ab620bf Tab to spaces (#578)
* tab to spaces

* change tab size to 4.
2019-05-13 18:06:36 -07:00
Syed Faheel Ahmad
af3a421938 doc: improve the formatting of keyboard keys (#730)
Use the `<kbd>` HTML tag

[skip ci]
2019-05-13 18:05:53 -07:00
Tim Heuer
04c7b944bd Adding keymapping for access to Settings (#684)
This commit adds the keychord Ctrl+Comma, which launches settings.
2019-05-13 18:02:06 -07:00
Malcolm Smith
c2ee6277f8 Fix downlevel support for traditional console (#562) 2019-05-13 16:10:46 -07:00
koteski
5b1183a4b3 doc: append Debugging section with instructions to enable debugging from VS (#726) 2019-05-13 12:46:18 -07:00
Daniel Gillespie
6c80ab8017 added windows insider info to readme (#631)
* added windows insider info to readme

* improved readme description for insider program

* minor improvement to readme insider program
2019-05-13 09:35:30 -07:00
Andy Muehlhausen
fc49caca8a Update EXCEPTIONS.md (#736)
updated to indicate HRESULT is preferred over NTSTATUS, as suggested in 
https://github.com/Microsoft/Terminal/blob/master/doc/STYLE.md

[skip ci]
2019-05-13 09:14:41 -07:00
Mario Kneidinger
aeef340bdc Fixed duplicate line in TermControl (#732) (#739)
* Fixed duplicate line in TermControl #732

* Deleted lines, because values were unnecessarily set to default values.
2019-05-13 09:11:31 -07:00
That's My Face
9ba3a53b4b Fixed typo (#723) 2019-05-13 08:59:56 -05:00
Ghosty141
1e478ae99d Bugfix: The opacity of the text background color was set to 0.9 (#677) (#688) 2019-05-12 19:27:16 -05:00
Joel Bennett
dc7fff7ab0 Fix the Generated Files .gitignore (#697)
[skip ci]
2019-05-11 22:56:10 -07:00
fghzxm
6088134832 Improve startingDirectory functionality (#604)
* Improve `startingDirectory` functionality

This commit adds the `startingDirectory` property to the default-created
`cmd` and `powershell` profiles, with the default value
`%HOMEDRIVE%%HOMEPATH%`.

Signed-off-by: Fred Miller <fghzxm@outlook.com>

* Use %USERPROFILE% to replace %HOMEDRIVE%%HOMEPATH%

This commit changes `%USERPROFILE%` in the default profiles to
`%HOMEDRIVE%%HOMEPATH%`.

https://stackoverflow.com/posts/36392591/revisions says `%USERPROFILE%`
is better than `%HOMEDRIVE%%HOMEPATH%`, so changed it.

Signed-off-by: Fred Miller <fghzxm@outlook.com>

* Improve `startingDirectory` functionality

This commit adds the `startingDirectory` property to the default-created
`cmd` and `powershell` profiles, with the default value
`%HOMEDRIVE%%HOMEPATH%`.

Signed-off-by: Fred Miller <fghzxm@outlook.com>

* Use %USERPROFILE% to replace %HOMEDRIVE%%HOMEPATH%

This commit changes `%USERPROFILE%` in the default profiles to
`%HOMEDRIVE%%HOMEPATH%`.

https://stackoverflow.com/posts/36392591/revisions says `%USERPROFILE%`
is better than `%HOMEDRIVE%%HOMEPATH%`, so changed it.

Signed-off-by: Fred Miller <fghzxm@outlook.com>

* Consolidate constant

Refer to the externally defined constant in code.

Signed-off-by: Fred Miller <fghzxm@outlook.com>
2019-05-11 00:02:28 -07:00
Carlos Zamora
bf460ab7fe Bugfix: don't allow closing last tab with middle click (#648)
* Bugfix: don't allow closing last tab with middle click
(Also add a few of the TODOs for similar areas)

* Replaced MSFT TODO with GitHub TODO
2019-05-10 15:11:23 -07:00
Matthew
5c707032a7 Make powershell the default profile (#639)
* Make powershell the default profile

Sets powershell as the default profile.

* Apply suggestions from code review

Co-Authored-By: Gabriel <gabriel@potter.fr>

* Update src/cascadia/TerminalApp/CascadiaSettings.cpp

Co-Authored-By: Gabriel <gabriel@potter.fr>

* Change profile order
2019-05-10 15:09:22 -07:00
Dustin L. Howett (MSFT)
660d31ac52 Add a dev manifest, which will be used by default (#558)
* Add a dev manifest, which will be used by default

To build a package named Microsoft.WindowsTerminal, you must build with
/p:WindowsTerminalReleaseBuild=true. This is to improve the SxS
developer/user scenario.

* Change dev manifest version to 0.0.1.0.
2019-05-10 11:56:06 -07:00
Carlos Zamora
644cd3ec6c Bugfix: ESC didn't clear selection (except CMD) (#647)
* Bugfix: ESC didn't clear selection (except CMD)

* Bugfix: ESC didn't clear selection - moved TriggerSelection() to ClearSelection()
2019-05-10 11:16:59 -07:00
Artem Chernousov
99555ef9e9 Check null pointer before fclose (#586)
* Check null pointer before fclose, because fclose(NULL) will lead to undefined behavior

* Update main.cpp

Cast to one code style

* Update main.cpp

Remove redundant ==
2019-05-10 11:02:24 -07:00
Adam Weiss
cafe59d73c Update razzle to use vswhere (#13) (#606)
* Update razzle to use vswhere

* Make vswhere pickup build tools

* Make razzle handle errors better

* Make bcz handle MSBUILD with spaces

* Update readmes to use bcz and fix typo
2019-05-10 10:40:25 -07:00
Hao
f74a9d3e0b add shortcut alt-* for select tab (#623)
* add shortcut alt-* for select tab

* all right, 0 for 10th
2019-05-10 09:48:36 -07:00
Alessandro (Ale) Segala
6c98fc19f5 Lowercase GH org name in .gitmodules (#629)
The `Microsoft` org has been renamed to `microsoft`. While casing isn't an issue with GitHub, just correcting it in case some implementations are case-sensitive.
2019-05-09 12:19:45 -07:00
Ian Frosst
37fd00c822 Add ARM64 output directories to .gitignore (#630)
[skip ci]
2019-05-09 12:18:05 -07:00
何智权
5dc7d0e843 close one tab by press ctrl-w and hide the bar (#628)
close one tab by press ctrl-w and hide the bar

fix #614
2019-05-09 12:32:57 -05:00
lstefano71
32f4f7133c make closeOnExit: true the default (#599)
* make closeOnExit: true the default

* another very similar instance of _closeOnExit
2019-05-09 09:17:33 -05:00
Huo Yaoyuan
af7316c130 Add .vsconfig for required components to build (#566)
[skip ci]
2019-05-08 21:36:26 -07:00
Samuel Kelemen
5a8e746d82 shared: Fix some Spelling issues in InputStateMachine (#588) 2019-05-08 21:35:30 -07:00
Hao
b3b98373c6 doc: Explicitly mention tools document in root README (#495)
[skip ci]
2019-05-08 21:34:57 -07:00
RB
ec44bf0068 doc: improve some grammar in the README (#542)
Grammatical Errors and sentence structure

[skip ci]
2019-05-08 21:34:36 -07:00
jroberts101
cb17115c72 doc: fix some more instances of "it's" (#551)
part 2/2

[skip ci]
2019-05-08 21:31:15 -07:00
jroberts101
2aed13ac37 doc: fix some instances of "it's" (#552)
part 1/2

[skip ci]
2019-05-08 21:30:41 -07:00
Benjamin Staneck
e37ba7a923 doc: actually link to the Azure CI from the badge (#582) 2019-05-08 07:18:29 -07:00
Yan Reznikov
a7404a2df9 Clarify where prerequisites packages are installed in VS, could be unclear as 'packages' is overloaded term (#544) 2019-05-08 08:59:36 -05:00
Xiaoshi Sha
d5b8e7c32f Add repositorypath to NuGet config. (#503) 2019-05-07 13:01:49 -07:00
Michael Niksa
ec38580042 Put Terminal build pipeline badge on README 2019-05-07 12:57:30 -07:00
Hermès BÉLUSCA - MAÏTO
599a8dff0f Fix casts warnings. (#509) 2019-05-07 12:08:26 -07:00
沈嘉欢
e6767acf46 minor readme fix (#494) 2019-05-07 13:51:41 -05:00
Hugh Wells
5948b95cd8 Fix grammatical error (#450)
* Fix grammatical error

* Use American English
2019-05-07 13:51:14 -05:00
Mike Griese
79c74aadff Add an FAQ to the README (#518)
* Add an FAQ to the README

* drastically->dramatically
2019-05-07 11:36:38 -05:00
Aaron
58ec47236d Fix build errors in VS2019 (#449) 2019-05-07 10:59:33 -05:00
SLaks
501a4a5e59 doc: Fix typo (#434) 2019-05-07 08:32:37 -07:00
0xflotus
dda4ef23c8 Update WindowsTestPasses.md (#470) 2019-05-07 08:31:41 -07:00
Lorenz Nickel
1c345515b8 fix: replaced outdated url (#515)
http://colororacle.cartography.ch/ moved to https://colororacle.org/
2019-05-07 10:30:14 -05:00
Jack Owens
590eb1fc91 Grammar fixes/improvements (#511) 2019-05-07 08:30:01 -07:00
David Ralph
b35c801093 Update GitHub URL link (#505)
"console" -> "Terminal"
2019-05-07 10:28:50 -05:00
Mike Griese
688483c3af Add some prerequisites to the readme (#429)
* add some prerequisites to the readme

Add some really basic guidance on how to get started with the Terminal project

* Add note about VS2019
2019-05-07 10:23:47 -05:00
Dustin L. Howett (MSFT)
fc83699c1d ci: check out submodules, too (#512) 2019-05-07 07:57:46 -07:00
Dustin L. Howett (MSFT)
f9f2525c72 build: port our Azure CI pipeline to YAML (#510) 2019-05-07 07:35:43 -07:00
Cyandev
47cebce11c docs: fix ORGANIZATION.md hierarchy issues (#478) 2019-05-07 07:28:50 -07:00
Ganbarukamo41
f1309ee211 tools: add a few more possible locations of MSBuild (#436)
* Add few more possible locations of MSBuild, including VS2019 and VS2017 Professional
2019-05-07 07:27:36 -07:00
Michael Niksa
35229a775d Merge pull request #425 from Microsoft/miniksa-i-want-in
Add myself to list of contacts on README
2019-05-06 11:29:57 -07:00
Michael Niksa
82b9efc1c6 Add myself to list of contacts on README
Hey guys, I want in on the fun. Added my twitter handle and information to the contact list.
2019-05-06 11:26:32 -07:00
Dustin L. Howett
b726a3d05d Add a README and a CODE_OF_CONDUCT 2019-05-05 22:01:21 -07:00
Dustin Howett
23f85d01f0 Merge https://github.com/Microsoft/Console into master 2019-05-02 17:34:28 -07:00
Dustin Howett
4ab4051f63 Merged PR 3219702: Fix elevation by putting Markup & App in the manifest
Related work items: #21424135
2019-05-02 22:47:33 +00:00
Michael Niksa
87e85603b9 Merged PR 3215853: Fix spacing/layout for block characters and many retroactively-recategorized emoji (and more!)
This encompasses a handful of problems with column counting.

The Terminal project didn't set a fallback column counter. Oops. I've fixed this to use the `DxEngine` as the fallback.

The `DxEngine` didn't implement its fallback method. Oops. I've fixed this to use the `CustomTextLayout` to figure out the advances based on the same font and fallback pattern as the real final layout, just without "rounding" it into cells yet.
- `CustomTextLayout` has been updated to move the advance-correction into a separate phase from glyph shaping. Previously, we corrected the advances to nice round cell counts during shaping, which is fine for drawing, but hard for column count analysis.
- Now that there are separate phases, an `Analyze` method was added to the `CustomTextLayout` which just performs the text analysis steps and the glyph shaping, but no advance correction to column boundaries nor actual drawing.

I've taken the caching code that I was working on to improve chafa, and I've brought it into this. Now that we're doing a lot of fallback and heavy lifting in terms of analysis via the layout, we should cache the results until the font changes.

I've adjusted how column counting is done overall. It's always been in these phases:
1. We used a quick-lookup of ranges of characters we knew to rapidly decide `Narrow`, `Wide` or `Invalid` (a.k.a. "I dunno")
2. If it was `Invalid`, we consulted a table based off of the Unicode standard that has either `Narrow`, `Wide`, or `Ambiguous` as a result.
3. If it's still `Ambiguous`, we consult a render engine fallback (usually GDI or now DX) to see how many columns it would take.
4. If we still don't know, then it's `Wide` to be safe.
- I've added an additional flow here. The quick-lookup can now return `Ambiguous` off the bat for some glyph characters in the x2000-x3000 range that used to just be simple shapes but have been retroactively recategorized as emoji and are frequently now using full width color glyphs.
- This new state causes the lookup to go immediately to the render engine if it is available instead of consulting the Unicode standard table first because the half/fullwidth table doesn't appear to have been updated for this nuance to reclass these characters as ambiguous, but we'd like to keep that table as a "generated from the spec" sort of table and keep our exceptions in the "quick lookup" function.

I have confirmed the following things "just work" now:
- The windows logo flag from the demo. (💖🌌😊)
- The dotted chart on the side of crossterm demo (•)
- The powerline characters that make arrows with the Consolas patched font (██)
- An accented é
- The warning and checkmark symbols appearing same size as the X. (✔⚠🔥)

Related work items: #21167256, #21237515, #21243859, #21274645, #21296827
2019-05-02 15:29:10 -07:00
Dustin Howett
d4d59fa339 Initial release of the Windows Terminal source code
This commit introduces all of the Windows Terminal and Console Host source,
under the MIT license.
2019-05-02 15:29:04 -07:00
Dustin L. Howett (MSFT)
00bb050826 cleanup: move ISSUE_TEMPLATE to .github/ (#423) 2019-04-30 12:27:12 -07:00
Dustin L. Howett (MSFT)
864f45fa11 Move ColorTool to src/ (#422) 2019-04-30 12:27:06 -07:00
Michael Niksa
723efc70e2 Merge pull request #418 from waf/fix-parser-and-registry-bugs-with-refactor
Fix ColorTool parser and registry bugs, and refactor
2019-04-29 12:12:01 -07:00
Michael Niksa
2d1055d153 Merge pull request #421 from oising/move-readconsoleinputstream-demo
moved readconsoleinputstream to samples folder
2019-04-29 12:10:01 -07:00
oising
987805ebaf moved readconsoleinputstream to samples folder; added readme; updated root readme. 2019-04-29 14:50:38 -04:00
Will Fuqua
f8f4f263a5 standardize casing on PascalCase
Feedback from review. I've decided to go with PascalCase as that's more standard in C# and recommended by MS (see the "Field" row in the table on https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/capitalization-conventions)
2019-04-26 12:34:55 +07:00
Michael Niksa
2e0fd58bc5 Merge pull request #414 from oising/readconsoleinputstream-demo
ReadConsoleInputStream demo
2019-04-25 10:08:52 -07:00
oising
cfe3eb9624 address PR comments (root namespace) 2019-04-25 10:15:02 -04:00
Rich Turner
370cea5cab Retargeted EchoCon sample project to 17763 now Win10 1809 has shipped (#340) 2019-04-24 17:20:20 -07:00
oising
5bd3f887b1 remove empty xmldoc 2019-04-23 17:40:10 -04:00
oising
2dc178b852 address issues and suggestions in PR review 2019-04-23 17:38:35 -04:00
Will Fuqua
12fff3126b add support for writing foreground / background indices to registry
This functionality was implemented for the "current console" but was never implemented for writing to the registry, which affects all future consoles.
2019-04-23 22:42:32 +07:00
Will Fuqua
b61cb830c3 allow scheme parsers to opt out of attempting to parse a file
This fixes the issue where the INI file parser can throw errors because it's attempting to parse an `.itermcolors` (xml) file.
2019-04-23 22:04:18 +07:00
Will Fuqua
05f518db5b replace mutable public fields with properties
The properties are made readonly where possible, which is possible in almost all cases.
2019-04-23 21:51:05 +07:00
Will Fuqua
7daea0a25c pull logic out of Program.cs
There aren't any user-facing changes in this commit, just pulling logic out of Program.cs. All that remains in Program.cs is command line parsing.

- The functions that wrote to the registry, the console, and the virtual terminal (--xterm) are now in their own files, implementing the `IConsoleTarget` interface
- Move the utility method UIntToColor into ColorScheme, where it can be used as an indexer, e.g. myColorScheme[i] returns a System.Drawing.Color
- The "export to INI" functionality is now in a "SchemeWriters" namespace; Parsers are now in a "SchemeParsers" namespace
- Printing the color table is now in the ColorTable class.
2019-04-23 21:10:16 +07:00
oising
7eea98d4ea add sln file 2019-04-21 13:32:04 -04:00
oising
cade139e0c initial commit for tools/readconsoleinputstream PR 2019-04-21 13:31:36 -04:00
Michael Niksa
619a80ea14 Merge pull request #400 from LokiMidgard/back-and-forground-index-export
Back and forground index export
2019-04-02 10:21:23 -07:00
Patrick Kranz
2661fbe0b9 put console attributes in own variable 2019-04-02 19:09:59 +02:00
Patrick Kranz
a247624e90 encapsule console attributes in struct 2019-04-02 19:09:54 +02:00
Patrick Kranz
3484e07089 Fix spelling of foreground (was forground) 2019-04-02 19:09:36 +02:00
Patrick Kranz
9bf9a6f62c add popup color support to json format 2019-04-02 19:08:53 +02:00
Patrick Kranz
c1e1f5124c Merge branch 'master' into back-and-forground-index-export 2019-04-02 19:04:50 +02:00
Michael Niksa
3990a68770 Merge pull request #402 from LokiMidgard/json-parser-screen-color-support
added Support for parsing screen color in json
2019-04-01 19:16:01 -07:00
Mike Griese
ecea0c9f40 Merge pull request #401 from avdi/master
Document loading colortool schemes from current dir
2019-04-01 07:30:37 -07:00
Patrick Kranz
b38f6ffbd1 Added check if screen or popup colors were not found. 2019-03-29 21:53:50 +01:00
Patrick Kranz
e6500864bc added Support for parsing screen color in json 2019-03-29 21:52:04 +01:00
Avdi Grimm
ee8589110a Document loading colortool schemes from current dir 2019-03-29 15:04:58 -05:00
Patrick Kranz
99f71a0cc5 Export now writes screen and popup indexes in ini 2019-03-29 17:18:26 +01:00
Patrick Kranz
16b1b059a4 added abblity to parse popup and screen color from ini file 2019-03-29 17:09:09 +01:00
Patrick Kranz
cafe71c50b added popup color to scheme 2019-03-29 16:44:41 +01:00
Dustin L. Howett (MSFT)
1145336538 Merge pull request #278 from JakeHL/master
Added location flag to colortool and updated help.
2019-03-28 16:59:38 -07:00
Dustin L. Howett (MSFT)
a30f56645a Merge branch 'master' into master 2019-03-28 16:59:03 -07:00
Jake Langford
14f9cfc389 Removed trailing slashes on schemes directory 2019-03-28 17:20:08 +00:00
Michael Niksa
52ef47533b Merge pull request #378 from devhawk/devhawk/errorsArg
Don't report scheme parse errors by default
2019-02-27 12:57:12 -08:00
Harry Pierson
f3e53f1dac updated resources file 2019-02-27 09:50:08 -08:00
Harry Pierson
ae5be18556 add --errors cmd line arg to enable scheme parsing error reporting 2019-02-27 08:33:06 -08:00
Harry Pierson
4a30b1868b change ISchemeParser ParseScheme reportErrors param default to false 2019-02-27 08:32:45 -08:00
Michael Niksa
7e5c034b7f Merge pull request #314 from Microsoft/signing
Add signing configuration information to repository.
2018-11-29 12:42:22 -08:00
Michael Niksa
058b3f5d19 Austin should be in the list. 2018-11-29 12:38:36 -08:00
Michael Niksa
df1843c87d Add signing configuration information to repository. 2018-11-29 10:32:04 -08:00
AzureAD\JakeLangford
10b05fbe23 fixed trailing slash at the end of path 2018-10-12 09:11:48 +01:00
Jake Langford
66bc1f547e Added location flag to colortool and updated help. Also used path combine for schemes directory 2018-10-10 21:25:36 +01:00
Mike Griese
34ff272cfa Merge pull request #272 from waf/add-conpty-samples-to-readme
Add the new ConPTY samples to the readme
2018-10-08 09:09:01 -07:00
Will Fuqua
9971abf4e4 add the new ConPTY samples to the readme
Now that both the ConPTY samples (https://github.com/Microsoft/console/pull/247 and https://github.com/Microsoft/console/pull/260) are merged, mention them on the main repository README.
2018-10-06 17:49:48 +07:00
Michael Niksa
5456666d35 Merge pull request #260 from waf/add-csharp-conpty-sample
Add csharp conpty sample
2018-10-04 10:18:34 -07:00
Michael Niksa
bb795f5258 Merge pull request #266 from Microsoft/version
Correct version lookup for ES autoincremented value
2018-10-02 11:27:09 -07:00
Michael Niksa
2791753780 Adjust version lookup to use file version info stamp which is automatically incremented/generated by engineering system. 2018-10-02 11:18:00 -07:00
Michael Niksa
e5aa14ea7b Merge pull request #265 from Microsoft/fix-accessdenied-write
Wrap file system export write in try/catch.
2018-10-02 10:49:38 -07:00
Michael Niksa
e25ca32022 Wrap file system export write in try/catch. 2018-10-02 10:43:03 -07:00
Michael Niksa
bb5088ae6c Merge pull request #50 from Microsoft/osc-color
Add support for using ColorTool in WSL
2018-10-02 10:24:38 -07:00
Michael Niksa
4272e9c8e9 These masks were unused after I used the color helper. Removing. 2018-10-02 10:16:36 -07:00
Michael Niksa
15c2e57b96 Use helper and move constant for STD_OUTPUT_HANDLE. Use string interpolation for colors. Use Color object and UIntToColor helper for creating our pattern. Add SetLastError annotations to native functions. 2018-10-02 10:03:26 -07:00
Michael Niksa
0c3872d577 Merge branch 'master' into osc-color 2018-10-02 09:46:57 -07:00
Michael Niksa
7371ed764d Set to LF line endings. 2018-10-02 09:46:15 -07:00
Michael Niksa
f1627dd571 merge master 2018-10-02 09:25:28 -07:00
Michael Niksa
046475f7ab Merge pull request #181 from mikemaccana/master
Adjust 'ANSI 8' color to be more visible against background. Fixes #180
2018-10-02 09:11:49 -07:00
Michael Niksa
2c33edcba9 Merge pull request #236 from Jaykul/feature/schemeslist
Fix UIntTocolor
2018-10-02 09:09:48 -07:00
Will Fuqua
08b436f1a5 move Process and ProcessFactory classes into separate files 2018-09-21 21:54:01 +07:00
Will Fuqua
3a1ee61476 fix exit behavior
old behavior was whenever the user types "exit" to stop the entire terminal, which is not correct (e.g. does not work correctly for nested cmd.exe sessions). Now we wait for the top-level process to exit, which I think is more correct.
Also contains a minor rename, Process -> ProcessFactory, ProcessResources -> Process.
2018-09-21 21:50:18 +07:00
Will Fuqua
bf32b8d48f implement dispose pattern
- Full Dispose Pattern for ProcessResources since it has unmanaged resources
- Basic Dispose Pattern for PseudoConsolePipe since it has managed resources
- Fix naming of iStdOut to hStdOut
- Change parameter order of Process.Start to make more sense
2018-09-21 20:47:18 +07:00
Will Fuqua
637c57473e add c# files
- Move from rather ad-hoc, error-prone resource management to IDisposable, which should give us a bit more enforcement.
- Optimistically remove "buggy" from readme because the known bugs are now fixed! The main source of bugs was the incorrect InitializeProcThreadAttributeList usage.
- Handle ctrl-c by forwarding it to the PseudoConsole
- Handle terminal close when the window close button is used
- Use .NET's CopyTo in the CopyPipeToOutput, it's much simpler code and seems more robust than the ReadFile/WriteFile approach
- Minor refactor to split native APIs to multiple files
2018-09-20 22:13:37 +07:00
Will Fuqua
e09359138e add pinvoke signatures 2018-09-20 22:11:55 +07:00
Will Fuqua
0884a1bb1d add project infrastructure (sln, csproj, readme, etc) 2018-09-20 22:11:24 +07:00
Mike Griese
d8ab20d970 Merge pull request #252 from devhawk/devhawk/concfg-support
Add support for parsing concfg presets
2018-09-12 08:54:03 -07:00
Rich Turner
ac843745fa Add an example application that uses the pseudoconsole APIs (#247)
This sample implements a simple "Echo Console" that illustrates the mechanism by which a caller can directly invoke & communicate with Command-Line applications.

1. Creates two pipes - one for output, the second for output
1. Creates a Pseudo Console attached to the other end of the pipes
1. Creates a child process (an instance of `ping.exe` in this case), attached to the Pseudo Console
1. Creates a thread that reads the input pipe, displaying received text on the screen
2018-09-10 20:07:17 -07:00
Harry Pierson
1e6232b751 Add support for parsing concfg (https://github.com/lukesampson/concfg) presets 2018-09-10 09:38:22 -07:00
Joel Bennett
8dacee626a Fix UIntTocolor 2018-08-19 01:14:29 -04:00
Michael Niksa
da53ff957f Merge pull request #197 from atifaziz/consolidate-schemes-search
Consolidate schemes path search code
2018-06-06 14:54:29 -07:00
Michael Niksa
11a65ef0c7 Update README.md 2018-06-05 10:52:57 -07:00
Atif Aziz
aa20e89a84 Consolidate schemes path search code 2018-05-31 12:58:28 +02:00
Michael Niksa
f334ba68c9 Merge pull request #186 from minhhai2209/patch-1
Fixed Markdown link
2018-05-21 08:09:34 -07:00
minhhai2209
8afb12e747 Fixed Markdown link 2018-05-20 14:39:20 +07:00
Michael Niksa
b3b9f719fa Merge pull request #184 from mikemaccana/patch-4
Markdown fixes, also add a description
2018-05-17 08:18:04 -07:00
Mike MacCana
ae5b5fb5b1 Markdown fixes, also add a description 2018-05-17 11:28:58 +01:00
Michael Niksa
3d0f15d433 Merge pull request #183 from mikemaccana/patch-3
Add link to a visual editor for .itermcolors files
2018-05-16 11:09:53 -07:00
Michael Niksa
d3678caea7 Merge pull request #182 from mikemaccana/patch-1
Add a link to colortool releases page
2018-05-16 11:09:33 -07:00
Mike MacCana
f735286a7d Add link to a visual editor for .itermcolors files 2018-05-16 18:18:56 +01:00
Mike MacCana
aed5f9eae9 Add a link to colortool releases page
For those who just want the zip / don't have a build environment set up.
2018-05-16 18:12:39 +01:00
Mike MacCana
b2ed728bf1 Also update the 'one half dark' dark theme to fix #180 2018-05-16 18:00:25 +01:00
Mike MacCana
8d75ff1bec Adjust 'ANSI 8' color to be more visible against background. Fixes #180 2018-05-16 17:47:47 +01:00
Michael Niksa
a9973139e4 Merge pull request #164 from Hsn723/master
Change listing of available schemes to use directory of executable
2018-04-30 08:26:32 -07:00
Natsumi Hoshino
78e50fcf26 Change listing of available schemes to use directory of executable 2018-04-26 23:11:28 +09:00
Michael Niksa
5885732a2d Merge branch 'yatli-master' 2018-04-25 15:57:17 -07:00
Michael Niksa
ae4e0086a9 Merge branch 'master' of https://github.com/yatli/console into yatli-master
Changes made by <miniksa> to make it fit on merging.
2018-04-25 15:56:59 -07:00
Michael Niksa
3f76c471d0 Merge branch 'hugo-vrijswijk-master' 2018-04-25 15:45:38 -07:00
Michael Niksa
d6e77edc27 Add error suppression to make listing work better. 2018-04-25 15:37:40 -07:00
Michael Niksa
1465871e98 Merge pull request #161 from twsouthwick/turn-off-attributes
Disable automatic assembly info generation
2018-04-25 15:26:29 -07:00
Taylor Southwick
198c75cf26 Disable automatic assembly info generation 2018-04-25 15:24:59 -07:00
Michael Niksa
550e197684 Merge. 2018-04-25 15:11:14 -07:00
Michael Niksa
4c3065fec7 Merge pull request #26 from twsouthwick/use-new-csproj
Use simpler csproj format
2018-04-25 14:26:22 -07:00
Michael Niksa
cad9d55e41 Merge branch 'twsouthwick-dynamic-parser-list' 2018-04-25 14:23:34 -07:00
Michael Niksa
21b618648b Merge branch 'dynamic-parser-list' of https://github.com/twsouthwick/console into tsouthwich-dynamic-parser-list 2018-04-25 14:22:15 -07:00
Michael Niksa
d66df17bcb Merge pull request #19 from Microsoft/dev/zadjii/f/output-current
Add a switch for exporting settings
2018-04-25 14:18:48 -07:00
Michael Niksa
ddb74ef5db Fix typo from PR feedback. 2018-04-25 14:17:38 -07:00
Yatao Li
49b3df3d71 weighted RGB distance works well 2018-02-14 23:01:37 +08:00
Yatao Li
22dd8a8e01 colortool: add support for fg/bg color slot designation 2018-02-14 22:40:28 +08:00
Mike Griese
e0248749eb Merge pull request #33 from bvli/master
Check for VS 2017 Professional in build.bat
2018-01-19 13:59:51 -08:00
Mike Griese
eba68a04b6 Enable setting the colors w/ VT even on windows 2018-01-19 13:51:56 -08:00
Mike Griese
85e347fc4a I guess I didn't need this after all 2018-01-19 13:32:45 -08:00
Mike Griese
9a5393d49d Fix printing the table in vt mode 2018-01-19 13:31:01 -08:00
Mike Griese
48021e1d75 fix the xterm version 2017-10-23 10:02:08 -07:00
Mike Griese
5b47a58a3a Prototype support for WSL 2017-10-13 16:09:49 -07:00
Bjarke Lindberg
889e19a05a Check for VS 2017 Professional in build.bat 2017-10-13 11:03:00 +02:00
Rich Turner
dc9cab01cd Update README.md 2017-10-08 14:34:48 -07:00
Rich Turner
f052ca5dc4 Updated readme 2017-10-08 14:30:31 -07:00
Rich Turner
e9d52f7f0f Update ISSUE_TEMPLATE.md 2017-09-11 14:49:09 -07:00
Rich Turner
a8c1100bfa Created 2017-09-11 14:46:11 -07:00
Hugo van Rijswijk
fe7a2d00fa Add option to view available color schemes 2017-09-11 20:19:33 +02:00
Taylor Southwick
7ae6ee6e00 Use simpler csproj format 2017-08-28 10:20:25 -07:00
Taylor Southwick
9bd6053664 Dynamically generate list of parsers 2017-08-28 10:06:45 -07:00
Mike Griese
cf4780a4a2 Merge pull request #21 from Nacimota/master
Fix typos in colortool help message and README
2017-08-23 13:02:29 -07:00
Lachlan Picking
c12f5a9157 Fix typos in colortool help message and README 2017-08-18 10:49:01 +10:00
Mike Griese
ce43f9af2a Merge pull request #17 from metathinker/master
ColorTool: Restore old console colors after printing the color table
2017-08-15 09:10:26 -07:00
Mike Griese
fed6302eeb Merge pull request #18 from metathinker/all.bat
ColorTool: Fix the included all.bat batch file
2017-08-15 09:08:13 -07:00
Michael Ratanapintha
f757ecaa29 ColorTool: Fix the included all.bat batch file
This batch file doesn't work if you use build.bat to build
the program, as all.bat looks for ct.exe rather than colortool.exe.
Fortunately, fixing the batch file is almost as easy as working around
its bug manually.
2017-08-14 21:49:42 -07:00
Michael Ratanapintha
4964aad780 ColorTool: Restore old console colors after printing the console table
Unfortunately, when you run `.\colortool.exe --current`,
you might notice that the color of the prompt printed after
the program finishes is slightly different from what it was
before you ran the program.

This changelist fixes the issue by restoring the old console colors
after the program finishes printing the color table.

Testing: manual
2017-08-14 21:44:53 -07:00
Mike Griese
067cf3a29b Add a switch for exporting settings
As suggested by #6
2017-08-14 13:29:39 -07:00
1294 changed files with 191595 additions and 1071 deletions

13
.editorconfig Normal file
View File

@@ -0,0 +1,13 @@
root = true
[*]
trim_trailing_whitespace = true
insert_final_newline = true
[{*.cpp,*.c,*.hpp,*.h,*.cs}]
indent_style = space
indent_size = 4
[*.json]
indent_style = space
indent_size = 2

63
.gitattributes vendored Normal file
View File

@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* -text
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

39
.github/ISSUE_TEMPLATE/Bug_Report.md vendored Normal file
View File

@@ -0,0 +1,39 @@
---
name: Bug report 🐛
about: Report errors or unexpected behavior
title: "Bug Report"
labels: ''
assignees: ''
---
<!--
This bug tracker is monitored by Windows Terminal development team and other technical folks.
**Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**.
Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue.
Please use this form and describe your issue, concisely but precisely, with as much detail as possible.
-->
# Environment
```none
Windows build number: [run "ver" at a command prompt]
Windows Terminal version (if applicable):
Any other software?
```
# Steps to reproduce
<!-- A description of how to trigger this bug. -->
# Expected behavior
<!-- A description of what you're expecting, possibly containing screenshots or reference material. -->
# Actual behavior
<!-- What's actually happening? -->

View File

@@ -0,0 +1,10 @@
---
name: Documentation Issue 📚
about: Report issues in our documentation
title: "Documentation Issue"
labels: Issue-Docs
assignees: ''
---
<!-- Briefly describe which document needs to be corrected and why. -->

View File

@@ -0,0 +1,21 @@
---
name: Feature Request/Idea 🚀
about: Suggest a new feature or improvement (this does not mean you have to implement it)
title: "Feature Request"
labels: Issue-Feature
assignees: ''
---
# Summary of the new feature/enhancement
<!--
A clear and concise description of what the problem is that the new feature would solve.
Describe why and how a user would use this new functionality (if applicable).
-->
# Proposed technical implementation details (optional)
<!--
A clear and concise description of what you want to happen.
-->

View File

@@ -0,0 +1,10 @@
---
name: Community Guidance Request ✨
about: Suggest somewhere the Windows Terminal Team needs to provide community guidance through new documentation or process.
title: "Guidance"
labels: Issue-Docs
assignees: 'bitcrazed'
---
<!-- What needs to change? Who is responsible for it? Why is it an open question? -->

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,16 @@
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request
<!-- Other than the issue solved, is this relevant to any other issues/existing PRs? -->
## References
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
* [ ] Closes #xxx
* [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [ ] Tests added/passed
* [ ] Requires documentation to be updated
* [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx
<!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

530
.gitignore vendored
View File

@@ -1,253 +1,277 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
*.exe
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
ARM64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
objfre/
objchk/
# Visual Studio 2015 cache/options directory
.vs/
# Visual Studio Code cache/options directory
.vscode/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
*.exe
# Windows Build System files
build*.dbb
build*.err
build*.evt
build*.log
build*.prf
build*.trc
build*.rec
build*.wrn
build*.metadata
# .razzlerc.cmd file - used by dev environment
tools/.razzlerc.*
# message compiler output
MSG*.bin
/*.exe
# python
*.pyc
**/Generated Files/
**/Merged/*
**/Unmerged/*
profiles.json
*.metaproj

6
.gitmodules vendored Normal file
View File

@@ -0,0 +1,6 @@
[submodule "dep/gsl"]
path = dep/gsl
url = https://github.com/microsoft/gsl
[submodule "dep/wil"]
path = dep/wil
url = https://github.com/microsoft/wil

4
.nuget/packages.config Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="vswhere" version="2.6.7" />
</packages>

34
.vsconfig Normal file
View File

@@ -0,0 +1,34 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.CoreEditor",
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.VisualStudio.Workload.Universal",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
"Microsoft.VisualStudio.Component.NuGet",
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
"Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
"Microsoft.Component.MSBuild",
"Microsoft.VisualStudio.Component.ManagedDesktop.Core",
"Microsoft.Net.Component.4.TargetingPack",
"Microsoft.Net.Component.4.5.TargetingPack",
"Microsoft.VisualStudio.Component.DiagnosticTools",
"Microsoft.VisualStudio.Component.Debugger.JustInTime",
"Microsoft.VisualStudio.Component.Windows10SDK.18362",
"Microsoft.VisualStudio.ComponentGroup.UWP.Support",
"Microsoft.VisualStudio.Component.VC.CoreIde",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
"Microsoft.VisualStudio.Component.Graphics",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.VC.Tools.ARM64",
"Microsoft.VisualStudio.Component.VC.v141.x86.x64",
"Microsoft.VisualStudio.Component.VC.v141.ARM64",
"Microsoft.VisualStudio.ComponentGroup.UWP.VC",
"Microsoft.VisualStudio.ComponentGroup.UWP.VC.v141",
"Microsoft.VisualStudio.Component.UWP.VC.ARM64"
]
}

8
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,8 @@
# Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct][conduct-code].
For more information see the [Code of Conduct FAQ][conduct-FAQ] or contact [opencode@microsoft.com][conduct-email] with any additional questions or comments.
[conduct-code]: https://opensource.microsoft.com/codeofconduct/
[conduct-FAQ]: https://opensource.microsoft.com/codeofconduct/faq/
[conduct-email]: mailto:opencode@microsoft.com

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
Copyright (c) Microsoft Corporation. All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

17
NuGet.Config Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
<!-- Add repositories here to the list of available repositories -->
<!-- Dependencies that we must carry because they're not on public nuget feeds right now. -->
<add key="Static Package Dependencies" value="dep\packages" />
<!-- Internal NuGet feeds that may not be accessible outside Microsoft corporate network -->
<!--<add key="TAEF - internal" value="https://microsoft.pkgs.visualstudio.com/DefaultCollection/_packaging/Taef/nuget/v3/index.json" />
<add key="OpenConsole - Internal" value="https://microsoft.pkgs.visualstudio.com/_packaging/OpenConsole/nuget/v3/index.json" />-->
</packageSources>
<config>
<add key="repositorypath" value=".\packages" />
</config>
</configuration>

1185
OpenConsole.sln Normal file

File diff suppressed because it is too large Load Diff

184
README.md
View File

@@ -1,16 +1,178 @@
# Console
# Welcome\!
#### This repository contains the source code for:
This is the Official Windows Console Github Repo.
Here you'll find assorted console tools in the `tools/` directory, such as the
[ColorTool](https://github.com/Microsoft/Console/tree/master/tools/ColorTool).
* Windows Terminal
* The Windows console host (`conhost.exe`)
* Components shared between the two projects
* [ColorTool](https://github.com/Microsoft/Terminal/tree/master/src/tools/ColorTool)
* [Sample projects](https://github.com/Microsoft/Terminal/tree/master/samples) that show how to consume the Windows Console APIs
#### Other related repositories include:
* [Console API Documentation](https://github.com/MicrosoftDocs/Console-Docs/issues)
## Issues
We will be monitoring and responding to issues as best we can.
Please attempt to avoid filing duplicates of open or closed items when possible.
## Build Status
### Build Status
Project|Build Status
---|---
tools/ColorTool|![](https://microsoft.visualstudio.com/_apis/public/build/definitions/c93e867a-8815-43c1-92c4-e7dd5404f1e1/17023/badge)
Terminal|[![Build Status](https://dev.azure.com/ms/Terminal/_apis/build/status/Terminal%20CI?branchName=master)](https://dev.azure.com/ms/Terminal/_build?definitionId=136)
ColorTool|![](https://microsoft.visualstudio.com/_apis/public/build/definitions/c93e867a-8815-43c1-92c4-e7dd5404f1e1/17023/badge)
# Terminal & Console Overview
Please take a few minutes to review the overview below before diving into the code:
## Windows Terminal
Windows Terminal is a new, modern, feature-rich, productive terminal application for command-line users. It includes many of the features most frequently requested by the Windows command-line community including support for tabs, rich text, globalization, configurability, theming & styling, and more.
The Terminal will also need to meet our goals and measures to ensure it remains fast, and efficient, and doesn't consume vast amounts of memory or power.
## The Windows console host
The Windows console host, `conhost.exe`, is Windows' original command-line user experience. It implements Windows' command-line infrastructure, and is responsible for hosting the Windows Console API, input engine, rendering engine, and user preferences. The console host code in this repository is the actual source from which the `conhost.exe` in Windows itself is built.
Console's primary goal is to remain backwards-compatible with existing console subsystem applications.
Since assuming ownership of the Windows command-line in 2014, the team has added several new features to the Console, including window transparency, line-based selection, support for [ANSI / Virtual Terminal sequences](https://en.wikipedia.org/wiki/ANSI_escape_code), [24-bit color](https://devblogs.microsoft.com/commandline/24-bit-color-in-the-windows-console/), a [Pseudoconsole ("ConPTY")](https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/), and more.
However, because the Console's primary goal is to maintain backward compatibility, we've been unable to add many of the features the community has been asking for, and which we've been wanting to add for the last several years--like tabs!
These limitations led us to create the new Windows Terminal.
## Shared Components
While overhauling the Console, we've modernized its codebase considerably. We've cleanly separated logical entities into modules and classes, introduced some key extensibility points, replaced several old, home-grown collections and containers with safer, more efficient [STL containers](https://docs.microsoft.com/en-us/cpp/standard-library/stl-containers?view=vs-2019), and made the code simpler and safer by using Microsoft's [WIL](https://github.com/Microsoft/wil) header library.
This overhaul work resulted in the creation of several key components that would be useful for any terminal implementation on Windows, including a new DirectWrite-based text layout and rendering engine, a text buffer capable of storing both UTF-16 and UTF-8, and a VT parser/emitter.
## Building a new terminal
When we started building the new terminal application, we explored and evaluated several approaches and technology stacks. We ultimately decided that our goals would be best met by sticking with C++ and sharing the aforementioned modernized components, placing them atop the modern Windows application platform and UI framework.
Further, we realized that this would allow us to build the terminal's renderer and input stack as a reusable Windows UI control that others can incorporate into their applications.
# FAQ
## Where can I download Windows Terminal?
### There are no binaries to download quite yet.
The Windows Terminal is in the _very early_ alpha stage, and not ready for the general public quite yet. If you want to jump in early, you can try building it yourself from source.
Otherwise, you'll need to wait until Mid-June for an official preview build to drop.
## I built and ran the new Terminal, but I just get a blank window app!
Make sure you are building for your computer's architecture. If your box has a 64-bit Windows change your Solution Platform to x64.
To check your OS architecture go to Settings -> System -> About (or Win+X -> System) and under `Device specifications` check for the `System type`
## I built and ran the new Terminal, but it looks just like the old console! What gives?
Firstly, make sure you're building & deploying `CascadiaPackage` in Visual Studio, _NOT_ `Host.EXE`. `OpenConsole.exe` is just `conhost.exe`, the same old console you know and love. `opencon.cmd` will launch `openconsole.exe`, and unfortunately, `openterm.cmd` is currently broken.
Secondly, try pressing <kbd>Ctrl</kbd> + <kbd>T</kbd>. The tabs are hidden when you only have one tab by default. In the future, the UI will be dramatically different, but for now, the defaults are _supposed_ to look like the console defaults.
## I tried running WindowsTerminal.exe and it crashes!
* Don't try to run it unpackaged. Make sure to build & deploy `CascadiaPackage` from Visual Studio, and run the Windows Terminal (Dev Build) app.
* Make sure you're on the right version of Windows. You'll need to be on Insider's builds, or wait for the 1903 release, as the Windows Terminal **REQUIRES** features from the latest Windows release.
# Getting Started
## Prerequisites
* You must be running Windows 1903 (build >= 10.0.18362.0) or above in order to run Windows Terminal
* You must have the [1903 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk) (build 10.0.18362.0) installed
* You must have at least [VS 2017](https://visualstudio.microsoft.com/downloads/) installed.
* You must install the following Workloads via the VS Installer. If you're running VS 2019, opening the solution will [prompt you to install missing components automatically](https://devblogs.microsoft.com/setup/configure-visual-studio-across-your-organization-with-vsconfig/).
- Desktop Development with C++
- Universal Windows Platform Development
- Also install the following Individual Component:
- C++ (v141) Universal Windows Platform Tools
* You must also [enable Developer Mode in the Windows Settings app](https://docs.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development) to locally install and run the Terminal app.
## Debugging
* To debug in VS, right click on CascadiaPackage (from VS Solution Explorer) and go to properties, in the Debug menu, change "Application process" and "Background task process" to "Native Only"
## Contributing
We are excited to work alongside you, our amazing community, to build and enhance Windows Terminal\!
We ask that **before you start work on a feature that you would like to contribute, <span class="underline">please file an issue</span> describing your proposed change**: We will be happy to work with you to figure out the best approach, provide guidance and mentorship throughout feature development, and help avoid any wasted or duplicate effort.
> 👉 **Remember\!** Your contributions may be incorporated into future versions of Windows\! Because of this, all pull requests will be subject to the same level of scrutiny for quality, coding standards, performance, globalization, accessibility, and compatibility as those of our internal contributors.
> ⚠ **Note**: The Command-Line Team is actively working out of this repository and will be periodically re-structuring the code to make it easier to comprehend, navigate, build, test, and contribute to, so **DO expect significant changes to code layout on a regular basis**.
## Documentation
All documentation is located in the `./doc` folder. If you would like to contribute to the documentation, please submit a pull request.
## Communicating with the Team
The easiest way to communicate with the team is via GitHub issues. Please file new issues, feature requests and suggestions, but **DO search for similar open/closed pre-existing issues before you do**.
Please help us keep this repository clean, inclusive, and fun\! We will not tolerate any abusive, rude, disrespectful or inappropriate behavior. Read our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/) for more details.
If you would like to ask a question that you feel doesn't warrant an issue (yet), please reach out to us via Twitter:
* Rich Turner, Program Manager: [@richturn\_ms](https://twitter.com/richturn_ms)
* Dustin Howett, Engineering Lead: [@dhowett](https://twitter.com/DHowett)
* Michael Niksa, Senior Developer: [@michaelniksa](https://twitter.com/MichaelNiksa)
* Kayla Cinnamon, Program Manager (especially for UX issues): [@cinnamon\_msft](https://twitter.com/cinnamon_msft)
# Developer Guidance
## Building the Code
This repository uses [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) for some of its dependencies. To make sure submodules are restored or updated, be sure to run the following prior to building:
```shell
git submodule update --init --recursive
```
OpenConsole.sln may be built from within Visual Studio or from the command-line using MSBuild. To build from the command line, find your shell below.
### PowerShell
```powershell
Import-Module .\tools\OpenConsole.psm1
Set-MsBuildDevEnvironment
Invoke-OpenConsoleBuild
```
### CMD
```shell
.\tools\razzle.cmd
bcz
```
We've provided a set of convenience scripts as well as [README](./tools/README.md) in the **/tools** directory to help automate the process of building and running tests.
## Coding Guidance
Please review these brief docs below relating to our coding standards etc.
> 👉 If you find something missing from these docs, feel free to contribute to any of our documentation files anywhere in the repository (or make some new ones\!)
This is a work in progress as we learn what we'll need to provide people in order to be effective contributors to our project.
- [Coding Style](https://github.com/Microsoft/Terminal/blob/master/doc/STYLE.md)
- [Code Organization](https://github.com/Microsoft/Terminal/blob/master/doc/ORGANIZATION.md)
- [Exceptions in our legacy codebase](https://github.com/Microsoft/Terminal/blob/master/doc/EXCEPTIONS.md)
- [Helpful smart pointers and macros for interfacing with Windows in WIL](https://github.com/Microsoft/Terminal/blob/master/doc/WIL.md)
# Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct][conduct-code].
For more information see the [Code of Conduct FAQ][conduct-FAQ] or contact [opencode@microsoft.com][conduct-email] with any additional questions or comments.
[conduct-code]: https://opensource.microsoft.com/codeofconduct/
[conduct-FAQ]: https://opensource.microsoft.com/codeofconduct/faq/
[conduct-email]: mailto:opencode@microsoft.com

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Taef.TestAdapter" version="10.30.180808002" />
</packages>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="TAEF Internal" value="https://microsoft.pkgs.visualstudio.com/_packaging/Taef/nuget/v3/index.json" />
</packageSources>
<config>
<add key="repositorypath" value="..\..\packages" />
</config>
</configuration>

View File

@@ -0,0 +1,5 @@
<SignConfigXML>
<job platform="" configuration="" certSubject="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" jobname="EngFunSimpleSign" approvers="">
<file src="__INPATHROOT__\Microsoft.WindowsTerminal_8wekyb3d8bbwe.msixbundle" signType="136020001" dest="__OUTPATHROOT__\Microsoft.WindowsTerminal_8wekyb3d8bbwe.msixbundle" />
</job>
</SignConfigXML>

36
build/pipelines/ci.yml Normal file
View File

@@ -0,0 +1,36 @@
trigger:
batch: true
branches:
include:
- master
paths:
exclude:
- doc/*
- samples/*
- tools/*
pr:
branches:
include:
- master
# 0.0.yyMM.dd##
# 0.0.1904.0900
name: 0.0.$(Date:yyMM).$(Date:dd)$(Rev:rr)
jobs:
- template: ./templates/build-console-audit-job.yml
parameters:
platform: x64
- template: ./templates/build-console-ci.yml
parameters:
platform: x64
- template: ./templates/build-console-ci.yml
parameters:
platform: x86
- template: ./templates/build-console-ci.yml
parameters:
platform: ARM64

View File

@@ -0,0 +1,38 @@
trigger: none
pr: none
variables:
baseYearForVersioning: 2019 # Used by build-console-int
versionMajor: 0
versionMinor: 1
# When we move off PackageES for Versioning, we'll need to switch
# name to this format. For now, though, we need to use DayOfYear.Rev
# to unique our builds, as mandated by PackageES's Setup task.
# name: '$(versionMajor).$(versionMinor).$(DayOfYear)$(Rev:r).0'
#
# Build name/version number above must end with .0 to make the
# store publication machinery happy.
name: 'Terminal_$(date:yyMM).$(date:dd)$(rev:rrr)'
jobs:
- template: ./templates/build-console-audit-job.yml
parameters:
platform: x64
- template: ./templates/build-console-int.yml
parameters:
platform: x64
additionalBuildArguments: /p:WindowsTerminalReleaseBuild=true
- template: ./templates/build-console-int.yml
parameters:
platform: x86
additionalBuildArguments: /p:WindowsTerminalReleaseBuild=true
- template: ./templates/build-console-int.yml
parameters:
platform: arm64
additionalBuildArguments: /p:WindowsTerminalReleaseBuild=true
- template: ./templates/release-sign-and-bundle.yml

View File

@@ -0,0 +1,53 @@
parameters:
platform: ''
additionalBuildArguments: ''
jobs:
- job: Build${{ parameters.platform }}AuditMode
displayName: Static Analysis Build ${{ parameters.platform }}
variables:
BuildConfiguration: AuditMode
BuildPlatform: ${{ parameters.platform }}
pool: { vmImage: vs2017-win2016 }
steps:
- checkout: self
submodules: true
clean: true
- task: NuGetToolInstaller@0
displayName: Ensure NuGet 4.8.1
inputs:
versionSpec: 4.8.1
# In the Microsoft Azure DevOps tenant, NuGetCommand is ambiguous.
# This should be `task: NuGetCommand@2`
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
displayName: Restore NuGet packages
inputs:
command: restore
feedsToUse: config
configPath: NuGet.config
restoreSolution: OpenConsole.sln
restoreDirectory: '$(Build.SourcesDirectory)\packages'
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
displayName: 'NuGet restore packages for CI'
inputs:
command: restore
restoreSolution: build/.nuget/packages.config
feedsToUse: config
externalFeedCredentials: 'TAEF NuGet Feed'
nugetConfigPath: build/config/NuGet.config
restoreDirectory: '$(Build.SourcesDirectory)/packages'
- task: VSBuild@1
displayName: 'Build solution **\OpenConsole.sln'
inputs:
solution: '**\OpenConsole.sln'
vsVersion: 15.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArgs: ${{ parameters.additionalBuildArguments }}
clean: true
maximumCpuCount: true

View File

@@ -0,0 +1,17 @@
parameters:
configuration: 'Release'
platform: ''
additionalBuildArguments: ''
jobs:
- job: Build${{ parameters.platform }}${{ parameters.configuration }}
displayName: Build ${{ parameters.platform }} ${{ parameters.configuration }}
variables:
BuildConfiguration: ${{ parameters.configuration }}
BuildPlatform: ${{ parameters.platform }}
pool: { vmImage: vs2017-win2016 }
steps:
- template: build-console-steps.yml
parameters:
additionalBuildArguments: ${{ parameters.additionalBuildArguments }}

View File

@@ -0,0 +1,30 @@
parameters:
configuration: 'Release'
platform: ''
additionalBuildArguments: ''
jobs:
- job: Build${{ parameters.platform }}${{ parameters.configuration }}
displayName: Build ${{ parameters.platform }} ${{ parameters.configuration }}
variables:
BuildConfiguration: ${{ parameters.configuration }}
BuildPlatform: ${{ parameters.platform }}
pool:
name: Package ES Lab E
demands:
- msbuild
- visualstudio
- vstest
steps:
- task: PkgESSetupBuild@10
displayName: 'Package ES - Setup Build'
inputs:
useDfs: false
productName: WindowsTerminal
disableOutputRedirect: true
- template: build-console-steps.yml
parameters:
additionalBuildArguments: "/p:XesUseOneStoreVersioning=true;XesBaseYearForStoreVersion=$(baseYearForVersioning) ${{ parameters.additionalBuildArguments }}"

View File

@@ -0,0 +1,95 @@
parameters:
additionalBuildArguments: ''
steps:
- checkout: self
submodules: true
clean: true
- task: NuGetToolInstaller@0
displayName: Ensure NuGet 4.8.1
inputs:
versionSpec: 4.8.1
- task: VisualStudioTestPlatformInstaller@1
displayName: Ensure VSTest Platform
# In the Microsoft Azure DevOps tenant, NuGetCommand is ambiguous.
# This should be `task: NuGetCommand@2`
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
displayName: Restore NuGet packages
inputs:
command: restore
feedsToUse: config
configPath: NuGet.config
restoreSolution: OpenConsole.sln
restoreDirectory: '$(Build.SourcesDirectory)\packages'
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
displayName: 'NuGet restore packages for CI'
inputs:
command: restore
restoreSolution: build/.nuget/packages.config
feedsToUse: config
externalFeedCredentials: 'TAEF NuGet Feed'
nugetConfigPath: build/config/NuGet.config
restoreDirectory: '$(Build.SourcesDirectory)/packages'
- task: VSBuild@1
displayName: 'Build solution **\OpenConsole.sln'
inputs:
solution: '**\OpenConsole.sln'
vsVersion: 15.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArgs: ${{ parameters.additionalBuildArguments }}
clean: true
maximumCpuCount: true
- task: VSTest@2
displayName: 'Run Unit Tests'
inputs:
testAssemblyVer2: |
$(BUILD.SOURCESDIRECTORY)\**\*unit.test*.dll
!**\obj\**
runSettingsFile: '$(BUILD.SOURCESDIRECTORY)\src\unit.tests.$(BuildPlatform).runsettings'
codeCoverageEnabled: true
runInParallel: False
testRunTitle: 'Console Unit Tests'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x64'), eq(variables['BuildPlatform'], 'x86')))
- task: VSTest@2
displayName: 'Run Feature Tests (x64 only)'
inputs:
testAssemblyVer2: |
$(BUILD.SOURCESDIRECTORY)\**\*feature.test*.dll
!**\obj\**
runSettingsFile: '$(BUILD.SOURCESDIRECTORY)\src\unit.tests.$(BuildPlatform).runsettings'
codeCoverageEnabled: true
runInParallel: False
testRunTitle: 'Console Feature Tests'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
condition: and(succeeded(), eq(variables['BuildPlatform'], 'x64'))
- task: CopyFiles@2
displayName: 'Copy *.appx/*.msix to Artifacts (Non-PR builds only)'
inputs:
Contents: |
**/*.appx
**/*.msix
**/*.appxsym
!**/Microsoft.VCLibs*.appx
TargetFolder: '$(Build.ArtifactStagingDirectory)/appx'
OverWrite: true
flattenFolders: true
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact (appx) (Non-PR builds only)'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/appx'
ArtifactName: 'appx-$(BuildConfiguration)'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

View File

@@ -0,0 +1,72 @@
parameters:
configuration: 'Release'
jobs:
- job: SignDeploy${{ parameters.configuration }}
displayName: Sign and Deploy for ${{ parameters.configuration }}
dependsOn:
- Buildx64AuditMode
- Buildx64Release
- Buildx86Release
- Buildarm64Release
condition: |
and
(
in(dependencies.Buildx64AuditMode.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.Buildx64Release.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.Buildx86Release.result, 'Succeeded', 'SucceededWithIssues', 'Skipped'),
in(dependencies.Buildarm64Release.result, 'Succeeded', 'SucceededWithIssues', 'Skipped')
)
variables:
BuildConfiguration: ${{ parameters.configuration }}
AppxProjectName: CascadiaPackage
AppxBundleName: Microsoft.WindowsTerminal_8wekyb3d8bbwe.msixbundle
pool:
name: Package ES Lab E
steps:
- checkout: self
clean: true
- task: PkgESSetupBuild@10
displayName: 'Package ES - Setup Build'
inputs:
useDfs: false
productName: WindowsTerminal
disableOutputRedirect: true
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: 'Component Detection'
- task: DownloadBuildArtifacts@0
displayName: Download AppX artifacts
inputs:
artifactName: 'appx-$(BuildConfiguration)'
itemPattern: |
**/*.appx
**/*.msix
downloadPath: '$(Build.ArtifactStagingDirectory)\appx'
- task: PowerShell@2
displayName: 'Create $(AppxBundleName)'
inputs:
targetType: filePath
filePath: '.\build\scripts\Create-AppxBundle.ps1'
arguments: |
-InputPath "$(Build.ArtifactStagingDirectory)\appx" -ProjectName $(AppxProjectName) -BundleVersion 0.0.0.0 -OutputPath "$(Build.ArtifactStagingDirectory)\$(AppxBundleName)"
- task: PkgESCodeSign@10
displayName: 'Package ES - SignConfig.WindowsTerminal.xml'
inputs:
signConfigXml: 'build\config\SignConfig.WindowsTerminal.xml'
inPathRoot: '$(Build.ArtifactStagingDirectory)'
outPathRoot: '$(Build.ArtifactStagingDirectory)\signed'
- task: PublishBuildArtifacts@1
displayName: 'Publish Signed AppX'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\signed'
ArtifactName: 'appxbundle-signed-$(BuildConfiguration)'

View File

@@ -0,0 +1,57 @@
Param(
[Parameter(Mandatory,
HelpMessage="Base name for input .appx files")]
[string]
$ProjectName,
[Parameter(Mandatory,
HelpMessage="Appx Bundle Version")]
[version]
$BundleVersion,
[Parameter(Mandatory,
HelpMessage="Path under which to locate appx/msix files")]
[string]
$InputPath,
[Parameter(Mandatory,
HelpMessage="Output Path")]
[string]
$OutputPath,
[Parameter(HelpMessage="Path to makeappx.exe")]
[ValidateScript({Test-Path $_ -Type Leaf})]
[string]
$MakeAppxPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\MakeAppx.exe"
)
If ($null -Eq (Get-Item $MakeAppxPath -EA:SilentlyContinue)) {
Write-Error "Could not find MakeAppx.exe at `"$MakeAppxPath`".`nMake sure that -MakeAppxPath points to a valid SDK."
Exit 1
}
# Enumerates a set of appx files beginning with a project name
# and generates a temporary file containing a bundle content map.
Function Create-AppxBundleMapping {
Param(
[Parameter(Mandatory)]
[string]
$InputPath,
[Parameter(Mandatory)]
[string]
$ProjectName
)
$lines = @("[Files]")
Get-ChildItem -Path:$InputPath -Recurse -Filter:*$ProjectName* -Include *.appx, *.msix | % {
$lines += ("`"{0}`" `"{1}`"" -f ($_.FullName, $_.Name))
}
$outputFile = New-TemporaryFile
$lines | Out-File -Encoding:ASCII $outputFile
$outputFile
}
$NewMapping = Create-AppxBundleMapping -InputPath:$InputPath -ProjectName:$ProjectName
& $MakeAppxPath bundle /v /bv $BundleVersion.ToString() /f $NewMapping.FullName /p $OutputPath

13
common.openconsole.props Normal file
View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
This props file is a workaround for the fact that for wapproj projects,
the $(SolutionDir) is never evaluated correctly. So, instead we're using this
file to define $(OpenConsoleDir), which should be used in place of $(SolutionDir)
-->
<PropertyGroup Condition="'$(OpenConsoleDir)'==''">
<OpenConsoleDir>$(MSBuildThisFileDirectory)</OpenConsoleDir>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,36 @@
{
"PrefixFilters": [
"."
],
"ContainsFilters": [
"/.",
"/.git/",
"/obj/",
"/bin/",
"/TestResults/",
"/packages/",
"/ipch/",
"/dep/",
"/.vs/",
"/build/",
"/src/cascadia/",
"/.nuget/",
"/.github/",
"/samples/"
],
"SuffixFilters": [
".dbb",
".evt",
".log",
".metadata",
".prf",
".trc",
".user",
".tmp",
".TMP",
".db",
".wrn",
".rec",
".err"
]
}

24
dep/Console/conapi.h Normal file
View File

@@ -0,0 +1,24 @@
/*++
Copyright (c) Microsoft Corporation
Module Name:
- conapi.h
Abstract:
- This module contains the internal structures and definitions used by the console server.
Author:
- Therese Stowell (ThereseS) 12-Nov-1990
Revision History:
--*/
#pragma once
// these should be in precomp but aren't being picked up...
#include <unordered_map>
#define STATUS_SHARING_VIOLATION ((NTSTATUS)0xC0000043L)
#include "conmsgl1.h"
#include "conmsgl2.h"
#include "conmsgl3.h"

214
dep/Console/condrv.h Normal file
View File

@@ -0,0 +1,214 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
condrv.h
Abstract:
This module contains the declarations shared by the console driver and the
user-mode components that use it.
Author:
Wedson Almeida Filho (wedsonaf) 24-Sep-2009
Environment:
Kernel and user modes.
--*/
#pragma once
#include "..\NT\ntioapi_x.h"
//
// Messages that can be received by servers, used in CD_IO_DESCRIPTOR::Function.
//
#define CONSOLE_IO_CONNECT 0x01
#define CONSOLE_IO_DISCONNECT 0x02
#define CONSOLE_IO_CREATE_OBJECT 0x03
#define CONSOLE_IO_CLOSE_OBJECT 0x04
#define CONSOLE_IO_RAW_WRITE 0x05
#define CONSOLE_IO_RAW_READ 0x06
#define CONSOLE_IO_USER_DEFINED 0x07
#define CONSOLE_IO_RAW_FLUSH 0x08
//
// Header of all IOs submitted to a server.
//
typedef struct _CD_IO_DESCRIPTOR {
LUID Identifier;
ULONG_PTR Process;
ULONG_PTR Object;
ULONG Function;
ULONG InputSize;
ULONG OutputSize;
ULONG Reserved;
} CD_IO_DESCRIPTOR, *PCD_IO_DESCRIPTOR;
//
// Types of objects, used in CREATE_OBJECT_INFORMATION::ObjectType.
//
#define CD_IO_OBJECT_TYPE_CURRENT_INPUT 0x01
#define CD_IO_OBJECT_TYPE_CURRENT_OUTPUT 0x02
#define CD_IO_OBJECT_TYPE_NEW_OUTPUT 0x03
#define CD_IO_OBJECT_TYPE_GENERIC 0x04
//
// Payload of the CONSOLE_IO_CREATE_OBJECT io.
//
typedef struct _CD_CREATE_OBJECT_INFORMATION {
ULONG ObjectType;
ULONG ShareMode;
ACCESS_MASK DesiredAccess;
} CD_CREATE_OBJECT_INFORMATION, *PCD_CREATE_OBJECT_INFORMATION;
//
// Create EA buffers.
//
#define CD_BROKER_EA_NAME "broker"
#define CD_SERVER_EA_NAME "server"
#define CD_ATTACH_EA_NAME "attach"
typedef struct _CD_CREATE_SERVER {
HANDLE BrokerHandle;
LUID BrokerRequest;
} CD_CREATE_SERVER, *PCD_CREATE_SERVER;
typedef struct _CD_ATTACH_INFORMATION {
HANDLE ProcessId;
} CD_ATTACH_INFORMATION, *PCD_ATTACH_INFORMATION;
typedef struct _CD_ATTACH_INFORMATION64 {
PVOID64 ProcessId;
} CD_ATTACH_INFORMATION64, *PCD_ATTACH_INFORMATION64;
//
// Information passed to the driver by a server when a connection is accepted.
//
typedef struct _CD_CONNECTION_INFORMATION {
ULONG_PTR Process;
ULONG_PTR Input;
ULONG_PTR Output;
} CD_CONNECTION_INFORMATION, *PCD_CONNECTION_INFORMATION;
//
// Ioctls.
//
typedef struct _CD_IO_BUFFER {
ULONG Size;
PVOID Buffer;
} CD_IO_BUFFER, *PCD_IO_BUFFER;
typedef struct _CD_IO_BUFFER64 {
ULONG Size;
PVOID64 Buffer;
} CD_IO_BUFFER64, *PCD_IO_BUFFER64;
typedef struct _CD_USER_DEFINED_IO {
HANDLE Client;
ULONG InputCount;
ULONG OutputCount;
CD_IO_BUFFER Buffers[ANYSIZE_ARRAY];
} CD_USER_DEFINED_IO, *PCD_USER_DEFINED_IO;
typedef struct _CD_USER_DEFINED_IO64 {
PVOID64 Client;
ULONG InputCount;
ULONG OutputCount;
CD_IO_BUFFER64 Buffers[ANYSIZE_ARRAY];
} CD_USER_DEFINED_IO64, *PCD_USER_DEFINED_IO64;
typedef struct _CD_IO_BUFFER_DESCRIPTOR {
PVOID Data;
ULONG Size;
ULONG Offset;
} CD_IO_BUFFER_DESCRIPTOR, *PCD_IO_BUFFER_DESCRIPTOR;
typedef struct _CD_IO_COMPLETE {
LUID Identifier;
IO_STATUS_BLOCK IoStatus;
CD_IO_BUFFER_DESCRIPTOR Write;
} CD_IO_COMPLETE, *PCD_IO_COMPLETE;
typedef struct _CD_IO_OPERATION {
LUID Identifier;
CD_IO_BUFFER_DESCRIPTOR Buffer;
} CD_IO_OPERATION, *PCD_IO_OPERATION;
typedef struct _CD_IO_SERVER_INFORMATION {
HANDLE InputAvailableEvent;
} CD_IO_SERVER_INFORMATION, *PCD_IO_SERVER_INFORMATION;
typedef struct _CD_IO_DISPLAY_SIZE {
ULONG Width;
ULONG Height;
} CD_IO_DISPLAY_SIZE, *PCD_IO_DISPLAY_SIZE;
typedef struct _CD_IO_CHARACTER {
WCHAR Character;
USHORT Atribute;
} CD_IO_CHARACTER, *PCD_IO_CHARACTER;
typedef struct _CD_IO_ROW_INFORMATION {
SHORT Index;
PCD_IO_CHARACTER Old;
PCD_IO_CHARACTER New;
} CD_IO_ROW_INFORMATION, *PCD_IO_ROW_INFORMATION;
typedef struct _CD_IO_CURSOR_INFORMATION {
USHORT Column;
USHORT Row;
ULONG Height;
BOOLEAN IsVisible;
} CD_IO_CURSOR_INFORMATION, *PCD_IO_CURSOR_INFORMATION;
#define IOCTL_CONDRV_READ_IO \
CTL_CODE(FILE_DEVICE_CONSOLE, 1, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_CONDRV_COMPLETE_IO \
CTL_CODE(FILE_DEVICE_CONSOLE, 2, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_CONDRV_READ_INPUT \
CTL_CODE(FILE_DEVICE_CONSOLE, 3, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_CONDRV_WRITE_OUTPUT \
CTL_CODE(FILE_DEVICE_CONSOLE, 4, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_CONDRV_ISSUE_USER_IO \
CTL_CODE(FILE_DEVICE_CONSOLE, 5, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_CONDRV_DISCONNECT_PIPE \
CTL_CODE(FILE_DEVICE_CONSOLE, 6, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_CONDRV_SET_SERVER_INFORMATION \
CTL_CODE(FILE_DEVICE_CONSOLE, 7, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_CONDRV_GET_SERVER_PID \
CTL_CODE(FILE_DEVICE_CONSOLE, 8, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_CONDRV_GET_DISPLAY_SIZE \
CTL_CODE(FILE_DEVICE_CONSOLE, 9, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_CONDRV_UPDATE_DISPLAY \
CTL_CODE(FILE_DEVICE_CONSOLE, 10, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_CONDRV_SET_CURSOR \
CTL_CODE(FILE_DEVICE_CONSOLE, 11, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_CONDRV_ALLOW_VIA_UIACCESS \
CTL_CODE(FILE_DEVICE_CONSOLE, 12, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_CONDRV_LAUNCH_SERVER \
CTL_CODE(FILE_DEVICE_CONSOLE, 13, METHOD_NEITHER, FILE_ANY_ACCESS)

156
dep/Console/conmsgl1.h Normal file
View File

@@ -0,0 +1,156 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
conmsgl1.h
Abstract:
This include file defines the layer 1 message formats used to communicate
between the client and server portions of the CONSOLE portion of the
Windows subsystem.
Author:
Therese Stowell (thereses) 10-Nov-1990
Revision History:
Wedson Almeida Filho (wedsonaf) 23-May-2010
Modified the messages for use with the console driver.
--*/
#pragma once
#define CONSOLE_FIRST_API_NUMBER(Layer) \
(Layer << 24) \
typedef struct _CONSOLE_SERVER_MSG {
ULONG IconId;
ULONG HotKey;
ULONG StartupFlags;
USHORT FillAttribute;
USHORT ShowWindow;
COORD ScreenBufferSize;
COORD WindowSize;
COORD WindowOrigin;
ULONG ProcessGroupId;
BOOLEAN ConsoleApp;
BOOLEAN WindowVisible;
USHORT TitleLength;
WCHAR Title[MAX_PATH + 1];
USHORT ApplicationNameLength;
WCHAR ApplicationName[128];
USHORT CurrentDirectoryLength;
WCHAR CurrentDirectory[MAX_PATH + 1];
} CONSOLE_SERVER_MSG, *PCONSOLE_SERVER_MSG;
typedef struct _CONSOLE_BROKER_DATA {
WCHAR DesktopName[MAX_PATH];
} CONSOLE_BROKER_MSG, *PCONSOLE_BROKER_MSG;
typedef struct _CONSOLE_GETCP_MSG {
OUT ULONG CodePage;
IN BOOLEAN Output;
} CONSOLE_GETCP_MSG, *PCONSOLE_GETCP_MSG;
typedef struct _CONSOLE_MODE_MSG {
IN OUT ULONG Mode;
} CONSOLE_MODE_MSG, *PCONSOLE_MODE_MSG;
typedef struct _CONSOLE_GETNUMBEROFINPUTEVENTS_MSG {
OUT ULONG ReadyEvents;
} CONSOLE_GETNUMBEROFINPUTEVENTS_MSG, *PCONSOLE_GETNUMBEROFINPUTEVENTS_MSG;
typedef struct _CONSOLE_GETCONSOLEINPUT_MSG {
OUT ULONG NumRecords;
IN USHORT Flags;
IN BOOLEAN Unicode;
} CONSOLE_GETCONSOLEINPUT_MSG, *PCONSOLE_GETCONSOLEINPUT_MSG;
typedef struct _CONSOLE_READCONSOLE_MSG {
IN BOOLEAN Unicode;
IN BOOLEAN ProcessControlZ;
IN USHORT ExeNameLength;
IN ULONG InitialNumBytes;
IN ULONG CtrlWakeupMask;
OUT ULONG ControlKeyState;
OUT ULONG NumBytes;
} CONSOLE_READCONSOLE_MSG, *PCONSOLE_READCONSOLE_MSG;
typedef struct _CONSOLE_WRITECONSOLE_MSG {
OUT ULONG NumBytes;
IN BOOLEAN Unicode;
} CONSOLE_WRITECONSOLE_MSG, *PCONSOLE_WRITECONSOLE_MSG;
typedef struct _CONSOLE_LANGID_MSG {
OUT LANGID LangId;
} CONSOLE_LANGID_MSG, *PCONSOLE_LANGID_MSG;
typedef struct _CONSOLE_MAPBITMAP_MSG {
OUT HANDLE Mutex;
OUT PVOID Bitmap;
} CONSOLE_MAPBITMAP_MSG, *PCONSOLE_MAPBITMAP_MSG;
typedef struct _CONSOLE_MAPBITMAP_MSG64 {
OUT PVOID64 Mutex;
OUT PVOID64 Bitmap;
} CONSOLE_MAPBITMAP_MSG64, *PCONSOLE_MAPBITMAP_MSG64;
typedef enum _CONSOLE_API_NUMBER_L1 {
ConsolepGetCP = CONSOLE_FIRST_API_NUMBER(1),
ConsolepGetMode,
ConsolepSetMode,
ConsolepGetNumberOfInputEvents,
ConsolepGetConsoleInput,
ConsolepReadConsole,
ConsolepWriteConsole,
ConsolepNotifyLastClose,
ConsolepGetLangId,
ConsolepMapBitmap,
} CONSOLE_API_NUMBER_L1, *PCONSOLE_API_NUMBER_L1;
typedef struct _CONSOLE_MSG_HEADER {
ULONG ApiNumber;
ULONG ApiDescriptorSize;
} CONSOLE_MSG_HEADER, *PCONSOLE_MSG_HEADER;
typedef union _CONSOLE_MSG_BODY_L1 {
CONSOLE_GETCP_MSG GetConsoleCP;
CONSOLE_MODE_MSG GetConsoleMode;
CONSOLE_MODE_MSG SetConsoleMode;
CONSOLE_GETNUMBEROFINPUTEVENTS_MSG GetNumberOfConsoleInputEvents;
CONSOLE_GETCONSOLEINPUT_MSG GetConsoleInput;
CONSOLE_READCONSOLE_MSG ReadConsole;
CONSOLE_WRITECONSOLE_MSG WriteConsole;
CONSOLE_LANGID_MSG GetConsoleLangId;
#if defined(BUILD_WOW6432) && !defined(BUILD_WOW3232)
CONSOLE_MAPBITMAP_MSG64 MapBitmap;
#else
CONSOLE_MAPBITMAP_MSG MapBitmap;
#endif
} CONSOLE_MSG_BODY_L1, *PCONSOLE_MSG_BODY_L1;
#ifndef __cplusplus
typedef struct _CONSOLE_MSG_L1 {
CONSOLE_MSG_HEADER Header;
union {
CONSOLE_MSG_BODY_L1;
} u;
} CONSOLE_MSG_L1, *PCONSOLE_MSG_L1;
#else
typedef struct _CONSOLE_MSG_L1 :
public CONSOLE_MSG_HEADER
{
CONSOLE_MSG_BODY_L1 u;
} CONSOLE_MSG_L1, *PCONSOLE_MSG_L1;
#endif // __cplusplus

207
dep/Console/conmsgl2.h Normal file
View File

@@ -0,0 +1,207 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
conmsgl2.h
Abstract:
This include file defines the layer 2 message formats used to communicate
between the client and server portions of the CONSOLE portion of the
Windows subsystem.
Author:
Therese Stowell (thereses) 10-Nov-1990
Revision History:
Wedson Almeida Filho (wedsonaf) 23-May-2010
Modified the messages for use with the console driver.
--*/
#pragma once
typedef struct _CONSOLE_CREATESCREENBUFFER_MSG {
IN ULONG Flags;
IN ULONG BitmapInfoLength;
IN ULONG Usage;
} CONSOLE_CREATESCREENBUFFER_MSG, *PCONSOLE_CREATESCREENBUFFER_MSG;
#define CONSOLE_ASCII 0x1
#define CONSOLE_REAL_UNICODE 0x2
#define CONSOLE_ATTRIBUTE 0x3
#define CONSOLE_FALSE_UNICODE 0x4
typedef struct _CONSOLE_FILLCONSOLEOUTPUT_MSG {
IN COORD WriteCoord;
IN ULONG ElementType;
IN USHORT Element;
IN OUT ULONG Length;
} CONSOLE_FILLCONSOLEOUTPUT_MSG, *PCONSOLE_FILLCONSOLEOUTPUT_MSG;
typedef struct _CONSOLE_CTRLEVENT_MSG {
IN ULONG CtrlEvent;
IN ULONG ProcessGroupId;
} CONSOLE_CTRLEVENT_MSG, *PCONSOLE_CTRLEVENT_MSG;
typedef struct _CONSOLE_SETCP_MSG {
IN ULONG CodePage;
IN BOOLEAN Output;
} CONSOLE_SETCP_MSG, *PCONSOLE_SETCP_MSG;
typedef struct _CONSOLE_GETCURSORINFO_MSG {
OUT ULONG CursorSize;
OUT BOOLEAN Visible;
} CONSOLE_GETCURSORINFO_MSG, *PCONSOLE_GETCURSORINFO_MSG;
typedef struct _CONSOLE_SETCURSORINFO_MSG {
IN ULONG CursorSize;
IN BOOLEAN Visible;
} CONSOLE_SETCURSORINFO_MSG, *PCONSOLE_SETCURSORINFO_MSG;
typedef struct _CONSOLE_SCREENBUFFERINFO_MSG {
IN OUT COORD Size;
IN OUT COORD CursorPosition;
IN OUT COORD ScrollPosition;
IN OUT USHORT Attributes;
IN OUT COORD CurrentWindowSize;
IN OUT COORD MaximumWindowSize;
IN OUT USHORT PopupAttributes;
IN OUT BOOLEAN FullscreenSupported;
IN OUT COLORREF ColorTable[16];
} CONSOLE_SCREENBUFFERINFO_MSG, *PCONSOLE_SCREENBUFFERINFO_MSG;
typedef struct _CONSOLE_SETSCREENBUFFERSIZE_MSG {
IN COORD Size;
} CONSOLE_SETSCREENBUFFERSIZE_MSG, *PCONSOLE_SETSCREENBUFFERSIZE_MSG;
typedef struct _CONSOLE_SETCURSORPOSITION_MSG {
IN COORD CursorPosition;
} CONSOLE_SETCURSORPOSITION_MSG, *PCONSOLE_SETCURSORPOSITION_MSG;
typedef struct _CONSOLE_GETLARGESTWINDOWSIZE_MSG {
OUT COORD Size;
} CONSOLE_GETLARGESTWINDOWSIZE_MSG, *PCONSOLE_GETLARGESTWINDOWSIZE_MSG;
typedef struct _CONSOLE_SCROLLSCREENBUFFER_MSG {
IN SMALL_RECT ScrollRectangle;
IN SMALL_RECT ClipRectangle;
IN BOOLEAN Clip;
IN BOOLEAN Unicode;
IN COORD DestinationOrigin;
IN CHAR_INFO Fill;
} CONSOLE_SCROLLSCREENBUFFER_MSG, *PCONSOLE_SCROLLSCREENBUFFER_MSG;
typedef struct _CONSOLE_SETTEXTATTRIBUTE_MSG {
IN USHORT Attributes;
} CONSOLE_SETTEXTATTRIBUTE_MSG, *PCONSOLE_SETTEXTATTRIBUTE_MSG;
typedef struct _CONSOLE_SETWINDOWINFO_MSG {
IN BOOLEAN Absolute;
IN SMALL_RECT Window;
} CONSOLE_SETWINDOWINFO_MSG, *PCONSOLE_SETWINDOWINFO_MSG;
typedef struct _CONSOLE_READCONSOLEOUTPUTSTRING_MSG {
IN COORD ReadCoord;
IN ULONG StringType;
OUT ULONG NumRecords;
} CONSOLE_READCONSOLEOUTPUTSTRING_MSG, *PCONSOLE_READCONSOLEOUTPUTSTRING_MSG;
typedef struct _CONSOLE_WRITECONSOLEINPUT_MSG {
OUT ULONG NumRecords;
IN BOOLEAN Unicode;
IN BOOLEAN Append;
} CONSOLE_WRITECONSOLEINPUT_MSG, *PCONSOLE_WRITECONSOLEINPUT_MSG;
typedef struct _CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG {
IN COORD WriteCoord;
IN ULONG StringType;
OUT ULONG NumRecords;
} CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG, *PCONSOLE_WRITECONSOLEOUTPUTSTRING_MSG;
typedef struct _CONSOLE_WRITECONSOLEOUTPUT_MSG {
IN OUT SMALL_RECT CharRegion;
IN BOOLEAN Unicode;
} CONSOLE_WRITECONSOLEOUTPUT_MSG, *PCONSOLE_WRITECONSOLEOUTPUT_MSG;
typedef struct _CONSOLE_READCONSOLEOUTPUT_MSG {
IN OUT SMALL_RECT CharRegion;
IN BOOLEAN Unicode;
} CONSOLE_READCONSOLEOUTPUT_MSG, *PCONSOLE_READCONSOLEOUTPUT_MSG;
typedef struct _CONSOLE_GETTITLE_MSG {
OUT ULONG TitleLength;
IN BOOLEAN Unicode;
IN BOOLEAN Original;
} CONSOLE_GETTITLE_MSG, *PCONSOLE_GETTITLE_MSG;
typedef struct _CONSOLE_SETTITLE_MSG {
IN BOOLEAN Unicode;
} CONSOLE_SETTITLE_MSG, *PCONSOLE_SETTITLE_MSG;
typedef enum _CONSOLE_API_NUMBER_L2 {
ConsolepFillConsoleOutput = CONSOLE_FIRST_API_NUMBER(2),
ConsolepGenerateCtrlEvent,
ConsolepSetActiveScreenBuffer,
ConsolepFlushInputBuffer,
ConsolepSetCP,
ConsolepGetCursorInfo,
ConsolepSetCursorInfo,
ConsolepGetScreenBufferInfo,
ConsolepSetScreenBufferInfo,
ConsolepSetScreenBufferSize,
ConsolepSetCursorPosition,
ConsolepGetLargestWindowSize,
ConsolepScrollScreenBuffer,
ConsolepSetTextAttribute,
ConsolepSetWindowInfo,
ConsolepReadConsoleOutputString,
ConsolepWriteConsoleInput,
ConsolepWriteConsoleOutput,
ConsolepWriteConsoleOutputString,
ConsolepReadConsoleOutput,
ConsolepGetTitle,
ConsolepSetTitle,
} CONSOLE_API_NUMBER_L2, *PCONSOLE_API_NUMBER_L2;
typedef union _CONSOLE_MSG_BODY_L2 {
CONSOLE_CTRLEVENT_MSG GenerateConsoleCtrlEvent;
CONSOLE_FILLCONSOLEOUTPUT_MSG FillConsoleOutput;
CONSOLE_SETCP_MSG SetConsoleCP;
CONSOLE_GETCURSORINFO_MSG GetConsoleCursorInfo;
CONSOLE_SETCURSORINFO_MSG SetConsoleCursorInfo;
CONSOLE_SCREENBUFFERINFO_MSG GetConsoleScreenBufferInfo;
CONSOLE_SCREENBUFFERINFO_MSG SetConsoleScreenBufferInfo;
CONSOLE_SETSCREENBUFFERSIZE_MSG SetConsoleScreenBufferSize;
CONSOLE_SETCURSORPOSITION_MSG SetConsoleCursorPosition;
CONSOLE_GETLARGESTWINDOWSIZE_MSG GetLargestConsoleWindowSize;
CONSOLE_SCROLLSCREENBUFFER_MSG ScrollConsoleScreenBuffer;
CONSOLE_SETTEXTATTRIBUTE_MSG SetConsoleTextAttribute;
CONSOLE_SETWINDOWINFO_MSG SetConsoleWindowInfo;
CONSOLE_READCONSOLEOUTPUTSTRING_MSG ReadConsoleOutputString;
CONSOLE_WRITECONSOLEINPUT_MSG WriteConsoleInput;
CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG WriteConsoleOutputString;
CONSOLE_WRITECONSOLEOUTPUT_MSG WriteConsoleOutput;
CONSOLE_READCONSOLEOUTPUT_MSG ReadConsoleOutput;
CONSOLE_SETTITLE_MSG SetConsoleTitle;
CONSOLE_GETTITLE_MSG GetConsoleTitle;
} CONSOLE_MSG_BODY_L2, *PCONSOLE_MSG_BODY_L2;
#ifndef __cplusplus
typedef struct _CONSOLE_MSG_L2 {
CONSOLE_MSG_HEADER Header;
union {
CONSOLE_MSG_BODY_L2;
} u;
} CONSOLE_MSG_L2, *PCONSOLE_MSG_L2;
#else
typedef struct _CONSOLE_MSG_L2 :
public CONSOLE_MSG_HEADER
{
CONSOLE_MSG_BODY_L2 u;
} CONSOLE_MSG_L2, *PCONSOLE_MSG_L2;
#endif // __cplusplus

392
dep/Console/conmsgl3.h Normal file
View File

@@ -0,0 +1,392 @@
/*++
Copyright (c) 1985 - 1999, Microsoft Corporation
Module Name:
conmsgl3.h
Abstract:
This include file defines the message formats used to communicate
between the client and server portions of the CONSOLE portion of the
Windows subsystem.
Author:
Therese Stowell (thereses) 10-Nov-1990
Revision History:
Wedson Almeida Filho (wedsonaf) 23-May-2010
Modified the messages for use with the console driver.
--*/
#pragma once
#include <winconp.h> // need FONT_SELECT
typedef struct _CONSOLE_GETNUMBEROFFONTS_MSG {
OUT ULONG NumberOfFonts;
} CONSOLE_GETNUMBEROFFONTS_MSG, *PCONSOLE_GETNUMBEROFFONTS_MSG;
typedef struct _CONSOLE_GETSELECTIONINFO_MSG {
OUT CONSOLE_SELECTION_INFO SelectionInfo;
} CONSOLE_GETSELECTIONINFO_MSG, *PCONSOLE_GETSELECTIONINFO_MSG;
typedef struct _CONSOLE_GETMOUSEINFO_MSG {
OUT ULONG NumButtons;
} CONSOLE_GETMOUSEINFO_MSG, *PCONSOLE_GETMOUSEINFO_MSG;
typedef struct _CONSOLE_GETFONTINFO_MSG {
IN BOOLEAN MaximumWindow;
OUT ULONG NumFonts; // this value is valid even for error cases
} CONSOLE_GETFONTINFO_MSG, *PCONSOLE_GETFONTINFO_MSG;
typedef struct _CONSOLE_GETFONTSIZE_MSG {
IN ULONG FontIndex;
OUT COORD FontSize;
} CONSOLE_GETFONTSIZE_MSG, *PCONSOLE_GETFONTSIZE_MSG;
typedef struct _CONSOLE_CURRENTFONT_MSG {
IN BOOLEAN MaximumWindow;
IN OUT ULONG FontIndex;
IN OUT COORD FontSize;
IN OUT ULONG FontFamily;
IN OUT ULONG FontWeight;
IN OUT WCHAR FaceName[LF_FACESIZE];
} CONSOLE_CURRENTFONT_MSG, *PCONSOLE_CURRENTFONT_MSG;
typedef struct _CONSOLE_SETFONT_MSG {
IN ULONG FontIndex;
} CONSOLE_SETFONT_MSG, *PCONSOLE_SETFONT_MSG;
typedef struct _CONSOLE_SETICON_MSG {
IN HICON hIcon;
} CONSOLE_SETICON_MSG, *PCONSOLE_SETICON_MSG;
typedef struct _CONSOLE_SETICON_MSG64 {
IN PVOID64 hIcon;
} CONSOLE_SETICON_MSG64, *PCONSOLE_SETICON_MSG64;
typedef struct _CONSOLE_ADDALIAS_MSG {
IN USHORT SourceLength;
IN USHORT TargetLength;
IN USHORT ExeLength;
IN BOOLEAN Unicode;
} CONSOLE_ADDALIAS_MSG, *PCONSOLE_ADDALIAS_MSG;
typedef struct _CONSOLE_GETALIAS_MSG {
IN USHORT SourceLength;
OUT USHORT TargetLength;
IN USHORT ExeLength;
IN BOOLEAN Unicode;
} CONSOLE_GETALIAS_MSG, *PCONSOLE_GETALIAS_MSG;
typedef struct _CONSOLE_GETALIASESLENGTH_MSG {
OUT ULONG AliasesLength;
IN BOOLEAN Unicode;
} CONSOLE_GETALIASESLENGTH_MSG, *PCONSOLE_GETALIASESLENGTH_MSG;
typedef struct _CONSOLE_GETALIASEXESLENGTH_MSG {
OUT ULONG AliasExesLength;
IN BOOLEAN Unicode;
} CONSOLE_GETALIASEXESLENGTH_MSG, *PCONSOLE_GETALIASEXESLENGTH_MSG;
typedef struct _CONSOLE_GETALIASES_MSG {
IN BOOLEAN Unicode;
OUT ULONG AliasesBufferLength;
} CONSOLE_GETALIASES_MSG, *PCONSOLE_GETALIASES_MSG;
typedef struct _CONSOLE_GETALIASEXES_MSG {
OUT ULONG AliasExesBufferLength;
IN BOOLEAN Unicode;
} CONSOLE_GETALIASEXES_MSG, *PCONSOLE_GETALIASEXES_MSG;
typedef struct _CONSOLE_EXPUNGECOMMANDHISTORY_MSG {
IN BOOLEAN Unicode;
} CONSOLE_EXPUNGECOMMANDHISTORY_MSG, *PCONSOLE_EXPUNGECOMMANDHISTORY_MSG;
typedef struct _CONSOLE_SETNUMBEROFCOMMANDS_MSG {
IN ULONG NumCommands;
IN BOOLEAN Unicode;
} CONSOLE_SETNUMBEROFCOMMANDS_MSG, *PCONSOLE_SETNUMBEROFCOMMANDS_MSG;
typedef struct _CONSOLE_GETCOMMANDHISTORYLENGTH_MSG {
OUT ULONG CommandHistoryLength;
IN BOOLEAN Unicode;
} CONSOLE_GETCOMMANDHISTORYLENGTH_MSG, *PCONSOLE_GETCOMMANDHISTORYLENGTH_MSG;
typedef struct _CONSOLE_GETCOMMANDHISTORY_MSG {
OUT ULONG CommandBufferLength;
IN BOOLEAN Unicode;
} CONSOLE_GETCOMMANDHISTORY_MSG, *PCONSOLE_GETCOMMANDHISTORY_MSG;
typedef struct _CONSOLE_INVALIDATERECT_MSG {
IN SMALL_RECT Rect;
} CONSOLE_INVALIDATERECT_MSG, *PCONSOLE_INVALIDATERECT_MSG;
typedef struct _CONSOLE_VDM_MSG {
IN ULONG iFunction;
OUT BOOLEAN Bool;
IN OUT POINT Point;
OUT RECT Rect;
} CONSOLE_VDM_MSG, *PCONSOLE_VDM_MSG;
typedef struct _CONSOLE_SETCURSOR_MSG {
IN HCURSOR CursorHandle;
} CONSOLE_SETCURSOR_MSG, *PCONSOLE_SETCURSOR_MSG;
typedef struct _CONSOLE_SETCURSOR_MSG64 {
IN PVOID64 CursorHandle;
} CONSOLE_SETCURSOR_MSG64, *PCONSOLE_SETCURSOR_MSG64;
typedef struct _CONSOLE_SHOWCURSOR_MSG {
IN BOOLEAN bShow;
OUT ULONG DisplayCount;
} CONSOLE_SHOWCURSOR_MSG, *PCONSOLE_SHOWCURSOR_MSG;
typedef struct _CONSOLE_MENUCONTROL_MSG {
IN ULONG CommandIdLow;
IN ULONG CommandIdHigh;
OUT HMENU hMenu;
} CONSOLE_MENUCONTROL_MSG, *PCONSOLE_MENUCONTROL_MSG;
typedef struct _CONSOLE_MENUCONTROL_MSG64 {
IN ULONG CommandIdLow;
IN ULONG CommandIdHigh;
OUT PVOID64 hMenu;
} CONSOLE_MENUCONTROL_MSG64, *PCONSOLE_MENUCONTROL_MSG64;
typedef struct _CONSOLE_SETPALETTE_MSG {
IN HPALETTE hPalette;
IN ULONG dwUsage;
} CONSOLE_SETPALETTE_MSG, *PCONSOLE_SETPALETTE_MSG;
typedef struct _CONSOLE_SETPALETTE_MSG64 {
IN PVOID64 hPalette;
IN ULONG dwUsage;
} CONSOLE_SETPALETTE_MSG64, *PCONSOLE_SETPALETTE_MSG64;
typedef struct _CONSOLE_SETDISPLAYMODE_MSG {
IN ULONG dwFlags;
OUT COORD ScreenBufferDimensions;
} CONSOLE_SETDISPLAYMODE_MSG, *PCONSOLE_SETDISPLAYMODE_MSG;
typedef struct _CONSOLE_REGISTERVDM_MSG {
IN ULONG RegisterFlags;
IN HANDLE StartEvent;
IN HANDLE EndEvent;
IN HANDLE ErrorEvent;
OUT ULONG StateLength;
OUT PVOID StateBuffer;
OUT PVOID VDMBuffer;
} CONSOLE_REGISTERVDM_MSG, *PCONSOLE_REGISTERVDM_MSG;
typedef struct _CONSOLE_REGISTERVDM_MSG64 {
IN ULONG RegisterFlags;
IN PVOID64 StartEvent;
IN PVOID64 EndEvent;
IN PVOID64 ErrorEvent;
OUT ULONG StateLength;
OUT PVOID64 StateBuffer;
OUT PVOID64 VDMBuffer;
} CONSOLE_REGISTERVDM_MSG64, *PCONSOLE_REGISTERVDM_MSG64;
typedef struct _CONSOLE_GETHARDWARESTATE_MSG {
OUT COORD Resolution;
OUT COORD FontSize;
} CONSOLE_GETHARDWARESTATE_MSG, *PCONSOLE_GETHARDWARESTATE_MSG;
typedef struct _CONSOLE_SETHARDWARESTATE_MSG {
IN COORD Resolution;
IN COORD FontSize;
} CONSOLE_SETHARDWARESTATE_MSG, *PCONSOLE_SETHARDWARESTATE_MSG;
typedef struct _CONSOLE_GETDISPLAYMODE_MSG {
OUT ULONG ModeFlags;
} CONSOLE_GETDISPLAYMODE_MSG, *PCONSOLE_GETDISPLAYMODE_MSG;
typedef struct _CONSOLE_GETKEYBOARDLAYOUTNAME_MSG {
union {
WCHAR awchLayout[9];
char achLayout[9];
};
BOOLEAN bAnsi;
} CONSOLE_GETKEYBOARDLAYOUTNAME_MSG, *PCONSOLE_GETKEYBOARDLAYOUTNAME_MSG;
typedef struct _CONSOLE_SETKEYSHORTCUTS_MSG {
IN BOOLEAN Set;
IN BYTE ReserveKeys;
} CONSOLE_SETKEYSHORTCUTS_MSG, *PCONSOLE_SETKEYSHORTCUTS_MSG;
typedef struct _CONSOLE_SETMENUCLOSE_MSG {
IN BOOLEAN Enable;
} CONSOLE_SETMENUCLOSE_MSG, *PCONSOLE_SETMENUCLOSE_MSG;
typedef struct _CONSOLE_CHAR_TYPE_MSG {
IN COORD coordCheck;
OUT ULONG dwType;
} CONSOLE_CHAR_TYPE_MSG, *PCONSOLE_CHAR_TYPE_MSG;
typedef struct _CONSOLE_LOCAL_EUDC_MSG {
IN USHORT CodePoint;
IN COORD FontSize;
} CONSOLE_LOCAL_EUDC_MSG, *PCONSOLE_LOCAL_EUDC_MSG;
typedef struct _CONSOLE_CURSOR_MODE_MSG {
IN OUT BOOLEAN Blink;
IN OUT BOOLEAN DBEnable;
} CONSOLE_CURSOR_MODE_MSG, *PCONSOLE_CURSOR_MODE_MSG;
typedef struct _CONSOLE_REGISTEROS2_MSG {
IN BOOLEAN fOs2Register;
} CONSOLE_REGISTEROS2_MSG, *PCONSOLE_REGISTEROS2_MSG;
typedef struct _CONSOLE_SETOS2OEMFORMAT_MSG {
IN BOOLEAN fOs2OemFormat;
} CONSOLE_SETOS2OEMFORMAT_MSG, *PCONSOLE_SETOS2OEMFORMAT_MSG;
typedef struct _CONSOLE_NLS_MODE_MSG {
IN OUT BOOLEAN Ready;
IN ULONG NlsMode;
} CONSOLE_NLS_MODE_MSG, *PCONSOLE_NLS_MODE_MSG;
typedef struct _CONSOLE_GETCONSOLEWINDOW_MSG {
OUT HWND hwnd;
} CONSOLE_GETCONSOLEWINDOW_MSG, *PCONSOLE_GETCONSOLEWINDOW_MSG;
typedef struct _CONSOLE_GETCONSOLEWINDOW_MSG64 {
OUT PVOID64 hwnd;
} CONSOLE_GETCONSOLEWINDOW_MSG64, *PCONSOLE_GETCONSOLEWINDOW_MSG64;
typedef struct _CONSOLE_GETPROCESSLIST_MSG {
OUT ULONG dwProcessCount;
} CONSOLE_GETCONSOLEPROCESSLIST_MSG, *PCONSOLE_GETCONSOLEPROCESSLIST_MSG;
typedef struct _CONSOLE_GETHISTORY_MSG {
OUT ULONG HistoryBufferSize;
OUT ULONG NumberOfHistoryBuffers;
OUT ULONG dwFlags;
} CONSOLE_HISTORY_MSG, *PCONSOLE_HISTORY_MSG;
typedef enum _CONSOLE_API_NUMBER_L3 {
ConsolepGetNumberOfFonts = CONSOLE_FIRST_API_NUMBER(3),
ConsolepGetMouseInfo,
ConsolepGetFontInfo,
ConsolepGetFontSize,
ConsolepGetCurrentFont,
ConsolepSetFont,
ConsolepSetIcon,
ConsolepInvalidateBitmapRect,
ConsolepVDMOperation,
ConsolepSetCursor,
ConsolepShowCursor,
ConsolepMenuControl,
ConsolepSetPalette,
ConsolepSetDisplayMode,
ConsolepRegisterVDM,
ConsolepGetHardwareState,
ConsolepSetHardwareState,
ConsolepGetDisplayMode,
ConsolepAddAlias,
ConsolepGetAlias,
ConsolepGetAliasesLength,
ConsolepGetAliasExesLength,
ConsolepGetAliases,
ConsolepGetAliasExes,
ConsolepExpungeCommandHistory,
ConsolepSetNumberOfCommands,
ConsolepGetCommandHistoryLength,
ConsolepGetCommandHistory,
ConsolepSetKeyShortcuts,
ConsolepSetMenuClose,
ConsolepGetKeyboardLayoutName,
ConsolepGetConsoleWindow,
ConsolepCharType,
ConsolepSetLocalEUDC,
ConsolepSetCursorMode,
ConsolepGetCursorMode,
ConsolepRegisterOS2,
ConsolepSetOS2OemFormat,
ConsolepGetNlsMode,
ConsolepSetNlsMode,
ConsolepGetSelectionInfo,
ConsolepGetConsoleProcessList,
ConsolepGetHistory,
ConsolepSetHistory,
ConsolepSetCurrentFont,
} CONSOLE_API_NUMBER_L3, *PCONSOLE_API_NUMBER_L3;
typedef union _CONSOLE_MSG_BODY_L3 {
CONSOLE_GETNUMBEROFFONTS_MSG GetNumberOfConsoleFonts;
CONSOLE_GETMOUSEINFO_MSG GetConsoleMouseInfo;
CONSOLE_GETFONTINFO_MSG GetConsoleFontInfo;
CONSOLE_GETFONTSIZE_MSG GetConsoleFontSize;
CONSOLE_CURRENTFONT_MSG GetCurrentConsoleFont;
CONSOLE_SETFONT_MSG SetConsoleFont;
CONSOLE_INVALIDATERECT_MSG InvalidateConsoleBitmapRect;
CONSOLE_VDM_MSG VDMConsoleOperation;
CONSOLE_SHOWCURSOR_MSG ShowConsoleCursor;
CONSOLE_SETDISPLAYMODE_MSG SetConsoleDisplayMode;
#ifdef BUILD_WOW6432
CONSOLE_REGISTERVDM_MSG64 RegisterConsoleVDM;
CONSOLE_SETCURSOR_MSG64 SetConsoleCursor;
CONSOLE_SETICON_MSG64 SetConsoleIcon;
CONSOLE_MENUCONTROL_MSG64 ConsoleMenuControl;
CONSOLE_SETPALETTE_MSG64 SetConsolePalette;
CONSOLE_GETCONSOLEWINDOW_MSG64 GetConsoleWindow;
#else
CONSOLE_REGISTERVDM_MSG RegisterConsoleVDM;
CONSOLE_SETCURSOR_MSG SetConsoleCursor;
CONSOLE_SETICON_MSG SetConsoleIcon;
CONSOLE_MENUCONTROL_MSG ConsoleMenuControl;
CONSOLE_SETPALETTE_MSG SetConsolePalette;
CONSOLE_GETCONSOLEWINDOW_MSG GetConsoleWindow;
#endif
CONSOLE_GETHARDWARESTATE_MSG GetConsoleHardwareState;
CONSOLE_SETHARDWARESTATE_MSG SetConsoleHardwareState;
CONSOLE_GETDISPLAYMODE_MSG GetConsoleDisplayMode;
CONSOLE_ADDALIAS_MSG AddConsoleAliasW;
CONSOLE_GETALIAS_MSG GetConsoleAliasW;
CONSOLE_GETALIASESLENGTH_MSG GetConsoleAliasesLengthW;
CONSOLE_GETALIASEXESLENGTH_MSG GetConsoleAliasExesLengthW;
CONSOLE_GETALIASES_MSG GetConsoleAliasesW;
CONSOLE_GETALIASEXES_MSG GetConsoleAliasExesW;
CONSOLE_EXPUNGECOMMANDHISTORY_MSG ExpungeConsoleCommandHistoryW;
CONSOLE_SETNUMBEROFCOMMANDS_MSG SetConsoleNumberOfCommandsW;
CONSOLE_GETCOMMANDHISTORYLENGTH_MSG GetConsoleCommandHistoryLengthW;
CONSOLE_GETCOMMANDHISTORY_MSG GetConsoleCommandHistoryW;
CONSOLE_SETKEYSHORTCUTS_MSG SetConsoleKeyShortcuts;
CONSOLE_SETMENUCLOSE_MSG SetConsoleMenuClose;
CONSOLE_GETKEYBOARDLAYOUTNAME_MSG GetKeyboardLayoutName;
CONSOLE_CHAR_TYPE_MSG GetConsoleCharType;
CONSOLE_LOCAL_EUDC_MSG SetConsoleLocalEUDC;
CONSOLE_CURSOR_MODE_MSG SetConsoleCursorMode;
CONSOLE_CURSOR_MODE_MSG GetConsoleCursorMode;
CONSOLE_REGISTEROS2_MSG RegisterConsoleOS2;
CONSOLE_SETOS2OEMFORMAT_MSG SetConsoleOS2OemFormat;
CONSOLE_NLS_MODE_MSG GetConsoleNlsMode;
CONSOLE_NLS_MODE_MSG SetConsoleNlsMode;
CONSOLE_GETSELECTIONINFO_MSG GetConsoleSelectionInfo;
CONSOLE_GETCONSOLEPROCESSLIST_MSG GetConsoleProcessList;
CONSOLE_CURRENTFONT_MSG SetCurrentConsoleFont;
CONSOLE_HISTORY_MSG SetConsoleHistory;
CONSOLE_HISTORY_MSG GetConsoleHistory;
} CONSOLE_MSG_BODY_L3, *PCONSOLE_MSG_BODY_L3;
#ifndef __cplusplus
typedef struct _CONSOLE_MSG_L3 {
CONSOLE_MSG_HEADER Header;
union {
CONSOLE_MSG_BODY_L3;
} u;
} CONSOLE_MSG_L3, *PCONSOLE_MSG_L3;
#else
typedef struct _CONSOLE_MSG_L3 :
public CONSOLE_MSG_HEADER
{
CONSOLE_MSG_BODY_L3 u;
} CONSOLE_MSG_L3, *PCONSOLE_MSG_L3;
#endif // __cplusplus

29
dep/Console/ntcon.h Normal file
View File

@@ -0,0 +1,29 @@
//
// Copyright (C) Microsoft. All rights reserved.
//
#ifndef _NTCON_
#define _NTCON_
//
// originally in winconp.h
//
#define CONSOLE_DETACHED_PROCESS ((HANDLE)-1)
#define CONSOLE_NEW_CONSOLE ((HANDLE)-2)
#define CONSOLE_CREATE_NO_WINDOW ((HANDLE)-3)
#define SYSTEM_ROOT_CONSOLE_EVENT 3
#define CONSOLE_READ_NOREMOVE 0x0001
#define CONSOLE_READ_NOWAIT 0x0002
#define CONSOLE_READ_VALID (CONSOLE_READ_NOREMOVE | CONSOLE_READ_NOWAIT)
#define CONSOLE_GRAPHICS_BUFFER 2
//
// These are flags stored in PEB::ProcessParameters::ConsoleFlags.
//
#define CONSOLE_IGNORE_CTRL_C 0x1
#endif //_NTCON_

671
dep/Console/winconp.h Normal file
View File

@@ -0,0 +1,671 @@
#ifndef _WINCONP_
#define _WINCONP_
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER >= 1200
#pragma warning(push)
#pragma warning(disable:4820) // padding added after data member
#endif
#include <wincontypes.h>
//
// History flags (internal)
//
#define CHI_VALID_FLAGS (HISTORY_NO_DUP_FLAG)
//
// Selection flags (internal)
//
#define CONSOLE_SELECTION_INVERTED 0x0010 // selection is inverted (turned off)
#define CONSOLE_SELECTION_VALID (CONSOLE_SELECTION_IN_PROGRESS | \
CONSOLE_SELECTION_NOT_EMPTY | \
CONSOLE_MOUSE_SELECTION | \
CONSOLE_MOUSE_DOWN)
WINBASEAPI
BOOL
WINAPI
GetConsoleKeyboardLayoutNameA(
_Out_writes_(KL_NAMELENGTH) LPSTR pszLayout);
WINBASEAPI
BOOL
WINAPI
GetConsoleKeyboardLayoutNameW(
_Out_writes_(KL_NAMELENGTH) LPWSTR pszLayout);
#ifdef UNICODE
#define GetConsoleKeyboardLayoutName GetConsoleKeyboardLayoutNameW
#else
#define GetConsoleKeyboardLayoutName GetConsoleKeyboardLayoutNameA
#endif // !UNICODE
//
// Registry strings
//
#define CONSOLE_REGISTRY_STRING L"Console"
#define CONSOLE_REGISTRY_FONTSIZE L"FontSize"
#define CONSOLE_REGISTRY_FONTFAMILY L"FontFamily"
#define CONSOLE_REGISTRY_BUFFERSIZE L"ScreenBufferSize"
#define CONSOLE_REGISTRY_CURSORSIZE L"CursorSize"
#define CONSOLE_REGISTRY_WINDOWMAXIMIZED L"WindowMaximized"
#define CONSOLE_REGISTRY_WINDOWSIZE L"WindowSize"
#define CONSOLE_REGISTRY_WINDOWPOS L"WindowPosition"
#define CONSOLE_REGISTRY_WINDOWALPHA L"WindowAlpha"
#define CONSOLE_REGISTRY_FILLATTR L"ScreenColors"
#define CONSOLE_REGISTRY_POPUPATTR L"PopupColors"
#define CONSOLE_REGISTRY_FULLSCR L"FullScreen"
#define CONSOLE_REGISTRY_QUICKEDIT L"QuickEdit"
#define CONSOLE_REGISTRY_FACENAME L"FaceName"
#define CONSOLE_REGISTRY_FONTWEIGHT L"FontWeight"
#define CONSOLE_REGISTRY_INSERTMODE L"InsertMode"
#define CONSOLE_REGISTRY_HISTORYSIZE L"HistoryBufferSize"
#define CONSOLE_REGISTRY_HISTORYBUFS L"NumberOfHistoryBuffers"
#define CONSOLE_REGISTRY_HISTORYNODUP L"HistoryNoDup"
#define CONSOLE_REGISTRY_COLORTABLE L"ColorTable%02u"
#define CONSOLE_REGISTRY_EXTENDEDEDITKEY L"ExtendedEditKey"
#define CONSOLE_REGISTRY_EXTENDEDEDITKEY_CUSTOM L"ExtendedEditkeyCustom"
#define CONSOLE_REGISTRY_WORD_DELIM L"WordDelimiters"
#define CONSOLE_REGISTRY_TRIMZEROHEADINGS L"TrimLeadingZeros"
#define CONSOLE_REGISTRY_LOAD_CONIME L"LoadConIme"
#define CONSOLE_REGISTRY_ENABLE_COLOR_SELECTION L"EnableColorSelection"
#define CONSOLE_REGISTRY_SCROLLSCALE L"ScrollScale"
// V2 console settings
#define CONSOLE_REGISTRY_FORCEV2 L"ForceV2"
#define CONSOLE_REGISTRY_LINESELECTION L"LineSelection"
#define CONSOLE_REGISTRY_FILTERONPASTE L"FilterOnPaste"
#define CONSOLE_REGISTRY_LINEWRAP L"LineWrap"
#define CONSOLE_REGISTRY_CTRLKEYSHORTCUTS_DISABLED L"CtrlKeyShortcutsDisabled"
#define CONSOLE_REGISTRY_ALLOW_ALTF4_CLOSE L"AllowAltF4Close"
#define CONSOLE_REGISTRY_VIRTTERM_LEVEL L"VirtualTerminalLevel"
#define CONSOLE_REGISTRY_CURSORTYPE L"CursorType"
#define CONSOLE_REGISTRY_CURSORCOLOR L"CursorColor"
#define CONSOLE_REGISTRY_INTERCEPTCOPYPASTE L"InterceptCopyPaste"
#define CONSOLE_REGISTRY_COPYCOLOR L"CopyColor"
#define CONSOLE_REGISTRY_USEDX L"UseDx"
#define CONSOLE_REGISTRY_DEFAULTFOREGROUND L"DefaultForeground"
#define CONSOLE_REGISTRY_DEFAULTBACKGROUND L"DefaultBackground"
#define CONSOLE_REGISTRY_TERMINALSCROLLING L"TerminalScrolling"
// end V2 console settings
/*
* Starting code page
*/
#define CONSOLE_REGISTRY_CODEPAGE (L"CodePage")
//
// registry strings on HKEY_LOCAL_MACHINE
//
#define MACHINE_REGISTRY_CONSOLE (L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Console")
#define MACHINE_REGISTRY_CONSOLEIME (L"ConsoleIME")
#define MACHINE_REGISTRY_ENABLE_CONIME_ON_SYSTEM_PROCESS (L"EnableConImeOnSystemProcess")
#define MACHINE_REGISTRY_CONSOLE_TTFONT (L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Console\\TrueTypeFont")
#define MACHINE_REGISTRY_CONSOLE_TTFONT_WIN32_PATH (L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Console\\TrueTypeFont")
#define MACHINE_REGISTRY_CONSOLE_NLS (L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Console\\Nls")
#define MACHINE_REGISTRY_CONSOLE_FULLSCREEN (L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Console\\FullScreen")
#define MACHINE_REGISTRY_INITIAL_PALETTE (L"InitialPalette")
#define MACHINE_REGISTRY_COLOR_BUFFER (L"ColorBuffer")
#define MACHINE_REGISTRY_COLOR_BUFFER_NO_TRANSLATE (L"ColorBufferNoTranslate")
#define MACHINE_REGISTRY_MODE_FONT_PAIRS (L"ModeFontPairs")
#define MACHINE_REGISTRY_FS_CODEPAGE (L"CodePage")
#define MACHINE_REGISTRY_EUDC (L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Nls\\CodePage\\EUDCCodeRange")
//
// TrueType font list
//
// doesn't available bold when add BOLD_MARK on first of face name.
#define BOLD_MARK (L'*')
typedef struct _TT_FONT_LIST {
SINGLE_LIST_ENTRY List;
UINT CodePage;
BOOL fDisableBold;
TCHAR FaceName1[LF_FACESIZE];
TCHAR FaceName2[LF_FACESIZE];
} TTFONTLIST, *LPTTFONTLIST;
//
// registry strings on HKEY_CURRENT_USER
//
#define PRELOAD_REGISTRY_STRING (L"Keyboard Layout\\Preload")
//
// Special key for previous word erase
//
#define EXTKEY_ERASE_PREV_WORD (0x7f)
#ifndef NOGDI
typedef struct _CONSOLE_GRAPHICS_BUFFER_INFO {
DWORD dwBitMapInfoLength;
LPBITMAPINFO lpBitMapInfo;
DWORD dwUsage;
HANDLE hMutex;
PVOID lpBitMap;
} CONSOLE_GRAPHICS_BUFFER_INFO, *PCONSOLE_GRAPHICS_BUFFER_INFO;
#endif
BOOL
WINAPI
InvalidateConsoleDIBits(
_In_ HANDLE hConsoleOutput,
_In_ PSMALL_RECT lpRect);
VOID
WINAPI
SetLastConsoleEventActive(
VOID);
#define VDM_HIDE_WINDOW 1
#define VDM_IS_ICONIC 2
#define VDM_CLIENT_RECT 3
#define VDM_CLIENT_TO_SCREEN 4
#define VDM_SCREEN_TO_CLIENT 5
#define VDM_IS_HIDDEN 6
#define VDM_FULLSCREEN_NOPAINT 7
#define VDM_SET_VIDEO_MODE 8
BOOL
WINAPI
VDMConsoleOperation(
_In_ DWORD iFunction,
_Inout_opt_ LPVOID lpData);
BOOL
WINAPI
SetConsoleIcon(
_In_ HICON hIcon);
//
// These console font APIs don't appear to be used anywhere. Maybe they
// should be removed.
//
BOOL
WINAPI
SetConsoleFont(
_In_ HANDLE hConsoleOutput,
_In_ DWORD nFont);
DWORD
WINAPI
GetConsoleFontInfo(
_In_ HANDLE hConsoleOutput,
_In_ BOOL bMaximumWindow,
_In_ DWORD nLength,
_Out_ PCONSOLE_FONT_INFO lpConsoleFontInfo);
DWORD
WINAPI
GetNumberOfConsoleFonts(
VOID);
BOOL
WINAPI
SetConsoleCursor(
_In_ HANDLE hConsoleOutput,
_In_ HCURSOR hCursor);
int
WINAPI
ShowConsoleCursor(
_In_ HANDLE hConsoleOutput,
_In_ BOOL bShow);
HMENU
APIENTRY
ConsoleMenuControl(
_In_ HANDLE hConsoleOutput,
_In_ UINT dwCommandIdLow,
_In_ UINT dwCommandIdHigh);
BOOL
SetConsolePalette(
_In_ HANDLE hConsoleOutput,
_In_ HPALETTE hPalette,
_In_ UINT dwUsage);
#define CONSOLE_UNREGISTER_VDM 0
#define CONSOLE_REGISTER_VDM 1
#define CONSOLE_REGISTER_WOW 2
BOOL
APIENTRY
RegisterConsoleVDM(
_In_ DWORD dwRegisterFlags,
_In_ HANDLE hStartHardwareEvent,
_In_ HANDLE hEndHardwareEvent,
_In_ HANDLE hErrorhardwareEvent,
_Reserved_ DWORD Reserved,
_Out_ LPDWORD lpStateLength,
_Outptr_ PVOID *lpState,
_In_opt_ COORD VDMBufferSize,
_Outptr_ PVOID *lpVDMBuffer);
BOOL
APIENTRY
GetConsoleHardwareState(
_In_ HANDLE hConsoleOutput,
_Out_ PCOORD lpResolution,
_Out_ PCOORD lpFontSize);
BOOL
APIENTRY
SetConsoleHardwareState(
_In_ HANDLE hConsoleOutput,
_In_ COORD dwResolution,
_In_ COORD dwFontSize);
#define CONSOLE_NOSHORTCUTKEY 0x00000000 /* no shortcut key */
#define CONSOLE_ALTTAB 0x00000001 /* Alt + Tab */
#define CONSOLE_ALTESC 0x00000002 /* Alt + Escape */
#define CONSOLE_ALTSPACE 0x00000004 /* Alt + Space */
#define CONSOLE_ALTENTER 0x00000008 /* Alt + Enter */
#define CONSOLE_ALTPRTSC 0x00000010 /* Alt Print screen */
#define CONSOLE_PRTSC 0x00000020 /* Print screen */
#define CONSOLE_CTRLESC 0x00000040 /* Ctrl + Escape */
typedef struct _APPKEY {
WORD Modifier;
WORD ScanCode;
} APPKEY, *LPAPPKEY;
#define CONSOLE_MODIFIER_SHIFT 0x0003 // Left shift key
#define CONSOLE_MODIFIER_CONTROL 0x0004 // Either Control shift key
#define CONSOLE_MODIFIER_ALT 0x0008 // Either Alt shift key
BOOL
APIENTRY
SetConsoleKeyShortcuts(
_In_ BOOL bSet,
_In_ BYTE bReserveKeys,
_In_reads_(dwNumAppKeys) LPAPPKEY lpAppKeys,
_In_ DWORD dwNumAppKeys);
BOOL
APIENTRY
SetConsoleMenuClose(
_In_ BOOL bEnable);
DWORD
GetConsoleInputExeNameA(
_In_ DWORD nBufferLength,
_Out_writes_(nBufferLength) LPSTR lpBuffer);
DWORD
GetConsoleInputExeNameW(
_In_ DWORD nBufferLength,
_Out_writes_(nBufferLength) LPWSTR lpBuffer);
#ifdef UNICODE
#define GetConsoleInputExeName GetConsoleInputExeNameW
#else
#define GetConsoleInputExeName GetConsoleInputExeNameA
#endif // !UNICODE
BOOL
SetConsoleInputExeNameA(
_In_ LPSTR lpExeName);
BOOL
SetConsoleInputExeNameW(
_In_ LPWSTR lpExeName);
#ifdef UNICODE
#define SetConsoleInputExeName SetConsoleInputExeNameW
#else
#define SetConsoleInputExeName SetConsoleInputExeNameA
#endif // !UNICODE
BOOL
WINAPI
ReadConsoleInputExA(
_In_ HANDLE hConsoleInput,
_Out_writes_(nLength) PINPUT_RECORD lpBuffer,
_In_ DWORD nLength,
_Out_ LPDWORD lpNumberOfEventsRead,
_In_ USHORT wFlags);
BOOL
WINAPI
ReadConsoleInputExW(
_In_ HANDLE hConsoleInput,
_Out_writes_(nLength) PINPUT_RECORD lpBuffer,
_In_ DWORD nLength,
_Out_ LPDWORD lpNumberOfEventsRead,
_In_ USHORT wFlags);
#ifdef UNICODE
#define ReadConsoleInputEx ReadConsoleInputExW
#else
#define ReadConsoleInputEx ReadConsoleInputExA
#endif // !UNICODE
BOOL
WINAPI
WriteConsoleInputVDMA(
_In_ HANDLE hConsoleInput,
_In_reads_(nLength) PINPUT_RECORD lpBuffer,
_In_ DWORD nLength,
_Out_ LPDWORD lpNumberOfEventsWritten);
BOOL
WINAPI
WriteConsoleInputVDMW(
_In_ HANDLE hConsoleInput,
_In_reads_(nLength) PINPUT_RECORD lpBuffer,
_In_ DWORD nLength,
_Out_ LPDWORD lpNumberOfEventsWritten);
#ifdef UNICODE
#define WriteConsoleInputVDM WriteConsoleInputVDMW
#else
#define WriteConsoleInputVDM WriteConsoleInputVDMA
#endif // !UNICODE
BOOL
APIENTRY
GetConsoleNlsMode(
_In_ HANDLE hConsole,
_Out_ PDWORD lpdwNlsMode);
BOOL
APIENTRY
SetConsoleNlsMode(
_In_ HANDLE hConsole,
_In_ DWORD fdwNlsMode);
BOOL
APIENTRY
GetConsoleCharType(
_In_ HANDLE hConsole,
_In_ COORD coordCheck,
_Out_ PDWORD pdwType);
#define CHAR_TYPE_SBCS 0 // Displayed SBCS character
#define CHAR_TYPE_LEADING 2 // Displayed leading byte of DBCS
#define CHAR_TYPE_TRAILING 3 // Displayed trailing byte of DBCS
BOOL
APIENTRY
SetConsoleLocalEUDC(
_In_ HANDLE hConsoleHandle,
_In_ WORD wCodePoint,
_In_ COORD cFontSize,
_In_ PCHAR lpSB);
BOOL
APIENTRY
SetConsoleCursorMode(
_In_ HANDLE hConsoleHandle,
_In_ BOOL Blink,
_In_ BOOL DBEnable);
BOOL
APIENTRY
GetConsoleCursorMode(
_In_ HANDLE hConsoleHandle,
_Out_ PBOOL pbBlink,
_Out_ PBOOL pbDBEnable);
BOOL
APIENTRY
RegisterConsoleOS2(
_In_ BOOL fOs2Register);
BOOL
APIENTRY
SetConsoleOS2OemFormat(
_In_ BOOL fOs2OemFormat);
BOOL
IsConsoleFullWidth(
_In_ HDC hDC,
_In_ DWORD CodePage,
_In_ WCHAR wch);
#if defined(FE_IME)
BOOL
APIENTRY
RegisterConsoleIME(
_In_ HWND hWndConsoleIME,
_Out_opt_ DWORD *lpdwConsoleThreadId);
BOOL
APIENTRY
UnregisterConsoleIME(
VOID);
#endif // FE_IME
//
// These bits are always on for console handles and are used for routing
// by windows.
//
#define CONSOLE_HANDLE_SIGNATURE 0x00000003
#define CONSOLE_HANDLE_NEVERSET 0x10000000
#define CONSOLE_HANDLE_MASK (CONSOLE_HANDLE_SIGNATURE | CONSOLE_HANDLE_NEVERSET)
#define CONSOLE_HANDLE(HANDLE) (((ULONG_PTR)(HANDLE) & CONSOLE_HANDLE_MASK) == CONSOLE_HANDLE_SIGNATURE)
//
// These strings are used to open console input or output.
//
#define CONSOLE_INPUT_STRING L"CONIN$"
#define CONSOLE_OUTPUT_STRING L"CONOUT$"
#define CONSOLE_GENERIC L"CON"
//
// this string is used to call RegisterWindowMessage to get
// progman's handle.
//
#define CONSOLE_PROGMAN_HANDLE_MESSAGE "ConsoleProgmanHandle"
//
// stream API definitions. these API are only supposed to be used by
// subsystems (i.e. OpenFile routes to OpenConsoleW).
//
HANDLE
APIENTRY
OpenConsoleW(
_In_ LPWSTR lpConsoleDevice,
_In_ DWORD dwDesiredAccess,
_In_ BOOL bInheritHandle,
_In_ DWORD dwShareMode);
HANDLE
APIENTRY
DuplicateConsoleHandle(
_In_ HANDLE hSourceHandle,
_In_ DWORD dwDesiredAccess,
_In_ BOOL bInheritHandle,
_In_ DWORD dwOptions);
BOOL
APIENTRY
GetConsoleHandleInformation(
_In_ HANDLE hObject,
_Out_ LPDWORD lpdwFlags);
BOOL
APIENTRY
SetConsoleHandleInformation(
_In_ HANDLE hObject,
_In_ DWORD dwMask,
_In_ DWORD dwFlags);
BOOL
APIENTRY
CloseConsoleHandle(
_In_ HANDLE hConsole);
BOOL
APIENTRY
VerifyConsoleIoHandle(
_In_ HANDLE hIoHandle);
HANDLE
APIENTRY
GetConsoleInputWaitHandle(
VOID);
typedef struct _CONSOLE_STATE_INFO {
/* BEGIN V1 CONSOLE_STATE_INFO */
COORD ScreenBufferSize;
COORD WindowSize;
INT WindowPosX;
INT WindowPosY;
COORD FontSize;
UINT FontFamily;
UINT FontWeight;
WCHAR FaceName[LF_FACESIZE];
UINT CursorSize;
UINT FullScreen : 1;
UINT QuickEdit : 1;
UINT AutoPosition : 1;
UINT InsertMode : 1;
UINT HistoryNoDup : 1;
UINT FullScreenSupported : 1;
UINT UpdateValues : 1;
UINT Defaults : 1;
WORD ScreenAttributes;
WORD PopupAttributes;
UINT HistoryBufferSize;
UINT NumberOfHistoryBuffers;
COLORREF ColorTable[16];
HWND hWnd;
HICON hIcon;
LPWSTR OriginalTitle;
LPWSTR LinkTitle;
/*
* Starting code page
*/
UINT CodePage;
/* END V1 CONSOLE_STATE_INFO */
/* BEGIN V2 CONSOLE_STATE_INFO */
BOOL fIsV2Console;
BOOL fWrapText;
BOOL fFilterOnPaste;
BOOL fCtrlKeyShortcutsDisabled;
BOOL fLineSelection;
BYTE bWindowTransparency;
BOOL fWindowMaximized;
unsigned int CursorType;
COLORREF CursorColor;
BOOL InterceptCopyPaste;
COLORREF DefaultForeground;
COLORREF DefaultBackground;
BOOL TerminalScrolling;
LPWSTR VersionString;
/* END V2 CONSOLE_STATE_INFO */
} CONSOLE_STATE_INFO, *PCONSOLE_STATE_INFO;
#ifdef DEFINE_CONSOLEV2_PROPERTIES
#define PID_CONSOLE_FORCEV2 1
#define PID_CONSOLE_WRAPTEXT 2
#define PID_CONSOLE_FILTERONPASTE 3
#define PID_CONSOLE_CTRLKEYSDISABLED 4
#define PID_CONSOLE_LINESELECTION 5
#define PID_CONSOLE_WINDOWTRANSPARENCY 6
#define PID_CONSOLE_WINDOWMAXIMIZED 7
#define PID_CONSOLE_CURSOR_TYPE 8
#define PID_CONSOLE_CURSOR_COLOR 9
#define PID_CONSOLE_INTERCEPT_COPY_PASTE 10
#define PID_CONSOLE_DEFAULTFOREGROUND 11
#define PID_CONSOLE_DEFAULTBACKGROUND 12
#define PID_CONSOLE_TERMINALSCROLLING 13
#define CONSOLE_PROPKEY(name, id) \
DEFINE_PROPERTYKEY(name, 0x0C570607, 0x0396, 0x43DE, 0x9D, 0x61, 0xE3, 0x21, 0xD7, 0xDF, 0x50, 0x26, id);
CONSOLE_PROPKEY(PKEY_Console_ForceV2, PID_CONSOLE_FORCEV2);
CONSOLE_PROPKEY(PKEY_Console_WrapText, PID_CONSOLE_WRAPTEXT);
CONSOLE_PROPKEY(PKEY_Console_FilterOnPaste, PID_CONSOLE_FILTERONPASTE);
CONSOLE_PROPKEY(PKEY_Console_CtrlKeyShortcutsDisabled, PID_CONSOLE_CTRLKEYSDISABLED);
CONSOLE_PROPKEY(PKEY_Console_LineSelection, PID_CONSOLE_LINESELECTION);
CONSOLE_PROPKEY(PKEY_Console_WindowTransparency, PID_CONSOLE_WINDOWTRANSPARENCY);
CONSOLE_PROPKEY(PKEY_Console_WindowMaximized, PID_CONSOLE_WINDOWMAXIMIZED);
CONSOLE_PROPKEY(PKEY_Console_CursorType, PID_CONSOLE_CURSOR_TYPE);
CONSOLE_PROPKEY(PKEY_Console_CursorColor, PID_CONSOLE_CURSOR_COLOR);
CONSOLE_PROPKEY(PKEY_Console_InterceptCopyPaste, PID_CONSOLE_INTERCEPT_COPY_PASTE);
CONSOLE_PROPKEY(PKEY_Console_DefaultForeground, PID_CONSOLE_DEFAULTFOREGROUND);
CONSOLE_PROPKEY(PKEY_Console_DefaultBackground, PID_CONSOLE_DEFAULTBACKGROUND);
CONSOLE_PROPKEY(PKEY_Console_TerminalScrolling, PID_CONSOLE_TERMINALSCROLLING);
#endif
//
// Ensure the alignment is WORD boundary
//
#include <pshpack2.h>
typedef struct {
WORD wMod;
WORD wVirKey;
WCHAR wUnicodeChar;
} ExtKeySubst;
typedef struct {
ExtKeySubst keys[3]; // 0: Ctrl
// 1: Alt
// 2: Ctrl+Alt
} ExtKeyDef;
typedef ExtKeyDef ExtKeyDefTable['Z' - 'A' + 1];
typedef struct {
DWORD dwVersion;
DWORD dwCheckSum;
ExtKeyDefTable table;
} ExtKeyDefBuf;
//
// Restore the previous alignment
//
#include <poppack.h>
#if _MSC_VER >= 1200
#pragma warning(pop)
#endif
#ifdef __cplusplus
}
#endif
#endif // _WINCONP_

3
dep/NT/ntioapi_x.h Normal file
View File

@@ -0,0 +1,3 @@
#pragma once
#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020

12
dep/Win32K/winuserp.h Normal file
View File

@@ -0,0 +1,12 @@
/*
* Reserved console space.
*
* This was moved from the console code so that we can localize it
* in one place. This was necessary for dealing with the background
* color, which we need to have for the hungapp drawing. These are
* stored in the extra-window-bytes of each console.
*/
#define GWL_CONSOLE_WNDALLOC (3 * sizeof(DWORD))
#define GWL_CONSOLE_PID 0
#define GWL_CONSOLE_TID 4
#define GWL_CONSOLE_BKCOLOR 8

96
dep/WinAppDriver/EULA.rtf Normal file
View File

@@ -0,0 +1,96 @@
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\fswiss\fprq2\fcharset0 Arial;}{\f2\fnil\fcharset0 Calibri;}}
{\colortbl ;\red0\green0\blue255;}
{\stylesheet{ Normal;}{\s1 heading 1;}{\s2 heading 2;}}
{\*\generator Riched20 10.0.10586}\viewkind4\uc1
\pard\widctlpar\sb120\sa120\b\f0\fs28 MICROSOFT SOFTWARE LICENSE TERMS\par
\pard\brdrb\brdrs\brdrw10\brsp20 \widctlpar\sb120\sa120 Pre-Release and Evaluation EULA \endash Windows Application Driver\par
\pard\widctlpar\sb120\sa120\b0\fs20 IF YOU LIVE IN (OR ARE A BUSINESS WITH YOUR PRINCIPAL PLACE OF BUSINESS IN) THE UNITED STATES, PLEASE READ THE \ldblquote BINDING ARBITRATION AND CLASS ACTION WAIVER\rdblquote SECTION BELOW. IT AFFECTS HOW DISPUTES ARE RESOLVED.\lang9\par
\pard\brdrt\brdrs\brdrw10\brsp20 \widctlpar\sb120\sa120 These license terms are an agreement between you and Microsoft Corporation (or one of its affiliates). They apply to the software named above and any Microsoft services or software updates (except to the extent such services or updates are accompanied by new or \lang1033 additional terms, in which case those different terms apply prospectively and do not alter your or Microsoft\rquote s rights relating to pre-updated software or services\lang9 ). IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW.\par
\pard
{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent360\pnstart1\pndec{\pntxta.}}
\widctlpar\s1\fi-357\li357\sb120\sa120\b\lang1033 INSTALLATION AND USE RIGHTS.\par
\pard
{\pntext\f0 a)\tab}{\*\pn\pnlvlbody\pnf0\pnindent0\pnstart1\pnlcltr{\pntxta)}}
\widctlpar\s2\fi-360\li717\sb120\sa120 General. \b0 You may install and use any number of copies of the software on your devices, solely to i) evaluate for internal business purposes; and ii) design, develop and test your applications. \par
{\pntext\f0 b)\tab}\b Included Microsoft Applications. \b0 The software may include other Microsoft applications. These license terms apply to those included applications, if any, unless other license terms are provided with the other Microsoft applications.\par
{\pntext\f0 c)\tab}\b Third Party Applications. \b0 The software may include third party applications that Microsoft, not the third party, licenses to you under this agreement. Any included notices for third party applications are for your information only and are listed in Exhibit A to these license terms.\par
{\pntext\f0 d)\tab}\b No Distribution Rights. \b0 This agreement does not grant you a license to distribute nor sublicense all or part of the software to any third party.\par
{\pntext\f0 e)\tab}\b\lang9 Package Managers. \b0\lang1033 The software may include package managers, like NuGet, that give you the option to download other Microsoft and third party software packages to use with your application. Those packages are under their own licenses, and not this agreement. Microsoft does not distribute, license or provide any warranties for any of the third party packages\lang9 .\lang1033\par
\pard\widctlpar\s1\fi-357\li357\sb120\sa120\b 2.\tab TIME-SENSITIVE SOFTWARE.\par
\pard
{\pntext\f0 a)\tab}{\*\pn\pnlvlbody\pnf0\pnindent0\pnstart1\pnlcltr{\pntxta)}}
\widctlpar\s2\fi-360\li717\sb120\sa120 Period. \b0 The software is time-sensitive and may stop running on a date that is defined in the software.\par
{\pntext\f0 b)\tab}\b Notice. \b0 You may receive periodic reminder notices of this date through the software.\par
{\pntext\f0 c)\tab}\b Access to data. \b0 You may not be able to access data used in the software when it stops running.\par
\pard\widctlpar\s1\fi-357\li357\sb120\sa120\b 3.\tab PRE-RELEASE SOFTWARE.\b0 The software is a pre-release version. It may not operate correctly. It may be different from the commercially released version.\par
\b 4.\tab FEEDBACK.\b0 If you give feedback about the software to Microsoft, you give to Microsoft, without charge, the right to use, share and commercialize your feedback in any way and for any purpose. You will not give feedback that is subject to a license that requires Microsoft to license its software or documentation to third parties because Microsoft includes your feedback in them. These rights survive this agreement.\par
\b 5.\tab DATA.\b0 The software may collect information about you and your use of the software and send that to Microsoft. Microsoft may use this information to provide services and improve Microsoft\rquote s products and services. Your opt-out rights, if any, are described in\b \b0 the product documentation. Some features in the software may enable collection of data from users of your applications that access or use the software. If you use these features to enable data collection in your applications, you must comply with applicable law, including getting any required user consent, and maintain a prominent privacy policy that accurately informs users about how you use, collect, and share their data. You can learn more about Microsoft\rquote s data collection and use in the product documentation and the Microsoft Privacy Statement at {{\field{\*\fldinst{HYPERLINK http://go.microsoft.com/fwlink/?LinkID=521839 }}{\fldrslt{http://go.microsoft.com/fwlink/?LinkID=521839\ul0\cf0}}}}\f0\fs20 . You agree to comply with all applicable provisions of the Microsoft Privacy Statement.\par
\b 6.\tab SCOPE OF LICENSE.\b0 The software is licensed, not sold. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you will not (and have no right to):\par
\pard
{\pntext\f0 a)\tab}{\*\pn\pnlvlbody\pnf0\pnindent0\pnstart1\pnlcltr{\pntxta)}}
\widctlpar\s2\fi-360\li717\sb120\sa120 work around any technical limitations in the software that only allow you to use it in certain ways;\par
{\pntext\f0 b)\tab}reverse engineer, decompile or disassemble the software;\par
{\pntext\f0 c)\tab}remove, minimize, block, or modify any notices of Microsoft or its suppliers in the software;\par
{\pntext\f0 d)\tab}use the software in any way that is against the law or to create or propagate malware; or\par
{\pntext\f0 e)\tab}share, publish, or lend the software (except for any distributable code, and then subject to the applicable terms above), provide the software as a stand-alone hosted solution for others to use, or transfer the software or this agreement to any third party.\par
\pard\widctlpar\s1\fi-357\li357\sb120\sa120\b 7.\tab EXPORT RESTRICTIONS.\b0 You must comply with all domestic and international export laws and regulations that apply to the software, which include restrictions on destinations, end users, and end use. For further information on export restrictions, visit (aka.ms/exporting).\par
\b 8.\tab SUPPORT SERVICES.\b0 Microsoft is not obligated under this agreement to provide any support services for the software. Any support provided is \ldblquote as is\rdblquote , \ldblquote with all faults\rdblquote , and without warranty of any kind.\par
\b 9.\tab UPDATES.\b0 The software may periodically check for updates, and download and install them for you. You may obtain updates only from Microsoft or authorized sources. Microsoft may need to update your system to provide you with updates. You agree to receive these automatic updates without any additional notice. Updates may not include or support all existing software features, services, or peripheral devices.\par
\b 10.\tab BINDING ARBITRATION AND CLASS ACTION WAIVER.\b0 This Section applies if you live in (or, if a business, your principal place of business is in) the United States. If you and Microsoft have a dispute, you and Microsoft agree to try for 60 days to resolve it informally. If you and Microsoft can\rquote t, you and Microsoft agree to binding individual arbitration before the American Arbitration Association under the Federal Arbitration Act (\ldblquote FAA\rdblquote ), and not to sue in court in front of a judge or jury. Instead, a neutral arbitrator will decide. Class action lawsuits, class-wide arbitrations, private attorney-general actions, and any other proceeding where someone acts in a representative capacity are not allowed; nor is combining individual proceedings without the consent of all parties. The complete Arbitration Agreement contains more terms and is at aka.ms/arb-agreement-1. You and Microsoft agree to these terms.\par
\b 11.\tab ENTIRE AGREEMENT.\b0 This agreement, and any other terms Microsoft may provide for supplements, updates, or third-party applications, is the entire agreement for the software.\par
\b 12.\tab APPLICABLE LAW AND PLACE TO RESOLVE DISPUTES.\b0 If you acquired the software in the United States or Canada, the laws of the state or province where you live (or, if a business, where your principal place of business is located) govern the interpretation of this agreement, claims for its breach, and all other claims (including consumer protection, unfair competition, and tort claims), regardless of conflict of laws principles, except that the FAA governs everything related to arbitration. If you acquired the software in any other country, its laws apply, except that the FAA governs everything related to arbitration. If U.S. federal jurisdiction exists, you and Microsoft consent to exclusive jurisdiction and venue in the federal court in King County, Washington for all disputes heard in court (excluding arbitration). If not, you and Microsoft consent to exclusive jurisdiction and venue in the Superior Court of King County, Washington for all disputes heard in court (excluding arbitration).\par
\b 13.\tab CONSUMER RIGHTS; REGIONAL VARIATIONS\b0 . This agreement describes certain legal rights. You may have other rights, including consumer rights, under the laws of your state, province, or country. Separate and apart from your relationship with Microsoft, you may also have rights with respect to the party from which you acquired the software. This agreement does not change those other rights if the laws of your state, province, or country do not permit it to do so. For example, if you acquired the software in one of the below regions, or mandatory country law applies, then the following provisions apply to you:\par
\pard
{\pntext\f0 a)\tab}{\*\pn\pnlvlbody\pnf0\pnindent0\pnstart1\pnlcltr{\pntxta)}}
\widctlpar\s2\fi-360\li717\sb120\sa120\b Australia.\b0 You have statutory guarantees under the Australian Consumer Law and nothing in this agreement is intended to affect those rights.\par
{\pntext\f0 b)\tab}\b Canada.\b0 If you acquired this software in Canada, you may stop receiving updates by turning off the automatic update feature, disconnecting your device from the Internet (if and when you re-connect to the Internet, however, the software will resume checking for and installing updates), or uninstalling the software. The product documentation, if any, may also specify how to turn off updates for your specific device or software.\par
{\pntext\f0 c)\tab}\b Germany and Austria\b0 .\par
\pard\widctlpar\li717\sb120\sa120\b (i)\b0\tab\b Warranty.\b0 The properly licensed software will perform substantially as described in any Microsoft materials that accompany the software. However, Microsoft gives no contractual guarantee in relation to the licensed software.\par
\b (ii)\b0\tab\b Limitation of Liability\b0 . In case of intentional conduct, gross negligence, claims based on the Product Liability Act, as well as, in case of death or personal or physical injury, Microsoft is liable according to the statutory law.\par
\pard\widctlpar\s1\li717\sb120\sa120 Subject to the foregoing clause (ii), Microsoft will only be liable for slight negligence if Microsoft is in breach of such material contractual obligations, the fulfillment of which facilitate the due performance of this agreement, the breach of which would endanger the purpose of this agreement and the compliance with which a party may constantly trust in (so-called "cardinal obligations"). In other cases of slight negligence, Microsoft will not be liable for slight negligence.\par
\pard\widctlpar\s1\fi-357\li357\sb120\sa120\b 14.\tab DISCLAIMER OF WARRANTY.\b0 \b THE SOFTWARE IS LICENSED \ldblquote AS IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES, OR CONDITIONS. TO THE EXTENT PERMITTED UNDER APPLICABLE LAWS, MICROSOFT EXCLUDES ALL IMPLIED WARRANTIES, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.\b0\par
\b 15.\tab LIMITATION ON AND EXCLUSION OF DAMAGES. IF YOU HAVE ANY BASIS FOR RECOVERING DAMAGES DESPITE THE PRECEDING DISCLAIMER OF WARRANTY, YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par
\pard\widctlpar\li357\sb120\sa120\b0 This limitation applies to (a) anything related to the software, services, content (including code) on third party Internet sites, or third party applications; and (b) claims for breach of contract, warranty, guarantee, or condition; strict liability, negligence, or other tort; or any other claim; in each case to the extent permitted by applicable law.\par
It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your state, province, or country may not allow the exclusion or limitation of incidental, consequential, or other damages.\par
\pard\widctlpar\sb120\sa120\page\par
\pard\widctlpar\sb120\sa120\qc EXHIBIT A\par
THIRD PARTY NOTICES AND INFORMATION\par
FOR\par
MICROSOFT WINDOWS APPLICATION DRIVER\par
\pard\widctlpar\sb120\sa120\par
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION\line\line Note: While Microsoft is not the author of the files below, Microsoft is offering you a license subject to the terms of the Microsoft Software License Terms for Microsoft Windows Application Driver (the \ldblquote Microsoft Program\rdblquote ). Microsoft reserves all other rights. The notices below are provided for informational purposes only and are not the license terms under which Microsoft distributes these files.\par
The Microsoft Program includes the following third-party software:\par
1.\tab Newtonsoft.json version 7.0. ({\b{\field{\*\fldinst{HYPERLINK http://www.newtonsoft.com/json }}{\fldrslt{http://www.newtonsoft.com/json\ul0\cf0}}}}\f0\fs20 )\par
2.\tab Casablanca ({{\field{\*\fldinst{HYPERLINK http://casablanca.codeplex.com/ }}{\fldrslt{http://casablanca.codeplex.com/\ul0\cf0}}}}\f0\fs20 )\par
As the recipient of the above third-party software, Microsoft sets forth a copy of the notices and other information below.\par
1. Newtonsoft.json version 7.0.1 ({{\field{\*\fldinst{HYPERLINK http://www.newtonsoft.com/json }}{\fldrslt{http://www.newtonsoft.com/json\ul0\cf0}}}}\f0\fs20 )\par
NEWTONSOFT.JSON NOTICES AND INFORMATION BEGIN HERE\line =========================================\par
The MIT License (MIT)\line\line Copyright (c) 2007 James Newton-King\line\line Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\line\line The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\line\line THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\par
NEWTONSOFT.JSON NOTICES AND INFORMATION END HERE\line =========================================\par
2. Casablanca ({{\field{\*\fldinst{HYPERLINK http://casablanca.codeplex.com/ }}{\fldrslt{http://casablanca.codeplex.com/\ul0\cf0}}}}\f0\fs20 )\par
CASABLANCA NOTICES AND INFORMATION BEGIN HERE\line =========================================\par
Copyright (c) Microsoft Corporation. All rights reserved. \line Licensed under the Apache License, Version 2.0 (the "License");\line you may not use this file except in compliance with the License.\line You may obtain a copy of the License at\line {{\field{\*\fldinst{HYPERLINK http://www.apache.org/licenses/LICENSE-2.0 }}{\fldrslt{http://www.apache.org/licenses/LICENSE-2.0\ul0\cf0}}}}\f0\fs20\line\line Unless required by applicable law or agreed to in writing, software\line\f1\fs19 distributed under the License is distributed on an "AS IS" BASIS,\line WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\line See the License for the specific language governing permissions and\line limitations under the License.\fs20\par
\f0 CASABLANCA NOTICES AND INFORMATION END HERE\line =========================================\par
\par
\pard\sa200\sl276\slmult1\f2\fs22\lang9\par
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,7 @@
Windows Application Driver (Beta)
For documentation, sample code, and logging issues:
https://github.com/Microsoft/WinAppDriver
To request new features and upvote requests filed by others:
https://wpdev.uservoice.com

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1
dep/gsl Submodule

Submodule dep/gsl added at b74b286d5e

BIN
dep/nuget/nuget.exe Normal file

Binary file not shown.

7
dep/packages/README.md Normal file
View File

@@ -0,0 +1,7 @@
These packages are redistributed inside this folder because they are not yet available on a public NuGet feed.
## Microsoft.UI.XAML
This package is a custom development build fork to help us light up tab support. It will eventually go onto the same public feed as the existing `Microsoft.UI.XAML` package that's currently available on NuGet.org
## TAEF.Redist.WLK
This package is vetted for public redistribution and release, but the TAEF team hasn't set up a public feed to consume it yet. If/when they do, we'll move to that.

Binary file not shown.

View File

@@ -0,0 +1,17 @@
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- ProjectTelemetry.h
Abstract:
- This module is used for basic definitions for telemetry for the entire project
--*/
#define TraceLoggingOptionMicrosoftTelemetry() TraceLoggingOptionGroup(0x9aa7a361, 0x583f, 0x4c09, 0xb1, 0xf1, 0xce, 0xa1, 0xef, 0x58, 0x63, 0xb0)
#define TelemetryPrivacyDataTag(tag) TraceLoggingUInt64((tag), "PartA_PrivTags")
#define PDT_ProductAndServicePerformance 0x0u
#define PDT_ProductAndServiceUsage 0x0u
#define MICROSOFT_KEYWORD_TELEMETRY 0x0
#define MICROSOFT_KEYWORD_MEASURES 0x0

1
dep/wil Submodule

Submodule dep/wil added at fbcd1d2abb

3
dirs Normal file
View File

@@ -0,0 +1,3 @@
DIRS=\
src

40
doc/AddASetting.md Normal file
View File

@@ -0,0 +1,40 @@
# Adding a Settings Property
1. Add to wincon.w
* THIS IS NOT IN OPENCONSOLE. Make sure you update
`.../console/published/wincon.w` in the OS repo when you submit the PR.
The branch won't build without it.
* For now, you can update winconp.h with your consumable changes.
* define registry name (ex `CONSOLE_REGISTRY_CURSORCOLOR`)
* add the setting to `CONSOLE_STATE_INFO`
* define the property key ID and the property key itself
- Yes, the large majority of the `DEFINE_PROPERTYKEY` defs are the same, it's only the last byte of the guid that changes
2. Add matching fields to Settings.hpp
- add getters, setters, the whole drill.
3. Add to the propsheet
- We need to add it to *reading and writing* the registry from the propsheet, and *reading* the link from the propsheet. Yes, that's weird, but the propsheet is smart enough to re-use ShortcutSerialization::s_SetLinkValues, but not smart enough to do the same with RegistrySerialization.
- `src/propsheet/registry.cpp`
- `propsheet/registry.cpp@InitRegistryValues` should initialize the default value for the property.
- `propsheet/registry.cpp@GetRegistryValues` should make sure to read the property from the registry
4. Add the field to the propslib registry map
5. Add the value to `ShortcutSerialization.cpp`
- Read the value in `ShortcutSerialization::s_PopulateV2Properties`
- Write the value in `ShortcutSerialization::s_SetLinkValues`
6. Add the setting to `Menu::s_GetConsoleState`, and `Menu::s_PropertiesUpdate`
Now, your new setting should be stored just like all the other properties.
7. Update the feature test properties to get add the setting as well
- `ft_uia/Common/NativeMethods.cs@WinConP`:
- `Wtypes.PROPERTYKEY PKEY_Console_`
- `NT_CONSOLE_PROPS`
8. Add the default value for the setting to `win32k-settings.man`
- If the setting shouldn't default to 0 or `nullptr`, then you'll need to set the default value of the setting in `win32k-settings.man`.
9. Update `Settings::InitFromStateInfo` and `Settings::CreateConsoleStateInfo` to get/set the value in a CONSOLE_STATE_INFO appropriately

22
doc/ConsoleCtrlEvent.md Normal file
View File

@@ -0,0 +1,22 @@
# Console Control Events
## Generation
conhost requests that user32 injects a thread into the attached console application.
See ntuser's exitwin.c for `CreateCtrlThread`.
## Timeouts
_Sourced from ntuser's **exitwin.c**, **user.h**_
| Event | Circumstances | Timeout |
|------------------------|---------------------------------|-------------------------------------------------------------|
| `CTRL_CLOSE_EVENT` | _any_ | system parameter `SPI_GETHUNGAPPTIMEOUT`, 5000ms |
| `CTRL_LOGOFF_EVENT` | `CONSOLE_QUICK_RESOLVE_FLAG`[1] | registry key `CriticalAppShutdownTimeout` or 500ms |
| `CTRL_LOGOFF_EVENT` | _none of the above_ | system parameter `SPI_GETWAITTOKILLTIMEOUT`, 5000ms |
| `CTRL_SHUTDOWN_EVENT` | **service process** | system parameter `SPI_GETWAITTOKILLSERVICETIMEOUT`, 20000ms |
| `CTRL_SHUTDOWN_EVENT` | `CONSOLE_QUICK_RESOLVE_FLAG`[1] | registry key `CriticalAppShutdownTimeout` or 500ms |
| `CTRL_SHUTDOWN_EVENT` | _none of the above_ | system parameter `SPI_GETWAITTOKILLTIMEOUT`, 5000ms |
| `CTRL_C`, `CTRL_BREAK` | _any_ | **no timeout** |
_[1]: nobody sets `CONSOLE_QUICK_RESOLVE_FLAG`._

View File

@@ -0,0 +1,70 @@
# Understanding Console Host Settings
Settings in the Windows Console Host can be a bit tricky to understand. This is mostly because the settings system evolved over the course of decades. Before we dig into the details of how settings are persisted, it's probably worth taking a quick look at what these settings are.
## Settings Description
|Name |Type |Description |
|---------------------------|-----------------------|--------------------------------------|
|`FontSize` |Coordinate (REG_DWORD) |Size of font in pixels |
|`FontFamily` |REG_DWORD |GDI Font family |
|`ScreenBufferSize` |Coordinate (REG_DWORD) |Size of the screen buffer in WxH characters |
|`CursorSize` |REG_DWORD |Cursor height as percentage of a single character |
|`WindowSize` |Coordinate (REG_DWORD) |Initial size of the window in WxH characters |
|`WindowPosition` |Coordinate (REG_DWORD) |Initial position of the window in WxH pixels (if not set, use auto-positioning) |
|`WindowAlpha` |REG_DWORD |Opacity of the window (valid range: 0x4D-0xFF) |
|`ScreenColors` |REG_DWORD |Default foreground and background colors |
|`PopupColors` |REG_DWORD |FG and BG colors used when displaying a popup window (e.g. when F2 is pressed in CMD.exe) |
|`QuickEdit` |REG_DWORD |Whether QuickEdit is on by default or not |
|`FaceName` |REG_SZ |Name of font to use (or "__DefaultTTFont__", which defaults to whichever font is deemed most appropriate for your codepage) |
|`FontWeight` |REG_DWORD |GDI font weight |
|`InsertMode` |REG_DWORD |Whether Insert mode is on by default or not |
|`HistoryBufferSize` |REG_DWORD |Number of history entries to retain |
|`NumberOfHistoryBuffers` |REG_DWORD |Number of history buffers to retain |
|`HistoryNoDup` |REG_DWORD |Whether to retain duplicate history entries or not |
|`ColorTable%%` |REG_DWORD |For each of the 16 colors in the palette, the RGB value of the color to use |
|`ExtendedEditKey` |REG_DWORD |Whether to allow the use of extended edit keys or not |
|`WordDelimiters` |REG_SZ |A list of characters that are considered as delimiting words (e.g. `' .-/\=|,()[]{}'`) |
|`TrimLeadingZeros` |REG_DWORD |Whether to remove zeroes from the beginning of a selected string on copy (e.g. `00000001` becomes `1`) |
|`EnableColorSelection` |REG_DWORD |Whether to allow selection colorization or not |
|`ScrollScale` |REG_DWORD |How many lines to scroll when using `SHIFT|Scroll Wheel` |
|`CodePage` |REG_DWORD |The default codepage to use |
|`ForceV2` |REG_DWORD |Whether to use the improved version of the Windows Console Host |
|`LineSelection`* |REG_DWORD |Whether to use wrapped text selection |
|`FilterOnPaste`* |REG_DWORD |Whether to replace characters on paste (e.g. Word "smart quotes" are replaced with regular quotes) |
|`LineWrap`* |REG_DWORD |Whether to have the Windows Console Host break long lines into multiple rows |
|`CtrlKeyShortcutsDisabled`*|REG_DWORD |Disables new control key shortcuts |
|`AllowAltF4Close`* |REG_DWORD |Allows the user to disable the Alt-F4 hotkey |
|`VirtualTerminalLevel`* |REG_DWORD |The level of VT support provided by the Windows Console Host |
*: Only applies to the improved version of the Windows Console Host
## The Settings Hierarchy
Settings are persisted to a variety of locations depending on how they are modified and how the Windows Console Host was invoked:
* Hardcoded settings in conhostv2.dll
* User's configured defaults (stored as values in `HKCU\Console`)
* Per-console-application storage (stored as subkeys of `HKCU\Console`). Subkey names:
* Console application path (with `\` replaced with `_`)
* Console title
* Windows shortcut (.lnk) files
To modify the defaults, invoke the `Defaults` titlebar menu option on a Windows Console Host window. Any changes made in the resulting dialog will be persisted to the registry location mentioned above.
To modify settings specific to the current application, invoke the `Properties` titlebar menu option on a Windows Console Host window. If the application was launched directly (e.g. via the Windows run dialog), changes made in the dialog will be persisted in the per-application storage location mentioned above. If the application was launched via a Windows shortcut file, changes made in the settings dialog will be persisted directly into the .lnk file. For console applications with a shortcut, you can also right-click on the shortcut file and choose `Properties` to access the settings dialog.
When console applications are launched, the Windows Console Host determines which settings to use by overlaying settings from the above locations.
1. Initialize settings based on hardcoded defaults
2. Overlay settings specified by the user's configured defaults
3. Overlay application-specific settings from either the registry or the shortcut file, depending on how the application was launched
Note that the registry settings are "sparse" settings repositories, meaning that if a setting isn't present, then whatever value that is already in use remains unchanged. This allows users to have some settings shared amongst all console applications and other settings be specific. Shortcut files, however, store each setting regardless of whether it was a default setting or not.
## Known Issues
* Modifications to system-created Start Menu and Win-X menu console applications are not kept during upgrade.
## Adding settings
Adding a setting involves a bunch of steps - see [AddASetting.md](AddASetting.md).

10
doc/Debugging.md Normal file
View File

@@ -0,0 +1,10 @@
# Debugging Miscellanea
This file contains notes about debugging various items in the repository.
## Setting breakpoints in Visual Studio for Cascadia (packaged) application
If you want to debug code in the Cascadia package via Visual Studio, your breakpoints will not be hit by default. A tweak is required to the *CascadiaPackage* project in order to enable this.
1. Right-click on *CascadiaPackage* in Solution Explorer and select Properties.
2. Change the *Application process* type from *Mixed (Managed and Native)* to *Native Only*.

36
doc/EXCEPTIONS.md Normal file
View File

@@ -0,0 +1,36 @@
# Using Exceptions
## Philosophy
Introducing exceptions to an existing non-exception-based codebase can be perilous. The console was originally written
in C at a time when C++ was relatively unused in the Windows operating system. As part of our project to modernize the
Windows console, we converted to use C++, but still had an aversion to using exception-based error handling in
our code for fear that it introduce unexpected failures. However, the STL and other libraries like it are so useful that
sometimes it's significantly simpler to use them. Given that, we have a set of rules that we follow when considering
exception use.
## Rules
1. **DO NOT** allow exceptions to leak out of new code into old code
1. **DO** use NTSTATUS or HRESULT as return values as appropriate (HRESULT is preferred)
1. **DO** Encapsulate all exception behaviors within implementing classes
1. **DO NOT** introduce modern exception throwing code into old code. Instead, refactor as needed to allow encapsulation or
use non-exception based code
1. **DO** use WIL as an alternative for non-throwing modern facilities (e.g. wil::unique_ptr<>)
## Examples
### Encapsulating exception behaviors in a class
class ExceptionsDoNotLeak
{
public:
HRESULT SomePublicFunction();
int iPublic;
private:
void _SomePrivateFunction();
int _iPrivate;
};
### Using WIL for non-throwing modern facilities
TODO

123
doc/ORGANIZATION.md Normal file
View File

@@ -0,0 +1,123 @@
# Code Organization
## Rules
- **Follow the pattern of what you already see in the code**
- Try to package new ideas/components into libraries that have nicely defined interfaces
- Package new ideas into classes or refactor existing ideas into a class as you extend
- Each project should have a Unit test in a ut_ folder in its subdirectory (like `ut_host`)
- Functional tests should be in ft_ subdirectories (like `ft_api`)
- Build scripts are generally in subdirectories with their type of output (like `/dll` or `/exe`)
- Try to place interfaces in an `inc` folder in an appropriate location
- Structure related libraries together (`/terminal/parser` and `/terminal/adapter`)
## Code Overview
* `/` - root is where solution files, root MD documentation, SD replication artifacts go.
* `/bin` not checked in is where binaries will be generated by the MSBuild system
* `/dep` dependencies that arent a part of the SDK
* `/dep/console` files that are currently in the internal-only private SDK for the console but were working on opening
* `/dep/DDK` files lifted wholesale from the public Microsoft DDK so you dont have to install that. Were reducing dependencies on these but we still use TAEF (included in here) as our test runner engine
* `/dep/NT` some more structures from the DDK, sometimes internal-only/non-public were trying to remove.
* `/dep/telemetry` Private Microsoft telemetry headers
* `/dep/wil` Windows Internal Library extremely useful for interfacing with Win32/NT/COM APIs. Contains tons of “unique pointer” like syntax for various Win32 APIs and a handful of useful macros to enable cleaner code writing (RETURN_HR_IF, LOG_IF_WIN32_ERROR, etc.)
* `/dep/win32k` private headers from the Windows windowing system that were trying to migrate off of
* `/ipch` not checked in is where intellisense data will be generated if you use Visual Studio 2015
* `/obj` not checked in is where objects will be generated by the MSBuild system
* `/src` This is the fun one. In the root is common build system data.
* `/src/host` The meat of the windows console host. This includes buffer, input, output, windowing, server management, clipboard, and most interactions with the console host window that arent stated anywhere else. Were trying to pull things out that are reusable into other libraries, but its a work in progress
* `/src/host/lib` Builds the reusable LIB copy of the host
* `/src/host/dll` Packages LIB into conhostv2.dll to be put into the OS C:\windows\system32\
* `/src/host/exe` Packages LIB into OpenConsole.exe currently used for testing without replacing your system32 copy
* `/src/host/tools` Random odds and ends that make testing/debugging/development a bit easier
* ...to be docd, each of what these are
* `/src/host/ut_host` Contains complete unit test library for everything weve managed to get unit tests on. Wed like all new code to contribute appropriate unit tests in here
* `/src/host/ft_api` Feature level tests for anything that changes the way we interact with the outside world via the API. Building these up as we work as well
* `/src/host/ft_cjk` Double-wide/double-byte specific Chinese/Japanese/Korean language tests that previously had to be run in a different environment. To be merged into ft_api one day
* `/src/host/ft_resize` Special test for resizing/reflowing the buffer window
* `/src/host/ft_uia` Currently disabled (for not being very reliable) UI Automation tests that we are looking to re-enable and expand to do UI Automation coverage of various human interactions
* `/src/host/...` - The files Ill list out below
* `/src/inc` Include files that are shared between the host and some of the other libraries. This is only some of them. The include story is kind of a mess right now, but wed like to clean it up at some point
* `/src/propslib` Library shared between console host and the OS shell “right click a shortcut file and modify console properties” page to read/write user settings to and from the registry and embedded within shortcut LNK data
* `/src/renderer` Refactored extraction of all activities related to rendering the text in the buffers onto the screen
* `/src/renderer/base` Base interface layer providing non-engine-specific rendering things like choosing the data from the console buffer, deciding how to lay out or transform that data, then dispatching commands to a specific final display engine
* `/src/renderer/gdi` The GDI implementation of rendering to the screen. Takes commands to “draw a line” or “fill the background” or “select a region” from the base and turns them into GDI calls to the screen. Extracted from original console host code.
* `/src/renderer/inc` Interface definitions for all renderer communication
* `/src/terminal` Virtual terminal support for the console. This is the sequences that are found in-band with other text on STDIN/STDOUT that command the display to do things. This is the *nix way of controlling a console.
* `/src/terminal/parser` This contains a state machine and sorting engine for feeding in individual characters from STDOUT or STDIN and decoding them into the appropriate verbs that should be performed
* `/src/terminal/adapter` This converts the verbs from the interface into calls on the console API. It doesnt actually call through the API (for performance reasons since it lives inside the same binary), but it tries to remain as close to an API call as possible. There are some private extensions to the API for behaviors that didnt exist before this was written that weve not made public. We dont know if we will yet or force people to use VT to get at them.
* `/src/tsf` Text Services Foundation. This provides IME input services to the console. This was historically used for only Chinese, Japanese, and Korean IMEs specifically on OS installations with those as the primary language. It was in the summer of 2016 unrestricted to be able to be used on any OS installation with any IME (whether or not it will display correctly is a different story). It also was unrestricted to allow things like Pen and Touch input (which are routed via IME messages) to display properly inside the console from the TabTip window (the little popup that helps you insert pen/touch writing/keyboard candidates into an application)
## Host File Overview
* Generally related to handling input/output data and sometimes intertwined with the actual service calls
* `_output.cpp`
* `_stream.cpp`
* Handles copy/paste/etc.
* `clipboard.cpp`
* Handles the command prompt line as you see in CMD.exe (known as the processed input line… most other shells handle this themselves with raw input and dont use ours. This is a legacy of bad architectural design, putting stuff in conhost not in CMD)
* `cmdline.cpp`
* Handles shunting IME data back and forth to the TSF library and to and from the various buffers
* `Conimeinfo.cpp`
* `Convarea.cpp`
* Contains the global state for the entire console application
* `consoleInformation.cpp`
* Stuff related to the low-level server communication over our protocol with the driver
* `Csrutil.cpp`
* `Srvinit.cpp`
* `Handle.cpp`
* Routines related to startup of the application
* `Srvinit.cpp`
* Routines related to the API calls (and the servicing thereof, muxes a bit with the server protocol)
* `Directio.cpp`
* `Getset.cpp`
* `Srvinit.cpp`
* Extra stuff strapped onto the buffer to enable CJK languages
* `Dbcs.cpp`
* Attempted class-ification of existing Cursor structures to take them out of Screen Info/Text Info
* `Cursor.cpp`
* Related to searching through the back buffer of the console (the output scroll buffer as defined in screeninfo/textinfo)
* `Find.cpp`
* Contains global state data
* `Globals.cpp`
* Attempted class-ification of existing Icon manipulation to take them out of ConsoleInformation/Settings
* `Icon.cpp`
* Contains all keyboard/mouse input handling, capture of keys, conversion of keys, and some manipulation of the input buffer
* `Input.cpp`
* `Inputkeyinfo.cpp`
* `Inputreadhandledata.cpp`
* Main entry point used ONLY by the OS to send a pre-configured driver handle to conhostv2.dll
* `Main.cpp`
* Assorted utilities and stuff
* `Misc.cpp` (left for us by previous eras of random console devs)
* `Util.cpp` (created in our era)
* Custom zeroing and non-throwing allocator
* `Newdelete.cpp`
* Related to inserting text into the TextInfo buffer
* `Output.cpp`
* `Stream.cpp`
* Connects to interfaces in the PropsLib to manipulate persistent settings state
* `Registry.cpp`
* Connects to our relatively recently extracted renderer LIB to give it data about console state and user prefs
* `renderData.cpp`
* `renderFontDefaults.cpp`
* Maintains most of the information about what we should present inside the window on the screen (sizes, dimensions, also holds a text buffer instance and a cursor instance and a selection instance)
* `screenInfo.cpp`
* Handles some aspects of scrolling with the mouse and keyboard
* `Scrolling.cpp`
* Handles the click-and-drag highlighting of text on the screen to select (or the keyboard-based Mark mode selection where you can enter the mode and select around). Often calls clipboard when done
* `Selection.cpp`
* `selectionInput.cpp`
* `selectionState.cpp`
* Handles all user preferences and state. Was extracted from consoleInformation and CI subclasses it still (because it was hard to break the association out)
* `Settings.cpp`
* Good ol Windows 10 telemetry pipeline & ETW events as debugging aids (they use the same channel with a different flag)
* `Telemetry.cpp`
* `Tracing.cpp`
* Private calls into the Windows Window Manager to perform privileged actions related to the console process (working to eliminate) or for High DPI stuff (also working to eliminate)
* `Userprivapi.cpp`
* `Windowdpiapi.cpp`
* New UTF8 state machine in progress to improve Bash (and other apps) support for UTF-8 in console
* `Utf8ToWideCharParser.cpp`
* Window resizing/layout/management/window messaging loops and all that other stuff that has us interact with Windows to create a visual display surface and control the user interaction entry point
* `Window.cpp`
* `Windowproc.cpp`

7
doc/STYLE.md Normal file
View File

@@ -0,0 +1,7 @@
# Coding Style
## Philosophy
1. If it's inserting something into the existing classes/functions, try to follow the existing style as closely as possible.
1. If it's brand new code or refactoring a complete class or area of the code, please follow as Modern C++ of a style as you can and reference the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines) as much as you possibly can.
1. When working with any Win32 or NT API, please try to use the [Windows Implementation Library](./WIL.md) smart pointers and result handlers.
1. The use of NTSTATUS as a result code is discouraged, HRESULT or exceptions are preferred. Functions should not return a status code if they would always return a successful status code. Any function that returns a status code should be marked `noexcept` and have the `nodiscard` attribute.

20
doc/TAEF.md Normal file
View File

@@ -0,0 +1,20 @@
### TAEF ###
TAEF, the Test Authoring and Execution Framework, is used extensively within the Windows organization to test the operating system code in a unified manner for system, driver, and application code. As the console is a Windows OS Component, we strive to continue using the same system such that tests can be ran in a unified manner both externally to Microsoft as well as inside the official OS Build/Test system.
The [official documentation](https://msdn.microsoft.com/en-us/library/windows/hardware/hh439725\(v=vs.85\).aspx) for TAEF describes the basic architecture, usage, and functionality of the test system. It is similar to Visual Studio test, but a bit more comprehensive and flexible.
For the purposes of the console project, you can run the tests using the *TE.exe* that matches the architecture for which the test was build (x86/x64) in the pattern
te.exe Console.Unit.Tests.dll
Replacing the binary name with any other test binary name that might need running. Wildcard patterns or multiple binaries can be specified and all found tests will be executed.
Limiting the tests to be run is also useful with:
te.exe Console.Unit.Tests.dll /name:*BufferTests*
Any pattern of class/method names can be specified after the */name:* flag with wildcard patterns.
For any further details on the functionality of the TAEF test runner, *TE.exe*, please see the documentation above or run the embedded help with
te.exe /!

117
doc/UniversalTest.md Normal file
View File

@@ -0,0 +1,117 @@
# Universal Testing for Console
## Overview
Universal Testing is the Microsoft framework for creating and deploying test packages onto just about any device through just about any process. We use it for packaging up all sorts of test resources and sending it into our automated test labs no matter what the source of the content or the engineering system involved.
It involves several parts:
- TESTMD
- These define a package unit for deployment to the test device. This usually includes the test binaries and any dependent data that it will need to execute.
- There can also be a hierarchy where one package can depend on another such that packages can be re-used.
- TESTLIST
- This defines a batch of TESTMD packages that should be executed together.
- TESTPASSES
- This defines a list of tests via a TESTLIST and a lab environment configuration on which the tests should be run.
These files can either include their child element as they're supposed to (TESTMDs included in TESTLISTs) or they can often include themselves to provide chain structuring (one TESTLIST can reference another TESTLIST).
- TREX
- This is the legacy configuration system that performed the same job as TESTPASSES, but not in source files.
## Configuration
This is a record of the current setup (as of Mar-1-2019) of the console's universal tests. This series of steps was created in conjunction with converting the console's testing from the legacy TREX dispatching mode to the new TESTPASSES dispatching mode for the Source Is Truth initiative (define all testing metadata in source next to the code being tested, instead of in a separate database somewhere else).
1. Have some TestMDs.
- \onecore\windows\core\console\open\src\host\ut_host\testmd.definition + SOURCES file
- Generates “Microsoft-Console-Host-UnitTests” TESTMD and package
- Binplaces to prebuilt\test\<arch>\<fre/chk>\
1. Microsoft.Console.Host.UnitTests.testmd
1. Microsoft-Console-Host-UnitTests.cab
1. Microsoft-Console-Host-UnitTests.man.dsm.xml
- \onecore\windows\core\console\open\src\host\ft_host\testmd.definition + SOURCES file
- Generates “Microsoft-Console-Host-FeatureTests” TESTMD and package
- Binplaces to prebuilt\test\<arch>\<fre/chk>\
1. Microsoft.Console.Host.FeatureTests.testmd
1. Microsoft-Console-Host-FeatureTests.cab
1. Microsoft-Console-Host-FeatureTests.man.dsm.xml
- \onecore\windows\core\console\open\src\buffer\out\ut_textbuffer\testmd.definition + SOURCES file
- Generates “Microsoft-Console-TextBuffer-UnitTests” TESTMD and package
- Binplaces to prebuilt\test\<arch>\<fre/chk>\
1. Microsoft.Console.TextBuffer.UnitTests.testmd
1. Microsoft-Console-TextBuffer-UnitTests.cab
1. Microsoft-Console-TextBuffer-UnitTests.man.dsm.xml
- \minkernel\console\client\ut_conpty\testmd.definition + SOURCES file
- Generates “Microsoft-Console-ConPty-UnitTests” TESTMD and package
- Binplaces to prebuilt\test\<arch>\<fre/chk>\
1. Microsoft.Console.ConPty.UnitTests.testmd
1. Microsoft-Console-ConPty-UnitTests.cab
1. Microsoft-Console-ConPty-UnitTests.man.dsm.xml
- \onecore\windows\core\console\open\src\terminal\parser\ut_parser\testmd.definition + SOURCES file
- Generates “Microsoft-Console-VirtualTerminal-Parser-UnitTests” TESTMD and package
- Binplaces to prebuilt\test\<arch>\<fre/chk>\
1. Microsoft.Console.VirtualTerminal.Parser.UnitTests.testmd
1. Microsoft-Console-VirtualTerminal-Parser-UnitTests.cab
1. Microsoft-Console-VirtualTerminal-Parser-UnitTests.man.dsm.xml
- \onecore\windows\core\console\open\src\terminal\adapter\ut_adapter\testmd.definition + SOURCES file
- Generates “Microsoft-Console-VirtualTerminal-Adapter-UnitTests” TESTMD and package
- Binplaces to prebuilt\test\<arch>\<fre/chk>\
1. Microsoft.Console.VirtualTerminal.Adapter.UnitTests.testmd
1. Microsoft-Console-VirtualTerminal-Adapter-UnitTests.cab
1. Microsoft-Console-VirtualTerminal-Adapter-UnitTests.man.dsm.xml
1. Have some TESTLISTs that refer to the TESTMDs
- \onecore\windows\core\console\open\src\testlist\Microsoft.Console.Tests.testlist + SOURCES file
- Includes
1. Microsoft.Console.Host.UnitTests.testmd
1. Microsoft.Console.Host.FeatureTests.testmd
1. Microsoft.Console.TextBuffer.UnitTests.testmd
1. Microsoft.Console.Conpty.UnitTests.testmd
1. Microsoft.Console.VirtualTerminal.Parser.UnitTests.testmd
1. Microsoft.Console.VirtualTerminal.Adapter.UnitTests.testmd
- Binplaces to prebuilt\test\<arch>\<fre/chk>\
- Microsoft.Console.Tests.testlist
- \onecore\windows\core\console\open\src\testlist\Microsoft.Console.TestLab.Desktop.testlist + SOURCES file
- Includes
1. Microsoft.Console.Tests.testlist
- Binplaces to prebuilt\test\<arch>\<fre/chk>\
- Microsoft.Console.TestLab.Desktop.testlist
- Is currently the subject of TREX IDs
1. 153251 TESTLIST based AMD64 Desktop VM testpass (to be offboarded when done)
1. 153252 TESTLIST based X86 Desktop VM testpass (to be offboarded when done)
- \onecore\windows\core\console\open\src\testlist\Microsoft.Console.TestLab.OneCoreUap.testlist + SOURCES file
- Includes
1. Microsoft.Console.Tests.testlist
- Binplaces to prebuilt\test\<arch>\<fre/chk>\
- Microsoft.Console.TestLab.OneCoreUAP.testlist
- Is currently the subject of TREX IDs
1. 153253 TESTLIST based AMD64 OneCoreUAP VM testpass (to be offboarded when done)
1. 153254 TESTLIST based X86 OneCoreUAP VM testpass (to be offboarded when done)
1. Create some TESTPASSES
- For the existing OneCoreUAP ones…
- Create directory \onecoreuap\testpasses\local\console\
- Create file console_onecoreuap.testpasses
1. Create AMD64 pass
- Name it similarly to the existing name
- Use the environment $(TESTPASSES_ONECOREUAP)/standard_testenvs/OneCoreUAP-amd64-VM.testenv
- Connect to the testlist $(TESTLIST_SEARCH_PATHS)/Microsoft.Console.TestLab.OneCoreUAP.testlist
1. Create X86 pass
- Name it similarly to the existing name
- Use the environment $(TESTPASSES_ONECOREUAP)/standard_testenvs/OneCoreUAP-x86-VM.testenv
- Connect to the testlist $(TESTLIST_SEARCH_PATHS)/Microsoft.Console.TestLab.OneCoreUAP.testlist
- For the Desktop ones…
- Create directory \pcshell\testpasses\local\console\
- Create file console_desktop.testpasses
1. Create AMD64 pass
- Name it similarly to the existing name
- Use the environment $(TESTPASSES_PCSHELL)/standard_testenvs/Enterprise-amd64-VM.testenv
- Connect to the testlist $(TESTLIST_SEARCH_PATHS)/Microsoft.Console.TestLab.Desktop.testlist
1. Create X86 pass
- Name it similarly to the existing name
- Use the environment $(TESTPASSES_PCSHELL)/standard_testenvs/Enterprise-x86-VM.testenv
- Connect to the testlist $(TESTLIST_SEARCH_PATHS)/Microsoft.Console.TestLab.Desktop.testlist
1. Hook up the TESTPASSES into the official branch TESTPASSES file
- Open up \.branchconfig\official\rs_onecore_dep_acidev\official_build.testpasses
1. Add TestpassReferences item targeting $(TESTPASSES_ONECOREUAP)/local/console/console_onecoreuap.testpasses
1. Add TestpassReferences item targeting $(TESTPASSES_PCSHELL)/local/console/console_desktop.testpasses

27
doc/WIL.md Normal file
View File

@@ -0,0 +1,27 @@
# Windows Implementation Library
## Overview
[Windows Implementation Library](https://github.com/Microsoft/wil), or WIL, is a header-only library created to help make working with the Windows API more predictable and (hopefully) bug free.
A majority of functions are in either the `wil::` or `wistd::` namespace. `wistd::` is used for things that have an equivalent in STL's `std::` namespace but have some special functionality like being exception-free. Everything else is in `wil::` namespace.
The primary usages of WIL in our code so far are...
### Smart Pointers ###
Inside [wil\resource.h](https://github.com/microsoft/wil/blob/master/include/wil/resource.h) are smart pointer like classes for many Windows OS resources like file handles, socket handles, process handles, and so on. They're of the form `wil::unique_handle` and call the appropriate/matching OS function (like `CloseHandle()` in this case) when they go out of scope.
Another useful item is `wil::make_unique_nothrow()` which is analogous to `std::make_unique` (except without the exception which might help you integrate with existing exception-free code in the console.) This will return a `wistd::unique_ptr` (vs. a `std::unique_ptr`) which can be used in a similar manner.
### Result Handling ###
To manage the various types of result codes that come back from Windows APIs, the file [wil\result.h](https://github.com/microsoft/wil/blob/master/include/wil/result.h) provides a wealth of macros that can help.
As an example, the method `DuplicateHandle()` returns a `BOOL` value that is `FALSE` under failure and would like you to `GetLastError()` from the operating system to find out what the actual result code is. In this circumstance, you could use the macro `RETURN_IF_WIN32_BOOL_FALSE` to wrap the call to `DuplicateHandle()` which would automatically handle this pattern for you and return the `HRESULT` equivalent on failure.
This leads to nice patterns where you can set up all resources in a function as protected by `std::unique_ptr` or the various `wil::` smart pointers and smart handles then `RETURN_IF_*` on every call to a Windows API and be guaranteed that your resources will be cleaned up appropriately under any failure case. Do note that this generally requires you to return an `HRESULT` as your return code and use out pointer parameters for return data. There are exceptions to this... read the header for more details.
The additional advantage to using this pattern is that failures at any point are logged to our global tracing/debugging channels to be viewed under the debugger output with the exact line number and function details for the error.
Additionally, if you just want to make sure that a failure case is logged for debugging purposes, all of these macros have a `LOG_IF_*` equivalent that will simply log a failure and keep rolling.

42
doc/WindowsTestPasses.md Normal file
View File

@@ -0,0 +1,42 @@
# Windows Test Passes for Console
## Overview
Every night, we run a set of automated test passes in the Windows engineering system for the console host code. This process is orchestrated on our working branch, which at the time of this writing is `RS_ONECORE_DEP_ACIDEV` (and will soon switch back to `RS_ONECORE_DEP_ACIOSS` or something of that ilk).
You can find the information about our nightly build, including these test passes, at the website [https://es.microsoft.com], choosing our branch, and then navigating to the `Execution Status` page.
At the bottom of the page will be the test pass runs for our tests that night. You can find out more about how these are set up in the [UniversalTest.md] file.
When a failure occurs in one of these passes, a bug will automatically be generated in the Azure DevOps project for the OS and assigned to our path.
The next step would be investigating one of these failures...
## Investigation
A quick overview of investigation... normally you can just attempt to build and reproduce the failure locally with the `OpenConsole` project and it will happen the same way as it did on the nightly build in the lab. However, sometimes the failure will be exclusive to the lab or won't happen in the same way as it does on your local dev machine. At that point, you need to move into setting up the environment as it was during the testpass and figuring out what went wrong.
You can try to do this all manually by pulling down a VM image from the release share for the nightly build, making a VM, deploying the test binaries and TAEF test runner executables to the machine, installing the VS Remote Debugging or WinDBG tools on the VM, and then running the test and figuring out what's going wrong with the debuggers.
Or you can use some of the Engineering Systems tools to make this easier. I'll detail how to do that below.
Prerequisites:
- Visual Studio 2017
- Install the TDP (Test Development Platform) plug-in (see: [https://osgwiki.com/wiki/Test_Development_Platform_(TDP)]).
1. Open Visual Studio 2017 and use the TDP drop-down menu to open the `Device Manager`.
1. In the pane that opens to the left, choose `Add` and then `Nebula VM Device`. Nebula is a cloud provider for VMs (like Azure but a more private instance for corporate work usage).
1. Name the machine and choose the build/branch/flavor/SKU from the drop downs at the bottom. It will find the VHD for you from the build shares. Hit `Add Device` to deploy to Nebula.
1. Wait a few minutes. It took 5-10 for it to be deployed.
1. Right click the machine name in the `Device Manager` list and choose `Launch T-Shell`. You can also use `Connect via Console` to get a "remote desktop"-like session to the KVM port on the VM.
1. In T-shell, use `testd Microsoft.Console.TestLab.Desktop.testlist` or a command of that format with a different TESTLIST or TESTMD name from our project (see the [UniversalTest.md] documentation). The `testd` utility will automatically resolve the build/branch/flavor information, dig through the build shares for the matching TESTLIST/TESTMD metadata, and attempt to deploy all relevant packages and dependencies on the device. When it's successful, it will move onto running all the tests and giving you the results. On conclusion, the test results should pop up in the web browser or the `Hubble - Log Viewer` tool provided by the Engineering Systems team.
If some of the above things do not work, go to [https://osgwiki.com] and type them into the Search bar. For instance, if T-Shell isn't found or working, you can find out where to get it or download it on `OSGWiki`. The same goes for the other commands besides `testd` to use in T-shell and more information on what `Hubble` or `Nebula` are.
Presumably now you have a failure. Or a success. You can attempt to spelunk the logs in `Hubble` and you might come to a conclusion. Or you can move onto debugging directly.
Now that you've relied on `testd` to get everything deployed and orchestrated and run once on the device, you can use `execd` to run things again or to run a smaller subset of things on the remote device through `T-Shell`.
By default, in the `Universal Test` world, everything will be deployed onto the remote machine at `C:\data\test\bin`. In T-Shell, use `cdd C:\data\test\bin` to change to that directory and then `execd te.exe Microsoft.Console.Host.FeatureTests.dll /name:*TestReadFileEcho*` to run just one specific test. Of course you should substitute the file name and test name parameters as makes sense. And of course you can find out more about `cdd` and `execd` on the `T-shell` page of `OSGWiki`.
Fortunately, running things through `T-shell` in this fashion is exactly the same way that the testlab orchestrates the tests. If you still don't get good data this way, you can use the `Connect via Console` mechanism way above to try to run things under `WinDBG` or the `Visual Studio Remote Debugger` manually on the machine to get them to repro or under the debugger more completely.

89
doc/bot.md Normal file
View File

@@ -0,0 +1,89 @@
# Issue/PR Management Bot Information
## Overview
The goal here is to help us automate, manage, and narrow down what we actually need to focus on in this repository.
We'll be using tags, primarily, to help us understand what needs attention, what is sitting around and turning stale, etc.
### Quick-Guidance to Core Contributors
1. Look at `Needs-Attention` as top priority
1. Look at `Needs-Triage` during triage meetings to get a handle on what's new and sort it out
1. Look at `Needs-Tag-Fix` when you have a few minutes to fix up things tagged impoperly
1. Manually add `Needs-Author-Feedback` when there's something we need the author to follow up on and want attention if they return it or an auto-close for inactivity if it goes stale.
### Tagging/Process Details
1. When new issues arrive, or when issues are not properly tagged... we'll mark them as `Needs-Triage` automatically.
- The core contributor team will then come through and mark them up as appropriate. The goal is to have a tag that fits the `Product`, `Area`, and `Issue` category.
- The `Needs-Triage` tag will be removed manually by the core contributor team during a triage meeting. (Exception, triage may also be done offline by senior team members during high-volume times.)
- An issue may or may not be assigned to a contributor during triage. It is not necessary to assign someone to complete it.
- We're not focusing on Projects yet.
1. When core contributors need to ask something of the author, they will manually assign the `Needs-Author-Feedback` tag.
- This tag will automatically drop off when the author comes back around and applies activity to the thread.
- When this tag drops off, the bot will apply the `Needs-Attention` tag to get the core contribution team's attention again. If an author cares enough to be active, we will attempt to prioritize engaging with that author.
- If the author doesn't come back around in a while, this will become a `No-Recent-Activity` tag.
- If there's activity on an issue, the `No-Recent-Activity` tag will automatically drop.
- If the `No-Recent-Activity` stays, the issue will be closed as stale.
1. PRs will automatically get a `Needs-Author-Feedback` tag when reviewers wait on the author
- This follows a similar decay strategy to issues.
- If the author responds, the `Needs-Author-Feedback` tag will drop.
- If there is no activity in a while, the `No-Recent-Activity` tag will appear.
- If the `No-Recent-Activity` tag exists for a while, the PR will be closed as stale.
1. Issues manually marked as `Resolution-Duplicate` will be closed shortly after activity stops
1. Pull requests manually marked as `AutoMerge` will permit the bot to complete the PR and do cleanup when certain conditions are met. See details below.
## Rules
### Issue Management
#### Mark as Triage Needed
- When an issue doesn't meet triage criteria, applies `Needs-Triage` tag. Right now, this is just when it's opened.
#### Author Has Responded
- When an issue with `Needs-Author-Feedback` gets an author response, drops that tag in favor of `Needs-Attention` to flag core contributors to drop by.
#### Remove Activity Tag
- When an issue with `No-Recent-Activity` has activity, drops this tag
#### Close Stale
- Every hour, checks if there's an issue with `Needs-Author-Feedback` and `No-Recent-Activity` for 3 days. Closes as stale.
#### Tag as No Activity
- Every hour, checks if there's been no activity in 4 days on an issue that `Needs-Author-Feedback`. If it's been 4 days, mark `No-Recent-Activity` as well.
#### Close Duplicate Issues
- Every hour, checks if there's been a day since the last activity on an issue with tag `Resolution-Duplicate` and closes it if inactive.
#### Enforce tag system
- When an issue is opened or labels are changed in any way, we will check if the tagging matches the system. If not, it will get `Needs-Tag-Fix`. The system is to have an `Area-`, `Issue-`, and `Product-` tag for all open things, and also a `Resolution-` for closed ones.
- When the tags from appropriate categories are applied, it will auto-remove the `Needs-Tag-Fix` tag.
### PR Management
#### Codeflow Link *(Disabled)*
- Bumps a PR with a link to the Microsoft CodeFlow tool for reviewing PRs
#### Marks PR as Awaiting Author Feedback
- When a reviewer marks the PR as changes requested, the `Needs-Author-Feedback` tag will be applied
#### Removes Awaiting Author Feedback
- When the PR author updates the pull request, comments on it, or responds to a review, the `Needs-Author-Feedback` tag is removed.
#### Removes No Recent Activity
- When anyone touches the pull request, the `No-Recent-Activity` tag is removed.
#### Markup stale pull requests
- Every hour, if a pull request `Needs-Author-Feedback` and hasn't been touched in 7 days, it will get the `No-Recent-Activity` tag.
#### Close stale pull requests
- Every hour, if a pull request has `No-Recent-Activity` and hasn't been touched in a further 7 days, it will be closed.
#### Auto-Merge pull requests
- When a pull request has the `AutoMerge` label...
- If it has been at least 480 minutes and all the statuses pass, merge it in.
- Will use Squash merge stratgy
- Will attempt to delete branch after merge, if possible
- Will automatically remove the `AutoMerge` label if changes are pushed by someone *without* Write Access.
- More information on bot-logic that can be controlled with comments is [here](https://github.com/OfficeDev/office-ui-fabric-react/wiki/Advanced-auto-merge)
## Admin Panel
[Here](https://fabric-cp.azurewebsites.net/bot/)

32
doc/building.md Normal file
View File

@@ -0,0 +1,32 @@
# How to build Openconsole
Openconsole can be built with Visual Studio or from the command line. There are build scripts for both cmd and powershell in /tools.
## Building with cmd
The cmd scripts are set up to emulate a portion of the OS razzle build environment. razzle.cmd is the first script that should be run. bcz.cmd will build clean and bz.cmd should build incrementally.
There are also scripts for running the tests:
- `runut.cmd` - run the unit tests
- `runft.cmd` - run the feature tests
- `runuia.cmd` - run the UIA tests
## Build with Powershell
Openconsole.psm1 should be loaded with `Import-Module`. From there `Set-MsbuildDevEnvironment` will set up environment variables required to build. There are a few exported functions (look at their documentation for further details):
- `Invoke-OpenConsolebuild` - builds the solution. Can be passed msbuild arguments.
- `Invoke-OpenConsoleTests` - runs the various tests. Will run the unit tests by default.
- `Start-OpenConsole` - starts Openconsole.exe from the output directory. x64 is run by default.
- `Debug-OpenConsole` - starts Openconsole.exe and attaches it to the default debugger. x64 is run by default.
## Configuration Types
Openconsole has three configuration types:
- Debug
- Release
- AuditMode
AuditMode is an experimental mode that enables some additional static analyis from CppCoreCheck.

View File

@@ -0,0 +1,108 @@
# Keymapping spec
* author: Mike Griese __migrie__
* created on: 2018-Oct-23
## Abstract
It should be possible to configure the terminal so that it doesn't send certain keystrokes as input to the terminal, and instead triggers certain actions. Examples of these actions could be copy/pasting text, opening a new tab, or changing the font size.
This spec describes a mechanism by which we could provide a common implementation of handling keyboard shortcuts like these. This common implementation could then be leveraged and extended by the UX implementation as to handle certain callbacks in the UX layer. For example, The TerminalCore doesn't have a concept of what a tab is, but the keymap abstraction could raise an event such that a WPF app could implement creating a new tab in its idomatic way, and UWP could implement them in their own way.
## Terminology
* **Key Chord**: This is any possible keystroke that a user can input
simultaneously, as a combination of a single character and any set of
(<kbd>Ctrl</kbd>, <kbd>Alt</kbd> and <kbd>Shift</kbd>).
For example, pressing <kbd>Ctrl</kbd> and <kbd>C</kbd> at the same time is the
key chord Ctrl+C. Pressing <kbd>Ctrl+B</kbd>, <kbd>C</kbd> are two separate
key chords. Trying to press them simultaneously (<kbd>Ctrl+B+C</kbd>) should
generate two separate key chords, with the order determined by the OS.
## User Stories
1. The User should be able to press certain key-chords to trigger certain
actions in the frontend of the application, such as copying text, pasting,
opening new tabs, or switching focus between panes.
2. The user should be able to configure which key chords are bound to which actions.
3. If a key chord is not mapped to an action, it should be sent to the Terminal just as any other keypress.
## Details
When the UX frontend is created, it should instantiate a `IKeyBindings` object with the keybindings mapped as it would like.
When it's creating its platform-dependent terminal component, it can pass the `IKeyBindings` object to that component. The component will then be able to pass that object to the terminal instance.
When the terminal component calls `ITerminalInput.SendKeyEvent(uint vkey, KeyModifiers modifiers)`, the terminal will use `IKeyBindings.TryKeyChord` to see if there are any bound actions to that input. If there are, the `IKeyBindings` implementation will either handle the event by interacting with the `ITerminalInput`, or it'll invoke an event that's been registered by the frontend
```csharp
struct KeyChord
{
KeyModifiers modifiers;
int vkey;
}
interface IKeyBindings {
bool TryKeyChord(KeyChord kc);
}
```
Each frontend can implement the `IKeyBindings` interface however it so chooses.
The `ITerminalInput` interface will be extended with the following method:
```csharp
public interface ITerminalInput
{
...
void SetKeyBindings(IKeyBindings bindings);
...
}
```
This will set the `IKeyBindings` object that the `ITerminalInput` implementation will use to filter key events.
This method will be implemented by the `Terminal` object:
```csharp
partial class Terminal
{
public void ITerminalInput.SetKeyBindings(IKeyBindings bindings);
}
```
### Project Cascadia Sample
Below is an example of how the Project Cascadia application might implement its
keybindings.
```csharp
enum ShortcutAction
{
CopyText,
PasteText,
NewTab,
NewWindow,
CloseWindow,
CloseTab,
SwitchToTab,
NextTab,
PrevTab,
IncreaseFontSize,
DecreaseFontSize,
...
}
public delegate bool NewTabEvent(object sender);
public delegate bool CloseTabEvent(object sender);
public delegate bool NewWindowEvent(object sender);
public delegate bool CloseWindowEvent(object sender);
public delegate bool CopyEvent(object sender);
public delegate bool PasteEvent(object sender);
class KeyBindings : IKeyBindings
{
private Dictionary<ShortcutAction, KeyChord?> keyShortcuts;
public void SetKeyBinding(ShortcutAction action, KeyChord? chord);
public bool TryKeyChord(KeyChord chord);
}
```
### Copy/Paste
How does Copy/paste play into this?
When Input is written to the terminal, and it tries the copy keybinding, what happens?
The Keybindings are global to the frontend, not local to the terminal. Copy/Paste events should also be delegates that get raised, and the frontend can then determine what to do with them. It'll probably query its active/focused Terminal Component, then Get the `ITerminalInput` from that component, and use that to CopyText / PasteText from the Terminal as needed.

View File

@@ -0,0 +1,233 @@
# Terminal Settings
* author: Mike Griese __migrie__
* created on: 2018-Oct-23
## Abstract
This spec will outline how various terminal frontends will be able to interact with the settings for the terminal.
## Terminology
* **Frontend** or **Application Layer**: This is the end-user experience. This
could be a Terminal Application (ex. Project Cascadia) or something that's
embedding a terminal window inside of it (ex. Visual Studio). These frontends
consume the terminal component as an atomic unit.
* **Component Layer**: This is the UI framework-dependent implementation of the
Terminal component. As planned currently, this is either the UWP or WPF
Terminal component.
* **Terminal Layer**: This is the shared core implementation of the terminal.
This is the Terminal Connection, Parser/Adapter, Buffer, and Renderer (but not
the UX-dependant RenderEngine).
## User Stories
1. "Project Cascadia" should be able to have both global settings (such as
scrollbar styling) and settings that are stored per-profile (such as
commandline, color scheme, etc.)
2. "Project Cascadia" should be able to load these settings at boot, use them to
create terminal instances, be able to edit them, and be able to save them
back.
3. "Project Cascadia" should be able to have terminal instances reflect the
changes to the settings when the settings are changed.
4. "Project Cascadia" should be able to host panes/tabs with different profiles
set at the same time.
5. Visual Studio should be able to persist and edit settings globally, without
the need for a globals/profiles structure.
6. The Terminal should be able to read information from a settings structure
that's independant of how it's persisted / implemented by the Application
7. The Component should be able to have its own settings independent of the
application that's embedding it, such as font size and face, scrollbar
visibility, etc. These should be settings that are specific to the component,
and the Terminal should logically be unaffected by these settings.
## Details
Some settings will need to be Application-specific, some will need to be component-specific, and some are terminal-specific. For example:
Terminal | Component | Frontend
--------------------|-----------------------|------------------
Color Table | Font Face, size | Status Line Visibility, contents
Cursor Color | Scrollbar Visibility | ~~Window Size~~[1]
History Size | |
Buffer Size [1] | |
* [1] I believe only the "Default" or "Initial" buffer size should be the one we truly store in the settings. When the app first boots up, it can use that value to with the font size to figure out how big its window should be. When additional tabs/panes are created, they should inherit the size of the existing window. Similarly, VS could first calculate how much space it has available, then override that value when creating the terminal.
Project Cascadia needs to be able to persist settings as a bipartite globals-profiles structure.
VS needs to be able to persist settings just as a simple set of global settings.
When the application needs to retrieve these settings, they need to use them as a tripartite structure: frontend-component-terminal settings.
Each frontend will have its own set of settings.
Each component implementation will also ned to have some settings that control it.
The terminal also will have some settings specific to the terminal.
### Globals and Profiles
With \*nix-like terminals, settings are typically structured as two parts:
Globals and Profiles.
Globals are settings that affect the entirety of the terminal application. They wouldn't be different from one pane to the next. An example is the Terminal KeyBindings - these should be the same for all tabs/panes that are running as a part of the terminal application.
Profiles are what you might consider per-application settings. These are settings that can be different from one terminal instance to the next. One of the primary differentiators between profiles is the commandline used to start the terminal instance - this enables the user to have both a `cmd` profile and a `powershell` profile, for example. Things like the color table/scheme, font size, history length, these all change per-profile.
Per-Profile | Globals
------------------------|------------------------
Color Table | Keybindings
Cursor Color | Scrollbar Visibility
History Size | Status Line Visibility, contents
Font Face, size | Window Size
Shell Commandline |
### Simple Settings
An application like VS might not even care about settings profiles. They should be able to persist the settings as just a singular entity, and change those as needed, without the additional overhead. Profiles will be something that's more specifc to Project Cascadia.
### Interface Descriptions
```csharp
public class TerminalSettings
{
Color DefaultForeground;
Color DefaultBackground;
Color[] ColorTable;
Coord? Dimensions;
int HistorySize;
Color CursorColor;
CursorShape CursorShape;
}
public interface IComponentSettings
{
TerminalSettings TerminalSettings { get; }
}
public interface IApplicationSettings
{
IComponentSettings ComponentSettings { get; }
}
```
The Application can store whatever settings it wants in its implementation of `IApplicationSettings`. When it instantiates a Terminal Component, it will pass its `IComponentSettings` to it.
The component will retrieve whatever settings it wants from that object, and then pass the `TerminalSettings` to the Terminal it creates.
The frontend will be able to get/set its settings from the `IApplicationSettings` implementation.
The frontend will be able to create components using the `IComponentSettings` in its `IApplicationSettings`.
The Component will then create the Terminal using the `TerminalSettings`.
#### Project Cascadia Settings Details
The `CascadiaSettings` will store the settings as two parts:
* A set of global data & settings
* A list of Profiles, that each have more data
When Cascadia starts up, it'll load all the settings, including the Globals and profiles. The Globals will also tell us which profile is the "Default" profile we should use to instantiate the terminal.
Using the globals and the Profile, it'll convert those to a `ApplicationSettings : IApplicationSettings`.
It'll read data from that `ApplicationSettings` to initialize things it needs to know.
* It'll determine whether or not to display the status line
* It'll query the Component settings for the default size of the component, so it knows how big of a space it needs to reserve for it
It'll then instantiate a `UWPTerminalComponent` and pass it the `UWPComponentSettings`.
This is a rough draft of what these members might all be like.
```csharp
class CascadiaSettings
{
void LoadAll();
void SaveAll();
GlobalAppSettings Globals;
List<Profile> Profiles;
ApplicationSettings ToSettings(GlobalAppSettings globals, Profile profile);
void Update(ApplicationSettings appSettings, GUID profileID);
}
class Profile
{
GUID ProfileGuid;
string Name;
string Commandline;
TerminalSettings TerminalSettings;
string FontFace;
int FontSize;
float acrylicTransparency;
bool useAcrylic;
}
class GlobalAppSettings
{
GUID defaultProfile;
Keybindings keybindings;
bool showScrollbars;
bool showStatusline;
}
class ApplicationSettings : IApplicationSettings
{
UWPComponentSettings ComponentSettings;
Keybindings keybindings;
bool showStatusline;
}
class UWPComponentSettings : IComponentSettings
{
Point GetDefaultComponentSize();
TerminalSettings TerminalSettings;
string FontFace;
int FontSize;
bool showScrollbars;
float acrylicTransparency;
bool useAcrylic;
}
```
### Updating Settings
What happens when the user changes the application's settings? The App,
Component, and Terminal might all need to update their settings.
The component will expose a `UpdateSettings()` method that will cause the
Component and Terminal to reload the settings from their settings objects.
```csharp
interface ITerminalComponent
{
void UpdateSettings(IComponentSettings componentSettings);
}
partial class UWPTerminalComponent : ITerminalComponent
{
void UpdateSettings(IComponentSettings componentSettings)
{
// Recalculate GlyphTypeFace
// Recalculate rows/cols using current geometry and typeface
// Update our terminal instance:
terminal.UpdateSettings(componentSettings.TerminalSettings);
}
}
```
#### Updating settings in Project Cascadia
However, when Cascadia's settings change, we're going to possibly change some global settings and possibly some profile settings. The profile's that are changed may or may not be currently active.
> Say we have two different panes open with different profiles (A and B).
> What happens if we change the settings for one profile's font and not the other's?
> ~~We resize the height of the terminal to account for the change in height of the win~~
>
> We should never change the window size in response to a settings change if there is more than one tab/pane open.
> > never?
Cascadia would have to maintain a mapping of which components have which profiles:
```csharp
class CascadiaTerminalInstance
{
GUID ProfileGuid;
UWPTerminalComponent component;
}
```
Then, when the settings are closed, it'll enumerate all of the components it has loaded, and apply the updated settings to them. It'll do this by looking up the profile GUID of the component, then getting the `ApplicationSettings` for the profile, then calling `UpdateSettings` on the component.
~~We need to have a way so that only the currently foreground component can change the window size.~~
I don't like that - if we change the font size, we should just recalculate how many characters can fit in the current window size.
## Questions / TODO
* How does this interplay with setting properties of the terminal component in XAML?
* I would think that the component would load the XAML properties first, and if the controlling application calls `UpdateSettings` on the component, then those in-XAML properties would likely get overwritten.
* It's not necessary to create the component with a `IComponentSettings`, nor is it necessary to call `UpdateSettings`. If you wanted to create a trivial settings-less terminal component entriely in XAML, go right ahead.
* Any settings that *are* exposed through XAML properties *should* also be exposed in the component's settings implementation as well.
* Can that be enforced any way? I doubt it.

26
doc/submitting_code.md Normal file
View File

@@ -0,0 +1,26 @@
# Branches in Openconsole
In Openconsole, `dev/main` is the master branch for the repo.
Any branch that begins with `dev/` is recognized by our CI system and will automatically run x86 and amd64 builds and run our unit and feature tests. For feature branchs the pattern we use is `dev/<alias>/<whatever you want here>`. ex. `dev/austdi/SomeCoolUnicodeFeature`. The important parts are the dev prefix and your alias.
`inbox` is a special branch that coordinates Openconsole code to the main OS repo.
The code will be checked into the OS repo at `/onecore/windows/core/console/open`. It would be prudent to make sure that directory builds in razzle with your submitted changes.
# Code Submission Process
Because we build outside of the OS repo, we need a way to get code back into it once it's been merged into `dev/main`. This is done by cherry-picking the PR to the `inbox` branch once it has been merged (and preferably squashed) into `dev/main`. We have a tool called Git2Git that listens for new merges into `inbox` and replicates the commits over to the OS repo. Feel free to approve and complete the `inbox` PR yourself. About a minute after the `inbox` PR is submitted, Git2Git will create a PR in the OS repo under the alias `miniksa`. It will automatically target the OS branch we're using at the time, it just needs you to go approve and complete it. Once that merge is completed it is a good idea to build the OS branch with the new code in it to make sure that the PR won't be the cause of a build break that evening.
## What to do when cherry-picking to inbox fails
Sometimes VSTS doesn't want to allow a cherry pick to the inbox branch. It might have a valid reason or it might just be finicky. You'll need to complete the merge manually on a local machine. The steps are:
1. make sure you have pulled the latest commits for the `dev/main` and `inbox` branches
2. make a new branch from inbox
3. cherry-pick the commits from the PR to the newly created branch (this is easier if you squashed your commits when you merged into `dev/main`
4. fix any merge conficts and commit
5. push the new branch to the remote
6. create a new PR of that branch in `inbox`
7. complete PR and continue on to completing the auto-created PR in the OS repo

35
doc/virtual-dtors.md Normal file
View File

@@ -0,0 +1,35 @@
# Virtual Destructors for Interfaces
* author: Mike Griese __migrie__
* created on: 2019-Feb-20
As you look through the code, you may come across patterns that look like the following:
``` c++
class IRenderData
{
public:
virtual ~IRenderData() = 0;
// methods
};
inline IRenderData::~IRenderData() {}
```
You may ask yourself, why is the destructor deleted, then later defined to the
default destructor? This is a good question, because it seems both unintuitive
and unnecessary. However, if you don't define your interfaces exactly like
this, then sometimes on object destruction, the interface's dtor will be
called instead of the destructor for the base class. There is other
strangeness that can occur as well, the details of which escape my memory from
when @austdi and I first investigaved this early 2018.
The end result of not defining your interfaces exacly like this will be that
occasionally, when destructing objects, you'll get a segfault.
To check that this behavior works, I direct your attention to the VtIoTests.
There are a bunch of tests in that module that create objects, then delete
them, to make sure that they won't ever crash.

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
<Import Project="$(OpenConsoleDir)src\wap-common.build.pre.props" />
<PropertyGroup Label="Configuration">
<TargetPlatformVersion>10.0.17763.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<!--
These two properties are very important!
Without them, msbuild will stomp MinVersion and MaxVersionTested in the
Package.appxmanifest and replace them with whatever our values for
TargetPlatformMinVersion and TargetPlatformVersion are.
-->
<AppxOSMinVersionReplaceManifestVersion>false</AppxOSMinVersionReplaceManifestVersion>
<AppxOSMaxVersionTestedReplaceManifestVersion>false</AppxOSMaxVersionTestedReplaceManifestVersion>
<!-- In a WAP project, this suppresses a spurious dependency on the non-Desktop VCLibs. -->
<IncludeGetResolvedSDKReferences>false</IncludeGetResolvedSDKReferences>
<!-- Suppress the inclusion of Windows.winmd in the appx. -->
<SkipUnionWinmd>true</SkipUnionWinmd>
</PropertyGroup>
<PropertyGroup>
<ProjectGuid>2D310963-F3E0-4EE5-8AC6-FBC94DCC3310</ProjectGuid>
<EntryPointExe>OpenConsole.exe</EntryPointExe>
<EntryPointProjectUniqueName>..\..\src\host\exe\Host.EXE.vcxproj</EntryPointProjectUniqueName>
</PropertyGroup>
<PropertyGroup>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
</PropertyGroup>
<PropertyGroup Condition="!Exists('OpenConsolePackage_TemporaryKey.pfx')">
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
<AppxBundle>Never</AppxBundle>
</PropertyGroup>
<PropertyGroup Condition="Exists('OpenConsolePackage_TemporaryKey.pfx')">
<AppxPackageSigningEnabled>true</AppxPackageSigningEnabled>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<PackageCertificateKeyFile>OpenConsolePackage_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<ItemGroup Condition="Exists('OpenConsolePackage_TemporaryKey.pfx')">
<None Include="OpenConsolePackage_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="images\LockScreenLogo.scale-200.png" />
<Content Include="images\Square150x150Logo.scale-200.png" />
<Content Include="images\Square44x44Logo.scale-200.png" />
<Content Include="images\Square44x44Logo.targetsize-16_altform-unplated.png" />
<Content Include="images\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="images\Square44x44Logo.targetsize-32_altform-unplated.png" />
<Content Include="images\Square44x44Logo.targetsize-48_altform-unplated.png" />
<Content Include="images\Square44x44Logo.targetsize-256_altform-unplated.png" />
<Content Include="images\StoreLogo.png" />
<Content Include="images\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<Import Project="$(OpenConsoleDir)src\wap-common.build.post.props" />
<ItemGroup>
<ProjectReference Include="..\..\src\host\exe\Host.EXE.vcxproj" />
<ProjectReference Include="..\..\src\propsheet\propsheet.vcxproj" />
</ItemGroup>
<Target Name="OpenConsoleStompSourceProjectForWapProject" BeforeTargets="_ConvertItems">
<ItemGroup>
<_TemporaryFilteredWapProjOutput Include="@(_FilteredNonWapProjProjectOutput)" />
<_FilteredNonWapProjProjectOutput Remove="@(_FilteredNonWapProjProjectOutput)" />
<_FilteredNonWapProjProjectOutput Include="@(_TemporaryFilteredWapProjOutput)">
<SourceProject></SourceProject> <!-- Blank SourceProject, which WapProj uses to name subdirectories. -->
</_FilteredNonWapProjProjectOutput>
</ItemGroup>
</Target>
</Project>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4" IgnorableNamespaces="uap mp rescap">
<Identity Name="Microsoft.WindowsConsoleHost" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="0.9.0.0" />
<Properties>
<DisplayName>Windows Console (Preview)</DisplayName>
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
<Logo>images\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="OpenConsole.exe" EntryPoint="$targetentrypoint$">
<Extensions>
<uap3:Extension Category="windows.appExecutionAlias" EntryPoint="Windows.FullTrustApplication" Executable="OpenConsole.exe">
<uap3:AppExecutionAlias>
<desktop:ExecutionAlias Alias="OpenConsole.exe" />
<desktop:ExecutionAlias Alias="confans.exe" />
</uap3:AppExecutionAlias>
</uap3:Extension>
</Extensions>
<uap:VisualElements DisplayName="Windows Console (Preview)" Description="The Windows Console, but actually fun!" BackgroundColor="transparent" Square150x150Logo="images\Square150x150Logo.png" Square44x44Logo="images\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="images\Wide310x150Logo.png">
</uap:DefaultTile>
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
res/console.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
res/truetype.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

View File

@@ -0,0 +1,36 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EchoCon", "EchoCon\EchoCon.vcxproj", "{96274800-9574-423E-892A-909FBE2AC8BE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{556CAA54-33E0-4F99-95C8-0DFD6E8F6C6B}"
ProjectSection(SolutionItems) = preProject
readme.md = readme.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{96274800-9574-423E-892A-909FBE2AC8BE}.Debug|x64.ActiveCfg = Debug|x64
{96274800-9574-423E-892A-909FBE2AC8BE}.Debug|x64.Build.0 = Debug|x64
{96274800-9574-423E-892A-909FBE2AC8BE}.Debug|x86.ActiveCfg = Debug|Win32
{96274800-9574-423E-892A-909FBE2AC8BE}.Debug|x86.Build.0 = Debug|Win32
{96274800-9574-423E-892A-909FBE2AC8BE}.Release|x64.ActiveCfg = Release|x64
{96274800-9574-423E-892A-909FBE2AC8BE}.Release|x64.Build.0 = Release|x64
{96274800-9574-423E-892A-909FBE2AC8BE}.Release|x86.ActiveCfg = Release|Win32
{96274800-9574-423E-892A-909FBE2AC8BE}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B27C5007-61E2-4080-965D-8C934367BA4F}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,189 @@
// EchoCon.cpp : Entry point for the EchoCon Pseudo-Console sample application.
// Copyright © 2018, Microsoft
#include "stdafx.h"
#include <Windows.h>
#include <process.h>
// Forward declarations
HRESULT CreatePseudoConsoleAndPipes(HPCON*, HANDLE*, HANDLE*);
HRESULT InitializeStartupInfoAttachedToPseudoConsole(STARTUPINFOEX*, HPCON);
void __cdecl PipeListener(LPVOID);
int main()
{
wchar_t szCommand[]{ L"ping localhost" };
HRESULT hr{ E_UNEXPECTED };
HANDLE hConsole = { GetStdHandle(STD_OUTPUT_HANDLE) };
// Enable Console VT Processing
DWORD consoleMode{};
GetConsoleMode(hConsole, &consoleMode);
hr = SetConsoleMode(hConsole, consoleMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)
? S_OK
: GetLastError();
if (S_OK == hr)
{
HPCON hPC{ INVALID_HANDLE_VALUE };
// Create the Pseudo Console and pipes to it
HANDLE hPipeIn{ INVALID_HANDLE_VALUE };
HANDLE hPipeOut{ INVALID_HANDLE_VALUE };
hr = CreatePseudoConsoleAndPipes(&hPC, &hPipeIn, &hPipeOut);
if (S_OK == hr)
{
// Create & start thread to listen to the incoming pipe
// Note: Using CRT-safe _beginthread() rather than CreateThread()
HANDLE hPipeListenerThread{ reinterpret_cast<HANDLE>(_beginthread(PipeListener, 0, hPipeIn)) };
// Initialize the necessary startup info struct
STARTUPINFOEX startupInfo{};
if (S_OK == InitializeStartupInfoAttachedToPseudoConsole(&startupInfo, hPC))
{
// Launch ping to emit some text back via the pipe
PROCESS_INFORMATION piClient{};
hr = CreateProcess(
NULL, // No module name - use Command Line
szCommand, // Command Line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Inherit handles
EXTENDED_STARTUPINFO_PRESENT, // Creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&startupInfo.StartupInfo, // Pointer to STARTUPINFO
&piClient) // Pointer to PROCESS_INFORMATION
? S_OK
: GetLastError();
if (S_OK == hr)
{
// Wait up to 10s for ping process to complete
WaitForSingleObject(piClient.hThread, 10 * 1000);
// Allow listening thread to catch-up with final output!
Sleep(500);
}
// --- CLOSEDOWN ---
// Now safe to clean-up client app's process-info & thread
CloseHandle(piClient.hThread);
CloseHandle(piClient.hProcess);
// Cleanup attribute list
DeleteProcThreadAttributeList(startupInfo.lpAttributeList);
free(startupInfo.lpAttributeList);
}
// Close ConPTY - this will terminate client process if running
ClosePseudoConsole(hPC);
// Clean-up the pipes
if (INVALID_HANDLE_VALUE != hPipeOut) CloseHandle(hPipeOut);
if (INVALID_HANDLE_VALUE != hPipeIn) CloseHandle(hPipeIn);
}
}
return S_OK == hr ? EXIT_SUCCESS : EXIT_FAILURE;
}
HRESULT CreatePseudoConsoleAndPipes(HPCON* phPC, HANDLE* phPipeIn, HANDLE* phPipeOut)
{
HRESULT hr{ E_UNEXPECTED };
HANDLE hPipePTYIn{ INVALID_HANDLE_VALUE };
HANDLE hPipePTYOut{ INVALID_HANDLE_VALUE };
// Create the pipes to which the ConPTY will connect
if (CreatePipe(&hPipePTYIn, phPipeOut, NULL, 0) &&
CreatePipe(phPipeIn, &hPipePTYOut, NULL, 0))
{
// Determine required size of Pseudo Console
COORD consoleSize{};
CONSOLE_SCREEN_BUFFER_INFO csbi{};
HANDLE hConsole{ GetStdHandle(STD_OUTPUT_HANDLE) };
if (GetConsoleScreenBufferInfo(hConsole, &csbi))
{
consoleSize.X = csbi.srWindow.Right - csbi.srWindow.Left + 1;
consoleSize.Y = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
}
// Create the Pseudo Console of the required size, attached to the PTY-end of the pipes
hr = CreatePseudoConsole(consoleSize, hPipePTYIn, hPipePTYOut, 0, phPC);
// Note: We can close the handles to the PTY-end of the pipes here
// because the handles are dup'ed into the ConHost and will be released
// when the ConPTY is destroyed.
if (INVALID_HANDLE_VALUE != hPipePTYOut) CloseHandle(hPipePTYOut);
if (INVALID_HANDLE_VALUE != hPipePTYIn) CloseHandle(hPipePTYIn);
}
return hr;
}
// Initializes the specified startup info struct with the required properties and
// updates its thread attribute list with the specified ConPTY handle
HRESULT InitializeStartupInfoAttachedToPseudoConsole(STARTUPINFOEX* pStartupInfo, HPCON hPC)
{
HRESULT hr{ E_UNEXPECTED };
if (pStartupInfo)
{
size_t attrListSize{};
pStartupInfo->StartupInfo.cb = sizeof(STARTUPINFOEX);
// Get the size of the thread attribute list.
InitializeProcThreadAttributeList(NULL, 1, 0, &attrListSize);
// Allocate a thread attribute list of the correct size
pStartupInfo->lpAttributeList =
reinterpret_cast<LPPROC_THREAD_ATTRIBUTE_LIST>(malloc(attrListSize));
// Initialize thread attribute list
if (pStartupInfo->lpAttributeList
&& InitializeProcThreadAttributeList(pStartupInfo->lpAttributeList, 1, 0, &attrListSize))
{
// Set Pseudo Console attribute
hr = UpdateProcThreadAttribute(
pStartupInfo->lpAttributeList,
0,
PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE,
hPC,
sizeof(HPCON),
NULL,
NULL)
? S_OK
: HRESULT_FROM_WIN32(GetLastError());
}
else
{
hr = HRESULT_FROM_WIN32(GetLastError());
}
}
return hr;
}
void __cdecl PipeListener(LPVOID pipe)
{
HANDLE hPipe{ pipe };
HANDLE hConsole{ GetStdHandle(STD_OUTPUT_HANDLE) };
const DWORD BUFF_SIZE{ 512 };
char szBuffer[BUFF_SIZE]{};
DWORD dwBytesWritten{};
DWORD dwBytesRead{};
BOOL fRead{ FALSE };
do
{
// Read from the pipe
fRead = ReadFile(hPipe, szBuffer, BUFF_SIZE, &dwBytesRead, NULL);
// Write received text to the Console
// Note: Write to the Console using WriteFile(hConsole...), not printf()/puts() to
// prevent partially-read VT sequences from corrupting output
WriteFile(hConsole, szBuffer, dwBytesRead, &dwBytesWritten, NULL);
} while (fRead && dwBytesRead >= 0);
}

View File

@@ -0,0 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{96274800-9574-423E-892A-909FBE2AC8BE}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>EchoCon</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="EchoCon.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="EchoCon.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// EchoCon.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@@ -0,0 +1,13 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here

View File

@@ -0,0 +1,8 @@
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>

Some files were not shown because too many files have changed in this diff Show More