mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
390 B
C++
20 lines
390 B
C++
#pragma once
|
|
|
|
#include "exception.hpp"
|
|
|
|
namespace llarp::win32
|
|
{
|
|
inline void
|
|
ensure_handle_is_valid(HANDLE h)
|
|
{
|
|
BY_HANDLE_FILE_INFORMATION info{};
|
|
if (GetFileInformationByHandle(h, &info))
|
|
return;
|
|
if (auto err = GetLastError())
|
|
{
|
|
SetLastError(0);
|
|
throw llarp::win32::error{err, "handle validity check failed"};
|
|
}
|
|
}
|
|
} // namespace llarp::win32
|