How i fix System.Security.SecurityException while editing registry set value

0

Im making a unban tool for a game. I made all unban steps successfully but i have problem at here.

I try to set a random machineguid for last step of unbanning i get random machineguid successfully but i have problem while set the machine guid.. Its giving you dont have permission to edit this key.. And Error code is: 0x8013150A

I already setup a error catcher i get the error always so i cant do the Try{} can anyone help me? i hope i fix the error.

PHOTO 1: https://image.ibb.co/bSuBkz/image.png PHOTO 2: https://image.ibb.co/m3XLdK/image.png PHOTO 3:https://image.ibb.co/fWJe5z/image.png

try {
                string nguid = b + "-" + b1 + "-" + b2 + "-" + b3 + "-" + b4;
                RegistryKey localmachine = Registry.LocalMachine;
            RegistryKey software = localmachine.OpenSubKey(@"Software\\",true);
            RegistryKey microsoft = software.OpenSubKey(@"Microsoft\\", true);
            RegistryKey cryptography = microsoft.OpenSubKey(@"Cryptography\\", true);
            cryptography.SetValue("MachineGuid", nguid,RegistryValueKind.String);
                lbox.Items.Add("New MachineGuid: " + nguid.ToString());
            }
            catch (SecurityException e)
            {
                MessageBox.Show(e.Message, "0x8013150A Error",
    MessageBoxButtons.OK, MessageBoxIcon.Error);
                lbox.Items.Add("ERROR: You dont have access to set machineguid.");
            }
c#
registry
guid
asked on Stack Overflow Aug 18, 2018 by Samo Hacks

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0