Page 1 of 3

Software Protection

Posted: Fri Nov 02, 2007 2:17 am
by Jeff Barnes
Hi Everybody,

With help from Antonio, I have tested some software that could be a very cost effective way to protect your software from unwanted copying.

The software is called AntiDuplicate.
( http://www.alkonost.com/antiduplicate/ )

Is basically modifies a standard USB Flash drive and allows you to check the USB Flash drive to see if it has this modification. You can NOT make a copy of the USB Flash drive ... You MUST use the AntiDuplicate software to create the drives.

The software costs $129.00 (usd).

I have also located a company in the US that will sell me some 32MB usb flash drives for $3.50each ... I have a couple on order so I can test and make sure these drives will work with AntiDuplicate.

You can see how this can offer a decent protection at a very low cost.

I just thought I'd pass this one along ... Enjoy.

Posted: Fri Nov 02, 2007 9:00 am
by Antonio Linares
Jeff,

Glad to know that it is working fine for you.

If someone else is interested, we can publish here the required PRG functions (and C code) to use this protection

Posted: Fri Nov 02, 2007 9:44 am
by norberto
Antonio, please publish it... thanks

Posted: Fri Nov 02, 2007 10:12 am
by Antonio Linares
Here it is the code:

Code: Select all

#include "FiveWin.ch" 

function Main()

  CheckIt()
  
return nil  

function CheckIt() 

   local cArray := FillArray(), aInfo

   if Fddig1( 0 ) < 7
      MsgAlert( "No Key drive in the USB port!" )
      return 0
   endif   

   Accdd1( cArray )
   aInfo = GetValues( cArray ) 

   MsgInfo( aInfo[ 1 ], "LicType" )
   MsgInfo( aInfo[ 2 ], "TokenId1" )
   MsgInfo( aInfo[ 3 ], "TokenId3" )
   
return nil 

DLL FUNCTION ACCDD1( pValues AS LPSTR ) AS VOID PASCAL ;
FROM "Accdd1" LIB "Aas973.dll" 

DLL FUNCTION FDDIG1( nVal AS LONG ) AS LONG PASCAL ;
FROM "Fddig1" LIB "Aas973.dll" 

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>

static LONG accm[] = {
        0,
        0x...,
        0x...,
        0x...,
        0x...,
        0x...,
        0x...,
        0x...,
        0x...,
        0x...
};

HB_FUNC( FILLARRAY )
{
   LONG acck[ 100 ];
   LONG accNa, accUr;
   int i;
   
   srand( GetTickCount() );
   accUr = rand();
	
   for( i = 1; i < 100; i++ )
     acck[ i ] = rand();

   for( i = 1; i < 100; i++ )
     accUr = acck[ ( acck[ i ] ^ ( accUr & 0x0ff ) ) % 99 ] ^ ( accUr >> 8 );

   accUr = ( accm[ 6 ] ^ accUr ) & 0x0ffff;
   
   hb_retclen( ( char * ) acck, 100 * sizeof( LONG ) );
}      

HB_FUNC( GETVALUES )
{
   LONG * acck = ( LONG * ) hb_parc( 1 );
   LONG accr1, accr2, accr3, accr4;
   LONG accNa, accUr;
   LONG LicType, TokenId1, TokenId2;
   BOOL OrigDrive;
   
   accNa = ( acck[ 99 ] ^ accm[ 5 ] ) & 1061109567;
   accr1 = accm[ 1 ] ^ acck[ LOBYTE( LOWORD( accNa ) ) ];
   accr2 = accm[ 2 ] ^ acck[ HIBYTE( LOWORD( accNa ) ) ];
   accr3 = accm[ 3 ] ^ acck[ LOBYTE( HIWORD( accNa ) ) ];
   accr4 = accm[ 4 ] ^ acck[ HIBYTE( HIWORD( accNa ) ) ];

   OrigDrive = accr4 == ( ( ( accr2 - ~accr1 / accUr ) ^ accr3 ) - accUr );
   LicType = TokenId1 = TokenId2 = 0;

   hb_reta( 3 );
   
   if( OrigDrive )
   {
      LicType = acck[ 64 + ( HIBYTE( HIWORD( accNa ) ) % 35 ) ] ^ acck[ LOBYTE( LOWORD( accNa ) ) ];
      if( LicType == ( accm[ 1 ] ^ accm[ 3 ] ^ accm[ 4 ] ^ accm[ 5 ] ) )  
         LicType = 1; 
      else
			   if( LicType == ( accm[ 1 ] ^ accm[ 2 ] ^ accm[ 4 ] ^ accm[ 5 ] ) )  
			      LicType = 2; 
			   else
				    LicType = 0;

			TokenId1 = accm[ 7 ] ^ acck[ LOBYTE( LOWORD( accNa ) ) + 1 ];
			TokenId2 = accm[ 8 ] ^ acck[ HIBYTE( LOWORD( accNa ) ) + 1 ];

      hb_stornl( LicType, -1, 1 );
      hb_stornl( TokenId1, -1, 2 );
      hb_stornl( TokenId2, -1, 3 );
   }
   else
   {
      hb_stornl( 0, -1, 1 );
      hb_stornl( 0, -1, 2 );
      hb_stornl( 0, -1, 3 );
   }   
}   
   
#pragma ENDDUMP         

Posted: Fri Nov 02, 2007 10:19 am
by Marc Vanzegbroeck
Jeff,

Does the software install some files on the flash-drive that are visible?
I'am just wondering because if the client delete them, the drive won't work anymore...

Thanks,
Marc

Posted: Fri Nov 02, 2007 11:47 am
by nageswaragunupudi
A bit out of topic, if the friends here dont mind answering me.

I used to think that piracy and unauthorised use / distribution of software are problems only developing countries like mine ( India ). Is it a problem in developed countries too? like canada or usa ? Now even in India things have changed a lot and we see authorised software only in all corporate sector. Though students and small timers still run for pirated software. I am just curious to know whats happening in developed countries.

For copy protection, I still like my old friend's solution. He used to encrypt and store company name and address , etc in the exe file. No other company likes to print invoices or documents with other company's name and address. That way redistribution of software or resale of software is prevented ( even among sister companies in a group).

What remains is the number of users in the client organisation using the software simultaneously. In the good old Novell days we could mornitor this very easily with Semaphores. ( Novell's API was ( and is ) very simple and reliable )

Even now with windows servers there should be some easier way. A crude but sure way is to manage the count of record locks on a specified shared table on the server. Or if we are using ADS, we can find the number of users who opened a particular table.

Though I dont need any protection for my software, I do keep track of number of users and simultaneous users (for information purposes), using ADS management functions.

Won't these simpler methods be adequate and protect the developers' interests? Merit being that it costs nothing and the customer does not get the feeling that we "do not trust" him.

Posted: Fri Nov 02, 2007 12:47 pm
by Jeff Barnes
Hi Marc,

Yes ... There will be some Hidden Protected Operating System Files added to the USB Drive.

If the customer completely deletes the drive you can re-make the drive in seconds (you will need to physically have the drive to do this)


I am sure there is software out there that can "lock" a flash drive from accidental deletes ... I will take a look.

Posted: Fri Nov 02, 2007 2:50 pm
by Marc Vanzegbroeck
Jeff,

The problem is that you need to physically have the drive to re-make the drive. Then the customer have to send the key to me, and I have to send it back.

Regards,
Marc

Posted: Fri Nov 02, 2007 4:06 pm
by Jeff Barnes
Hi Marc,

I never said it was the "perfect" way to protect your software, just cost effective :wink:

If you write-protect the drive and the customer still manages to delete the data than I guess they should not complain about any down time or the cost of sending the key back for re-programming.

Posted: Wed Nov 07, 2007 9:37 am
by Roberto Parisi
How to get aaa973.dll? I have only acc_de.dll.

Regards,
Roberto Parisi

Posted: Wed Nov 07, 2007 5:01 pm
by Jeff Barnes
Roberto,

Aas993.dll is only provided when you purchase the software.
(might be different for each version purchased)

You can download a demo copy of the software from:

http://www.alkonost.com/antiduplicate/



Jeff

Posted: Wed Nov 07, 2007 8:06 pm
by MOISES
Jeff,

When I compile Antonio´s code, I get some errors on the c part. I am using Harbour and FWH from octouber. Can you upload, please, the files to Rapidshare to do a test?. Thank you very much!!!


These are the errors:

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ FiveWin for Harbour 7.10 - Oct. 2007 Harbour development power ³Ü
³ (c) FiveTech, 1993-2007 for Microsoft Windows 95/98/NT/2000/ME/XP/Vista ³Û
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
Compiling...
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
demo.c:
Error E2322 demo.prg 40: Incorrect number format
Error E2039 demo.prg 40: Misplaced decimal point
Error E2223 demo.prg 40: Too many decimal points
Error E2322 demo.prg 41: Incorrect number format
Error E2039 demo.prg 41: Misplaced decimal point
Error E2223 demo.prg 41: Too many decimal points
Error E2322 demo.prg 42: Incorrect number format
Error E2039 demo.prg 42: Misplaced decimal point
Error E2223 demo.prg 42: Too many decimal points
Error E2322 demo.prg 43: Incorrect number format
Error E2039 demo.prg 43: Misplaced decimal point
Error E2223 demo.prg 43: Too many decimal points
Error E2322 demo.prg 44: Incorrect number format
Error E2039 demo.prg 44: Misplaced decimal point
Error E2223 demo.prg 44: Too many decimal points
Error E2322 demo.prg 45: Incorrect number format
Error E2039 demo.prg 45: Misplaced decimal point
Error E2223 demo.prg 45: Too many decimal points
Error E2322 demo.prg 46: Incorrect number format
Error E2039 demo.prg 46: Misplaced decimal point
Error E2223 demo.prg 46: Too many decimal points
Error E2322 demo.prg 47: Incorrect number format
Error E2039 demo.prg 47: Misplaced decimal point
Error E2223 demo.prg 47: Too many decimal points
Error E2322 demo.prg 48: Incorrect number format
Error E2228 demo.prg 48: Too many error or warning messages
*** 26 errors in Compile ***
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Fatal: Unable to open file 'DEMO.OBJ'
* There are errors

Posted: Wed Nov 07, 2007 8:52 pm
by Jeff Barnes
Moises,

You will not be able to do a test in Fivewin.

If you download the demo version you can do the following:
-create a usb key
-test the usb key you created

Then you can try to manually make a "copy" of the usb key and run the test program again.

You will get a message from the test program that tells you if the key is real or not.

If they were to supply an actual working sample, they would be giving away the software.

Posted: Thu Nov 08, 2007 10:28 am
by MOISES
oK. THANK YOU, but I would like to test the Fivewin code. If I buy now the software, I still get the same compilation error.

Can you please, provide, us a working example, without the registered dll?. Thank you.

Posted: Thu Nov 08, 2007 11:17 am
by Jeff Barnes
Sorry, I can not supply a working sample without giving away the software.

With the purchased version you still need to use the "make key" program (which is slightly different for each purchased version via the dll)

This section will be different for each user:

static LONG accm[] = {
0,
0x...,
0x...,
0x...,
0x...,
0x...,
0x...,
0x...,
0x...,
0x...



Jeff