1. Eric Freudenberg
  2. PowerBuilder
  3. Wednesday, 10 October 2018 06:35 AM UTC

Hello community,

I have a question about the possibilities in PB to get access from a 32bit application on the 64bit part of the registry.

Question:
- Does PB support, by default, to read (or set) registry keys in the 64bit part of the registry from a 32 bit application?
- Does exist other ways to solve the problem?

Background:
- Our application is a PB2017R2 32bit app.
- We use external apps, calling by our app, to do something.
- On 64bit OS we call 64bit apps.

=> Befor calling external apps we must check if the app and the needed software of this app is installed on the local maschine. To check this, we need access to the 64bit registry.

Example:
- We want to check if C++ 2010 (x64) is installed (on a 64bit machine of course).
=> "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1D8E6291-B0D5-35EC-8441-6616F567A0F7}"

My knowledge:
- I found no information to this topic in PB help or here in this forum
- I know, in .Net you have two ways solve this porblem
=> 1. The framework blocks reading 64bit registry from 32bit apps by default, but you can import the functions manually reading the windows api (not my preferred solution)
=> 2. Befor get anything from registry, you can set the "registryview" to 64bit, so your registry command go to the correctly registry part

I hope someone can help us, to solve our problem.

Many thanks.

 

Eric

Accepted Answer
Eric Freudenberg Accepted Answer Pending Moderation
  1. Monday, 15 October 2018 07:47 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi everyone,

many thanks for all answeres and ideas.
From the answers I conclude, that PowerBuilder doesn't support a nativ solution for this problem, so I think the best practise in such cases is to import the functions using the win-api how René describe in his answere.

For all how search for the same or similar solution, some addional / helpful information about this theme:

- https://docs.microsoft.com/en-us/windows/desktop/sysinfo/registry-functions

- https://docs.microsoft.com/en-us/dotnet/api/microsoft.win32.registryview?view=netframework-4.7.2

- https://archive.sap.com/discussions/thread/3930331

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 10 October 2018 13:17 PM UTC
  2. PowerBuilder
  3. # 1

Windows limits access to the registry based on app bitness.

 

Try this:

Use the LoadLibrary Win API to load one of the dll files. If it fails, it wasn't installed. If it works, call FreeLibrary.

 

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Wednesday, 10 October 2018 08:30 AM UTC
  2. PowerBuilder
  3. # 2

You can use Microsoft API function to access the registry.

Read more here: https://archive.sap.com/discussions/thread/3930331

 

Comment
  1. Eric Freudenberg
  2. Wednesday, 10 October 2018 08:53 AM UTC
Hi René,



thanks for your answere.

I know using the ms / win api is a possible solution (see "my knowledge" of my question), but i would prefer if PB can handle the access by default.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 10 October 2018 13:48 PM UTC
Hi Eric;

Some other choices are:

1) Compile your PB App as a 64bit application

2) Create a small 64bit PB App EXE and call that from the 32bit one to access the 64bit side of the registry.

Food for thought.

Regards ... Chris
  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.