Beispiel #1
0
        public static RegistryKey GetWritableRegistryKey(string keyPath)
        {
            RegistryKey key = RegistrySeeker.GetRootKey(keyPath);

            if (key != null)
            {
                //Check if this is a root key or not
                if (key.Name != keyPath)
                {
                    //Must get the subKey name by removing root and '\\'
                    string subKeyName = keyPath.Substring(key.Name.Length + 1);

                    key = key.OpenWritableSubKeySafe(subKeyName);
                }
            }

            return(key);
        }
Beispiel #2
0
        public void HandleGetRegistryKey(TcpSocketSaeaSession session)
        {
            DoLoadRegistryKeyPack       packet         = GetMessageEntity <DoLoadRegistryKeyPack>(session);
            GetRegistryKeysResponsePack responsePacket = new GetRegistryKeysResponsePack();

            try
            {
                RegistrySeeker seeker = new RegistrySeeker();
                seeker.BeginSeeking(packet.RootKeyName);

                responsePacket.Matches = seeker.Matches;
                responsePacket.IsError = false;
            }
            catch (Exception e)
            {
                responsePacket.IsError  = true;
                responsePacket.ErrorMsg = e.Message;
            }
            responsePacket.RootKey = packet.RootKeyName;
            SendTo(CurrentSession, MessageHead.C_NREG_LOAD_REGKEYS, responsePacket);
        }