1. David Vasconcelos
  2. PowerBuilder
  3. Friday, 27 August 2021 16:15 PM UTC

The RetistrySet function has just started to fail.  The app was writing to HKEY_LOCAL_MACHINE (and windows was redirecting it to the VirtualStore) but for some reason it is now failing, and not for everyone, so far just a few.  I also noticed that on several machines this key no longer exists, I had it on my machine then suddenly after the latest windows update it was gone, not sure why.  It works for me due to I am admin on my PC, so it's tough trying to find a solution. 

Next steps:

Try to write directly to the virtual store.

Use windows API calls vs PB functions to write to the registry.

 

If anyone has any ideas why it suddenly is failing let me know or if you have a solution...what's strange is that it's not happening to everyone.

 

PB: 2017r3, 32bit app.

Thanks

Dave V.

 

 ***Follow-up 

Since we are locked down and can't change the registry we will be using an ini file.  So no easy/real resolution to this issue.

 

Matt Balent Accepted Answer Pending Moderation
  1. Friday, 3 September 2021 13:56 PM UTC
  2. PowerBuilder
  3. # 1

I've been advocating for years to NOT use the registry but most companies I've been at don't think it's a priority.  Then they fail a security audit and...

Anyway an approach I've taken is to write these things to the database which can be secured in any number of ways.  It also offers the advantage of being portable so the user's settings can be applied regardless of where they log in.

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 3 September 2021 09:31 AM UTC
  2. PowerBuilder
  3. # 2

The Virtual Store stuff has been giving us problems for over 2 years now. Some windows update will fix things, the next one will break things.

I think there'll be way less problems if we don't write to HKEY_LOCAL_MACHINE, but use HKEY_CURRENT_USER instead. That will make our programs less likely to suffer from group policies.

If possible at all, write your stuff to a database and avoid registries completely.

just my 2 pesetas,

regards.

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Thursday, 2 September 2021 20:16 PM UTC
  2. PowerBuilder
  3. # 3

DELETE the Virtual Store, and try again.

The <app> VirtualStore/hive location is here:
HKEY_CLASSES_ROOT\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\<app>


Comment
  1. Chris Pollach @Appeon
  2. Thursday, 2 September 2021 21:18 PM UTC
Hi Olan ... FWIW: I don't think any IT environment would let you do this - especially, in production.
  1. Helpful
  1. David Vasconcelos
  2. Friday, 3 September 2021 12:25 PM UTC
without the Admin right can't delete VirtualStore...
  1. Helpful
There are no comments made yet.
Mark Goldsmith Accepted Answer Pending Moderation
  1. Saturday, 28 August 2021 17:12 PM UTC
  2. PowerBuilder
  3. # 4

Hi David,

You probably already checked for this but, any chance that the Windows update changed the "Enabled" setting under the policy "User Account Control: Virtualize file and Registry write failures to per-user locations" to "Disabled"? Any chance the same policy may have been changed, for certain users, by network admin folks?

Regards,

Mark

Comment
  1. David Vasconcelos
  2. Monday, 30 August 2021 11:15 AM UTC
It is enabled, good idea though.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Saturday, 28 August 2021 05:07 AM UTC
  2. PowerBuilder
  3. # 5

How should a PB developer avoid writing to the Windows Registry? What are the best practices? Does Appeon have a White Paper or has there been an Elevate presentation on the subject? Are there code examples?

Are the cursed .ini files from the 1980's (queue the blood-curdling scream) the solution?

The Windows software development community has been encouraged to utilize the Registry for decades, ever since Microsoft unleashed it. That's certainly one factor on why we have PowerScript functions that make it more convenient for us to read from and write to the Registry. I completely understand the security issues concerning the use of the Registry and I get why a lot of companies prevent their users and the applications they use from writing to the Registry.

Like a lot of developers, it's just about all I can do each workday to complete my assignments on time. By and large, my days (and most nights and weekends) are pretty much filled with work, family, obligations and responsibilities. OK - that's life in the 21st century. While there may very well be strategies (for any languages) for replacing use of the Registry, I cannot recall ever seeing or hearing more than maybe a quick blurb about them. Usually it's blanket comments similar to "We shouldn't be writing to the Registry.", but I admittedly don't devote any time to perusing software development journals. I suspect there are many developers that share similar sentiments.

It's not enough to only say "this is bad / not allowed / blocked / a security risk / etc." How should we be addressing this issue?

Comment
  1. Chris Pollach @Appeon
  2. Saturday, 28 August 2021 13:10 PM UTC
" Are the cursed .ini files from the 1980's (queue the blood-curdling scream) the solution? " ... I'm 100% guilty, still using INI's in all my Apps. I love the INI feature is its a KISS implementation (easy to use for developers & production support) ... or as Timex says " Takes a lick'in & keeps on tick'in" ... LOL
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Saturday, 28 August 2021 16:00 PM UTC
Hi John, I wasn’t trying to pass judgement it is bad or not. It is just since a lot of corporate environments restrict so third-party software vendors make effort these days to go with the flow. For example, in PowerServer 2021 we put a lot of effort to make sure the Cloud App Launcher plays nice with corporate security requirements.

With that said, another alternatives come to my mind besides INI is writing to database. If you don’t need it to persist as the app user moves from machine to machine, you could just write it to lightweight DB like SQLite that is bundled with your app. Especially in mobile app dev world, SQLite is used a lot to store data on the client in extremely lightweight and seamless approach.
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Friday, 27 August 2021 17:45 PM UTC
  2. PowerBuilder
  3. # 6

I hate the Virtual Store. It screws up everything.
Try deleting the Virtual Store for your application, then re-running the app.

Comment
  1. David Vasconcelos
  2. Friday, 27 August 2021 19:30 PM UTC
Me too! its caused several headaches.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 27 August 2021 16:43 PM UTC
  2. PowerBuilder
  3. # 7

Hi Dave;

  You might be experiencing new Windows policy restrictions. I've experienced this before & why I don't personally use the Registry in my PB apps. When you get into environments where the workstations are really locked down, writing to the registry can often be fully restricted.

  Does the app work okay registry wise when the app is run "as Administrator"?

Regards ... Chris

Comment
  1. David Vasconcelos
  2. Friday, 27 August 2021 19:24 PM UTC
So the million dollar question is going to be if I have to update the registry then How? Unfortunately its a third party app (Wintertree Spellchecker) that we are updating registry for. The only way around this I can think of would be the network guys would have to do a registry push and add/set the registry, ugg!
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 27 August 2021 19:36 PM UTC
Hi David ... Yes, you might have to do that route. :-(
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Friday, 27 August 2021 20:59 PM UTC
Here is crazy idea... contact Wintertree and request they update their product not to use registry or use a different spellchecker. In this day and age PB apps should not be touching to registry to play nice with security requirements.
  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.