52 lines
2.0 KiB
Plaintext
52 lines
2.0 KiB
Plaintext
ApiTest - Runtime sample code in Ada
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Tested with GNAT gnatmake command-line utility 2011 but should work
|
|
with other Ada Compilers.
|
|
|
|
The dris.ads file contains the DRIS structure definition and other useful constants
|
|
The apitest.adb file is the main sample code file. You can compile it like this:
|
|
|
|
gnatmake apitest.adb
|
|
|
|
The sample code contains 12 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).
|
|
|
|
The best approach is to compile the sample code and see how it works and then to take
|
|
the appropriate code and apply it to your own project. You should include the dris.ads
|
|
file in your project and use/modify which ever functions from apitest.adb you feel are
|
|
appropriate. The dris.ads file should not be modified.
|
|
|
|
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 value to the value of your SDSN
|
|
* 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 use DinkeyAdd to protect dpwin32.dll and not your program.
|
|
Because your program is linked to the DLL it is protected.
|
|
|
|
Note - the protected dpwin32.dll should reside in the same folder as your compiled
|
|
code.
|
|
|
|
Note - because of our strong anti-debug code you may not be able to debug your code
|
|
after calling our DLL.
|