Exemplo n.º 1
0
        public static bool AssertControlAccessRights([NotNull] this ServiceController thisValue, [NotNull] SecurityIdentifier sid)
        {
            ServiceControllerPermission scp = new ServiceControllerPermission(ServiceControllerPermissionAccess.Control, thisValue.MachineName, thisValue.ServiceName);

            scp.Demand();

            //ServiceAccessRights accessRights = GetEffectiveAccessRights(thisValue, sid);
            //return accessRights.HasFlag(ServiceAccessRights.QueryStatus | ServiceAccessRights.Start | ServiceAccessRights.Stop | ServiceAccessRights.PauseContinue);
            return(true);
        }