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

IExplorerCommand: Methods could return flag type instead of u32 and flag types should be marked as flags #2007

Closed
Fulgen301 opened this issue Oct 21, 2024 · 1 comment
Assignees

Comments

@Fulgen301
Copy link

IExplorerCommand::GetState returns EXPCMDSTATE in C, which is a typedef to DWORD, while all the values are part of the _EXPCMDSTATE enum, necessitating extra casts when used in Rust. As all the valid values are part of that enum, the function could return that type directly, similar to #1674. The same applies to IExplorerCommand::GetFlags and EXPCMDSTATE / _EXPCMDSTATE.

Additionally, _EXPCMDSTATE / _EXPCMDFLAGS aren't marked as flags, so combining them via bitwise operations is impossible without casts in windows-rs.

@riverar
Copy link
Collaborator

riverar commented Oct 21, 2024

The underlying type of _EXPCMDSTATE is int sadly. We might be able to use the associated enum attribute here, haven't looked yet. Will leave this open for others to chime in.

enum _EXPCMDSTATE
    {
        ECS_ENABLED	= 0,
        ECS_DISABLED	= 0x1,
        ECS_HIDDEN	= 0x2,
        ECS_CHECKBOX	= 0x4,
        ECS_CHECKED	= 0x8,
        ECS_RADIOCHECK	= 0x10
    } ;

@mikebattista mikebattista self-assigned this Nov 7, 2024
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

3 participants