Listing 7 Enumerating an ACL
// from ACL.h namespace SynSoft { namespace Security { public __gc class ACL : public IEnumerable , public IDisposable { public: ACL(PACL pacl); // IDisposable public: void Close(); void Dispose(); // IEnumerable public: IEnumerator* GetEnumerator(); // Properties public: __property Int32 get_Count(); String *ToString(); // Members private: UInt32 m_revision; ArrayList *m_aces; }; } } // GroupList.cpp ACL::ACL(PACL pacl) : m_aces(new ArrayList(pacl->AceCount)) , m_revision(pacl->AclRevision) { using winstl::acl_sequence; acl_sequence aces(pacl); acl_sequence::const_iterator begin = aces.begin(); acl_sequence::const_iterator end = aces.end(); for(; begin != end; ++begin) { PACE_HEADER header = *begin; switch(header->AceType) { case ACCESS_ALLOWED_ACE_TYPE: m_aces->Add(new AccessAllowedACE(header)); break; case ACCESS_DENIED_ACE_TYPE: m_aces->Add(new AccessDeniedACE(header)); break; case SYSTEM_AUDIT_ACE_TYPE: m_aces->Add(new SystemAuditACE(header)); break; } } }