1
0
mirror of https://github.com/momo5502/hypervisor.git synced 2025-07-04 02:01:58 +00:00

Extract into library

This commit is contained in:
Maurice Heumann
2022-12-27 16:27:33 +01:00
parent f8f636a829
commit 28dd94f2ef
31 changed files with 279 additions and 237 deletions

View File

@ -0,0 +1,44 @@
#include "std_include.hpp"
#include "service_handle.hpp"
service_handle::service_handle()
: service_handle(nullptr)
{
}
service_handle::service_handle(const SC_HANDLE handle)
: handle_{handle}
{
}
service_handle::~service_handle()
{
if (this->handle_)
{
CloseServiceHandle(this->handle_);
this->handle_ = nullptr;
}
}
service_handle::service_handle(service_handle&& obj) noexcept
: service_handle()
{
this->operator=(std::move(obj));
}
service_handle& service_handle::operator=(service_handle&& obj) noexcept
{
if (this != &obj)
{
this->~service_handle();
this->handle_ = obj.handle_;
obj.handle_ = nullptr;
}
return *this;
}
service_handle::operator SC_HANDLE() const
{
return this->handle_;
}