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

No listing of error codes for SetConsoleCursorPosition #157

Closed
Lucretiel opened this issue Sep 2, 2020 · 4 comments
Closed

No listing of error codes for SetConsoleCursorPosition #157

Lucretiel opened this issue Sep 2, 2020 · 4 comments

Comments

@Lucretiel
Copy link

I'm currently trying to debug an FFI issue related to SetConsoleCursorPosition returning a certain error. However, it doesn't appear to be documented what possible errors can be returned from SetConsoleCursorPosition.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@miniksa
Copy link
Collaborator

miniksa commented Oct 29, 2020

The only errors I can see coming out of that function are E_INVALIDARG (0x80070057), STATUS_INVALID_PARAMETER (0xC000000D) or some HRESULTification of the NTSTATUS through the HRESULT_FROM_NT macro like HRESULT_FROM_NT(STATUS_INVALID_PARAMETER) which is (0xD000000D).

Are you seeing any other error than that?

We generally haven't documented the specific errors out of these APIs because tracing the comprehensive set of errors from all APIs is virtually impossible.

Also do note that you can see a lot of the logic behind these APIs by looking inside conhost.exe's code now that it's open source at: https://github.com/microsoft/terminal/tree/main/src/host

@Lucretiel
Copy link
Author

Lucretiel commented Oct 29, 2020

STATUS_INVALID_PARAMETER is what we were seeing, no issues there. This came up in kkawakam/rustyline#434 (which in turn was triggered by nushell/nushell#2440), where this call was causing the error in some terminals (Windows Terminal, Alacritty) but not others (cmd), and seemingly it shouldn't be happening at all. We couldn't figure out from the docs what specifically might cause this error to occur in a case where the inputs are ostensibly correct.

@miniksa
Copy link
Collaborator

miniksa commented Oct 29, 2020

The only way I could tell you which parameter was at fault or why would be to have a complete debugger state attached to the conhost.exe involved. Sorry.

If you're using Windows Terminal, though, it will have openconsole.exe powering the session (which is an open version of conhost.exe) and should have symbols and source available by nature of being built from our GitHub. That would perhaps help you all see what's going on.

Do you mind if I close this issue then? I don't think I can document my way to success on this one.

@Lucretiel
Copy link
Author

No problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants