1. Bjarne Anker
  2. PowerBuilder
  3. Tuesday, 20 February 2018 09:06 AM UTC

Hi.

 

I need to write to the HKEY_CLASSES_ROOT part in the windows registry from our PB 2017 application.

When I use RegistrySet("HKEY_CLASSES_ROOT\mykey","MyValue",RegString!,"MyValue"), it returns -1.

If I change to HKEY_CURRENT_USER, it works fine.

So I guess it has to do with permissions, and I can edit the HKEY_CLASSES_ROOT part when I run regedit.exe.

I this a known limitation in PB 2017? And is there a workaround, besides running the application as administrator?

And is perhaps the solution to use RegValueSetEx from "advapi32.dll" declared in Local External Functions?

It would be great if anyone has a working example of this. I cannot seem to find the values for the registry parts (RegValueSetEx expects a long value for HKEY_CLASSES_ROOT) or the correct parameters to write to registry using external functions.

 

It is not an option to run our application as administrator, even if it will write to the HKEY_CLASSES_ROOT just fine.

 

Br,

 

Bjarne Anker

Maritech Systems AS

Norway

Marco Meoni Accepted Answer Pending Moderation
  1. Tuesday, 20 February 2018 10:47 AM UTC
  2. PowerBuilder
  3. # 1

Hello Bjarne,

it isn't a limitation of PB 2017 at all.

It depends on your current user access rights.

If you really want to write there you can use GPO but be aware of the possible negative consequences

https://community.spiceworks.com/topic/378259-hkey_classes_root-clsid-permissions-full-control

Cheers,

Marco

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 20 February 2018 16:38 PM UTC
FWIW: That is why I never use the registry in my PB Apps. Too easy to get caught in the MS-Window access rights issues.

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.