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

Various structs have invalid definitions due to confusing Int64 with IntPtr #1134

Closed
kennykerr opened this issue Aug 25, 2022 · 3 comments
Closed
Labels
broken api An API is inaccurate and could lead to runtime failure rust Critical for Rust adoption

Comments

@kennykerr
Copy link
Contributor

Discrepancies where the numbers are different

Looks like these are also win32metadata bugs. For example CfDisconnectSyncRoot is defined as follows in metadata:

public struct CF_CONNECTION_KEY
{
    public IntPtr Value;
}

public static extern HRESULT CfDisconnectSyncRoot([In] CF_CONNECTION_KEY ConnectionKey);

That explains why windows-rs says the stack size is 4 since IntPtr is 4 bytes on x86.

But that's not accurate since the definition of CF_CONNECTION_KEY in the Windows SDK is always 8 bytes, regardless of architecture:

#define DECLARE_OPAQUE_KEY( name )          \
    typedef struct name##__ {               \
        LONGLONG Internal;                  \
    } name, *P##name

DECLARE_OPAQUE_KEY( CF_CONNECTION_KEY );

LONGLONG is just a typedef for __int64.

Originally posted by @kennykerr in microsoft/windows-rs#1985 (comment)

@taufikrh
Copy link

Not yet fixed #871

@kennykerr
Copy link
Contributor Author

Eek - we really should get this fixed.

@kennykerr kennykerr added the rust Critical for Rust adoption label Aug 29, 2022
@BenJKuhn
Copy link
Member

Duplicate of #871

@BenJKuhn BenJKuhn marked this as a duplicate of #871 Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
broken api An API is inaccurate and could lead to runtime failure rust Critical for Rust adoption
Projects
None yet
Development

No branches or pull requests

4 participants