protecting lite c and 3dgs app or games?

Post here any topics that related to Enigma Protector, its functionality, your misunderstanding, offers to improvements etc etc etc
Post Reply
snura
Posts: 15
Joined: Sat Sep 05, 2009 11:58 pm

protecting lite c and 3dgs app or games?

Post by snura » Sun Sep 06, 2009 12:04 am

have you have any plan to support lite c?it's a c like syntax compiler for 3d gamestudio packages,site here : http://www.3dgamestudio.com/ , the developer community need something to protect the games and also doesn't compromise the performance of their games,just notes sometime also the compiler support 3rd party dll,is it possible to protect those also?can you check it?and add it into your sdk,encrypted code,dll?iam sure gonna buy..

snura
Posts: 15
Joined: Sat Sep 05, 2009 11:58 pm

Re: protecting lite c and 3dgs app or games?

Post by snura » Sun Sep 06, 2009 12:19 am

sample lite-c code,

Code: Select all

/////////////////////////////////////////////
// clock.c - analog clock panel example
// requires WINDOWS VISTA or above
// (c) jcl / oP group 2009
/////////////////////////////////////////////
#include <acknex.h>
#include <default.c>

var hours;

// drag window with left mouse button
function on_mouse_left_event()
{
   VECTOR click_pos,new_pos;
   vec_set(click_pos,mouse_cursor);
// move the window by the mouse distance to the click position   
   while (mouse_left) {
      vec_diff(new_pos,mouse_cursor,click_pos);
      vec_add(new_pos,window_pos);
      video_window(new_pos,NULL,0,0);
      wait(1);
   }
}

// draw a halftransparent border for a sort of antialiasing
void bmap_drawborder(BMAP* bmap,COLOR* color,var alpha)
{
   var pixel = pixel_for_vec(color,alpha,bmap_lock(bmap,0));
   var width = bmap_width(bmap);
   var height = bmap_height(bmap);
   var i;
   for (i=0; i<width; i++) {
      pixel_to_bmap(bmap,i,0,pixel);
      pixel_to_bmap(bmap,i,height-1,pixel);
   }
   for (i=0; i<height; i++)
   {
      pixel_to_bmap(bmap,0,i,pixel);
      pixel_to_bmap(bmap,width-1,i,pixel);
   }
   bmap_unlock(bmap);   
}

////////////////////////////////////////////////////////////
#define COLOR_HAND vector(255,220,220)
#define COLOR_BODY vector(20,0,0) // dark blue

function main()
{
   vec_set(screen_size,vector(400,400,0));
   vec_set(screen_color,COLOR_BODY);
   if (sys_winversion >= 6)
      video_alpha = 85; // transparency works under Vista only
   wait(1); // wait until the engine window is opened

// place the clock in the upper left corner  
   video_window(vector(6,6,0),vector(200,200,0),2,0);
   PANEL* clock = pan_create(NULL,0);
   set(clock,SHOW);

   BMAP* hours_hand = bmap_fill(bmap_createblack(140,8,32),COLOR_HAND,100);
   bmap_drawborder(hours_hand,COLOR_HAND,60);
   pan_setneedle(clock,0,screen_size.x/2,screen_size.y/2,
     hours_hand, 10,4,90,12,0,hours);
   
   BMAP* minutes_hand = bmap_fill(bmap_createblack(180,6,32),COLOR_HAND,100);
   bmap_drawborder(minutes_hand,COLOR_HAND,60);
   pan_setneedle(clock,0,screen_size.x/2,screen_size.y/2,
     minutes_hand,10,3,90,60,0,sys_minutes);
   
   BMAP* seconds_hand = bmap_fill(bmap_createblack(190,5,32),COLOR_RED,100);
   bmap_drawborder(seconds_hand,COLOR_RED,60);
   pan_setneedle(clock,0,screen_size.x/2,screen_size.y/2,
     seconds_hand,20,2,90,60,0,sys_seconds);

// add inbetween value for hour hand
   while(1) { 
      hours = sys_hours + sys_minutes/60;
      wait(1); 
   }
}
the compiled exe :

Code: Select all

