Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy protection
Message
 
To
07/07/2006 03:39:32
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
01134081
Message ID:
01134467
Views:
19
Hi,

I doubt that it would work for FoxPro for DOS.

I hope the mentioned below code helps. Make a logic and protect. I am using a logic created out of this code from past 2 years and could'nt find anybody breaking it.

In India, You need a control of your copy to ensure you get your money ( even subjected to your software can create some emergency at clients end and he needs you :) ).

I know a client who is using my software from past 7 years and paid just once because its working fine for him till now and he dose not need me and my AMC services. One of my client is using my software from past 4 years in Demo mode as i have restriction of not having more then 10 Customer,Product and Suppliers. Unfortunately for me he just have 3 Products 7 Customers and only 2 Supplier.
Lparameters tcVolume
OldSet="'"+ALLTRIM(FULLPATH(CURDIR()))+"'"
SET DEFAULT TO (tcVolume)
Dimension taArray[10]
*==============================================================================
* Function:          GetVolumeInformation
* Purpose:           Returns information about the specified volume
* Author:            Doug Hennig, from code taken off MSDN
* Copyright:         (c) 2001 Stonefield Systems Group Inc.
* Last revision:     02/20/2001
* Parameters:        tcVolume - the volume to get information for
*                    taArray  - an array to hold information about the volume:
*
*                    Column    Information
*                    ------    -----------
*                     1        Volume name
*                     2        Volume serial number
*                     3        File system name (FAT, NTFS, etc.)
*                     4        .T. if the file system supports case-sensitive
*                              filenames
*                     5        .T. if the file system preserves case of filenames
*                     6        .T. if the file system supports Unicode filenames
*                     7        .T. if the file system preserves and enforces ACLs
*                              (NTFS only)
*                     8        .T. if the file system supports file-based
*                              compression
*                     9        .T. if the volume is compressed
*                    10        maximum filename length
*
* Returns:           .T.
* Environment in:    none
* Environment out:   none
*==============================================================================


#Define ccNULL                      Chr(0)
#Define cnMAX_PATH                  260
#Define cnFS_CASE_SENSITIVE           0
#Define cnFS_CASE_IS_PRESERVED        1
#Define cnFS_UNICODE_STORED_ON_DISK   2
#Define cnFS_PERSISTENT_ACLS          3
#Define cnFS_FILE_COMPRESSION         4
#Define cnFS_VOL_IS_COMPRESSED       15

Local lcVolume, ;
	lcVolumeName, ;
	lnVolumeNameLen, ;
	lnVolumeSerialNumber, ;
	lnMaxFileNameLen, ;
	lnFileSystemFlags, ;
	lcFileSystemName, ;
	lnFileSystemNameLen, ;
	lcFileInfo, ;
	lcFileName, ;
	laFiles[1], ;
	lnFiles, ;
	lnI, ;
	lcFile, ;
	lnHandle

* Declare the API function and constants.

Declare GetVolumeInformation In Win32API ;
	string lpRootPathName, String @lpVolumeNameBuffer, ;
	integer nVolumeNameSize, Integer @lpVolumeSerialNumber, ;
	integer @lpMaximumComponentLength, Integer @lpFileSystemFlags, ;
	string @lpFileSystemNameBuffer, Integer nFileSystemNameSize

* If the path wasn't specified, use the current drive. Otherwise, get the drive
* for the specified path, handling UNC paths specially.

Do Case
Case Vartype(tcVolume) ='C'
*&& #108;t;> 'C' or empty(tcVolume)
	lcVolume = Addbs(Sys(5))
Case Left(tcVolume, 2) = '\\'
	lcVolume = Addbs(tcVolume)
	lcVolume = Left(lcVolume, At('\', lcVolume, 4))
Case Len(tcVolume) = 1
	lcVolume = tcVolume + ':\'
Otherwise
	lcVolume = Addbs(Justdrive(tcVolume))
Endcase

* Create the parameters for the API function, then call it.

lcVolumeName         = Space(255)
lnVolumeNameLen      = Len(lcVolumeName)
lnVolumeSerialNumber = 0
lnMaxFileNameLen     = 0
lnFileSystemFlags    = 0
lcFileSystemName     = Space(255)
lnFileSystemNameLen  = Len(lcFileSystemName)
GetVolumeInformation(lcVolume, @lcVolumeName, lnVolumeNameLen, ;
	@lnVolumeSerialNumber, @lnMaxFileNameLen, @lnFileSystemFlags, ;
	@lcFileSystemName, lnFileSystemNameLen)

* Put the information into the array.

Dimension taArray[10]
taArray[ 1] = Left(lcVolumeName, At(ccNULL, lcVolumeName) - 1)
taArray[ 2] = lnVolumeSerialNumber
taArray[ 3] = Left(lcFileSystemName, At(ccNULL, lcFileSystemName) - 1)
taArray[ 4] = Bittest(lnFileSystemFlags, cnFS_CASE_SENSITIVE)
taArray[ 5] = Bittest(lnFileSystemFlags, cnFS_CASE_IS_PRESERVED)
taArray[ 6] = Bittest(lnFileSystemFlags, cnFS_UNICODE_STORED_ON_DISK)
taArray[ 7] = Bittest(lnFileSystemFlags, cnFS_PERSISTENT_ACLS)
taArray[ 8] = Bittest(lnFileSystemFlags, cnFS_FILE_COMPRESSION)
taArray[ 9] = Bittest(lnFileSystemFlags, cnFS_VOL_IS_COMPRESSED)
taArray[10] = lnMaxFileNameLen

* If the serial number is 0 (which happens with Win95/98 systems on remote
* drives), open a file on the drive and get the file information for it.

If lnVolumeSerialNumber = 0
	Declare GetFileInformationByHandle In Win32API ;
		integer lnHandle, String @lcFileInfo
	Declare Integer CreateFile In Win32API ;
		string @lcFileName, Integer dwDesiredAccess, ;
		integer dwShareMode, Integer lpSecurityAttributes, ;
		integer dwCreationDisposition, Integer dwFlagsAndAttributes, ;
		integer hTemplateFile
	Declare CloseHandle In Win32API ;
		integer lnHandle
	lcFileInfo = Space(255)

* If a file was specified for the volume name, use it. Otherwise, find some
* file we can open.

	If File(tcVolume)
		lcFileName = tcVolume
	Else
		lnFiles    = Adir(laFiles, lcVolume + '*.*')
		lcFileName = ''
		For lnI = 1 To lnFiles
			lcFile   = lcVolume + laFiles[lnI, 1]
			lnHandle = Fopen(lcFile)
			Fclose(lnHandle)
			If lnHandle >= 0 && >= 0
				lcFileName = lcFile
				Exit
			Endif &&lnHandle >= 0
		Next lnI
	Endif File(tcVolume)
	If Not Empty(lcFileName)
		lnHandle = CreateFile(@lcFileName, 0, 0, 0, 3, 0, 0)
		If lnHandle >= 0 && >= 0
			GetFileInformationByHandle(lnHandle, @lcFileInfo)
			CloseHandle(lnHandle)
			lnVolumeSerialNumber = Hex2Decimal(Substr(lcFileInfo, 29, 4))
			taArray[2] = lnVolumeSerialNumber
		Endif &&lnHandle >= 0
	Endif Not Empty(lcFileName)
Endif lnVolumeSerialNumber = 0
RetValue=taArray[ 2]
Release taArray, lcVolume, lcVolumeName,lnVolumeNameLen,lnVolumeSerialNumber,lnMaxFileNameLen
RELEASE lnFileSystemFlags,lcFileSystemName,lnFileSystemNameLen,lcFileInfo,lcFileName,laFiles,lnFiles,lnI,lcFile,lnHandle
IF !EMPTY(OldSet)
	SET DEFAULT TO &OldSet
ENDIF

Return RetValue

*==============================================================================
* Function:          Hex2Decimal
* Purpose:           Converts a value in Intel format to a decimal value
* Author:            Doug Hennig
* Copyright:         (c) 1996 Stonefield Systems Group Inc.
* Last Revision:     09/07/99
* Parameters:        tcValue  - the value to convert
*                    tlSigned - .T. if the value is signed
* Returns:           the numeric value
* Environment in:    none
* Environment out:   none
*==============================================================================
FUNCTION Hex2Decimal
Lparameters tcValue, ;
	tlSigned
Local lnDecimal, ;
	lnLen, ;
	lnI, ;
	lnMSB, ;
	lnMax
lnDecimal = 0
lnLen     = Len(tcValue)
For lnI = 1 To lnLen
	lnDecimal = lnDecimal + Asc(Substr(tcValue, lnI, 1)) * 256 ^ (lnI - 1)
Next lnI
If tlSigned
	lnMSB = (lnLen * 8) - 1
	If Bittest(lnDecimal, lnMSB)
		lnMax     = 2 ^ (lnMSB + 1)
		lnDecimal = lnResult - lnMax
	Endif Bittest(lnDecimal, lnMSB)
Endif tlSigned
Return lnDecimal
>We would like to change our present piracy control method. I can't disclose how it's done but it's simple & we developer know it. Hint : We update the s/w regularly at Customer site. It's getting unmanagable. Some people know & have started pirating our s/w. Our s/w is a Accounting software & sell copies.
>
>How is this HDD volume no. method of piracy control done ? We are using FPD 2.6
>
>Thanks
>
>Rakesh
>
>>Hi Aman,
>>
>>I Hope u mean HDD Volume Number, I would suggest to stick with the same, this method would ensure that they need you all the time and would continue their AMC with you.
>>
>>
>>
>>
>>>Hi!
>>>
>>>Any suggestion for copy protection?
>>>At the moment I check HDD Serial No., which is not very good or convinient, as users keep formatting their systems and keep me busy giving codes on telephone.
--
--
Aashish Sharma
Tele Nos: +1-201-490-5405
Mobile: +91-9821053938
E-Mail:
aashish@aashishsharma.com
write2aashish@gmail.com

You better believe in yourself... if you don't, who else will ?
TODAY is a gift, that's why it's called PRESENT
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform