Sid.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace AppSecInc
4 {
5  namespace LSA
6  {
8  class Sid
9  {
10  private:
11  SID_NAME_USE m_use;
12  std::vector<byte> m_data;
13  public:
15  Sid();
17  Sid(const Sid& sid);
19  Sid(PSID psid, SID_NAME_USE use = SidTypeInvalid);
21  Sid(const std::wstring& sid_string, SID_NAME_USE use = SidTypeInvalid);
23  Sid& operator=(const Sid& sid);
25  Sid& operator=(PSID psid);
27  Sid& operator=(const std::wstring&);
29  std::wstring ToString() const;
31  std::wstring ToHexString() const;
33  DWORD GetLength() const;
35  PSID GetPSID() const;
37  operator PSID() const { return GetPSID(); }
39  SID_NAME_USE GetUse() const { return m_use; }
41  void Set(PSID psid, SID_NAME_USE use = SidTypeUnknown);
43  void Set(const std::wstring& sid_string, SID_NAME_USE use = SidTypeUnknown);
45  bool operator==(const Sid&) const;
47  bool operator==(PSID) const;
49  bool IsValid() const;
50  };
51  }
52 }
53 
std::wstring ToHexString() const
return a hexidecimal string reperesntation of the sid.
Definition: Sid.cpp:63
DWORD GetLength() const
return the length of the SID
Definition: Sid.cpp:91
std::wstring ToString() const
return a string representation of a sid
Definition: Sid.cpp:54
Sid & operator=(const Sid &sid)
copy a sid
Definition: Sid.cpp:27
PSID GetPSID() const
return a PSID
Definition: Sid.cpp:98
bool IsValid() const
return true if SID is valid
Definition: Sid.cpp:117
Security identifier: a data structure of variable length that identifies user, group, and computer accounts.
Definition: Sid.h:8
SID_NAME_USE GetUse() const
return the type of sid
Definition: Sid.h:39
void Set(PSID psid, SID_NAME_USE use=SidTypeUnknown)
set sid
Definition: Sid.cpp:81
bool operator==(const Sid &) const
compare two sids
Definition: Sid.cpp:104
Sid()
default constructor
Definition: Sid.cpp:6


© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com