A little breakdown:
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\ADs\Clsid");
2 things here:
1) You can combine the first two lines into one. If not, you must assign the key to itself, i.e.
key = key.OpenSubKey(...
2) Remove the first backslash (before "SOFTWARE") - otherwise you'll get an "Object reference not set to an instance of an object" error
Now, you can use this:
InstallPath = (string)key.GetValue(null);
3) Finally, don't forget to close the key when you have finished with it!