Skip to content
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

How to get HRESULT of Win32::Networking::ActiveDirectory::IDirectorySearch::GetNextRow? #1371

Closed
rinfield opened this issue Dec 2, 2021 · 4 comments

Comments

@rinfield
Copy link

rinfield commented Dec 2, 2021

I apologize if I'm asking a silly question.

I need the HRESULT to check whether more rows are available to search ActiveDirectory using Win32::Networking::ActiveDirectory::IDirectorySearch.

How can I get actual HRESULT from Result<()>?
It seems executing GetNextRow() always returns Ok(()) even when no more rows.

https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/Networking/ActiveDirectory/struct.IDirectorySearch.html#method.GetNextRow

@rinfield rinfield changed the title How to get HRESULT of Win32::Networking::ActiveDirectory::IDirectorySearch::GetNextRow How to get HRESULT of Win32::Networking::ActiveDirectory::IDirectorySearch::GetNextRow? Dec 2, 2021
@tim-weis
Copy link
Contributor

tim-weis commented Dec 2, 2021

This is the result of an issue with the Win32 metadata, that fails to contain enough information for windows-rs to provide a useful binding. The issue was initially reported here. Since then some API's (but not all) have received the proposed AlternateSuccessCodes attribute (such as DoDragDrop). Unfortunately, IDirectorySearch::GetNextRow is not one of them.

As I understand it, the AlternateSuccessCodes attribute is in the process of getting replaced with DllImport.PreserveSig (see this PR for reference). It doesn't look like the Win32 metadata team is planning to invest into the temporary AlternateSuccessCodes solution.

The maintainers of windows-rs may want to bring this to the attention of the Win32 metadata team, and possibly prioritize having the issue resolved. At this time, this specific API is rendered unusable.

@rinfield
Copy link
Author

rinfield commented Dec 2, 2021

Thank you for your explanation! I'll wait for the progress of win32metadata and windows-rs.:+1:

💭 (If it takes a long time, I wish win32metadata teams accept AlternateSuccessCodes solution first...)

@dqtsth
Copy link

dqtsth commented Dec 8, 2021

Hi. I am blocked by issue. You can accept my solution AlternateSuccessCodes for now and later do solution better? Sorry for impatience I can not finish my project. Thank you for work and windows-rs. 👍

@rinfield
Copy link
Author

rinfield commented Jan 11, 2022

With 0.29.0, I can now get HRESULT as return type. I have confirmed that the actual implementation and documentation have been fixed.

Thank you!

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

No branches or pull requests

4 participants