tags:

views:

78

answers:

2

I am trying to change the friendly name of a USB sound card. I can don't it from windows as well as edit the registry location using regedit. But I get an exception when I try to open the subkey for write access.

Is there any way to get around this. For now my work around is to build the correct registry import file and run that, but I would like it much better if it could be implemented in code.

A: 

Are you running your c# application as an administrator? Only a user with administrative rights has access to write to HKLM.

Andy E
Yes. I can write the changes to a .reg file and call that from inside the app, I just can't make the direct changes using the Registry class.
Robin Robinson
A: 

The way I got around this is to write a text file in the format that can be imported into the registry and just call that file using Process.Start("edit.reg") or what ever you named your file. Works for now, only need to do this once on installation, for now.

Robin Robinson