Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a spec for #7335, "console allocation policy" #7337

Merged
merged 44 commits into from Feb 7, 2024

Conversation

DHowett
Copy link
Member

@DHowett DHowett commented Aug 18, 2020

This is a specification for a way to customize console allocations.
The new manifest type consoleAllocationPolicy and the new
AllocConsoleWithOptions API were already added to the console
client library internally.

Closes #7335

@DHowett
Copy link
Member Author

DHowett commented Aug 18, 2020

/cc @bpulliam, who was asking for something like this.
/cc @bitcrazed, who might want to see the first evolution of the console subsystem in a while

@zadjii-msft
Copy link
Member

Markdown view link

image

@zadjii-msft

This comment has been minimized.

@DHowett

This comment has been minimized.

@DHowett
Copy link
Member Author

DHowett commented Aug 19, 2020

Thinking about it a bit.. does always make sense? Do we need something inheritOnly for GUI applications so they don't need to AttachConsole? I don't know--i only included always because i wanted there to be more values.

@KalleOlaviNiemitalo
Copy link

How would these interact with Process Creation Flags CREATE_NEW_CONSOLE, CREATE_NO_WINDOW, or DETACHED_PROCESS? For example, if the parent process has no console and uses CreateProcess CREATE_NEW_CONSOLE and the consoleAllocationPolicy is inheritOnly, then does the child process get a console, and does that depend on the subsystem?

If consoleAllocationPolicy is set but Windows does not recognize the value, is that the same as not setting it? Just wondering how this will be extended in the future if other values are needed. Like dpiAware was extended and later replaced with dpiAwareness.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna block on behalf of @KalleOlaviNiemitalo, because they raised a good question

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 19, 2020
@DHowett
Copy link
Member Author

DHowett commented Aug 19, 2020

How would these interact with Process Creation Flags CREATE_NEW_CONSOLE, CREATE_NO_WINDOW, or DETACHED_PROCESS? For example, if the parent process has no console and uses CreateProcess CREATE_NEW_CONSOLE and the consoleAllocationPolicy is inheritOnly, then does the child process get a console, and does that depend on the subsystem?

Update pending on this.

If consoleAllocationPolicy is set but Windows does not recognize the value, is that the same as not setting it? Just wondering how this will be extended in the future if other values are needed. Like dpiAware was extended and later replaced with dpiAwareness.

This is covered in the Compatibility section. Applications will act the same way they always have contingent upon their subsystem on older versions of Windows.

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 19, 2020
@DHowett
Copy link
Member Author

DHowett commented Aug 19, 2020

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surely no sense in blocking this anymore 😅

@KalleOlaviNiemitalo
Copy link

Was this implemented and merged in Windows already?

@jantari
Copy link
Contributor

jantari commented Feb 7, 2024

If this was already live in Windows with the spec being approved just 10 minutes ago I'd be mighty impressed ;)

That being said, I too have been looking forward to it for a long time.

@KalleOlaviNiemitalo
Copy link

Well there was a commit message referencing "the final shape of the API", which gives me the impression that this thing might be in the Windows operating system repository already. But even if it were I don't know whether it would be released in Windows 11 or 12 or what.

@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Scenario Product-Meta The product is the management of the products. labels Feb 7, 2024
@lhecker
Copy link
Member

lhecker commented Feb 7, 2024

Blast! Our evil plan is foiled!

@DHowett I've edited your PR description, but I'm holding off on merging it just in case you want to modify it further.

@DHowett DHowett merged commit 71c35cf into main Feb 7, 2024
20 checks passed
@DHowett DHowett deleted the dev/duhowett/spec/console-allocation branch February 7, 2024 13:48
@mjr4077au
Copy link

mjr4077au commented Mar 17, 2024

In all seriousness (and apologies, I know its annoying to just randomly message on a closed PR like this), but is this something that's likely to make it's way into 24H2, or should it not be expected until 25H2, or later?

I come via PowerShell/PowerShell#3028 as we're all dying for a solution to the ongoing problems with -WindowStyle Hidden limitations for the end users we need to support.

@lhecker
Copy link
Member

lhecker commented Mar 18, 2024

I may be mistaken, but it's probably already in the Beta and Canary insider builds, ever since this update in February: https://blogs.windows.com/windows-insider/2024/02/08/announcing-windows-11-insider-preview-build-26052-canary-and-dev-channels/

@sylveon
Copy link

sylveon commented Mar 22, 2024

Am I correct in assuming that using detached on a GUI subsystem app would mean that it stays attached if launched from CLI but otherwise works as normal? The spec isn't fully clear regarding that scenario.

Comment on lines +276 to +279
I am **not** proposing a change in how shells determine whether to wait for an application before returning to a prompt.
This means that a console subsystem application that intends to primarily present a UI but occasionally print text to a
console (therefore choosing the **detached** allocation policy) will cause the shell to "hang" and wait for it to
exit.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a shell's default wait for a console app should wait on the child process handle for a second and then, if the child is still running, check GetConsoleProcessList(). If the child process ID is in the list, then continue the wait loop. Alternatively, the console API could provide a WaitForConsoleDetach() function that simplifies this into a single call. It would return as soon as the process either terminates or calls FreeConsole(). Explicit waiting until child process termination would still be possible via something like CMD's start /wait command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Server Down in the muck of API call servicing, interprocess communication, eventing, etc. Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Issue-Scenario Needs-Attention The core contributors need to come back around and look at this ASAP. Product-Conhost For issues in the Console codebase Product-Meta The product is the management of the products.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow console allocation policies that are finer-grained than the PE image subsystem