1. Anna Meriina
  2. PowerBuilder
  3. Thursday, 1 February 2024 15:52 PM UTC

PowerBuilder 2019 R2 Build 2353

We receive "Error opening dll library pbCrypt.dll for external function in line 20..." when calling Sec_3DesCryptApi. In Runtime and only on one virtual machine. On others it works ok.

This function Sec_3DesCryptApi is declared in Local External function as following:

FUNCTION long Sec_3DesCryptApi( string input, long len, ref string output) LIBRARY "pbCrypt.DLL" alias for "Sec_3DesCryptApi;Ansi";

Just before calling this function I added opening file pbcrypt.dll for reading (with fileopen-fileread-fileclose) and it connstantly succeeds, then we get the error message about opening dll library pbCrypt.dll.

What can be the reason?

 

Ken Guo @Appeon Accepted Answer Pending Moderation
  1. Sunday, 4 February 2024 00:29 AM UTC
  2. PowerBuilder
  3. # 1

Hi Anna,

 

Since some of your machines are normal and some are not, I recommend using the ProcessExplorer tool to compare and see if the DLL files loaded on your application are the same when running on the two machines, especially the pbcrypt.dll file.

 

In addition, if you want to encrypt strings, I recommend that you use the PB crypterobject instead of calling the pbcrypt.dll API directly.

https://docs.appeon.com/pb2022r3/objects_and_controls/CrypterObject_object.html

 

Regards,

Ken

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 1 February 2024 19:50 PM UTC
  2. PowerBuilder
  3. # 2

Hi, Anna -

It would appear from the following question from April 2021 that you are using a 3rd-party DLL named pbcrypt.dll, not the Appeon supplied pbcrypt.dll:

    https://community.appeon.com/index.php/qna/q-a/pbcrypt-dll-provided-in-pb-runtime-package-of-2019-r3-is-not-working

My guess is the virtual desktop/machine where this call is failing is missing one or more dependent DLL's. You might consider using a dependency walker utility to help you determine if this is the case. Here is a link to one that is available on GitHub:

    https://github.com/lucasg/Dependencies

In any event, performing a FileOpen, FileRead/FileReadEx, FileClose from the PB app on the dll will do nothing to resolve the issue.

Best regards, John

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 1 February 2024 20:02 PM UTC
I agree John .. that is NOT an Appeon PB DLL but an old "look alike" from what I remember of "days gone by" in the PowerSoft / Sybase days of PB..

I suspect that that DLL is no longer compliant with the VS C++ 2019 Microsoft compiler that PB 2022 R2 now uses.

It will also become even more out of date in PB 2022 R3 & higher as Appeon has again moved up to using even a newer VC++ compiler in that release.

The only hope (IMHO) is that Anna has the source code for the old 3rd party PBCrypt module and can then use the VS C++ 2019 compiler to recompile it for PB 2022 R2 use. However, I would then make sure that she changes the PBCrypt name to another DLL name as not to collide with the Appeon DLL of the same name.

Failing the missing old PBCrypt source, I would then suggest that Anna refactor her Apps to use the built-in PB "CryptorObject" object instead going forward. Just my $0.02 of course. ;-)
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 1 February 2024 17:12 PM UTC
  2. PowerBuilder
  3. # 3

Hi Anna;

  I am a bit confused as the PBCrypt.dll is an internal runtime DLL used by the PBVM that supports the built-in CryptorObject Class ( https://docs.appeon.com/pb2022r2/objects_and_controls/CrypterObject_object.html ).  Since this is all handled internally to the PBVM (akak transparent to the PB App) - I am confused as to even why your trying to declare it as an External Function????

Regards ... Chris

Comment
  1. Anna Meriina
  2. Thursday, 1 February 2024 19:32 PM UTC
Hi Chris,



If we need to use Sec_3DesCryptApi, how should we declare it? It has been working for years the way I described, so I suppose Sec_3DesCryptApi is inside pbcrypt.dll.



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