diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2017-05-17 06:00:20 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2017-05-17 06:00:20 +0300 |
commit | c67055bad3cdfc93e2ac57d87f36c6e0993af690 (patch) | |
tree | da8759c66f1af00415784e5824e6bfc2195aee92 /include/pdb/handle.hpp | |
download | winapi-debug-c67055bad3cdfc93e2ac57d87f36c6e0993af690.tar.gz winapi-debug-c67055bad3cdfc93e2ac57d87f36c6e0993af690.zip |
initial commit
Diffstat (limited to '')
-rw-r--r-- | include/pdb/handle.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/pdb/handle.hpp b/include/pdb/handle.hpp new file mode 100644 index 0000000..52fb805 --- /dev/null +++ b/include/pdb/handle.hpp @@ -0,0 +1,29 @@ +// Copyright (c) 2017 Egor Tensin <Egor.Tensin@gmail.com> +// This file is part of the "PDB repository" project. +// For details, see https://github.com/egor-tensin/pdb-repo. +// Distributed under the MIT License. + +#pragma once + +#include <Windows.h> + +#include <cassert> + +#include <memory> + +namespace pdb +{ + struct CloseHandle + { + void operator()(HANDLE raw) const + { + if (raw == NULL || raw == INVALID_HANDLE_VALUE) + return; + const auto ret = ::CloseHandle(raw); + assert(ret); + UNREFERENCED_PARAMETER(ret); + } + }; + + typedef std::unique_ptr<void, CloseHandle> Handle; +} |