Common: Enforce explicit handle validation

Some invalid handle values are -1 or INVALID_HANDLE_VALUE, hence our
handle template has a specific invalid handle value parameter we should
always test against. Time and again, I find my code simply comparing
handle against zero.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2025-07-08 10:38:40 +02:00
parent 3d53fb7b9b
commit 23b856f2e6

View File

@ -914,6 +914,9 @@ namespace winstd
handle(_In_ const handle<handle_type, INVAL> &h) noexcept {};
handle<handle_type, INVAL>& operator=(_In_ const handle<handle_type, INVAL> &h) noexcept {};
// Force use of valid() method when testing handle.
operator bool() const;
public:
///
/// Attaches already available object handle.