Skip to content

WinXP Compatibility for PdhUtil#PdhLookupPerfNameByIndex#1053

Merged
matthiasblaesing merged 2 commits into
java-native-access:masterfrom
dbwiddis:master
Jan 10, 2019
Merged

WinXP Compatibility for PdhUtil#PdhLookupPerfNameByIndex#1053
matthiasblaesing merged 2 commits into
java-native-access:masterfrom
dbwiddis:master

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Jan 9, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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.

2 participants