Esempio n. 1
0
        void ModSecVal(cLightning.ROOT_KEY RootKey, string SubKey, cSecurity.InheritenceFlags flags)
        {
            string sKey = RootKey.ToString();
            cSecurity sec = new cSecurity();
            string name = sec.UserName(cSecurity.EXTENDED_NAME_FORMAT.NameSamCompatible) ?? sec.UserName();

            sKey += @"\" + SubKey;
            sec.ChangeObjectOwnership(sKey, cSecurity.SE_OBJECT_TYPE.SE_REGISTRY_KEY);
            sec.ChangeKeyPermissions((cSecurity.ROOT_KEY)RootKey, SubKey, name, cSecurity.RegistryAccess.Registry_Full_Control,
                                     cSecurity.AccessTypes.Access_Allowed, flags);
        }
Esempio n. 2
0
        //store: root, subkey, value, path, id
        //scandata: key root, string key, string value, string path, string img, string name, int scope, int id
        void StoreResults(cLightning.ROOT_KEY root, string subkey, string value, string data, RESULT_TYPE id)
        {
            // ****************************************************
            // Trying to check registry key permissions
            // ****************************************************
            try
            {
                var permission = new RegistryPermission(RegistryPermissionAccess.Write, root.ToString());
                permission.Demand();
            }
            catch (System.Security.SecurityException ex)
            {
                return;
            }
            // ****************************************************
            // Trying to check registry key permissions
            // ****************************************************

            if (_oProcessAsyncBackgroundWorker != null && _oProcessAsyncBackgroundWorker.CancellationPending)
            {
                return;
            }

            int i = (int)id;
            if (value.Length == 0)
            {
                value = STR_DEFAULT;
            }
            Data.Add(new ScanData(root, subkey, value, data, "", IdConverter(id), IdToScope(i), i));
            // notify
            MatchItem(root, subkey, value, data, id);
        }