Protected Strings Procedure

Post here any topics that related to Enigma Protector, its functionality, your misunderstanding, offers to improvements etc etc etc
Post Reply
shamballa
Posts: 16
Joined: Tue Jun 08, 2010 11:13 pm

Protected Strings Procedure

Post by shamballa »

Hello

I have Delphi XE2 and The Enigma Protector v3.40

What I am trying to do is create a procedure for Protected Strings so I can reuse it in different places to keep my code smaller!

This is my procedure:

Code: Select all

procedure ProtStrings(StrID: integer; Str: ansistring);
var
  arr: array[0..MAX_STRING_SIZE -1] of AnsiChar;
begin
  ZeroMemory(@arr, SizeOf(arr));
  if EP_ProtectedStringByID(StrID, @arr, SizeOf(arr)) > 0 then
  begin
    Str := arr;
  end;
end;
...and how I call it:

Code: Select all

ProtStrings(1,Form1.Caption);
The code compiles and after I have protected the file it runs but nothing is shown in the Forms Caption, is there any way I can do this without having to rewrite the code for every protected string I will use?

Thanks for your time,
Chris
Enigma
Site Admin
Posts: 2945
Joined: Wed Aug 20, 2008 2:24 pm

Re: Protected Strings Procedure

Post by Enigma »

Hi Chris, really, your code is fully wrong :)

1. ProtStrings must return a string.
2. Form1.Caption should assign the string and not just pass as your code does.

The logic of the code is wrong at all.

There is correct one (haven't tried to compile, so typos and errors can be there):

Code: Select all

function ProtStrings(StrID: integer) : string;
var
  p : pointer;
  size : integer;
begin
  Result := '';
  size := EP_ProtectedStringByID(StrID, nil, 0);
  if size > 0 then
  begin
    GetMem(p, size);
    try
      if EP_ProtectedStringByID(StrID, p, size) > 0 then
      begin
        SetString(Result, PAnsiChar(p), size);
      end;
    finally
      FreeMem(p);
    end;
  end;
end;
and how it should be used:

Code: Select all

Form1.Caption := ProtStrings(1);
shamballa
Posts: 16
Joined: Tue Jun 08, 2010 11:13 pm

Re: Protected Strings Procedure

Post by shamballa »

Hello Vladimir,

Thank you kindly for your response and help, even though untested it compiled and executed perfectly! Thank you again, that has really helped.

I think I may have found a bug in the protection (At least for me it is)...

I am using Delphi XE2 and running Windows 7 Ultimate x64

This is the problem:

I set Limitation by days count to 15 days and Time Control is checked also - I was working on my program last night and checking things when the time passed to the next day, so early morning. Then each time I executed my protected program the Trial Days would run down as if it were limited by executions count. This is not enabled though!

To reproduce this, you can uncheck Time Control and move the date forward by one day and then run protected program it will move trial day forward on each run by one day. I can even make a video of this happening to show you.

Also an odd thing is after the Trial has expired and I try to reset by Tools, Debug, reset local trial information then a Dialog will appear to state that the trial information cannot be found. It is only found and reset after I do: Reset all local information after having tried all others.

I have set to store Trial Data in 2 custom places, one in the registry and one in a file. I can see the one in the registry but the file is never stored anywhere. The registry key, I opted to have written in Binary format and the file I have set the attributes, Read Only, Hidden and System but I have also tried with no attributes. The location I have set in %Default folder% - I will set eventually in System32 (but I moved it just for testing as I can never see the file) this file is never seen and even with a search is never located and after doing a DIR search from cmd - so I think the file is never created. It is not seen in default folder either.

I hope I have explained well enough the problem and if you need me to send project file and protected/unprotected file I will do.

by the way, I prolonged subscription earlier yesterday so I have now the latest version 3.70 with which this problem is happening as it was also occurring with 3.40 the version I had before.

Chris
shamballa
Posts: 16
Joined: Tue Jun 08, 2010 11:13 pm

Re: Protected Strings Procedure

Post by shamballa »

I have done some more testing and I have narrowed it down to being only when Trial Data Storing is Enabled in Trial Control.

I was wrong about the Trial Data File not being stored, I can see it now after I made unchecked Protected operating system files in System32 and after resetting all Trial Info...

I have tested on Windows XP Professional x86 with Trial Data Storing Enabled and the same happens, as soon the day changes it will then start to count down as if running by Executions Count.

When I don't use Trial Data Storing and let Enigma use it's own paths, when the date changes everything is as it should be.

Chris
Enigma
Site Admin
Posts: 2945
Joined: Wed Aug 20, 2008 2:24 pm

Re: Protected Strings Procedure

Post by Enigma »

Hi Chris, thanks you for the detailed report. Unfortunately, I can't nor agree nor disagree with the information you provided..

Let us test it out and then I will reply.
shamballa
Posts: 16
Joined: Tue Jun 08, 2010 11:13 pm

Re: Protected Strings Procedure

Post by shamballa »

Hello Vladimir,

I still await for a reply or any kind of information regarding this matter as the problem still persists.

I really would like to use my own paths for setting of the trial data as I think the Enigma paths are well known. My idea of how I will set this protection is to fool many "have a go crackers" misleading them, setting false strings and paths in the Registry but this is really a problem to me right now as the paths I set are acting as Limitation by Execution as described in my other post.

Have you found a problem that I describe how to reproduce or is it just my system? I have tested this on Windows 7, Vista and Windows XP but not on ME, 98 as I no longer support them. Not yet tested on win2k either.

Chris
Enigma
Site Admin
Posts: 2945
Joined: Wed Aug 20, 2008 2:24 pm

Re: Protected Strings Procedure

Post by Enigma »

Problem with Trial information described above is confirmed. It is fixed and new version will be soon released!
Post Reply