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

Add support for Win32 array parameters #1562

Merged
merged 34 commits into from
Feb 24, 2022
Merged

Add support for Win32 array parameters #1562

merged 34 commits into from
Feb 24, 2022

Conversation

kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Feb 23, 2022

Adds support for both relative and fixed size Win32 array parameters.

Here's an example of an API with a fixed-size array parameter:

let mut buffer = [0; 260];
let a = GetTempFileNameA(".", "test", 0x7b, &mut buffer);
assert_eq!(a, 0x7b);
assert_eq!(&buffer[..12], b".\\tes7B.tmp\0");

Previously, the last parameter was merely a pointer and could not check whether the buffer was large enough. Now the size is checked at compile time.

And here is an example of an API with a relative array parameter:

let input = b"hello";
let mut output = [0; 5];
let len = MultiByteToWideChar(CP_UTF8, Default::default(), input, &mut output);
assert_eq!(len, 5);

Previously, both input and output buffers consisted of a pair of parameters for each pointer and length. Now, a pair of slices is expected and the underlying argument pairs are derived from those.

Fixes #1339
Fixes #972
Fixes #790
Fixes #479

@kennykerr kennykerr closed this Feb 23, 2022
@kennykerr kennykerr changed the title Test build Add support for Win32 array parameters Feb 23, 2022
@kennykerr kennykerr reopened this Feb 23, 2022
@kennykerr
Copy link
Collaborator Author

kennykerr commented Feb 23, 2022

@damyanp could you look over the DirectX APIs - many changes there - they look good to me, but I'd appreciate another pair of eyes. It's a lot easier with CodeFlow. 😉

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