ATLSecurity Sample: Demonstrates ATL Security Classes
The ATLSecurity sample shows how to use the ATL security classes to examine security settings.
Security Note: |
---|
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. |
To get samples and instructions for installing them:
On the Visual Studio Help menu, click Samples.
For more information, see Visual Studio Samples.
The most recent version and complete list of samples is available online from the Visual Studio 2008 Samples page.
You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied into a folder under \Program Files\Visual Studio 9.0\Samples\. For Express editions of Visual Studio, all samples are located online.
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
Keywords
This sample shows how to use the following classes:
CSid, CAcl, CDacl, CSacl, CSecurityDesc, CSecurityAttributes, CTokenGroups, CTokenPrivileges, CAccessToken