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

WinXP Compatibility for PdhUtil#PdhLookupPerfNameByIndex #1053

Merged
merged 2 commits into from
Jan 10, 2019

Conversation

dbwiddis
Copy link
Contributor

@dbwiddis dbwiddis commented Jan 9, 2019

While the fix in #1052 worked on one XP system it did not work on another. Not sure if it was character encoding or bitness or something else, but the docs were also unclear as to the behavior of the buffer length value:

The function sets pcchNameBufferSize to either the required size or the size of the buffer that was used.

And also suggesting error code response varied:

PDH_INVALID_ARGUMENT ... on some releases you could receive this error if the specified size on input is greater than zero but less than the required size.

This second fix should work and passes tests on a few different XP VMs. Vista+ does the "pass null, get size, get result" calls. For XP the buffer is incremented until it succeeds so we don't have to rely on the returned size.

@matthiasblaesing
Copy link
Member

Thank you. Looks sane - I'll give it night to settle though.

@matthiasblaesing matthiasblaesing merged commit 216cb34 into java-native-access:master Jan 10, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants