-
-
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: Replace CreatePipe with ntdll implementation #19271
Windows: Replace CreatePipe with ntdll implementation #19271
Conversation
Some less important additional questions:
Something slightly more interesting: On a Windows 11 22631 system, Instead, it first checks a global variable to see whether it has already opened a handle to Then, the read handle is created using Finally, the write handle is opened using IMO this approach is better than having to come up with a unique name each time a pipe is created. It should be investigated whether this works on older Windows versions too, and if it does, we should probably switch to this implementation. |
Nice. Thanks for the review assistance, @e4m2 |
One potential problem is that this special casing of zero-length object names doesn't seem to exist in Wine's (this was discussed a bit in Discord here: https://discord.com/channels/605571803288698900/1217407987149307914) |
I'll do some research re: Wine compatibility soon. Would also be interesting to see which Windows version introduced this ability. |
Good news on this front. The new method is already being used by So I think we're mostly good to go on the Zig side, just need to know how Wine handles it. If they indeed don't support it, it's probably best to file an upstream bug, as squeek said. |
8ce4873
to
f326e86
Compare
Some more good news: It seems that at least Wine 8.2 supports these kinds of named pipes. There's even a test added in 9.4 that checks for this. |
f326e86
to
e1caff6
Compare
5fe9539
to
e5d976f
Compare
I've cached a handle to |
I think it's adequate how you implemented it, but does it really need to use a mutex? The strategy hinted at by @e4m2 seems more optimal:
|
This implementation is now a direct replacement for the `kernel32` one. New bitflags for named pipes and other generic ones were added based on browsing the ReactOS sources. `UNICODE_STRING.Buffer` has also been changed to be nullable, as this is what makes the implementation work. This required some changes to places accesssing the buffer after a `SUCCESS`ful return, most notably `QueryObjectName` which even referred to it being nullable.
This is how they've been implemented in `kernel32` since NT 3.1.
Fixes a TODO referencing the ancient issue ziglang#305.
e5d976f
to
67df3de
Compare
@andrewrk Ok, I've modified the code to use atomics loads and |
Looks perfect! |
PR [19271](#19271) added some static function implementations from kernel32, but some parts of the library still used the dynamically loaded versions.
PR [19271](ziglang#19271) added some static function implementations from kernel32, but some parts of the library still used the dynamically loaded versions.
PR [19271](ziglang#19271) added some static function implementations from kernel32, but some parts of the library still used the dynamically loaded versions.
One half of #19037.