Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

AX_SetPassword bug! 09 Jan 2020 12:39 #12514

  • rjpajaron
  • rjpajaron's Avatar
  • Topic Author


  • Posts: 364
  • 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.
    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:
    _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
    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
    --

    Rene Pajaron

    Please Log in or Create an account to join the conversation.

    AX_SetPassword bug! 10 Jan 2020 16:44 #12558

    • robert
    • robert's Avatar


  • Posts: 3595
  • 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

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1