mirror of
https://github.com/momo5502/hypervisor.git
synced 2025-04-19 13:42:55 +00:00
Support copying
This commit is contained in:
parent
4a3958d149
commit
1b14d5f657
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user