Skip to content

std.os.windows.advapi32: add RegOpenKeyExA and RegQueryValueExA #14368

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

Closed
wants to merge 1 commit into from

Conversation

FnControlOption
Copy link
Contributor

Noticed these were missing while starting work on #6363. Might find more bindings to add in the coming days/weeks...

Question: RegOpenKeyExW is duplicated in std.os.windows.kernel32, so should it be deleted there, or should RegOpenKeyExA be added? (The C prototypes in winreg.h have WINADVAPI, so advapi32 is probably the better place for these over kernel32)

@squeek502
Copy link
Collaborator

squeek502 commented Jan 19, 2023

W suffixed functions should always be preferred over A suffixed functions, and Zig's standard library is not intending on providing complete bindings, so I believe this PR is likely going to be rejected. From #4426 (comment):

This means removing the Windows extern functions that end in "A" is fair game now.

Relevant issues:

Part of the port of windows_sdk.cpp should be converting those A suffixed function calls to their W suffixed equivalents.

@FnControlOption
Copy link
Contributor Author

Oops, thanks for clarifying. Dumb question, what is the standard way to create a wide string in Zig?

@squeek502
Copy link
Collaborator

squeek502 commented Jan 19, 2023

what is the standard way to create a wide string in Zig?

Depends what you mean. If you want a UTF-16 string literal, you can use std.unicode.utf8ToUtf16LeStringLiteral. If you have a runtime string and need to get a wide string from it, there's std.unicode.utf8ToUtf16LeWithNull. If you're dealing with paths, there's things like std.os.windows.sliceToPrefixedFileW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants