1. François Molinas
  2. PowerBuilder
  3. Thursday, 04 July 2019

Hello community,

 

My 32-bit PB app needs to check the registry settings for a third party 64-bit application.

This community and the bug tracker both state that PB2017 won't allow me to do it.

Come PB2019... As far as I understand it, the New Features document specifically states that this problem has been addressed. But I still fail to access the non-redirected HKLM\Software registry section.

Here is a barebones demo, to be pasted to an Application Open script:

String	las_std[], las_wow[]
String	ls_tit, ls_msg
Environment	lenv

GetEnvironment(lenv)
ls_tit = String(lenv.ProcessBitness) + " bits - PB version "
ls_tit += String(lenv.PBMajorRevision) + "." + String(lenv.PBMinorRevision) + "." + String(lenv.PBFixesRevision) + "." + String(lenv.PBBuildNumber)

ls_msg = "Key count under HKLM\Software:~r~n"
RegistryKeys("HKEY_LOCAL_MACHINE\SOFTWARE", las_std)
ls_msg += "~r~nStd = " + String(UpperBound(las_std))
RegistryKeys("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node", las_wow)
ls_msg += "~r~nWoW = " + String(UpperBound(las_wow))

MessageBox(ls_tit, ls_msg)
HALT CLOSE

I compiled this code into 32- and 64-bit apps with PB 2017R2 (build 1858) and PB 2019 (build 2082). 32-bit apps show the same count, and 64-bit apps show differing counts. PB version makes no difference in the numbers shown.

 

Is there an option or a setting I am missing ?

 

Regards,

François

References
  1. https://www.appeon.com/standardsupport/search/view?id=1093
  2. https://community.appeon.com/index.php/qna/q-a/read-64bit-registry-from-32bit-pb-application
  3. https://www.appeon.com/support/documents/appeon_online_help/pb2019/whats_new/ch01s06.html
François Molinas Accepted Answer Pending Moderation
0
Votes
Undo

I have read about accessing an alternate view (link below); this would be the 64-bit side of the registry. So this is possible.

But it seems to "lock" the alternate view... Way too risky as my application uses the registry on a regular basis. Plus, what would happen tp PowerBuilder itself when I debug my app?

Appeon advertised a new feature on this very subject. Does anyone have a clue about what has changed?

References
  1. https://docs.microsoft.com/en-us/windows/win32/winprog64/accessing-an-alternate-registry-view
Comment
You would have to use the registry API functions rather than the built in functions.
  1. Roland Smith
  2. Monday, 8 July 2019
There are no comments made yet.
  1. Monday, 8 July 2019
  2. PowerBuilder
  3. # 1
Roland Smith Accepted Answer Pending Moderation
1
Votes
Undo

Windows internally redirects registry access so it is not possible to do it from 32bit.

Comment
I learned this the hard way when Windows 10 came out. Suddenly code that was working perfectly failed when the app was running on a 64 bit platform. :/



Olan
  1. Olan Knight
  2. Friday, 5 July 2019
There are no comments made yet.
  1. Thursday, 4 July 2019
  2. PowerBuilder
  3. # 2
Chris Pollach Accepted Answer Pending Moderation
1
Votes
Undo

Hi Francois;

   What I have done before is build a 64bit EXE that deals with the registry. Then call this App from your 32bit App as required.

Food for thought.

Regards ... Chris

Comment
There are no comments made yet.
  1. Thursday, 4 July 2019
  2. PowerBuilder
  3. # 3
  • Page :
  • 1


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