ATLSecurity Sample: Demonstrates ATL Security Classes

The ATLSecurity sample shows how to use the ATL security classes to examine security settings.

Security noteSecurity Note

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To get samples and instructions for installing them:

To access samples from Visual Studio

  • On the Help menu, click Samples.

    By default, these samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\.

  • For the most recent version of this sample and a list of other samples, see Visual Studio Samples on the MSDN Web site.

Building and Running the Sample

To build this sample

  1. Open ATLSecurity.sln.

  2. On the Build menu, click Build Solution.

You can run the ATLSecurity sample at a command prompt or in the debugger. Passing -? as a parameter displays a Help message. For examples of the format of the names of various objects that ATLSecurity can examine, see SE_OBJECT_TYPE.

The Event subproject creates an event that has 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 at one command prompt, then run the following command at 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

See Also

Other Resources

ATL Samples