marios
marios

Reputation: 153

Some level of security with registry and c#

In the setup i add this registry file like the image below.For security issues i dont want someone to copy the folder of the software and put it on other pc and work this is why added this file.

All i want is in my form 1 (main) on load to check if the registry file exists to be able to continue with the program else terminate. Do i need a for loop?

If you have any better suggestions let me know.

private void Form1_Load(object sender, EventArgs e)
        {

       RegistryKey MyReg = Registry.CurrentUser.OpenSubKey
        ("HKLM\\Software\\[Manufacturer]\\checkup");
        if (MyReg.ValueCount == 1)
        { }

        else{ MessageBox.Show("error");
       }


        }

Registry added

do i have to put any value on the checkup?

properties of checkup file

Any help will be appreciated

Upvotes: 0

Views: 65

Answers (1)

Guest
Guest

Reputation: 11

You forgot to assign the value of the registry to an object. :

object key_value = key.GetValue("Version");

Upvotes: 1

Related Questions