65 lines
2.9 KiB
Plaintext
65 lines
2.9 KiB
Plaintext
DllTest - Runtime sample code in RealBasic
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
This project is written in RealBasic 2011 but will also work in later versions
|
|
and also in Xojo (tested on Xojo 2013r4.1). It can also work on previous versions
|
|
of RealBasic (but if using versions previous to 2005 then see note about use of Nil).
|
|
It is a console program so for a Windows application you would need to change "Print"
|
|
statements for "MsgBox".
|
|
|
|
The Module1 module contains the DRIS structure definition and some useful functions.
|
|
The main sample code contains the functions:
|
|
|
|
DDProtCheck
|
|
DDProtCheckWithAlg
|
|
WriteBytes
|
|
ReadBytes
|
|
EncryptUserData
|
|
|
|
There are also encrypted versions of these functions (where the parameters passed
|
|
to and from our API are encrypted for greater security):
|
|
|
|
DDProtCheckEnc, DDProtCheckWithAlgEnc, WriteBytesEnc, ReadBytesEnc, EncryptUserDataEnc
|
|
|
|
These functions also use some smaller functions:
|
|
CryptDRIS, CryptAPIData, MyAlgorithm, MyRWAlgorithm
|
|
|
|
You will not need to use all these functions in your code. Just use which ever functions
|
|
are most appropriate and customise in your own way. The sample code is just a guide.
|
|
You should implement the protection in a stronger way using the techniques described in
|
|
the "Increasing your Protection" chapter of the manual.
|
|
|
|
Code marked with !!!! are places where you should customise the sample code so
|
|
that it will work properly:
|
|
|
|
* Change the MY_SDSN constant to the value of your SDSN
|
|
* Change the MY_PRODCODE value to the Product Code in the dongle
|
|
* Change the MyAlgorithm code (if you call a user algorithm)
|
|
* Change the CryptDRIS code (if you encrypt the DRIS)
|
|
* Change the CryptApiData (if you encrypt Data you send to our API)
|
|
* Change the MyRWAlgorithm code (if encrypt Data you send to our API using the R/W algorithm)
|
|
|
|
You will also probably want to replace our error messages with your own.
|
|
|
|
Note - you should protect dpwin32.dll and not your program. Because your program
|
|
is linked to the DLL it is protected. This protected dll should be placed in the
|
|
sample folder as the compiled program.
|
|
|
|
You can rename the runtime module (e.g. dpwin32.dll) if you want but you must also
|
|
change this name for every occurance in the MyDDProtCheck function in Module1.
|
|
|
|
You can also use the protected program on MacOS X and Linux by protecting the
|
|
appropriate runtime modules (i.e. dpmac32.dylib and dplin32.so). If you do this
|
|
you will probably want to protect all the runtime modules to a single licence.
|
|
|
|
Due to our anti-debug code it may be impossible to debug your code once it has been
|
|
protected (we found that the debugger often crashed anyway even without our anti-debug
|
|
code)!
|
|
|
|
Note for version of RealBasic previous to 2005
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
The "Nil" value is not defined for these earlier versions and so you should define a
|
|
MemoryBlock object, initialise it to something and pass that instead (it doesn't get used
|
|
so as long as it compiles it is OK).
|