Search code examples
.netwinapihandle

Is zero ever a valid handle?


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?


Solution

  • As additional lecture to the other answers, see this OldNewThing blog entry about inconsistent handle return values.