54 lines
2.9 KiB
Plaintext
54 lines
2.9 KiB
Plaintext
Sample code to call dpwin32_coff.obj OR dpwin32.dll using Dev C++
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
This project is written using Dev C++ 4.9.9.2 but should also work in other
|
|
versions (for olders version you may have to create the project yourself).
|
|
|
|
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_coff.obj Samples\c\object_modules static object modules e.g. dpwin32_coff.obj
|
|
libdpwin32.a 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_coff.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_coff.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_coff_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 - if you are interested in creating the libdpwin32.a import library yourself then
|
|
read the notes in the MinGW\Runtime\readme.txt file (Dev-C++ uses the minGW compiler).
|
|
|