private void BitToolStripMenuItem_Click(object sender, EventArgs e) { if (procRegEditExe != null) { procRegEditExe.Kill(); procRegEditExe = null; } Cursor.Current = Cursors.WaitCursor; string registryLocation = "Wow6432Node\\CLSID"; if (FileListcomboBox.SelectedItem != null) { List <RegData> regData = DllRegister.SearchRegistryNative(System.IO.Path.GetFileName((FileListcomboBox.SelectedItem as FileItem).FullPath), "Wow6432Node\\CLSID"); if (regData != null && regData.Count > 0 && !string.IsNullOrWhiteSpace(regData[0].RegistryPath)) { registryLocation = regData[0].RegistryPath; if (!string.IsNullOrWhiteSpace(regData[0].CLSID)) { Logger.Instance.AdddLog(LogType.Info, "Found CLSID in Wow6432Node : " + regData[0].CLSID, "DllRegister"); } if (!string.IsNullOrWhiteSpace(regData[0].Path)) { Logger.Instance.AdddLog(LogType.Info, "Found path in Wow6432Node\\CLSID: " + regData[0].Path, "DllRegister"); } } } Cursor.Current = Cursors.Default; OpenRegEdit(registryLocation); }
/* * Path structure: * * [Project name]-* Backup DLL/TLB/reg files *-------------------------[Date and time as file name]-*Backup from last build * * */ public MainForm() { InitializeComponent(); splitContainer1.SplitterDistance = FileListcomboBox.Location.Y + 30; #region int Logger if (!Logger.LoggerIsOnline) { Logger.Instance.Stop(); Logger.Instance.Start(Output.ADD_InnerException | Output.ADD_StackTrace); } Logger.Instance.OnLogMessage += Instance_OnLogMessage; #endregion Setting = Settings.Load("*.regdll"); if (!String.IsNullOrWhiteSpace(Settings.LoadedFrom)) { Setting.MainOptions.OptionPath = Settings.LoadedFrom; } if (Setting == null) { Setting = new Settings(); } DllRegister.TestSettings(Setting); Logger.Instance.AdddLog(LogType.Info, Assembly.GetEntryAssembly().FullName + " Start!", this); if (Environment.Is64BitProcess) { Logger.Instance.AdddLog(LogType.Info, "This is a 64 bit proccess"); } }
private void ButtonUnRegister_Click(object sender, EventArgs e) { if (!UacHelper.IsRunAsAdmin()) { MessageBox.Show("You need administrator rights to unregister a DLL!", "Administrator ?", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } labelResult.BorderStyle = BorderStyle.None; labelResult.BackColor = this.BackColor; labelResult.Text = string.Empty; fct_box.Text = string.Empty; SetToViewRegFile(); Logger.Instance.AdddLog(LogType.Debug, "Start to unregister DLLs!", this); GetUiInput(); if (comboBoxNetLink.SelectedItem == null || string.IsNullOrWhiteSpace((comboBoxNetLink.SelectedItem as NetItem).FullPath) || !System.IO.File.Exists((comboBoxNetLink.SelectedItem as NetItem).FullPath)) { Logger.Instance.AdddLog(LogType.Error, "Framework link ?", this); return; } if (Setting.FileItems == null || Setting.FileItems.Count == 0) { Logger.Instance.AdddLog(LogType.Error, "Missing DLL file link ?", this); return; } Cursor.Current = Cursors.WaitCursor; labelResult.BorderStyle = BorderStyle.FixedSingle; if (DllRegister.UnRegister(Setting, timeId)) { labelResult.Text = "OK!"; labelResult.BackColor = Color.ForestGreen; } else { labelResult.Text = "ERROR"; labelResult.BackColor = Color.Red; } Cursor.Current = Cursors.Default; }
private void ButtonRegister_Click(object sender, EventArgs e) { if ((checkBoxInstallinGAC.Checked || !checkBoxRegistry.Checked) && !UacHelper.IsRunAsAdmin()) { MessageBox.Show("You need administrator rights to register a DLL!", "Administrator ?", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } labelResult.BorderStyle = BorderStyle.None; labelResult.BackColor = this.BackColor; labelResult.Text = string.Empty; fct_box.Text = string.Empty; SetToViewRegFile(); Logger.Instance.AdddLog(LogType.Debug, "Start to register DLLs!", this); GetUiInput(); #region project name //test project name --set to default? if (string.IsNullOrWhiteSpace(Setting.ProjectName) && FileListcomboBox.SelectedItem != null && !string.IsNullOrWhiteSpace((FileListcomboBox.SelectedItem as FileItem).FullPath)) { textBoxPName.Text = "Register_" + System.IO.Path.GetFileNameWithoutExtension((FileListcomboBox.SelectedItem as FileItem).FullPath); } else { textBoxPName.Text = "Register_DLL"; } Setting.ProjectName = textBoxPName.Text; #endregion #region Regasm.exe & file links ? if (Setting.FileItems == null || Setting.FileItems.Count == 0) { Logger.Instance.AdddLog(LogType.Error, "Missing DLL file link ?", this); MessageBox.Show("Please select DLL files (add button)!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (comboBoxNetLink.SelectedItem == null || string.IsNullOrWhiteSpace((comboBoxNetLink.SelectedItem as NetItem).FullPath) || !System.IO.File.Exists((comboBoxNetLink.SelectedItem as NetItem).FullPath)) { Logger.Instance.AdddLog(LogType.Error, "Framework link ?", this); MessageBox.Show("Regasm.exe link is not set?", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } #endregion Cursor.Current = Cursors.WaitCursor; #region Register DLL if (DllRegister.Register(Setting, timeId)) { labelResult.Text = "OK!"; labelResult.BackColor = Color.ForestGreen; } else { labelResult.Text = "ERROR"; labelResult.BackColor = Color.Red; } #endregion labelResult.BorderStyle = BorderStyle.FixedSingle; Cursor.Current = Cursors.Default; }
private void ViewRegFileToolStripMenuItem_Click(object sender, EventArgs e) { viewRegFileToolStripMenuItem.Checked = !viewRegFileToolStripMenuItem.Checked; if (viewRegFileToolStripMenuItem.Checked) { GetUiInput(); if (!DllRegister.TestSettings(Setting)) { Logger.Instance.AdddLog(LogType.Error, "Project or file name or no write access? ", "DllRegister", ""); SetValuesToForm(false); } FileItem fileItem = FileListcomboBox.SelectedItem as FileItem; if (FileListcomboBox.SelectedItem != null && !string.IsNullOrWhiteSpace(fileItem.FullPath) && !string.IsNullOrWhiteSpace(Setting.OutputPath) && System.IO.Directory.Exists(Setting.OutputPath) ) { string path = string.Empty; if (!string.IsNullOrWhiteSpace(fileItem.RegBuildPath) && System.IO.File.Exists(fileItem.RegBuildPath)) { path = fileItem.RegBuildPath; } else { path = Setting.OutputPath + System.IO.Path.GetFileNameWithoutExtension(fileItem.FullPath) + ".reg"; if (string.IsNullOrWhiteSpace(path) || !System.IO.File.Exists(path)) { path = string.Empty; } } if (!string.IsNullOrWhiteSpace(path) && System.IO.File.Exists(path)) { try { var lines = File.ReadAllText(path); if (!string.IsNullOrWhiteSpace(lines)) { logBufferText = fct_box.Text; //logBuffer = fct_box.TextSource; fct_box.Language = Language.CSharp; fct_box.Text = lines; viewRegFileToolStripMenuItem.Text = "View Log file"; return; } } catch (Exception ex) { Logger.Instance.AdddLog(LogType.Error, ex.Message, this, "", ex); } } } viewRegFileToolStripMenuItem.Checked = false; } else { SetToViewRegFile(); } }