ReactOS  0.4.14-dev-358-gbef841c
CSecurityDescriptor Class Reference

#include <SecurityDescriptor.h>

Collaboration diagram for CSecurityDescriptor:

Public Types

enum  ACEntryType { Unknown, AccessAlowed, AccessDenied, SystemAudit }
 

Public Member Functions

void GetCurrentACE_Flags (BYTE &bFlags)
 
void GetCurrentACE_AccessMask (DWORD &dwMask)
 
PSID GetCurrentACE_SID ()
 
ACEntryType GetDACLEntry (DWORD nIndex)
 
ACEntryType GetSACLEntry (DWORD nIndex, BOOL &blnFailedAccess, BOOL &blnSeccessfulAccess)
 
DWORD GetDACLEntriesCount ()
 
DWORD GetSACLEntriesCount ()
 
BOOL HasValidDACL ()
 
BOOL HasNULLDACL ()
 
BOOL HasValidSACL ()
 
BOOL HasNULLSACL ()
 
BOOL DescriptorContainsDACL ()
 
BOOL DescriptorContainsSACL ()
 
DWORD BeginDACLInteration ()
 
DWORD BeginSACLInteration ()
 
void AssociateDescriptor (PSECURITY_DESCRIPTOR pSecurityDescriptor)
 
 CSecurityDescriptor ()
 
virtual ~CSecurityDescriptor ()
 

Private Attributes

PSECURITY_DESCRIPTOR m_pSecurityDescriptor
 
BOOL m_blnDACLPresent
 
BOOL m_blnDACLDefaulted
 
PACL m_pDACL
 
BOOL m_blnSACLPresent
 
BOOL m_blnSACLDefaulted
 
PACL m_pSACL
 
ACE_HEADERm_pCurrentACEHeader
 

Detailed Description

Definition at line 17 of file SecurityDescriptor.h.

Member Enumeration Documentation

◆ ACEntryType

Constructor & Destructor Documentation

◆ CSecurityDescriptor()

CSecurityDescriptor::CSecurityDescriptor ( )

Definition at line 135 of file SecurityDescriptor.cpp.

136 {
139 }
smooth NULL
Definition: ftsmooth.c:416
ACE_HEADER * m_pCurrentACEHeader
PSECURITY_DESCRIPTOR m_pSecurityDescriptor

◆ ~CSecurityDescriptor()

CSecurityDescriptor::~CSecurityDescriptor ( )
virtual

Definition at line 141 of file SecurityDescriptor.cpp.

142 {
143 }

Member Function Documentation

◆ AssociateDescriptor()

void CSecurityDescriptor::AssociateDescriptor ( PSECURITY_DESCRIPTOR  pSecurityDescriptor)

Definition at line 145 of file SecurityDescriptor.cpp.

146 {
147  m_pSecurityDescriptor = pSecurityDescriptor;
148 }
PSECURITY_DESCRIPTOR m_pSecurityDescriptor

◆ BeginDACLInteration()

DWORD CSecurityDescriptor::BeginDACLInteration ( )

Definition at line 150 of file SecurityDescriptor.cpp.

151 {
153  {
154  throw GetLastError();
155  }
156  return ERROR_SUCCESS;
157 }
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL *pDacl, LPBOOL lpbDaclDefaulted)
Definition: sec.c:45
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
PSECURITY_DESCRIPTOR m_pSecurityDescriptor

◆ BeginSACLInteration()

DWORD CSecurityDescriptor::BeginSACLInteration ( )

Definition at line 164 of file SecurityDescriptor.cpp.

165 {
167  throw GetLastError();
168  return ERROR_SUCCESS;
169 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbSaclPresent, PACL *pSacl, LPBOOL lpbSaclDefaulted)
Definition: sec.c:146
PSECURITY_DESCRIPTOR m_pSecurityDescriptor

◆ DescriptorContainsDACL()

BOOL CSecurityDescriptor::DescriptorContainsDACL ( )

Definition at line 159 of file SecurityDescriptor.cpp.

160 {
161  return m_blnDACLPresent;
162 }

◆ DescriptorContainsSACL()

BOOL CSecurityDescriptor::DescriptorContainsSACL ( )

Definition at line 171 of file SecurityDescriptor.cpp.

172 {
173  return m_blnSACLPresent;
174 }

◆ GetCurrentACE_AccessMask()

void CSecurityDescriptor::GetCurrentACE_AccessMask ( DWORD dwMask)

Definition at line 265 of file SecurityDescriptor.cpp.

266 {
269  {
271  dwMask = (((ACCESS_ALLOWED_ACE *)m_pCurrentACEHeader)->Mask);
272  return;
274  dwMask = (((ACCESS_DENIED_ACE *)m_pCurrentACEHeader)->Mask);
275  return;
277  dwMask = (((SYSTEM_AUDIT_ACE *)m_pCurrentACEHeader)->Mask);
278  return;
279  default:
280  ASSERT(FALSE); // Do not call this function for unknown ACE types !!!
281  return;
282  }
283 }
smooth NULL
Definition: ftsmooth.c:416
ACE_HEADER * m_pCurrentACEHeader
#define ACCESS_ALLOWED_ACE_TYPE
Definition: setypes.h:685
#define ACCESS_DENIED_ACE_TYPE
Definition: setypes.h:686
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
UCHAR AceType
Definition: ms-dtyp.idl:210
#define SYSTEM_AUDIT_ACE_TYPE
Definition: setypes.h:687

◆ GetCurrentACE_Flags()

void CSecurityDescriptor::GetCurrentACE_Flags ( BYTE bFlags)

Definition at line 285 of file SecurityDescriptor.cpp.

286 {
288  bFlags = m_pCurrentACEHeader->AceFlags;
289 }
UCHAR AceFlags
Definition: ms-dtyp.idl:211
smooth NULL
Definition: ftsmooth.c:416
ACE_HEADER * m_pCurrentACEHeader
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

◆ GetCurrentACE_SID()

PSID CSecurityDescriptor::GetCurrentACE_SID ( )

Definition at line 248 of file SecurityDescriptor.cpp.

249 {
252  {
254  return ((PSID)&(((ACCESS_ALLOWED_ACE *)m_pCurrentACEHeader)->SidStart));
256  return ((PSID)&(((ACCESS_DENIED_ACE *)m_pCurrentACEHeader)->SidStart));
258  return ((PSID)&(((SYSTEM_AUDIT_ACE *)m_pCurrentACEHeader)->SidStart));
259  default:
260  ASSERT(FALSE); // Do not call this function for unknown ACE types !!!
261  return NULL;
262  }
263 }
smooth NULL
Definition: ftsmooth.c:416
ACE_HEADER * m_pCurrentACEHeader
#define ACCESS_ALLOWED_ACE_TYPE
Definition: setypes.h:685
#define ACCESS_DENIED_ACE_TYPE
Definition: setypes.h:686
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
UCHAR AceType
Definition: ms-dtyp.idl:210
#define SYSTEM_AUDIT_ACE_TYPE
Definition: setypes.h:687

◆ GetDACLEntriesCount()

DWORD CSecurityDescriptor::GetDACLEntriesCount ( )

Definition at line 202 of file SecurityDescriptor.cpp.

203 {
204  ACL_SIZE_INFORMATION SizeInfo;
205  if (!GetAclInformation(m_pDACL,&SizeInfo,sizeof(SizeInfo),AclSizeInformation))
206  throw GetLastError();
207  return SizeInfo.AceCount;
208 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI GetAclInformation(PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass)
Definition: security.c:1073

◆ GetDACLEntry()

CSecurityDescriptor::ACEntryType CSecurityDescriptor::GetDACLEntry ( DWORD  nIndex)

Definition at line 218 of file SecurityDescriptor.cpp.

219 {
220  void *pACE;
221  if (!GetAce(m_pDACL,nIndex,&pACE)) throw GetLastError();
224  {
225  return AccessAlowed;
226  }
228  {
229  return AccessDenied;
230  }
231  return Unknown;
232 }
struct _ACE_HEADER * PACE_HEADER
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
ACE_HEADER * m_pCurrentACEHeader
#define ACCESS_ALLOWED_ACE_TYPE
Definition: setypes.h:685
#define ACCESS_DENIED_ACE_TYPE
Definition: setypes.h:686
UCHAR AceType
Definition: ms-dtyp.idl:210
BOOL WINAPI GetAce(PACL pAcl, DWORD dwAceIndex, LPVOID *pAce)
Definition: security.c:1065

◆ GetSACLEntriesCount()

DWORD CSecurityDescriptor::GetSACLEntriesCount ( )

Definition at line 210 of file SecurityDescriptor.cpp.

211 {
212  ACL_SIZE_INFORMATION SizeInfo;
213  if (!GetAclInformation(m_pSACL,&SizeInfo,sizeof(SizeInfo),AclSizeInformation))
214  throw GetLastError();
215  return SizeInfo.AceCount;
216 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI GetAclInformation(PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass)
Definition: security.c:1073

◆ GetSACLEntry()

CSecurityDescriptor::ACEntryType CSecurityDescriptor::GetSACLEntry ( DWORD  nIndex,
BOOL blnFailedAccess,
BOOL blnSeccessfulAccess 
)

Definition at line 234 of file SecurityDescriptor.cpp.

235 {
236  void *pACE;
237  if (!GetAce(m_pSACL,nIndex,&pACE)) throw GetLastError();
240  {
243  return SystemAudit;
244  }
245  return Unknown;
246 }
UCHAR AceFlags
Definition: ms-dtyp.idl:211
struct _ACE_HEADER * PACE_HEADER
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define SUCCESSFUL_ACCESS_ACE_FLAG
Definition: setypes.h:721
#define FAILED_ACCESS_ACE_FLAG
Definition: setypes.h:722
ACE_HEADER * m_pCurrentACEHeader
UCHAR AceType
Definition: ms-dtyp.idl:210
BOOL WINAPI GetAce(PACL pAcl, DWORD dwAceIndex, LPVOID *pAce)
Definition: security.c:1065
#define SYSTEM_AUDIT_ACE_TYPE
Definition: setypes.h:687

◆ HasNULLDACL()

BOOL CSecurityDescriptor::HasNULLDACL ( )

Definition at line 176 of file SecurityDescriptor.cpp.

177 {
179  return (m_pDACL == NULL);
180 }
smooth NULL
Definition: ftsmooth.c:416
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

◆ HasNULLSACL()

BOOL CSecurityDescriptor::HasNULLSACL ( )

Definition at line 189 of file SecurityDescriptor.cpp.

190 {
192  return (m_pSACL == NULL);
193 }
smooth NULL
Definition: ftsmooth.c:416
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

◆ HasValidDACL()

BOOL CSecurityDescriptor::HasValidDACL ( )

Definition at line 182 of file SecurityDescriptor.cpp.

183 {
185  ASSERT(m_pDACL != NULL);
186  return IsValidAcl(m_pDACL);
187 }
BOOL WINAPI IsValidAcl(PACL pAcl)
Definition: security.c:1088
smooth NULL
Definition: ftsmooth.c:416
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

◆ HasValidSACL()

BOOL CSecurityDescriptor::HasValidSACL ( )

Definition at line 195 of file SecurityDescriptor.cpp.

196 {
198  ASSERT(m_pSACL != NULL);
199  return IsValidAcl(m_pSACL);
200 }
BOOL WINAPI IsValidAcl(PACL pAcl)
Definition: security.c:1088
smooth NULL
Definition: ftsmooth.c:416
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

Member Data Documentation

◆ m_blnDACLDefaulted

BOOL CSecurityDescriptor::m_blnDACLDefaulted
private

Definition at line 48 of file SecurityDescriptor.h.

Referenced by BeginDACLInteration().

◆ m_blnDACLPresent

BOOL CSecurityDescriptor::m_blnDACLPresent
private

◆ m_blnSACLDefaulted

BOOL CSecurityDescriptor::m_blnSACLDefaulted
private

Definition at line 51 of file SecurityDescriptor.h.

Referenced by BeginSACLInteration().

◆ m_blnSACLPresent

BOOL CSecurityDescriptor::m_blnSACLPresent
private

◆ m_pCurrentACEHeader

ACE_HEADER* CSecurityDescriptor::m_pCurrentACEHeader
private

◆ m_pDACL

PACL CSecurityDescriptor::m_pDACL
private

◆ m_pSACL

PACL CSecurityDescriptor::m_pSACL
private

◆ m_pSecurityDescriptor

PSECURITY_DESCRIPTOR CSecurityDescriptor::m_pSecurityDescriptor
private

The documentation for this class was generated from the following files: