BEService spoofer refactoring.
This commit is contained in:
parent
444ccad844
commit
4a2dbcad27
6 changed files with 156 additions and 114 deletions
27
service/core/WinApi.h
Normal file
27
service/core/WinApi.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// core/WinApi.h
|
||||
#pragma once
|
||||
#include <windows.h>
|
||||
#include <tlhelp32.h>
|
||||
#include <memory>
|
||||
#include <utility> // for std::forward
|
||||
|
||||
namespace WinApi
|
||||
{
|
||||
struct HandleDeleter
|
||||
{
|
||||
void operator()(HANDLE h) const noexcept
|
||||
{
|
||||
if (h && h != INVALID_HANDLE_VALUE) CloseHandle(h);
|
||||
}
|
||||
};
|
||||
|
||||
using UniqueHandle = std::unique_ptr<std::remove_pointer<HANDLE>::type, HandleDeleter>;
|
||||
|
||||
template <typename F>
|
||||
struct ScopeExit
|
||||
{
|
||||
F func;
|
||||
explicit ScopeExit(F&& f) noexcept : func(std::forward<F>(f)) {}
|
||||
~ScopeExit() noexcept { func(); }
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue