private void button1_Click_1(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text.Trim())) { MessageBox.Show("请选择文件!", "选择文件提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ShowErrorMessage(DriverAPIInterface.Create(ServiceName, DisplayName, textBox1.Text).ToInt32()); RefreshStatus(); } }
private void button8_Click(object sender, EventArgs e) { textBox1.Text = AppDomain.CurrentDomain.BaseDirectory + "MyfirstDriver.sys"; filePath = textBox1.Text; ServiceName = Path.GetFileNameWithoutExtension(filePath); DisplayName = Path.GetFileNameWithoutExtension(filePath); textBox2.Text = ServiceName; textBox3.Text = DisplayName; DriverAPIInterface.Unload(1000).ToInt32(); //停止驱动 DriverAPIInterface.Delete().ToInt32(); //卸载驱动 ShowErrorMessage(DriverAPIInterface.Create(ServiceName, DisplayName, textBox1.Text).ToInt32()); ShowErrorMessage(DriverAPIInterface.Load().ToInt32()); RefreshStatus(); }