http://www.storage.to/get/TqfeCmiU/clock.cd.rar
i have tested with enigma demo 1.76,tested to protect the file without any pluggins,just default setting,when i run the protected exe,after the demo splash,nothing appear,the protected app just shutdown :(,the project file attached below,btw iam running win xp pro sp2 64 bit.
You do not have the required permissions to view the files attached to this post.

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

Re: protecting lite c and 3dgs app or games?

Post by Enigma » Sun Sep 06, 2009 5:29 am

Ok, thanks for the files, I will take a look!

Hope that this problem will be solved soon!

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

Re: protecting lite c and 3dgs app or games?

Post by Enigma » Sun Sep 06, 2009 6:56 pm

I have found a core of the problem! Protected files do not work becuase lite-c executables have self-check routine. For example, any modification of executable memory causes check sum exception and crasing.

Anyway, I also found how to solve this and how to allow to protect these exes with Enigma.
1. Download and install latest Enigma, this will not work with Enigma version < 1.76, only since 1.76 it is possible
2. Download attached plugin Lite-C plugin, unzip it and copy to Enigma installation folder, Plugins subfolder
3. Start Enigma, go to Miscellaneous - Plugins panel, if you have done everything correctly, you will see Lite-C plugin in the list, enable this plugin, this is very important!
4. Select input and outout files, click protect

Now your exe will work well protected!

PS: not sure if this plugin will work with any lite-c files, if it will not work, just send me these files back, I will test out!
You do not have the required permissions to view the files attached to this post.

snura
Posts: 15
Joined: Sat Sep 05, 2009 11:58 pm

Re: protecting lite c and 3dgs app or games?

Post by snura » Mon Sep 07, 2009 12:56 am

ok thank you it's working!iam gonna inform the community,what about sdk support and example?is there any plan to add lite-c into sdk?

Edited :
Posted the introduction here :

Code: Select all

http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=288522&#Post288522
you can reg in the forum and maybe if there is user interested to reply back?

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

Re: protecting lite c and 3dgs app or games?

Post by Enigma » Mon Sep 07, 2009 9:33 am

Ohh.. just do not want to register... :) Let's discuss here!

Regarding SDK, not sure I can give you good advices..

The main problem (as I took quick look), the Lite-C executable is an overlay exe file, i.e. it does not generate code for main exe, it just add some extra data to the end of file (overlay). In this case it will be impossible to use SDK Enigma features. Maybe I'm mistaking...

But, ask to lite-c developers, is it possible to call through the code the function from the external dll? For example, is it possible to call function X from Y.dll? If it will be possible, then I will explain how to apply Enigma power to protect exe!

snura
Posts: 15
Joined: Sat Sep 05, 2009 11:58 pm

Re: protecting lite c and 3dgs app or games?

Post by snura » Thu Sep 10, 2009 10:41 pm

a new reply from the a7 dev based on your request about the overlay :
No, there is no bytecode. A legacy mode executable is just a normal EXE as defined by Microsoft. A pure mode lite-C executable however is a normal EXE wrapped around another EXE. It's executed in two steps: the wrapper EXE loads acknex.dll, which performs a self check and then transfers control to the embedded real EXE. This should however normally not matter for protection systems.

But calling the enigma DLL from lite-C is of course the easiest way. Look here:

http://manual.3dgamestudio.net/litec_api.htm

Just put a #define PRAGMA_API definition in your code and then you can call the enigma DLL function.
i am gonna try it soon..

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

Re: protecting lite c and 3dgs app or games?

Post by Enigma » Sun Sep 13, 2009 8:58 am

Ok, then lite-c allows to call external libraries - that's good!

So, if API call is possible, then you can use Enigma API in your lite-c applications. API provides you a huge possibilities (manually check registration keys, check trial, other features), moreover, using an API is very good way to increase protection, any integration of protected file with protector - gives good protection level.

Since lite-c has very wide range of api declaration, you can use any type (static or dynamic), Enigma will support it well. Below are declarations of Enigma API to use it in lite-c (static PRAGMA method):

Code: Select all

const
  int WM_PUBLIC         = 1;
  int WM_PRIVATE        = 2;

  int MAX_STRING_SIZE   = 255;

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

typedef struct TWMContent {

    int   WMType;
    char* Name;
    int   NameLen;
    char* Text;
    int   TextLen;
    char* FileName;
    int   FileNameLen;
    char* AFile;
    int   AFileLen;

} TWMContent, *PWMContent;

// Registration API
BOOL EP_RegSaveKey( char* Name, char* Key );
#define PRAGMA_API EP_RegSaveKey;enigma_ide!
BOOL EP_RegLoadKey( char** Name, char** Key );
#define PRAGMA_API EP_RegLoadKey;enigma_ide!
BOOL EP_RegCheckKey( char* Name, char* Key );
#define PRAGMA_API EP_RegCheckKey;enigma_ide!
BOOL EP_RegDeleteKey();
#define PRAGMA_API EP_RegDeleteKey;enigma_ide!
BOOL EP_RegLoadAndCheckKey();
#define PRAGMA_API EP_RegLoadAndCheckKey;enigma_ide!
BOOL EP_RegCheckAndSaveKey( char* Name, char* Key );
#define PRAGMA_API EP_RegCheckAndSaveKey;enigma_ide!
LPCTSTR EP_RegHardwareID();
#define PRAGMA_API EP_RegHardwareID;enigma_ide!
BOOL EP_RegKeyCreationDate( WORD* Year, WORD* Month, WORD* Day );
#define PRAGMA_API EP_RegKeyCreationDate;enigma_ide!
BOOL EP_RegKeyExpirationDate( WORD* Year, WORD* Month, WORD* Day );
#define PRAGMA_API EP_RegKeyExpirationDate;enigma_ide!
// Trial API
BOOL EP_TrialExecutions( DWORD* Total, DWORD* Left );
#define PRAGMA_API EP_TrialExecutions;enigma_ide!
BOOL EP_TrialDays( DWORD* Total, DWORD* Left );
#define PRAGMA_API EP_TrialDays;enigma_ide!
BOOL EP_TrialExpirationDate( WORD* Year, WORD* Month, WORD* Day );
#define PRAGMA_API EP_TrialExpirationDate;enigma_ide!
BOOL EP_TrialDateTillDate( WORD* StartYear, WORD* StartMonth, WORD* StartDay, WORD* EndYear, WORD* EndMonth, WORD* EndDay );
#define PRAGMA_API EP_TrialDateTillDate;enigma_ide!
BOOL EP_TrialExecutionTime( DWORD* Total, DWORD* Left );
#define PRAGMA_API EP_TrialExecutionTime;enigma_ide!
// Misc API
int EP_MiscGetWatermark( int ID, PWMContent WM );
#define PRAGMA_API EP_MiscGetWatermark;enigma_ide!
// Protection API
int EP_ProtectedStringByID( int Total, char* Left, int Len);
#define PRAGMA_API EP_ProtectedStringByID;enigma_ide!
int EP_ProtectedStringByKey( char* Key, char* Left, int Len);
#define PRAGMA_API EP_ProtectedStringByKey;enigma_ide!
// Crypt API
int EP_CryptHashBuffer( int Hash, byte* Buffer, int Size, byte* Digest);
#define PRAGMA_API EP_CryptHashBuffer;enigma_ide!
int EP_CryptHashFileA( int Hash, char* FileName, byte* Digest);
#define PRAGMA_API EP_CryptHashFileA;enigma_ide!
int EP_CryptHashFileW( int Hash, wchar_t* FileName, byte* Digest);
#define PRAGMA_API EP_CryptHashFileW;enigma_ide!
int EP_CryptHashStringA( int Hash, char* Str, byte* Digest);
#define PRAGMA_API EP_CryptHashStringA;enigma_ide!
int EP_CryptHashStringW( int Hash, wchar_t* Str, byte* Digest);
#define PRAGMA_API EP_CryptHashStringW;enigma_ide!
// Checkup API
BOOL EP_CheckupCopies( int* Total, int* Current);
#define PRAGMA_API EP_CheckupCopies;enigma_ide!
BOOL EP_CheckupIsProtected();
#define PRAGMA_API EP_CheckupIsProtected;enigma_ide!
BOOL EP_CheckupIsEnigmaOk();
#define PRAGMA_API EP_CheckupIsEnigmaOk;enigma_ide!
I did not try these declarations, but hope it is working!

Post Reply