Exemplo n.º 1
0
        private void button6_Click(object sender, EventArgs e)
        {
            RegistryKey Rkey;

            //progressbar loading effect
            progressbarloading();

            Rkey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", true);
            Rkey.SetValue("NoDriveTypeAutoRun", 95); //disable

            //tampilkan kotak pesan
            MessageBox.Show("Disable Autorun USB Mode", "USB Defender V.2.0", MessageBoxButtons.OK, MessageBoxIcon.Information);

            //mengembalikan progressbar kesemula
            progressBar1.Value = 0;
        }
Exemplo n.º 2
0
        private void disableAutoRun()
        {
            RegistryKey Rkey;

            Rkey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", true);
            try
            {
                Rkey.SetValue("NoDriveTypeAutoRun", 255); //disable for all media types, recommended
                                                          //Rkey.SetValue("NoDriveTypeAutoRun", 95); //disable
                                                          //Rkey.SetValue("NoDriveTypeAutoRun", 145); //enable
            }
            catch
            {
                Rkey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", true);
                Rkey.CreateSubKey("NoDriveTypeAutoRun");
                Rkey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\NoDriveTypeAutoRun", true);
                Rkey.SetValue("NoDriveTypeAutoRun", 255);
            }
        }