Click here to Skip to main content
Licence 
First Posted 3 Apr 2003
Views 79,984
Bookmarked 33 times

CNTFS - A simple lib for managing NTFS permissions and audit settings.

By | 22 Oct 2003 | Article
CNTFS is a simple lib for setting NTFS permissions and audit settings.

Sample Image - ACLEditor.jpg

Introduction

CNTFS lib is a simple C++ wrapper for many of the Microsoft security calls such as: GetNamedSecurityInfo, GetAclInformation, AddAccessAllowedAceEx and many others. CNTFS is used to set NTFS permissions and audit settings on files and folders. It's a programmatic alternative to using utilities such as xcacls.exe.

Interface

The following methods are supported in the lib:

int DeleteDACL(CString & I_objPath, BOOL I_removeInheritance)

int DeleteSACL(CString & I_objPath, BOOL I_removeInheritance)

int RemoveInheritance(CString & I_objPath)

int TakeOwnership(CString & I_objPath, CString & I_newOwner)

int AddACEToDACL(CString & I_objPath, 
                 CString & I_securityPrincipal, 
                 DWORD I_objPermission)

int AddACEToSACL(CString & I_objPath, 
                 CString & I_securityPrincipal, 
                 DWORD I_objPermission,
                 BOOL I_auditSuccess,
                 BOOL I_auditFailure)

ACLEditor

ACLEditor is a test application for the CNTFS lib. One of the more tricky aspects of CNTFS is the use of access mask flags. Winnt.h defines access mask flags that can be OR'd together. For example, the Modify permission consists of: FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE | DELETE. Among other things, ACLEditor demonstrates the use of access masks in setting NTFS permissions.

Building

Be sure to have the Microsoft Platform SDK in c:\program files\Microsoft SDK. The project settings will reference the include files directory. I've run the lib through Rational Purify so all the mem leaks should be gone.

Any comments or suggestions are welcome.

Enjoy!

Version History

  • Version 1.1 - (Oct 23, 2003) Added support for modifying DACLs and SACLs on registry keys. Consolidated RemoveDACLInheritance and RemoveSACLInheritance into RemoveInheritance method by adding aclType enum.
  • Version 1.0 - (Apr 4, 2003) Initial Release.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Kevin Hilscher

Web Developer

Canada Canada

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
BugDoes not work on Windows 7 Pinmemberrhythm7:37 16 May '12  
GeneralBug in ResolveSID Pinmemberbrianbacon6:26 15 Jan '11  
Generalsome wrong on 2t disk simulator Pinmembernhchmg22:54 15 Dec '10  
GeneralMy vote of 4 :) PinmemberKushagra Tiwari22:57 3 Nov '09  
QuestionDelete account PinmemberJack691048712:53 21 Oct '08  
GeneralCrash on FAT file system PinmemberMember 36743902:07 4 Aug '08  
QuestionCNTFS Java Example ? Pinmemberbelaie_maqsood11:02 27 Apr '06  
Generalhelp !! it's not working in this case PinsussAnonymous16:26 26 Aug '05  
QuestionWhat about NetFileEnum() PinmemberAlex Evans23:40 28 Oct '04  
GeneralPerfect PinmemberSteve Schaneville7:22 21 Oct '03  
GeneralRe: Perfect PinmemberAlex Evans23:43 28 Oct '04  
GeneralERROR- Missing More Files !!! PinmemberTV Mogul6:25 11 Apr '03  
GeneralRe: ERROR- Missing More Files !!! PinmemberAndreas Saurwein6:41 11 Apr '03  
GeneralRe: ERROR- Missing More Files !!! Pinmemberyaron_gvili6:10 18 Apr '04  
QuestionRe: ERROR- Missing More Files !!! Pinmembertlongman15:17 7 Jan '07  
GeneralAddAccessAllowedAceEx - Only availabe on win 2000 and later PinmemberChristoph Weber22:39 7 Apr '03  
GeneralRe: AddAccessAllowedAceEx - Only availabe on win 2000 and later PinmemberKevin Hilscher16:53 8 Apr '03  
GeneralWarning: Code Won't Compile! PinmemberTV Mogul1:22 6 Apr '03  
GeneralRe: Warning: Code Won't Compile! PinmemberRyan Binns4:02 6 Apr '03  
GeneralRe: Warning: Code Won't Compile! PinmemberTV Mogul6:06 7 Apr '03  
GeneralRe: Warning: Code Won't Compile! PinmemberRyan Binns13:48 7 Apr '03  
GeneralRe: Warning: Code Won't Compile! Pinmemberkhilscher5:09 6 Apr '03  
GeneralRe: Warning: Code Won't Compile! PinsussAnonymous23:40 24 Jun '05  
Generaldemo project size Pinmember.S.Rod.4:45 5 Apr '03  
GeneralRe: demo project size Pinmemberkhilscher12:39 5 Apr '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 23 Oct 2003
Article Copyright 2003 by Kevin Hilscher
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid