I am using Visual Studio 2010, and I'm writing a program that needs to set (and read) new registry values under HKLM\Software\myapp 

The program is .NET 2.0-based and as for now it runs on Windows 7 64-bit. Here is my ocde:

RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey("Software", true);
RegistryKey MyKey = softwareKey.CreateSubKey("MyApp");
RegistryKey  = MyKey.CreateSubKey("MyKey");
selfPlacingWindowKey.SetValue("instaldateperson", datestr + usrname);     


The problem I have when running Visual Studio 2010, is that it will run the app but logged on as me, I am a user and member of local admin group.. however I cannot create the key (despite I am part of local admin group, who have rights to do so). Neither do I know how to do it as a logon as (but its also not what I want since then I would put Adminuser and password inside the code, and I already am admin ?? so why ??)

If this isn't possible at all, are there options for creating registry keys?

Somehow add them to the project or so ??.. I am a bit confused here.


Question: How to detect a virus in a network card?
Answer: Very few viruses will infect the network card on your server.  Viruses typically infect your OS or other application software.  Therefore, for most purposes you don't need to worry about viruses in your network card.  If you're worried about viruses, take standard steps to harden your server; search the archives for server hardening for instructions (this will be OS-dependent).

It may be possible for viruses to replace the firmware on your network card with a malicious version.  That'd be very bad, because then it wouldn't be detected by ordinary anti-virus software.  However, this would require a very sophisticated attack, and I don't think I can recall ever seeing this strategy used in the wild.  Therefore, most people won't need to worry about this.

And remember, the best defense against viruses is: don't get infected in the first place.  Keep your software up to date, use firewalls, don't run vulnerable software, etc.