-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Windows: Prefer ntdll
named pipe APIs over kernel32
#19037
Labels
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
os-windows
Milestone
Comments
I have a prototype of a Edit: I'm silly and passed the wrong flags. |
andrewrk
added
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
os-windows
labels
Mar 16, 2024
The-King-of-Toasters
added a commit
to The-King-of-Toasters/zig
that referenced
this issue
Apr 13, 2024
To facilitate ziglang#19037, this commit slims `std.windows.kernel32` to only have the functions needed by the standard library. Since this will break projects that relied on these, I offer two solutions: - Make an argument as to why certain functions should be added back in. Note that they may just be wrappers around `ntdll` APIs, which would go against ziglang#19037. If necessary I'll add them back in *and* make wrappers in `std.windows` for it. - Maintain your own list of APIs. This is the option taken by bun[1], where they wrap functions with tracing. - Use `zigwin32`. I've also added TODO comments that specify which functions can be reimplemented using `ntdll` APIs in the future. Other changes: - Group functions into groups (I/O, process management etc.). - Synchronize definitions against Microsoft documentation to use the proper parameter types/names. - Break all functions with parameters over multiple lines.
The-King-of-Toasters
added a commit
to The-King-of-Toasters/zig
that referenced
this issue
Apr 13, 2024
To facilitate ziglang#19037, this commit slims `std.windows.kernel32` to only have the functions needed by the standard library. Since this will break projects that relied on these, I offer two solutions: - Make an argument as to why certain functions should be added back in. Note that they may just be wrappers around `ntdll` APIs, which would go against ziglang#19037. If necessary I'll add them back in *and* make wrappers in `std.windows` for it. - Maintain your own list of APIs. This is the option taken by bun[1], where they wrap functions with tracing. - Use `zigwin32`. I've also added TODO comments that specify which functions can be reimplemented using `ntdll` APIs in the future. Other changes: - Group functions into groups (I/O, process management etc.). - Synchronize definitions against Microsoft documentation to use the proper parameter types/names. - Break all functions with parameters over multiple lines.
The-King-of-Toasters
added a commit
to The-King-of-Toasters/zig
that referenced
this issue
Apr 19, 2024
To facilitate ziglang#19037, this commit slims `std.windows.kernel32` to only have the functions needed by the standard library. Since this will break projects that relied on these, I offer two solutions: - Make an argument as to why certain functions should be added back in. Note that they may just be wrappers around `ntdll` APIs, which would go against ziglang#19037. If necessary I'll add them back in *and* make wrappers in `std.windows` for it. - Maintain your own list of APIs. This is the option taken by bun[1], where they wrap functions with tracing. - Use `zigwin32`. I've also added TODO comments that specify which functions can be reimplemented using `ntdll` APIs in the future. Other changes: - Group functions into groups (I/O, process management etc.). - Synchronize definitions against Microsoft documentation to use the proper parameter types/names. - Break all functions with parameters over multiple lines.
The-King-of-Toasters
added a commit
to The-King-of-Toasters/zig
that referenced
this issue
Apr 20, 2024
To facilitate ziglang#19037, this commit slims `std.windows.kernel32` to only have the functions needed by the standard library. Since this will break projects that relied on these, I offer two solutions: - Make an argument as to why certain functions should be added back in. Note that they may just be wrappers around `ntdll` APIs, which would go against ziglang#19037. If necessary I'll add them back in *and* make wrappers in `std.windows` for it. - Maintain your own list of APIs. This is the option taken by bun[1], where they wrap functions with tracing. - Use `zigwin32`. I've also added TODO comments that specify which functions can be reimplemented using `ntdll` APIs in the future. Other changes: - Group functions into groups (I/O, process management etc.). - Synchronize definitions against Microsoft documentation to use the proper parameter types/names. - Break all functions with parameters over multiple lines.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
os-windows
CreatePipe and CreateNamedPipe are used by
child_process
to... create anonymous and named pipes for redirecting i/o. From my research, these are abstractions aroundNtCreateNamedPipeFile
andNtOpenFile
for the writing end. As per #1840, we should prefer using these APIs over kernel32 ones.CreatePipe
Here is wine's implementation. Using
NtTrace
we see the same calls being made, just out of order:Example Program
Some improvements we could make:
FALSE/0
with proper constants (e.g.FILE_PIPE_BYTE_STREAM_MODE
).Not that I cannot find these pipes under the pipe device directory (
ls \\.\pipe\
in powershell), unlike proper named pipes.CreateNamedPipe
Again, here is Wine's impl and a trace log.
Sample
Pretty close to the real thing.
The text was updated successfully, but these errors were encountered: