Uh oh!
There was an error while loading. Please reload this page.
Windows: Rework kernel32 apis - #19641
Conversation
b987c2e to
edcbf9dCompareThe-King-of-Toasters
commented
Apr 19, 2024
I've added fleshed out the comments on the remaining APIs. I've categorised them into three groups:
|
3e99b86 to
ab020f0CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
60252bb to
7615944CompareUh oh!
There was an error while loading. Please reload this page.
57f8ff0 to
6fb865eCompare3999adb to
98b3e14Compareaa26b64 to
44b364cCompare44b364c to
4ac10cdCompareTo facilitate ziglang#1840, 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#1840. 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.
4ac10cd to
3095e83CompareThe-King-of-Toasters
commented
Jul 18, 2024
@andrewrk This pr has been open for a couple months now, since then a couple Windows API changes have been made. I've kept this branch up-to-date but I'd like it to be merged before I do any more changes (specifically, adding a Do you have any objections to these changes? |
andrewrk
commented
Jul 18, 2024
Sorry for the delay, I hadn't seen it until now. Looks good! Thanks for your patience on the merge. |
In ziglang#19641, this binding changed from `[*]u16` to `LPWSTR` which made it a sentinel-terminated pointer. This introduced a compiler error in the `std.os.windows.GetModuleFileNameW` wrapper since it takes a `[*]u16` pointer. This commit changes the binding back to what it was before instead of introducing a breaking change to `std.os.windows.GetModuleFileNameW` Related: ziglang#20858
In #19641, this binding changed from `[*]u16` to `LPWSTR` which made it a sentinel-terminated pointer. This introduced a compiler error in the `std.os.windows.GetModuleFileNameW` wrapper since it takes a `[*]u16` pointer. This commit changes the binding back to what it was before instead of introducing a breaking change to `std.os.windows.GetModuleFileNameW` Related: #20858
In ziglang#19641, this binding changed from `[*]u16` to `LPWSTR` which made it a sentinel-terminated pointer. This introduced a compiler error in the `std.os.windows.GetModuleFileNameW` wrapper since it takes a `[*]u16` pointer. This commit changes the binding back to what it was before instead of introducing a breaking change to `std.os.windows.GetModuleFileNameW` Related: ziglang#20858
To facilitate #1840, this commit slims
std.windows.kernel32to only have the functions needed by the standard library. Since this will break projects that relied on these, I offer these solutions:Make an argument as to why certain functions should be added back in. Note that they may just be wrappers around
ntdllAPIs, which would go against Prefer depending on NtDll rather than kernel32 or other higher level DLLs #1840.If necessary I'll add them back in and make wrappers in
std.windowsfor it.Maintain your own list of APIs. This is the option taken by bun, where they wrap functions with tracing.
Use
zigwin32.I've also added
TODOcomments that specify which functions can be reimplemented usingntdllAPIs in the future.Other changes: