Struggling to identify what the difference is in Delphi 10.4 and Delphi 11.3 in regards to the use of a DLL function.
I have some legacy code that uses a security library.
Works fine when compiled with Delphi 10.4 both for 32-bit and 64-bit.
In Delphi 11.3 it works fine for 32-bit, but not for 64-bit.
No changes to the code, nor project settings.
Code:
Interface
Function pp_lfopen (filename: PAnsiChar; lfflags: LongInt; lftype: LongInt; password: PAnsiChar; handle: PLongInt): LongInt; stdcall;
Implementation
const
{$IFDEF WIN32}
KeyLibModuleName = 'KEYLIB32.dll';
{$ELSEIF Defined(WIN64)}
KeyLibModuleName = 'KEYLIB64.dll';
{$ENDIF}
Function pp_lfopen; external KeyLibModuleName;
Usage:
var
LHandle: Longint;
begin
Lresult := pp_lfopen(PAnsiChar(FlicFilePath), 0, LF_FILE, PAnsiChar(FlicPassword), @Lhandle);
if Lresult = PP_SUCCESS then
begin
// additional DLL calls, which fail due to the invalid handle
end;
end;
The path and password are correct and valid text constants.
My analysis so far has shown that the Lhandle returned is not valid, even though the function result indicates success.
Just recently switched over to Delphi 11.3, but I cannot pinpoint the cause so far.
Anyone with knowledge about the differences in 11.3 compared to 10.4 that could explain this? Or ideas to find the cause?