Public Type TRUSTEE
pMultipleTrustee As Long
MultipleTrusteeOperation As MULTIPLE_TRUSTEE_OPERATION
TrusteeForm As TRUSTEE_FORM
TrusteeType As TRUSTEE_TYPE
ptstrName As Long
End Type
Public Type EXPLICIT_ACCESS
grfAccessPermissions As Long
grfAccessMode As ACCESS_MODE
grfInheritance As Long
TRUSTEE As TRUSTEE
End Type
Private Sub Get_FilePermissions()
Dim p_typObjType As SE_OBJECT_TYPE
Dim p_objFilePerms As clsFilePermissions
Dim p_atypExplicitAccess()As EXPLICIT_ACCESS
If m_strFilePath = Empty Then Exit Sub
p_typObjType = SE_FILE_OBJECT
p_lngRtn = _
GetNamedSecurityInfo(pObjectName:=m_strFilePath, _
ObjectType:=p_typObjType, _
SecurityInfo:=DACL_SECURITY_INFORMATION, _
ppsidOwner:=0&, ppsidGroup:=0&, _
ppDacl:=p_lngPtrDACL, ppSacl:=0&, _
ppSecurityDescriptor:=p_lngPtrSecureDescriptor)
' Deal with error if p_lngRtn <> ERROR_SUCCESS
p_lngRtn = GetExplicitEntriesFromAcl( _
pACL:=p_lngPtrDACL, _
pcCountOfExplicitEntries:=p_lngCountExplicitEntries, _
pListOfExplicitEntries:=p_lngListExplicitEntries)
' Deal with error if p_lngRtn <> ERROR_SUCCESS
If p_lngCountExplicitEntries > 0 Then
ReDim p_atypExplicitAccess(0 To _
p_lngCountExplicitEntries - 1) As EXPLICIT_ACCESS
CopyMem p_atypExplicitAccess(0), ByVal p_lngListExplicitEntries, _
Len(p_atypExplicitAccess(0)) * p_lngCountExplicitEntries
p_lngCurrIdx = 0
For p_lngLoop = 0 To p_lngCountExplicitEntries - 1
With p_atypExplicitAccess(p_lngLoop)
' Also get Trustee name, abbreviated name, and the type of icon
p_strAccessRights = m_objGeneral.AccessRights _
(.grfAccessMode, .grfAccessPermissions)
Add TrusteeName:=p_strTrusteeName, AbbreviatedName:=p_strAbbrName, _
AccessPermissions:=.grfAccessPermissions, _
AccessRights:=p_strAccessRights, _
AccessMode:=.grfAccessMode, TrusteeType:=.TRUSTEE.TrusteeType, _
TrusteeForm:=.TRUSTEE.TrusteeForm, Icon:=p_typIcon, _
sKey:="C" & CStr(p_lngCurrIdx)
p_lngCurrIdx = p_lngCurrIdx + 1
End With
Next p_lngLoop
End If
If p_lngPtrSecureDescriptor <> 0 Then LocalFree p_lngPtrSecureDescriptor
If p_lngPtrDACL <> 0 Then LocalFree p_lngPtrDACL
If p_lngListExplicitEntries <> 0 Then LocalFree p_lngListExplicitEntries
End Sub
|