The Kinetic Jump site navigation header requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

Welcome Guest Search | Active Topics | Log In | Register

Problem creating Registry Key in Dynamic Action Options
atorble
#1 Posted : Friday, July 29, 2011 1:36:01 AM
Rank: Member
Groups: Member

Joined: 6/10/2011
Posts: 5
Fixed:  Hadn't opened the parent key in write mode - doh!

Hi,

I'm trying out Dynamic Actions and have the following code

        public override void Execute(UpdateContext context) {
            //Add code here to define the activity that this action
            //should take on the client system during the update.
           
            //HKLM\Software\KineticJump\AppLifeUpdate\ServiceKeys
            RegistryKey servicesKey = getServiceKey();

            List<Dictionary<string, string>> values = context.SharedProperties["features"] as List<Dictionary<string, string>>;
            foreach (Dictionary<string, string> t in values)
            {
                RegistryKey regKey = servicesKey.CreateSubKey(t[@"ServiceKey"], RegistryKeyPermissionCheck.ReadWriteSubTree);
                regKey.SetValue(@"Path", t[@"Path"], RegistryValueKind.String);
                regKey.SetValue(@"PublicKey", t[@"PublicKey"], RegistryValueKind.String);
            }
        }

This is throwing an exception in the CreateSubKey call (UnauthorizedAccessException: Cannot write to the registry key).  Looks like a permission issue but this update is running under the update service and if I create a single key in the same hive using a Create Registry Key action all is ok.

Any idea how to resolve this?

Thanks
Andy
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.