Uh oh!
There was an error while loading. Please reload this page.
Add SetConsoleMode to windows.kernel32 - #15039
Conversation
kubkon
commented
Mar 21, 2023
Hi, and thank you for your contribution! Our general direction when it comes to Windows system API is to rely mainly on direct calls into the |
Kiyoshi364
commented
Mar 21, 2023
I'd like to try. If it's easy enough, should I reimplement GetConsoleMode too? |
kubkon
commented
Mar 21, 2023
My suggestion is to first focus on one, and if it goes well you are more than welcome to tackle others. |
kubkon
commented
Mar 21, 2023
Here's ReactOS' implementation that might be useful https://github.com/reactos/reactos/blob/2ae45e0985ba55a50f86a88a25067d937fcd3062/dll/win32/kernel32/client/console/console.c#L1606 |
This is almost guaranteed to run into the same problems encountered in #14411 (specifically #14411 (comment) and #14411 (comment)) when it comes to a The good news is that if you just want to use conststd=@import("std");
pubextern"kernel32"fnSetConsoleMode(in_hConsoleHandle: std.os.windows.HANDLE, in_dwMode: std.os.windows.DWORD) callconv(std.os.windows.WINAPI) std.os.windows.BOOL;
pubfnmain() !void {
_=SetConsoleMode(std.io.getStdIn().handle, 0x10);
}(and here's a larger / real-world example of using many win32 bindings not in the standard library) |
Kiyoshi364
commented
Mar 22, 2023
Thanks for the links and the example showing that I don't need to patch the |
Kiyoshi364
commented
Mar 27, 2023
This is what I've done so far. What is missing:
Theoretically, I could copy the entire If anyone has suggestions (or values/implementations), I could put more work into it. As an additional info:
|
squeek502
commented
Mar 28, 2023
First, to answer some questions:
Second, I think it's worth offering some warning:
|
Kiyoshi364
commented
Mar 28, 2023
Currently, I know that I don't need to patch I'm not sure how useful "my implementation" would be (I'm guessing not that useful, basing on what you said). I'm planing on closing this, thanks again for all links and suggestions. (I'm not sure if closing disallows anything important, like any closing thoughts. |
kubkon
commented
Mar 28, 2023
Until such time we gather compelling evidence we need such a wrapper, I am closing this PR for now. Feel free to re-open or submit a new one if you disagree or find a compelling use case! |
Hi,
I've read that
windows.kernel32's functions are "lazily added" tostdlib.I would like to use
SetConsoleModein my project.I have already patched
stdlibin my local machine and looks like it works.