#include "stdafx.h"
using namespace System;
using namespace System::Security;
using namespace System::Security::Principal;
using namespace System::Threading;
void main()
{
AppDomain::CurrentDomain->SetPrincipalPolicy(PrincipalPolicy::WindowsPrincipal);
WindowsPrincipal ^wPrinc = (WindowsPrincipal^)Thread::CurrentPrincipal;
Console::WriteLine("Is an Administrator?: {0}", wPrinc->IsInRole(WindowsBuiltInRole::Administrator));
Console::WriteLine("Is a Hacker?: {0}", wPrinc->IsInRole("Hacker"));
WindowsIdentity ^wIdent = (WindowsIdentity^)wPrinc->Identity;
Console::WriteLine("\nWindows Login Name: {0}", wIdent->Name);
Console::WriteLine("Authentication Type: {0}", wIdent->AuthenticationType);
Console::WriteLine("Is Authenticated: {0}", wIdent->IsAuthenticated);
Console::WriteLine("Is System Account: {0}", wIdent->IsSystem);
}