public static void SavePolicy()
{
if (InitPolicy())
{
polmgr.Save();
}
// We have serious issues with setting security on in a running process, therefore
// we go through some hoops to persist security on changes to the registry without
// affecting the running process.
if (needToSetSecurityOn)
{
// Grab the flags, set security on, save those flags, revert back to the original
int originalFlags = GetGlobalFlags();
SetGlobalFlags(SecurityOff, 0);
SaveGlobalFlags();
SetGlobalFlags(originalFlags, originalFlags);
}
else
{
SaveGlobalFlags();
}
}