-
-
Notifications
You must be signed in to change notification settings - Fork 327
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
Update to windows 0.58 #1338
base: master
Are you sure you want to change the base?
Update to windows 0.58 #1338
Conversation
} | ||
|
||
if !self.event.is_invalid() { | ||
let _err = CloseHandle(self.event); | ||
} | ||
|
||
if !self.query.is_invalid() { | ||
PdhCloseQuery(self.query.0); | ||
if !(self.query == -1 || self.query == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That code in particular is pretty bad. :-/
Do you know if there is a wrapper type instead of just handling an isize
directly? That's very error-prone... The previous HANDLE
wasn't great, but at least it was obvious what we were manipulating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's not great, it just duplicates the is_invalid
code but I wasn't sure even /that/ was actually correct in this case. Usually these windows functions are already hardened against invalid handles so it might just be OK to always call PdhCloseQuery
instead of checking on our side.
Ideally there'd be a PDH_HQUERY
as used by the Pdh* functions but no such type exists in windows-rs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened https://github.com/microsoft/windows-rs/issues/3200 for this. I'm really not sure what to do here... Is there any internals improvements in windows
crate worth merging this PR as is even with the new code?
If not, would you be open to create a newtype which would wrap this value so we at least know what we're manipulating?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened https://github.com/microsoft/windows-rs/issues/3200 for this. I'm really not sure what to do here... Is there any internals improvements in
windows
crate worth merging this PR as is even with the new code?If not, would you be open to create a newtype which would wrap this value so we at least know what we're manipulating?
It would be nice if this were merged so that my dependency tree doesn't use 4 or 5 different versions of windows-rs. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was merged. Just need to wait for windows-rs
0.59 version to be released now I suppose. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be a better idea to merge this and make the code look like 0.59 in the meantime. windows-rs upgrades are infrequent and (by us) kind of unwanted too since they're a massive ecosystem wide upgrade that needs to happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. The code is much less good with the 0.58 version and I'd prefer to avoid having "bad code" until next windows-rs release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was merged. Just need to wait for
windows-rs
0.59 version to be released now I suppose. :)
I'm confused. You say it was merged, but the PR is still open.
in master (why is it not called "main"?) you have windows = { version = ">=0.54, <=0.57", optional = true }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue I opened was merged in microsoft/win32metadata@ff991cf. Now I'm waiting for windows-rs to update their dependency.
(why is it not called "main"?)
It was created with the branch named master
so don't see a reason to change it.
Not the cleanest upgrade but some smaller things have changed in windows-rs that are backwards incompatible (HANDLE is now *const c_void rather then isize so we can't hide the query in there anymore, and PSID changed namespace).