Пример #1
0
        /// <summary>
        /// Harvest the registry values written by calling DllRegisterServer on the specified file.
        /// </summary>
        /// <param name="file">The file to harvest registry values from.</param>
        /// <returns>The harvested registry values.</returns>
        public Wix.RegistryValue[] HarvestRegistryValues(string file)
        {
            this.isFile64Bit = ATLDllHarvester.Is64Bit(file);

            using (var registryHarvester = new ATLRegistryHarvester(true))
            {
                try
                {
                    string options = (useDash ? "-RegServer" : "/RegServer");

                    if (isFile64Bit)
                    {
                        StartProxyProcess64(file, options);
                    }
                    else
                    {
                        ProcessWithInjectedDll.Start(file, options, "RegRedir.dll");
                    }

                    return(registryHarvester.HarvestRegistry());
                }
                catch (Exception e)
                {
                    e.Data["file"] = file;
                    throw;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Start EXE with specified arguments (typically "/RegServer"), and inject
        /// 64-bit registry redirector DLL.
        /// </summary>
        /// <param name="file">path to EXE</param>
        /// <param name="arguments">arguments to EXE</param>
        /// <returns>error code, or 0 if no error</returns>
        static int StartEXE(string file, string arguments)
        {
            try
            {
                ProcessWithInjectedDll.Start(file, arguments, RegRedirDLL);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(EXEError);
            }

            return(0);
        }