Support copying

This commit is contained in:
momo5502 2022-04-24 11:13:37 +02:00
parent 4a3958d149
commit 1b14d5f657
2 changed files with 24 additions and 2 deletions

View File

@ -35,6 +35,28 @@ namespace process
return *this;
}
process_handle::process_handle(const process_handle& obj)
{
this->operator=(std::move(obj));
}
process_handle& process_handle::operator=(const process_handle& obj)
{
if (this != &obj)
{
this->release();
this->own_ = obj.own_;
this->handle_ = obj.handle_;
if(this->own_ && this->handle_)
{
ObReferenceObject(this->handle_);
}
}
return *this;
}
process_handle::operator bool() const
{
return this->handle_ != nullptr;

View File

@ -12,8 +12,8 @@ namespace process
process_handle(process_handle&& obj) noexcept;
process_handle& operator=(process_handle&& obj) noexcept;
process_handle(const process_handle&) = delete;
process_handle& operator=(const process_handle&) = delete;
process_handle(const process_handle& obj);
process_handle& operator=(const process_handle& obj);
operator bool() const;
operator PEPROCESS() const;