1. Batel Azrad
  2. PowerBuilder
  3. Thursday, 18 January 2024 11:17 AM UTC

Hello,
We're in the process of upgrading our application from 32BIT to 64BIT using the PB2022.
We're having an issue with this line on Local External Functions.

SUBROUTINE RtlMoveMemory( long Dest, REF structure some_structure, long CBLen ) LIBRARY "kernel32.dll" alias for "RtlMoveMemory;Ansi"

We noticed that the 32bit is locatedC:\Windows\System32 and the 64bit is locatedCC:\Windows\SysWOW64.
How can we register it to use the kernel32.dll from the 32bit to the 64bit?

Batel Azrad Accepted Answer Pending Moderation
  1. Monday, 5 February 2024 09:48 AM UTC
  2. PowerBuilder
  3. # 1
Hi All,
Thank you it is now resolved :) (it was a data type error)
But now I'm having another issue, when I run the application it seems that some of the GUI are missing, as I understand it's because we use 'Canvas.pbx' and this is probably in 32bit, do you know what it is and is I should upgrade it to 64bit also?
Comment
  1. John Fauss
  2. Monday, 5 February 2024 14:39 PM UTC
Hi, Batel - I suggest you post this as a separate, new question in order to allow it to be seen by more people. A follow-on question, even if it might be related to the original question/issue, tends to be seen only by the people that have actively participated in the original thread. If you are unsure of the source for this .pbx, include the date and size of the file along with any additional information you can determine.
  1. Helpful 1
  1. Roland Smith
  2. Tuesday, 6 February 2024 14:19 PM UTC
Canvas.pbx is written in C++. You will need the 64bit version. The original author gave me the source code many years ago so I have a 64bit version on my home laptop.

I also have a replacement that is PB code only, you could try using that instead.

https://www.topwizprogramming.com/freecode_canvas.html
  1. Helpful 2
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 18 January 2024 17:31 PM UTC
  2. PowerBuilder
  3. # 2

Hi Batel;

  I use the "RtlMoveMemory" external SDK command in my STD Framework "all over the place". Here are some declarations that I use that also work perfectly for me also in 64 bit Apps ...

SUBROUTINE  BlobToUIntArray (  REF UnsignedInteger Dest[],  REF Blob  Source,   Long   Length  ) LIBRARY "kernel32.dll" Alias For "RtlMoveMemory"
SUBROUTINE  CopyMemory ( Ref string Destination, ulong Source, long Length ) Library  "KERNEL32.dll" Alias For "RtlMoveMemory"
SUBROUTINE  CopyMemory ( REF blob dest, longptr srcAddr, longptr len ) LIBRARY "kernel32.dll"Alias For "RtlMoveMemory"
SUBROUTINE  CopyMemoryIP ( Ref structure Destination, ulong Source, long Length 	) Library  "KERNEL32.dll" Alias For "RtlMoveMemory"
SUBROUTINE  CopyMemoryIP ( Ref blob Destination, ulong Source, long Length ) Library  "KERNEL32.dll" Alias For "RtlMoveMemory"
SUBROUTINE  CopyMemoryIP ( Ref ulong Destination, ulong Source, long Length ) Library  "KERNEL32.dll" Alias For "RtlMoveMemory"

HTH

Regards ... Chris

Comment
  1. Roland Smith
  2. Thursday, 18 January 2024 20:37 PM UTC
Those ULong arguments should really be LongPtr since Destination and Source are memory pointers.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 18 January 2024 20:56 PM UTC
Hi Roland!

True but MS-Windows WOW translates that for you. So my older code still runs OK (as long as it's Unicode compliant - which the framework is). However you are correct in that "some day" I should change those Declarations but, with over 900 SDK external commands declared in my STD framework I am working at these one at a time on an as needed. basis, ;-)
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 18 January 2024 14:51 PM UTC
  2. PowerBuilder
  3. # 3

Windows will automatically use the correct version based on the bitness of your application. There is no 'registration' process.

To make your external function references work in 64bit, you need to make sure you are using the correct data types.

Pointers / Handles - Longptr

DWORD / UINT - ulong

int - long

SIZE_T - Longptr

SHORT - integer

 

 

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 18 January 2024 13:39 PM UTC
  2. PowerBuilder
  3. # 4

Hi, Batel - 

Your current assessment of the System32 and SysWOW64 is incorrect. It is actually the opposite: 64-bit system DLL's reside in the System32 folder and the 32-bit system DLL's reside in SysWOW64. "SysWOW64" stands for "System (32-bit) Windows On Windows64".

Instead of spending a lot of time here explaining the finer nuances of interfacing PB applications with the Windows API, I encourage you to read through a series of tech articles on this subject. Here are links to the first two (of four total) that I think you will benefit the most from:

    https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/302-interfacing-pb-applications-with-the-windows-api-part-1

    https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/303-interfacing-pb-applications-with-the-windows-api-part-2

Please be aware that the internal memory length of a structure can vary between 32-bit and 64-bit, depending on the datatypes of the structure members it contains and also if the structure contains Unicode or ANSI characters/strings. The tech articles I've linked to explain all of this.

If you will provide more detail regarding the layout of the PB structure(s), I can help provide you with the external function declaration(s) you can use with the RtlMoveMemory API. It is also important to know which direction the data in the structure is to be copied from/to (From PB to Windows, or from Windows to PB).

Best regards, John

Comment
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.