AX_SetPassword bug!

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
User avatar
rjpajaron
Posts: 364
Joined: Fri Nov 06, 2015 12:01 am

AX_SetPassword bug!

Post by rjpajaron »

Hello,

I search for "AX_SetPassword" in the forum and none came up.

So, I have to file this bug report.

I assume that this is a bug.

Below are stack trace of the bug.

Code: Select all

Description :	Unable to cast object of type 'System.IntPtr' to type 'System.IConvertible'.
Subsystem :	BASE
GenCode :	EG_EXCEPTION Exception raised by CLR or external code
FuncSym :	OOPHELPERS:SENDHELPER
Severity :	ES_ERROR
Can Default :	False
Can Retry :	False
Can Substitute :	False
Stack Trace :	
   at System.Convert.ToUInt32(Object value)
   at XSharp.RDD.Functions.AX_GetAceTableHandle()
   at XSharp.RDD.Functions.AX_SetPassword(String szEncodeKey)
To workaround it, I do the following:

I inserted this on top of my dataserver class:

Code: Select all

_DLL FUNC DBFAXSAdsEnableEncryption( hTbl AS LONGINT, pucPassword AS PSZ ) AS LONGINT PASCAL:ACE32.AdsEnableEncryption
_DLL FUNC DBFAXSAdsDisableEncryption( hTbl AS LONGINT ) AS LONGINT PASCAL:ACE32.AdsDisableEncryption
then copy pasted from ADS DBFAXS.AEF the following code

Code: Select all

PROCEDURE AX_SetPassword( szEncodeKey AS STRING ) // Set password for record encryption
   IF  ( IsNil( szEncodeKey ) .OR. (szEncodeKey == '' ))
      DBFAXSAdsDisableEncryption( AX_GetAceTableHandle() )
   ELSE
      DBFAXSAdsEnableEncryption( AX_GetAceTableHandle(), String2Psz( szEncodeKey ) )
   ENDIF

FUNCTION AX_GetAceTableHandle() AS LONGINT
   // Returns the table handle for the current workarea.  This handle can be used
   // to call the Advantage Client Engine directly.
   // Returns a 0 if there is a problem.
RETURN DbInfo( DBI_GET_ACE_TABLE_HANDLE )

And I able to open an encrypted table. Work fine to me for now. Now I can continue my "mega testing...."

Regards,

Rene
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

AX_SetPassword bug!

Post by robert »

Rene,
Thanks for the report.
Your code will work in 32 bits only because you are casting the IntPtr returned from DbInfo( DBI_GET_ACE_TABLE_HANDLE ) to a LONG.
The 2 prototypes each also use a LONG as table handle and are directly linked to ACE32 (the 32 bits version of advantage).
I will fix this in one of the next builds and will make an anycpu version of these 2 functions that take a IntPtr as parameter.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply