MapKeyPath() private method

Maps the Windows Installer key path to an appropriate registry path given the current process's bitness.
private MapKeyPath ( string keyPath ) : string
keyPath string The Windows Installer key path to map.
return string
Esempio n. 1
0
        public void MapKeyPathsIn64BitProcess()
        {
            var view = new RegistryView(true);
            Assert.IsTrue(view.Is64Bit);

            // Invalid paths.
            Assert.IsNull(view.MapKeyPath(null));
            Assert.IsNull(view.MapKeyPath("TRE"));
            Assert.IsNull(view.MapKeyPath("TEST"));

            // 32-bit paths.
            Assert.AreEqual(@"HKEY_CLASSES_ROOT\Wow6432Node\CLSID\", view.MapKeyPath(@"00:\CLSID\"), true);
            Assert.AreEqual(@"HKEY_CURRENT_USER\Software\Wow6432Node\Classes\CLSID\", view.MapKeyPath(@"01:\Software\Classes\CLSID\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Wow6432Node\TEST\", view.MapKeyPath(@"02:\Software\TEST\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\", view.MapKeyPath(@"02:\Software\Microsoft\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Microsoft\EventSystem\", view.MapKeyPath(@"02:\Software\Microsoft\EventSystem\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Wow6432Node\TEST\", view.MapKeyPath(@"02:\Software\Wow6432Node\TEST\"), true);
            Assert.AreEqual(@"HKEY_USERS\S-1-5-18\Software\Wow6432Node\Classes\CLSID\", view.MapKeyPath(@"03:\S-1-5-18\Software\Classes\CLSID\"), true);

            // 64-bit paths.
            Assert.AreEqual(@"HKEY_CLASSES_ROOT\CLSID\", view.MapKeyPath(@"20:\CLSID\"), true);
            Assert.AreEqual(@"HKEY_CURRENT_USER\Software\Classes\CLSID\", view.MapKeyPath(@"21:\Software\Classes\CLSID\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\TEST\", view.MapKeyPath(@"22:\Software\TEST\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Microsoft\", view.MapKeyPath(@"22:\Software\Microsoft\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Microsoft\EventSystem\", view.MapKeyPath(@"22:\Software\Microsoft\EventSystem\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Wow6432Node\TEST\", view.MapKeyPath(@"22:\Software\Wow6432Node\TEST\"), true);
            Assert.AreEqual(@"HKEY_USERS\S-1-5-18\Software\Classes\CLSID\", view.MapKeyPath(@"23:\S-1-5-18\Software\Classes\CLSID\"), true);
        }
Esempio n. 2
0
        public void MapKeyPathsIn64BitProcess()
        {
            var view = new RegistryView(true);

            Assert.IsTrue(view.Is64Bit);

            // Invalid paths.
            Assert.IsNull(view.MapKeyPath(null));
            Assert.IsNull(view.MapKeyPath("TRE"));
            Assert.IsNull(view.MapKeyPath("TEST"));

            // 32-bit paths.
            Assert.AreEqual(@"HKEY_CLASSES_ROOT\Wow6432Node\CLSID\", view.MapKeyPath(@"00:\CLSID\"), true);
            Assert.AreEqual(@"HKEY_CURRENT_USER\Software\Wow6432Node\Classes\CLSID\", view.MapKeyPath(@"01:\Software\Classes\CLSID\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Wow6432Node\TEST\", view.MapKeyPath(@"02:\Software\TEST\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\", view.MapKeyPath(@"02:\Software\Microsoft\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Microsoft\EventSystem\", view.MapKeyPath(@"02:\Software\Microsoft\EventSystem\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Wow6432Node\TEST\", view.MapKeyPath(@"02:\Software\Wow6432Node\TEST\"), true);
            Assert.AreEqual(@"HKEY_USERS\S-1-5-18\Software\Wow6432Node\Classes\CLSID\", view.MapKeyPath(@"03:\S-1-5-18\Software\Classes\CLSID\"), true);

            // 64-bit paths.
            Assert.AreEqual(@"HKEY_CLASSES_ROOT\CLSID\", view.MapKeyPath(@"20:\CLSID\"), true);
            Assert.AreEqual(@"HKEY_CURRENT_USER\Software\Classes\CLSID\", view.MapKeyPath(@"21:\Software\Classes\CLSID\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\TEST\", view.MapKeyPath(@"22:\Software\TEST\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Microsoft\", view.MapKeyPath(@"22:\Software\Microsoft\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Microsoft\EventSystem\", view.MapKeyPath(@"22:\Software\Microsoft\EventSystem\"), true);
            Assert.AreEqual(@"HKEY_LOCAL_MACHINE\Software\Wow6432Node\TEST\", view.MapKeyPath(@"22:\Software\Wow6432Node\TEST\"), true);
            Assert.AreEqual(@"HKEY_USERS\S-1-5-18\Software\Classes\CLSID\", view.MapKeyPath(@"23:\S-1-5-18\Software\Classes\CLSID\"), true);
        }