zig icon indicating copy to clipboard operation
zig copied to clipboard

Fix GetFileInformationByHandle compile error

Open rdunnington opened this issue 2 years ago • 7 comments

The wrapper function was mistakenly referencing ntdll.zig when the actual function is declared in kernel32.zig.

rdunnington avatar Mar 07 '23 07:03 rdunnington

LGTM. Eventually we'd like to use the Ntdll calls for file stuff, because this is highly unlikely to change. For file information this would be NtQueryInformationFile. see #1840.

matu3ba avatar Mar 07 '23 08:03 matu3ba

Eventually we'd like to use the Ntdll calls for file stuff

This is already the case, unless you mean that Zig should supply a GetFileInformationByHandle implementation using NtQueryInformationFile.

std.os.windows.GetFileInformationByHandle is entirely unused in the std library (hence why this compile error was not found until now) and the only other related reference to GetFileInformationByHandle is one usage of std.os.windows.kernel32.GetFileInformationByHandleEx here.

squeek502 avatar Mar 07 '23 11:03 squeek502

Ok cool, is there anything else I can do to get this merged? Or just wait until an admin approves the PR? It's my first contribution so I'm not sure how this works.

rdunnington avatar Mar 08 '23 00:03 rdunnington

Nothing you need to do, just need to wait.

squeek502 avatar Mar 08 '23 03:03 squeek502

Thank you for the patch.

I think I would prefer to entirely remove this function from the standard library rather than fix it.

Related issue: #4426

andrewrk avatar Mar 08 '23 03:03 andrewrk

Ok, that makes sense given the std lib doesn't use this function at all.

rdunnington avatar Mar 08 '23 04:03 rdunnington

Latest change delete the function so no one will make the same mistake again. :) I think #14841 should probably clean up the dangling GetFileInformationByHandleEx declaration in kernel32.zig as well.

rdunnington avatar Mar 09 '23 07:03 rdunnington