1. Heribert Goeckel
  2. PowerBuilder
  3. Thursday, 4 April 2024 16:31 PM UTC

What is wrong ? 

 

PB Version 2022 R3 3289

 

li_ret = RegistryGet("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography",  "MachineGuid", RegString! , gnv_app.is_machineguid)

 

li_ret = -1

 

Thanks

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Friday, 5 April 2024 03:15 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi, Heribert -

I believe I know why this happens and I have a solution. Please forgive the length of this reply, but I want fully explain the issue.

The Windows OS re-directs (or "reflects") registry operations when you are running a 32-bit app on a 64-bit version of Windows. If you run your app as a 64-bit app, it will find and return the machine GUID as expected, but when it's 32-bit, Windows looks elsewhere due to reflection. Here is a link to a post in StackOverflow.com that put me on the right track:

    https://stackoverflow.com/questions/53100174/error-2-reading-software-microsoft-cryptography-machineguid-on-win-8-8-1-and-7

The actual key where Windows reflects the request to is:

    HKEY_USERS\S-x-x-xx-xxxxxxxxxx-xxxxxxxxxxx-xxxxxxxxxxx-xxxx\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Cryptography

The actual registry key will be in each user's personal subkey (I've xxx'd mine out for obvious reasons).

The PB registry functions utilize the normal Windows API registry functions as you would expect, but there are non-standard settings/options that can be used to ask Windows to not reflect the query request. This is what the StackOverflow.com post explains. Using the code posted there as a guide, I've been able to call the same WinAPI functions from PB and obtain the machine GUID in a 32-bit app.

I've attached my single-window, sample app that contains the external function declarations for the WinAPI functions and the needed PB code to obtain the machine GUID. The app works in both 32-bit and 64-bit from PB 2017 and up.

I hope this helps you out.

Best regards, John

Attachments (1)
Comment
  1. Miguel Leeuwe
  2. Friday, 5 April 2024 08:24 AM UTC
Hi John,

We use the registry quite a lot and anytime things start to fail, we simply do a search on "virtualstore" in the registry and deleting them solves the problem. There was a time some years ago where Windows had lots of problems due to the existence of these, then they seemed to have fixed it, and now lately we seem get more problems again.

(sorry I didn't have time to read your links).

regards.
  1. Helpful
  1. Heribert Goeckel
  2. Friday, 5 April 2024 10:11 AM UTC
Hi John,

thanks for the detailed information. It helped me alot.



Best regards, Heribert
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Tuesday, 9 April 2024 00:36 AM UTC
Thanks John!
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 4 April 2024 18:06 PM UTC
  2. PowerBuilder
  3. # 1

Hi Heribert ;

  FWIW: I looked in my W10 and W11 O/S's registry using the REGEdit utility and I do not have any such "MachineGuid" entry!  So that might explain the -1 RC.  HTH

Regards .. Chris

Comment
  1. Heribert Goeckel
  2. Friday, 5 April 2024 10:00 AM UTC
Hi Chris, I assume that the machine ID is a necessary entry in the registry. I have to rethink my concept.
  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.