Closed VedaviBalaji closed 4 days ago
Which API are you looking for @VedaviBalaji? They are available in version 0.58+ (e.g. https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/Security/Cryptography/fn.BCryptCloseAlgorithmProvider.html)
In particular API's like BCryptRegisterProvider
, BCryptUnregisterProvider
, BCryptAddContextFunctionProvider
and BCryptRemoveContextFunctionProvider
.
Ah yup. Looks like we (over in metadata) missed some lib mappings. Forwarding over there for resolution, thanks!
Thanks. Also, in order to use the API's currently, do you recommend generating the bindings locally?
As soon as we fix this up in metadata, you can use a local .winmd and then generate your own bindings with windows-bindgen. Your mileage may vary as it will be newer metadata that hasn't been vetted through windows-rs yet.
I'll try to get this patched up in a few hours.
PR is up, here's an early copy you can tinker with. Windows.Win32.zip
Thanks. I tried generating the bindings using
windows_bindgen::bindgen([
"--in",
"src/windows/Windows.Win32.winmd",
"--out",
"src/windows/bindings.rs",
"--filter",
"Windows.Win32",
])
.unwrap();
and I see that some functions and constants are generated twice. Is my code for generating the bindings right?
Also, when can we expect this to be part of official windows crate? Thanks.
I would filter to the exact BCrypt functions added and rely on the existing crate for the rest. (Your filter is too broad.)
After a metadata release, it typically takes a few days afterwards for us to update the crate (master). A release version bump will need to be requested over there if that's needed.
Thanks. I was able to generate the specific functions alone ( although I had to manually edit the file to find certain definitions inside existing namespaces). However, I get linker errors for the newly generated bindings
windows_bindgen::bindgen([
"--in",
"src/windows/Windows.Win32.winmd",
"--out",
"src/windows/bindings.rs",
"--filter",
"Windows.Win32.Security.Cryptography.BCryptRegisterProvider",
"--filter",
"Windows.Win32.Security.Cryptography.BCryptAddContextFunctionProvider",
"--filter",
"Windows.Win32.Security.Cryptography.BCryptRemoveContextFunctionProvider",
"--filter",
"Windows.Win32.Security.Cryptography.BCryptUnregisterProvider",
])
.unwrap();
If I understand it right, windows-target
uses import lib that has all these definitions. Does it not have these function definitions? Or do I need to link the bcrypt.dll
myself?
You can instruct windows-targets
to use raw-dylib
with windows_raw_dylib
and then it won't need a lib. Like so:
https://github.com/microsoft/windows-rs/blob/master/.cargo/config.toml
Otherwise, you'll need windows-rs
to update with the latest metadata and regenerate libs.
Suggestion
I see we do not have the bindings for functions in bcrypt_provider.h. I see this issue created - https://github.com/microsoft/win32metadata/issues/1907 but I do not see the functions in the documentation/crates. Do we have these bindings?