There is a SafeHandleZeroOrMinusOneIsInvalid
class in the .NET Framework, as well as a SafeHandleMinusOneIsInvalid
class.
Why is this? In which situations is zero ever a valid handle?
As additional lecture to the other answers, see this OldNewThing blog entry about inconsistent handle return values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With