winstd::security_id SID structure wrapper introduced

This commit is contained in:
Simon Rozman 2017-05-22 08:22:57 +02:00
parent b09610fd5f
commit 7fac8e286f
2 changed files with 43 additions and 0 deletions

View File

@ -42,6 +42,7 @@ namespace winstd
class WINSTD_API user_impersonator; class WINSTD_API user_impersonator;
class WINSTD_API vmemory; class WINSTD_API vmemory;
class WINSTD_API reg_key; class WINSTD_API reg_key;
class WINSTD_API security_id;
} }
@ -825,6 +826,31 @@ namespace winstd
virtual void free_internal(); virtual void free_internal();
}; };
///
/// SID wrapper class
///
class WINSTD_API security_id : public handle<PSID>
{
HANDLE_IMPL(security_id)
public:
///
/// Closes a handle to the SID.
///
/// \sa [FreeSid function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa446631.aspx)
///
virtual ~security_id();
protected:
///
/// Closes a handle to the SID.
///
/// \sa [FreeSid function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa446631.aspx)
///
virtual void free_internal();
};
/// @} /// @}
} }

View File

@ -309,3 +309,20 @@ void winstd::reg_key::free_internal()
{ {
RegCloseKey(m_h); RegCloseKey(m_h);
} }
//////////////////////////////////////////////////////////////////////
// winstd::security_id
//////////////////////////////////////////////////////////////////////
winstd::security_id::~security_id()
{
if (m_h)
FreeSid(m_h);
}
void winstd::security_id::free_internal()
{
FreeSid(m_h);
}