58 lines
3.0 KiB
Plaintext
58 lines
3.0 KiB
Plaintext
Sample code to call Runtime Modules in C++ Builder
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
This project is written in C++ Builder 2007 but will work in more recent
|
|
versions (they will upgrade the Project to the latest version). For earlier versions
|
|
you can make your own project using the files listed below.
|
|
|
|
The source files in the project are:
|
|
|
|
File name Folder Description
|
|
apitest.c Samples\c main source code file for C
|
|
dris.h Samples\c contains the DRIS structure
|
|
dpwin32_omf.obj Samples\c\object_modules static object modules
|
|
dpwin32_borland.lib Samples\c\import_libs contains the function definitions for dpwin32.dll
|
|
|
|
Note that the source paths are structured to minimise files. If you want to
|
|
move this project the references to these files will probably be no longer valid.
|
|
|
|
The ObjTest project links to the static runtime library module (e.g dpwin32_omf.obj)
|
|
|
|
The DllTest project uses the dynamic runtime library (e.g. dpwin32.dll).
|
|
|
|
The sample code contains 10 functions. 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 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 - if you are link the static module dpwin32_omf.obj then you should protect your program.
|
|
If you are linking to dpwin32.dll then you need to protect dpwin32.dll and *not* your program.
|
|
Because your program is linked to the DLL it is protected. The protected DLL will need to be
|
|
in the same folder as your compiled program for it to run correctly.
|
|
|
|
Note - once your program (or dpwin32.dll) is protected you will not be able to debug
|
|
your program - after our API has been called. Our strong anti-debug code will cause
|
|
the debugger to throw an exception. If you do want to debug your code then you can
|
|
use our debug module: dpwin32_omf_debug.obj (or dpwin32debug.dll), but these should not be
|
|
used for release. See readme.txt in samples\c for restrictions concerning the debug module.
|
|
|
|
Note - the dpwin32_borland.lib was created using Borland's IMPLIB tool. If there is a problem
|
|
with the file we provide you can create your own by running (for example):
|
|
|
|
c:\program files\CodeGear\Rad Studio\5.0\bin\implib import_libs\dpwin32_borland.lib dpwin32.dll
|
|
|
|
(This assumes that the current directory is the Samples\C directory).
|