Page 1 of 1

EP_RegKeyInformation crashed my VB6 APP

Posted: Wed Feb 26, 2014 5:20 pm
by brunosilva
Hi

i'm trying engima Protector before buying (version 3.150] and i'm having problems checking sections.

I have a form with 3 text boxes (HWID, user, Key) and 16 checkboxes for each possible sections (for different features in my program).

First, in the example folder of the programa, there isn't an example for VB. But you have definitions for VB...

I have this in a private sub in the form and it crashed in this line:
* If EP_RegKeyInformation(Name, Key, vDados) Then

What i'm doing wrong? Or maybe some setting when i'm protecting the APP.

Private sub CheckLicence()
Dim Name As String
Dim Key As String
Dim vDados As TKeyInformation
Dim ci As Integer

txtHardwareID.Text = EP_RegHardwareID
If EP_RegLoadAndCheckKey = 1 Then
If EP_RegLoadKey(Name, Key) = 1 Then
txtNomeRegisto.Text = Name
txtChaveRegisto.Text = Key
If EP_RegKeyInformation(Name, Key, vDados) Then

For ci = 0 To 15
chkLic(ci).Value = vDados.EncryptedSections(ci)
Next ci
End If
End If
End If

End Sub

Re: EP_RegKeyInformation crashed my VB6 APP

Posted: Mon Mar 03, 2014 7:24 am
by Enigma
Hi Bruno,

Can you please send us compiled non protected exe file at support@enigmaprotector.com. I think there is some alignment problems of the TKeyInformation structure. We will try to check it out and fix the structure declaration if there is a problem.

Re: EP_RegKeyInformation crashed my VB6 APP

Posted: Mon Mar 03, 2014 3:16 pm
by Enigma
The problem has been found. TKeyInformation structure declaration is not valid for Visual Basic.
All Boolean parameters should be replaced with Long, and these parameters should be checked against zero:

Code: Select all

Public Type TKeyInformation
    Stolen As Long ' {out} is key stolen?
    CreationYear As Long ' {out} key creation year
    CreationMonth As Long ' {out} key creation month
    CreationDay As Long ' {out} key creation day
    UseKeyExpiration As Long ' {out} has key expiration date?
    ExpirationYear As Long ' {out} key expiration year
    ExpirationMonth As Long ' {out} key expiration month
    ExpirationDay As Long ' {out} key expiration day
    UseHardwareLocking As Long ' {out} hardware locked key
    UseExecutionsLimit As Long ' {out} limit key by executions?
    ExecutionsCount As Long ' {out} number of executions
    UseDaysLimit As Long ' {out} limit key by days?
    DaysCount As Long ' {out} number of days
    UseRunTimeLimit As Long ' {out} limit key by run time?
    RunTimeMinutes As Long ' {out} run time minutes
    UseGlobalTimeLimit As Long ' {out} limit key by global time?
    GlobalTimeMinutes As Long ' {out} global time minutes
    UseCountyLimit As Long ' {out} limit key by country?
    CountryCode As Long ' {out} country code
    UseRegisterAfter As Long ' {out} register key after date?
    RegisterAfterYear As Long ' {out} register after year
    RegisterAfterMonth As Long ' {out} register after month
    RegisterAfterDay As Long ' {out} register after day
    UseRegisterBefore As Long ' {out} register key before date?
    RegisterBeforeYear As Long ' {out} register before year
    RegisterBeforeMonth As Long ' {out} register before month
    RegisterBeforeDay As Long ' {out} register before day
    EncryptedSections(NUMBER_OF_CRYPTED_SECTIONS - 1) As Long ' {out} Crypted sections
End Type
And check like this:

Code: Select all

if vDados.EncryptedSections(ci) = 0 Then
or

Code: Select all

if vDados.EncryptedSections(ci) <> 0 Then

Re: EP_RegKeyInformation crashed my VB6 APP

Posted: Mon Mar 03, 2014 4:35 pm
by brunosilva
Hi

thanks for the fast response but I still have some problems:

I changed the TkeyInformation struture in enigma_ide.bas and now the program doesn't crash.

But the EP_RegKeyInformation(Name, Key, vDados) function returns allways false.

It's not suposed to (I think). After that, the 16 vDados.EncryptedSections(ci) returns 0.

Thanks

Bruno

Re: EP_RegKeyInformation crashed my VB6 APP

Posted: Tue Mar 04, 2014 7:30 am
by Enigma
Hi Bruno,

I believe you just forgot to protect the file. Enigma API functions start to work ONLY after protection.

If the file is non protected, then all functions will fail, as happening in your case.

Re: EP_RegKeyInformation crashed my VB6 APP

Posted: Tue Mar 04, 2014 12:17 pm
by brunosilva
Hi

the file is protected...

iI just added msgbox to display the values after protect the file.

:(

Bruno

Re: EP_RegKeyInformation crashed my VB6 APP

Posted: Thu Mar 06, 2014 2:56 pm
by brunosilva
new version of program sent by mail to support!

Re: EP_RegKeyInformation crashed my VB6 APP

Posted: Fri Mar 07, 2014 10:53 am
by Enigma
Hi Bruno,

Thanks you for the pointing us to this problem, we have found why it happens. There is an error in declaring of EP_RegKeyInformation in enigma_ide.bas. It should be the following:

Code: Select all

Public Declare Function EP_RegKeyInformation Lib "enigma_ide.dll" (ByVal AName As String, ByVal AKey As String, ByRef AKeyInfo As TKeyInformation) As Boolean
Please change this in your enigma_ide.bas and the function will be working as expected.

We will include this fix in the next release.

Re: EP_RegKeyInformation crashed my VB6 APP

Posted: Fri Mar 07, 2014 11:25 am
by brunosilva
Hello

it's .bas file... not .pas file.

Anyway it worked!!!! :D

I Will buy the tool in a couple of days to deploy my app.

Thanks for the big support! :D

Bruno

Re: EP_RegKeyInformation crashed my VB6 APP

Posted: Fri Mar 07, 2014 11:28 am
by Enigma
No problems, you are welcome :)