1. Eric Freudenberg
  2. PowerBuilder
  3. Wednesday, 10 October 2018

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
0
Votes
Undo

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.
  1. Monday, 15 October 2018
  2. PowerBuilder
  3. # Permalink
Roland Smith Accepted Answer Pending Moderation
0
Votes
Undo

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.
  1. Wednesday, 10 October 2018
  2. PowerBuilder
  3. # 1
René Ullrich Accepted Answer Pending Moderation
1
Votes
Undo

You can use Microsoft API function to access the registry.

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

 

Comment
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. Eric Freudenberg
  2. Wednesday, 10 October 2018
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. Chris Pollach
  2. Wednesday, 10 October 2018
There are no comments made yet.
  1. Wednesday, 10 October 2018
  2. PowerBuilder
  3. # 2
  • Page :
  • 1


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