You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was updating a project that uses this crate to register and run an executable as a service in windows, and I ran into the issue that SC_HANDLE (returned from OpenServiceA) does not implement is_null() to see if the call executed successfully (which it did in the version I had before, 0.18.0).
As a workaround, I tried to do what the windows API says, to check if the return value is NULL (in which case it's not a valid handle). I've checked to see if there is a NULL constant defined somewhere and couldn't find it, so I'm guessing for now I have to use 0 directly (which I assume is what NULL means in the windows API, I don't have much experience with the API directly, only through the Rust crate)
The text was updated successfully, but these errors were encountered:
SC_HANDLE is now just a type alias for isize consistent with the underlying Win32 definition. You can therefore just compare against 0 as that is the equivalent of NULL.
This is true for the windows crate (SC_HANDLE) that restored newtypes for handles as of #1423 with version 0.30.0. In the windows-sys crate SC_HANDLE remains a type alias for isize and Kenny's comment above still applies here.
I was updating a project that uses this crate to register and run an executable as a service in windows, and I ran into the issue that SC_HANDLE (returned from OpenServiceA) does not implement is_null() to see if the call executed successfully (which it did in the version I had before, 0.18.0).
As a workaround, I tried to do what the windows API says, to check if the return value is NULL (in which case it's not a valid handle). I've checked to see if there is a NULL constant defined somewhere and couldn't find it, so I'm guessing for now I have to use 0 directly (which I assume is what NULL means in the windows API, I don't have much experience with the API directly, only through the Rust crate)
The text was updated successfully, but these errors were encountered: