Code of grant full access to everyone

 

#include <atlsecurity.h>

try
{
    CDacl dacl;
    dacl.AddAllowedAce(Sids::World(), GENERIC_ALL | FILE_ALL_ACCESS);
    AtlSetDacl(pszPath, SE_FILE_OBJECT, dacl);
}
catch(…){}

And check whether current process was running interactive:

bool b = false;
try
{
    CAccessToken token;
    token.GetProcessToken(TOKEN_QUERY);

    CTokenGroups groups;
    token.GetGroups(&groups);
    b = groups.LookupSid(Sids::Interactive());
}
catch(){}

Advertisements

Posted on April 1, 2009, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: