Page 1 of 1

Impossible to compile enigma IDE with Delphi 2009

Posted: Tue Jun 09, 2009 7:13 am
by remixtech
Hello

Delphi 2009 gives me some error when compiling enigma_IDE.pas
[DCC Erreur] enigma_ide.pas(78): E2267 La déclaration précédente de 'EP_RegSaveKey' n'a pas été marquée de la directive 'overload'
[DCC Erreur] enigma_ide.pas(79): E2267 La déclaration précédente de 'EP_RegLoadKey' n'a pas été marquée de la directive 'overload'
[DCC Erreur] enigma_ide.pas(81): E2267 La déclaration précédente de 'EP_RegCheckKey' n'a pas été marquée de la directive 'overload'
[DCC Erreur] enigma_ide.pas(82): E2267 La déclaration précédente de 'EP_RegCheckAndSaveKey' n'a pas été marquée de la directive 'overload'
[DCC Erreur] enigma_ide.pas(84): E2037 La déclaration de 'EP_RegHardwareID' diffère de la déclaration précédente
[DCC Erreur] enigma_ide.pas(97): E2267 La déclaration précédente de 'EP_ProtectedStringByKey' n'a pas été marquée de la directive 'overload'
[DCC Erreur] enigma_ide.pas(42): E2065 Déclaration forward ou external non satisfaite : 'EP_RegSaveKey'
[DCC Erreur] enigma_ide.pas(43): E2065 Déclaration forward ou external non satisfaite : 'EP_RegLoadKey'
[DCC Erreur] enigma_ide.pas(45): E2065 Déclaration forward ou external non satisfaite : 'EP_RegCheckKey'
[DCC Erreur] enigma_ide.pas(47): E2065 Déclaration forward ou external non satisfaite : 'EP_RegCheckAndSaveKey'
[DCC Erreur] enigma_ide.pas(61): E2065 Déclaration forward ou external non satisfaite : 'EP_ProtectedStringByKey'
[DCC Erreur fatale] test.dpr(8): F2063 Impossible de compiler l'unité utilisée '..\..\..\EnigmaSDK\Delphi\enigma_ide.pas'
It is just an example give with the enigma protector...

Thanks...

Re: Impossible to compile enigma IDE with Delphi 2009

Posted: Tue Jun 09, 2009 7:21 am
by remixtech

Code: Select all

unit enigma_ide;

interface

const
  WM_PUBLIC         = 1;
  WM_PRIVATE        = 2;

  MAX_STRING_SIZE   = 255;

  // Ctypt hash types, possible hash values for functions:
  // EP_CryptHashBuffer
  // EP_CryptHashStringA
  // EP_CryptHashStringW
  // EP_CryptHashFileA
  // EP_CryptHashFileW
  HASH_XOR32        = 0;
  HASH_MD2          = 1;
  HASH_MD5          = 2;
  HASH_RipeMD160    = 3;
  HASH_SH1          = 4;
  HASH_SHA224       = 5;
  HASH_SHA256       = 6;
  HASH_SHA384       = 7;
  HASH_SHA512       = 8;

type
  TWMContent = record
    WMType      : integer;
    Name        : PAnsiChar;
    NameLen     : integer;
    Text        : PAnsiChar;
    TextLen     : integer;
    FileName    : PAnsiChar;
    FileNameLen : integer;
    AFile       : pointer;
    AFileLen    : integer;
  end;
  PWMContent = ^TWMContent;

{API for registration}
function EP_RegSaveKey ( Name : PAnsiChar; Key : PAnsiChar) : boolean; stdcall;
function EP_RegLoadKey( var Name : PAnsiChar; var Key : PAnsiChar) : boolean; stdcall;
function EP_RegDeleteKey : boolean; stdcall;
function EP_RegCheckKey ( Name : PAnsiChar; Key : PAnsiChar) : boolean; stdcall;
function EP_RegLoadAndCheckKey : boolean; stdcall;
function EP_RegCheckAndSaveKey(  Name : PAnsiChar; Key : PAnsiChar) : boolean; stdcall;
function EP_RegHardwareID : PAnsiChar; stdcall;
function EP_RegKeyCreationDate( var Year, Month, Day : Cardinal) : boolean; stdcall;
function EP_RegKeyExpirationDate( var Year, Month, Day : Cardinal) : boolean; stdcall;
{API for trial}
function EP_TrialExecutions( var Total, Left : Cardinal) : boolean; stdcall;
function EP_TrialDays( var Total, Left : Cardinal) : boolean; stdcall;
function EP_TrialExpirationDate( var Year, Month, Day : Cardinal) : boolean; stdcall;
function EP_TrialDateTillDate( var StartYear, StartMonth, StartDay, EndYear, EndMonth, EndDay : Cardinal) : boolean; stdcall;
function EP_TrialExecutionTime( var Total, Left : Cardinal) : boolean; stdcall;
{API Misc}
function EP_MiscGetWatermark(ID : integer; WM : PWMContent) : integer; stdcall;
{API Protection}
function EP_ProtectedStringByID(ID : integer; Buffer : pointer; Len : integer) : integer; stdcall;
function EP_ProtectedStringByKey(Key : PAnsiChar; Buffer : pointer; Len : integer) : integer; stdcall;
{API Crypt}
function EP_CryptHashBuffer(Hash : Cardinal; Buffer : pointer; Size : Cardinal; Digest : pointer) : Cardinal; stdcall;
function EP_CryptHashFileA(Hash : Cardinal; FileName : PAnsiChar; Digest : pointer) : Cardinal; stdcall;
function EP_CryptHashFileW(Hash : Cardinal; FileName : PWideChar; Digest : pointer) : Cardinal; stdcall;
function EP_CryptHashStringA(Hash : Cardinal; Str : PAnsiChar; Digest : pointer) : Cardinal; stdcall;
function EP_CryptHashStringW(Hash : Cardinal; Str : PWideChar; Digest : pointer) : Cardinal; stdcall;
{API Checkup}
function EP_CheckupCopies( var Total, Current : Cardinal) : boolean; stdcall;
function EP_CheckupIsProtected : boolean;
function EP_CheckupIsEnigmaOk : boolean;

implementation

const
  enigma_api_dll_name  = 'enigma_ide.dll';

function EP_RegSaveKey ( Name : PAnsiChar; Key : PAnsiChar) : boolean; external enigma_api_dll_name name 'EP_RegSaveKey';
function EP_RegLoadKey(var Name : PAnsiChar; var Key : PAnsiChar) : boolean; external enigma_api_dll_name name 'EP_RegLoadKey';
function EP_RegDeleteKey : boolean; external enigma_api_dll_name name 'EP_RegDeleteKey';
function EP_RegCheckKey ( Name : PAnsiChar; Key : PAnsiChar) : boolean; external enigma_api_dll_name name 'EP_RegCheckKey';
function EP_RegCheckAndSaveKey(Name : PAnsiChar; Key : PAnsiChar) : boolean; external enigma_api_dll_name name 'EP_RegCheckAndSaveKey';
function EP_RegLoadAndCheckKey : boolean; external enigma_api_dll_name name 'EP_RegLoadAndCheckKey';
function EP_RegHardwareID : PAnsiChar; external enigma_api_dll_name name 'EP_RegHardwareID';
function EP_RegKeyCreationDate( var Year, Month, Day : Cardinal) : boolean; external enigma_api_dll_name name 'EP_RegKeyCreationDate';
function EP_RegKeyExpirationDate( var Year, Month, Day : Cardinal) : boolean; external enigma_api_dll_name name 'EP_RegKeyExpirationDate';

function EP_TrialExecutions( var Total, Left : Cardinal) : boolean; external enigma_api_dll_name name 'EP_TrialExecutions';
function EP_TrialDays( var Total, Left : Cardinal) : boolean; external enigma_api_dll_name name 'EP_TrialDays';
function EP_TrialExpirationDate( var Year, Month, Day : Cardinal) : boolean; external enigma_api_dll_name name 'EP_TrialExpirationDate';
function EP_TrialDateTillDate( var StartYear, StartMonth, StartDay, EndYear, EndMonth, EndDay : Cardinal) : boolean; external enigma_api_dll_name name 'EP_TrialDateTillDate';
function EP_TrialExecutionTime( var Total, Left : Cardinal) : boolean; external enigma_api_dll_name name 'EP_TrialExecutionTime';

function EP_MiscGetWatermark(ID : integer; WM : PWMContent) : integer; external enigma_api_dll_name name 'EP_MiscGetWatermark';

function EP_ProtectedStringByID(ID : integer; Buffer : pointer; Len : integer) : integer; external enigma_api_dll_name name 'EP_ProtectedStringByID';
function EP_ProtectedStringByKey(Key : PAnsiChar; Buffer : pointer; Len : integer) : integer; external enigma_api_dll_name name 'EP_ProtectedStringByKey';

function EP_CryptHashBuffer(Hash : Cardinal; Buffer : pointer; Size : Cardinal; Digest : pointer) : Cardinal; external enigma_api_dll_name name 'EP_CryptHashBuffer';
function EP_CryptHashFileA(Hash : Cardinal; FileName : PAnsiChar; Digest : pointer) : Cardinal; external enigma_api_dll_name name 'EP_CryptHashFileA';
function EP_CryptHashFileW(Hash : Cardinal; FileName : PWideChar; Digest : pointer) : Cardinal; external enigma_api_dll_name name 'EP_CryptHashFileW';
function EP_CryptHashStringA(Hash : Cardinal; Str : PAnsiChar; Digest : pointer) : Cardinal; external enigma_api_dll_name name 'EP_CryptHashStringA';
function EP_CryptHashStringW(Hash : Cardinal; Str : PWideChar; Digest : pointer) : Cardinal; external enigma_api_dll_name name 'EP_CryptHashStringW';

function EP_CheckupCopies( var Total, Current : Cardinal) : boolean; external enigma_api_dll_name name 'EP_CheckupCopies';
function EP_CheckupIsProtected : boolean; external enigma_api_dll_name name 'EP_CheckupIsProtected';
function EP_CheckupIsEnigmaOk : boolean; external enigma_api_dll_name name 'EP_CheckupIsEnigmaOk';


end.
Corrections for the file Change all PChar in PansiChar...

Note also that all the exemples dont work with delphi 2009. There is a mix of Pchar PansiChar etc... The parameters are passed in Pchar or PansiChar ?

Re: Impossible to compile enigma IDE with Delphi 2009

Posted: Tue Jun 09, 2009 8:03 am
by Enigma
Hi remixtech, yes, parameters are passed in PAnsiChar. Just all old versions of Delphi think that PChar = PAnsiChar, but the D2009 thinks PChar = PWideChar, this is due to all examples do not work. The decision is same as you wrote, change PChar to PAnsiChar.

In full Enigma 1.67 this problem is solved. Do you get this version?

Thanks!

Re: Impossible to compile enigma IDE with Delphi 2009

Posted: Tue Jun 09, 2009 8:12 am
by remixtech
Hello, thanks for this fast answer...

Yes i have got the 1.67 version 20090601, full version. Actually the only way i have found to work with the API is to send the parameter in Pchar with

Code: Select all

  if EP_RegCheckAndSaveKey(PChar(ansistring(eUserInfo.Text)), PChar(ansistring(eKey.Text))) then
And i have rewrite the function declaration

Code: Select all

function EP_RegCheckAndSaveKey(Name : PChar; Key : PChar) : boolean; external enigma_api_dll_name name 'EP_RegCheckAndSaveKey';
But when i deal with return of function. I haven't problem.
I declare :

Code: Select all

function EP_RegHardwareID : PansiChar; stdcall;
and Use

Code: Select all

 ehardware.text := string(EP_RegHardwareID);
What do you think of the solution ? Is there a more simple way ?

Thanks,
Rémi

Re: Impossible to compile enigma IDE with Delphi 2009

Posted: Tue Jun 09, 2009 8:20 am
by Enigma
Opps... I changed in 1.67 all PChar to PAnsiChar only before implementation but after keep PChar, this is due to it do not work.. My apologies, repaired enigma_ide.pas is in attachment.

Re: Impossible to compile enigma IDE with Delphi 2009

Posted: Tue Jun 09, 2009 8:40 am
by remixtech
Okay nice ;) Thanks for the help

Re: Impossible to compile enigma IDE with Delphi 2009

Posted: Tue Jun 09, 2009 8:45 am
by Enigma
Thanks you for the help to find a bug :)