Click here to Skip to main content
11,638,881 members (69,140 online)
Click here to Skip to main content
Add your own
alternative version

NT Security Classes for .NET

, 19 Feb 2004 CPOL 292.4K 3.6K 75
A collection of .NET classes written in Managed C++ that faciliate the manipulation of NT security rights
// =========================================================================
// enums.h - CLR enumerations for manipulating NT security objects
// =========================================================================

#pragma once

using namespace System;

namespace mmsseclib
{
	public __value enum SecuredObjectType
	{
		UnknownObjectType = 0,
		FileObject,
		Service,
		Printer,
		RegistryKey,
		LMShare,
		KernelObject,
		WindowObject,
		DSObject,
		DSObjectAll,
		ProviderDefinedObject,
		WMIGuidObject,
		RegistryWOW64_32Key
	};

	[System::FlagsAttribute]
	public __value enum AccessRights : System::UInt32
	{
		FileFullControl = FILE_ALL_ACCESS,
		FileRead = FILE_GENERIC_READ,
		FileWrite = FILE_GENERIC_WRITE,
		FileExecute = FILE_GENERIC_EXECUTE,
		FileReadExecute = (FILE_GENERIC_READ | FILE_GENERIC_EXECUTE),
		FileModify = (FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE | DELETE),
		FileReadUnsync = STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA,
		FileWriteUnsync = FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA,
		FileReadExecuteUnsync = (FILE_GENERIC_READ | FILE_GENERIC_EXECUTE) & (~SYNCHRONIZE),
		/*FileListDirectory = FILE_LIST_DIRECTORY,
		FileAddFile = FILE_ADD_FILE,
		FileAddSubdirectory = FILE_ADD_SUBDIRECTORY,*/

		KeyAllAccess = KEY_ALL_ACCESS,
		KeyRead = KEY_READ,
		KeyWrite = KEY_WRITE,
		KeyExecute = KEY_EXECUTE,
		/*
		DsReadProp = ADS_RIGHT_DS_READ_PROP,
		DsWriteProp = ADS_RIGHT_DS_WRITE_PROP,
		DsCreateChild = ADS_RIGHT_DS_CREATE_CHILD,
		DsDeleteChild = ADS_RIGHT_DS_DELETE_CHILD,
		DsList = ADS_RIGHT_DS_LIST,
		DsSelf = ADS_RIGHT_DS_SELF,
		DsListObject = ADS_RIGHT_DS_LIST_OBJECT,
		DsDeleteTree = ADS_RIGHT_DS_DELETE_TREE,
		DsControlAccess = ADS_RIGHT_DS_CONTROL_ACCESS,
		*/
		GenericRead = GENERIC_READ,
		GenericWrite = GENERIC_WRITE,
		GenericExecute = GENERIC_EXECUTE,
		GenericAll = GENERIC_ALL,

		Delete = DELETE,
		ReadControl = READ_CONTROL,
		WriteDac = WRITE_DAC,
		WriteOwner = WRITE_OWNER,
		Synchronize = SYNCHRONIZE,

		StandardRightsAll = STANDARD_RIGHTS_ALL,
		SpecificRightsAll = SPECIFIC_RIGHTS_ALL,
	};

	public __value enum AceType : System::Byte
	{
		AccessAllowed = ACCESS_ALLOWED_ACE_TYPE,
		AccessDenied = ACCESS_DENIED_ACE_TYPE,
		SystemAudit = SYSTEM_AUDIT_ACE_TYPE,
		SystemAlarm = SYSTEM_ALARM_ACE_TYPE,
//		AccessAllowedCompound = 0x4,
		AccessAllowedObject = ACCESS_ALLOWED_OBJECT_ACE_TYPE,
		AccessDeniedObject = ACCESS_DENIED_OBJECT_ACE_TYPE,
		SystemAuditObject = SYSTEM_AUDIT_OBJECT_ACE_TYPE,
		SystemAlarmObject = SYSTEM_ALARM_OBJECT_ACE_TYPE,
//		AccessAllowedCallback = 0x9,
//		AccessDeniedCallback = 0xA,
//		AccessAllowedCallbackObject = 0xB,
//		AccessDeniedCallbackObject = 0xC,
//		SystemAuditCallback = 0xD,
//		SystemAlarmCallback = 0xE,
//		SystemAuditCallbackObject = 0xF,
//		SystemAlarmCallbackObject = 0x10,
		Undefined = 0xFF,
	};

	[System::FlagsAttribute]
	public __value enum AceInheritanceFlags : System::Byte
	{
		ObjectInherit = OBJECT_INHERIT_ACE,
		ContainerInherit = CONTAINER_INHERIT_ACE,
		NoPropagateInherit = NO_PROPAGATE_INHERIT_ACE,
		InheritOnly = INHERIT_ONLY_ACE,
		Inherited = INHERITED_ACE,
		SuccessfulAccess = SUCCESSFUL_ACCESS_ACE_FLAG,
		FailedAccess = FAILED_ACCESS_ACE_FLAG,
	};

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

David Hall
Chief Technology Officer
United States United States
I have been a Windows software developer since 1991. Most of what I create fills the need for some aspect of bigger projects that I consult on.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150728.1 | Last Updated 20 Feb 2004
Article Copyright 2002 by David Hall
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid