Load() public static method

public static Load ( RegistryKey rootKey ) : COMRegistry
rootKey Microsoft.Win32.RegistryKey
return COMRegistry
Ejemplo n.º 1
0
 private void DoWorkEntry(object sender, DoWorkEventArgs e)
 {
     if (m_dbpath != null)
     {
         Instance = COMRegistry.Load(m_dbpath);
     }
     else
     {
         if (m_keyPath != null)
         {
             using (RegistryKey key = m_rootKey.OpenSubKey(m_keyPath))
             {
                 Instance = COMRegistry.Load(key);
             }
         }
         else
         {
             Instance = COMRegistry.Load(m_rootKey);
         }
     }
 }
Ejemplo n.º 2
0
        static bool GenerateSymbolFile(string symbol_dir)
        {
            try
            {
                Process proc  = Process.GetCurrentProcess();
                var     procs = COMUtilities.LoadProcesses(new Process[] { proc }, null, COMRegistry.Load(COMRegistryMode.UserOnly));
                if (!procs.Any())
                {
                    throw new ArgumentException("Couldn't parse the process information. Incorrect symbols?");
                }

                Dictionary <string, int> entries;
                if (Environment.Is64BitProcess)
                {
                    entries = SymbolResolverWrapper.GetResolvedNative();
                }
                else
                {
                    entries = SymbolResolverWrapper.GetResolved32Bit();
                }

                string        dll_name    = COMUtilities.GetCOMDllName();
                var           module      = SafeLoadLibraryHandle.GetModuleHandle(dll_name);
                string        output_file = Path.Combine(symbol_dir, $"{COMUtilities.GetFileMD5(module.FullPath)}.sym");
                List <string> lines       = new List <string>();
                lines.Add($"# {Environment.OSVersion.VersionString} {module.FullPath} {FileVersionInfo.GetVersionInfo(module.FullPath).FileVersion}");
                lines.AddRange(entries.Where(p => p.Key.StartsWith(dll_name)).Select(p => $"{p.Value} {p.Key}"));
                File.WriteAllLines(output_file, lines);
            }
            catch (Exception ex)
            {
                ShowError(null, ex);
                return(false);
            }
            return(true);
        }