ATLSecurity Sample: Demonstrates ATL Security Classes
The ATLSecurity sample shows how to use the ATL security classes to examine security settings.
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.
Building and Running the Sample
To build this sample
Open the solution file ATLSecurity.sln.
From the Build menu, click Build Solution.
You can run the ATLSecurity sample from a command prompt or the debugger. Passing -? as a parameter displays a help message. To get examples of the format of the names of various objects ATLSecurity can examine, see the documentation for the SE_OBJECT_TYPE enumeration.
The Event subproject creates an event with the name MyEvent and a DACL that gives everyone read access to the event and gives the Administrator and Localsystem full access to the event. The Event subproject demonstrates how to use the ATL security classes to build a DACL and gives a target for the ATLSecurity sample.
Event.exe will create an event and wait for a keypress. To use it with ATLSecurity.exe, run Event.exe from one command prompt, then run the following from another command prompt:
ATLSecurity –kernel MyEvent
This sample shows how to use the following classes:
CSid, CAcl, CDacl, CSacl, CSecurityDesc, CSecurityAttributes, CTokenGroups, CTokenPrivileges, CAccessToken