RegistryAccessExceptions in Windows 10

Hey all,

I’m trying to create and write some registry keys and on Windows 10, it seems to be failing. I get RegistryAccessException errors. Well, not me but my customers. I don’t have Win10 installed yet. My code works fine in Win7 but getting these errors in Windows 10.

What needs to be done to write registry keys in Windows 10?

Thanks,

Jon

What keys are you writing?

I’m trying to create a key in HKEY_CLASSES_ROOT

Works fine in Win 7. Not so much in Win 10.

Is creating a key in HKEY_CLASSES_ROOT a no-no?

You might need to run as administrator to do so. You could have a look at writing a helper app and using http://developer.xojo.com/elevating-user-access-control to launch it.

Well, I thought about that, but in at least one case, my user is running as an admin user. So that’s what’s confusing me…

And I only need to write this key once. From then on, I read from it. So I don’t need elevated permissions whenever the app is run. Are there other keys that don’t need admin permissions?

HKCU is fine. There is also a difference between being an admin user and running an app as admin. As an admin user you’ll be asked if it is ok to run the app, none admin users will also need to provide admin credentials.

So I could write in HKCU with no problem then - no need for elevated privileges?

I hate this stuff. I really don’t want to install Windows 10!!! I guess I’ll have to.

And actually, HKCU won’t work. I need this key to be global for all users… :frowning: