It depends on the part of the registry you want to write to. You can write into HKey_Current_User.
When you want to write into HKey_Local_Machine, add a manifest to your application, stating
requestedExecutionLevel level="requireAdministrator"
. See also
http://msdn.microsoft.com/en-us/library/bb756929.aspx[
^].
But think again whether it is really necessary to write data to that part of the registry. Often, a configuration file in
%programdata%\Company Name\Product Name
is more appriopriate.