Esempio n. 1
0
        private static string GetFirstClientKey(WowRegistryKey key)
        {
            string homeKey = null;

            if (key != null)
            {
                string[] keys = key.GetSubKeyNames();
                int      i    = 0;

                while ((i < keys.Length) && (homeKey == null))
                {
                    if (keys[i].StartsWith("KEY_Everest") ||
                        keys[i].StartsWith("KEY_OraClient") ||
                        keys[i].StartsWith("KEY_OraOdac"))
                    {
                        homeKey = registryPrefix + @"\" + keys[i];
                    }
                    else
                    {
                        i++;
                    }
                }
            }

            return(homeKey);
        }
Esempio n. 2
0
        public void GetSubKeyNamesTest()
        {
            WowRegistryKey key = WowRegistry.LocalMachine.OpenSubKey(@"SOFTWARE\Oracle");

            string[] names = key.GetSubKeyNames();
            Assert.IsNotNull(names);
            Assert.IsTrue(names.Length > 0);

            foreach (string name in names)
            {
                Console.WriteLine(String.Format("Subkey name=[{0}]", name));
            }
        }
Esempio n. 3
0
        // Different versions of Oracle place the ODP.NET key in different locations
        // under the HKLM\SOFTWARE\ORACLE key.  So recurse down the subtree until it
        // is found.

        private static bool HasOdpNetKey(WowRegistryKey key)
        {
            string[] keys  = key.GetSubKeyNames();
            bool     found = false;
            int      i     = 0;

            while ((i < keys.Length) && !found)
            {
                if (!(found = keys[i].Equals("ODP.NET")))
                {
                    if (!(found = HasOdpNetKey(key.OpenSubKey(keys[i]))))
                    {
                        i++;
                    }
                }
            }

            return(found);
        }
Esempio n. 4
0
        private static string GetHomeKey(WowRegistryKey key)
        {
            string homeKey = (string)key.GetValue("ORACLE_HOME_KEY");

            if ((homeKey == null) && (key != null))
            {
                string[] keys = key.GetSubKeyNames();
                int      i    = 0;

                while ((i < keys.Length) && (homeKey == null))
                {
                    var subkey = key.OpenSubKey(keys[i]);
                    if ((homeKey = GetHomeKey(subkey)) == null)
                    {
                        i++;
                    }
                }
            }

            return(homeKey);
        }