简体   繁体   中英

Get write access to local_machine\software in the registry for .net application

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM