Add Original SDK

This commit is contained in:
2026-05-06 07:47:36 +02:00
parent 2915e04380
commit 0ed627517a
674 changed files with 89334 additions and 0 deletions

View File

@@ -0,0 +1,149 @@
Attribute VB_Name = "DinkeyPro"
' A VBA Interface to the Dinkey Pro/FD API
' ***********************
' DO NOT MODIFY THIS FILE
' ***********************
Option Explicit
' ------------------------------------------------------------------------------
' Windows API functions used by this module
#If VBA7 Then
Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
#Else
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
#End If
' ------------------------------------------------------------------------------
' Dinkey Runtime Information Structure (DRIS)
Type DRIS
header As String * 4 ' should be set to "DRIS"
' Inputs
size As Long ' size of this structure
seed1 As Long ' seed for data/dris encryption
seed2 As Long ' as above
function As Long ' specify only one function
flags As Long ' options for the function selected. To use more than one OR them together: OPTION1 Or OPTION2...
execs_decrement As Long ' amount by which to decrement execs if the DEC_MANY_EXECS flag is used
data_crypt_key_num As Long ' number of the key (1-3) that the dongle uses to encrypt or decrypt user data
rw_offset As Long ' offset in the dongle data area to read or write data
rw_length As Long ' length of data to read/write/encrypt/decrypt
#If VBA7 Then
not_used As LongPtr ' This field is a pointer used in other programming languages. 4 bytes in 32-bit Excel, 8 bytes in 64-bit Excel
#Else
not_used As Long
#End If
alt_licence_name As String * 256 ' protection check for different licence instead of this one, must be null-terminated ASCII
var_a As Long ' variable values for user algorithms
var_b As Long
var_c As Long
var_d As Long
var_e As Long
var_f As Long
var_g As Long
var_h As Long
alg_number As Long ' the number of the user algorithm that you want to execute
' Outputs
ret_code As Long ' the return code from the protection check
ext_err As Long ' extended error
type As Long ' type of dongle detected. Possible values shown below
model As Long ' model of dongle detected. Possible values shown below
sdsn As Long ' Software Developer's Serial Number
prodcode As String * 12 ' product code (null-terminated)
dongle_number As Long ' dongle serial number
update_number As Long
data_area_size As Long ' size of the data area in the dongle detected
max_alg_num As Long ' the maximum algorithm number in the dongle detected
execs As Long ' executions left: -1 indicates 'no limit'
exp_day As Long ' expiry day: -1 indicates 'no limit'
exp_month As Long ' expiry month: -1 indicates 'no limit'
exp_year As Long ' expiry year: -1 indicates 'no limit'
features As Long ' features value
net_users As Long ' maximum number of network users for the dongle detected: -1 indicates 'mo limit'
alg_answer As Long ' answer to the user algorithm executed with the given variable values
fd_capacity As Long ' FD dongles only- capacity of the data area. Currently fixed at ~8KB but may change in the future.
fd_drive As String * 128 ' FD dongles only - drive letter of the dongle's flash drive, e.g. "F:\"
swkey_type As Long ' 0 = no software key detected, 1 = temporary software key, 2 = demo software key
swkey_exp_day As Long ' software key expiry date (if software key detected)
swkey_exp_month As Long
swkey_exp_year As Long
End Type
' ------------------------------------------------------------------------------
' Useful Constants
' Possible dris.function values
Public Const PROTECTION_CHECK = 1 ' Standard protection check
Public Const EXECUTE_ALGORITHM = 2 ' Protection check + execute an algorithm stored in the dongle
Public Const WRITE_DATA_AREA = 3 ' Protection check + write to the dongle data area
Public Const READ_DATA_AREA = 4 ' Protection check + read from the dongle data area
Public Const ENCRYPT_USER_DATA = 5 ' Protection check + use the dongle's encryption engine to encrypt your own data
Public Const DECRYPT_USER_DATA = 6 ' Protection check + the dongle will decrypt user data
Public Const FAST_PRESENCE_CHECK = 7 ' Checks for the presence of a valid dongle. Very quick but weaker security
Public Const STOP_NET_USER = 8 ' Stop a network user (a protection check is NOT performed)
' Possible dris.flags values
Public Const DEC_ONE_EXEC = 1 ' Decrement execs by 1
Public Const DEC_MANY_EXECS = 2 ' Decrement execs by number specified in execs
Public Const START_NET_USER = 4 ' Start a network user
Public Const USE_FUNCTION_ARGUMENT = 16 ' Use the extra argument in the function for pointers
Public Const CHECK_LOCAL_FIRST = 32 ' Force the API to look for a local dongle before a network dongle
Public Const CHECK_NETWORK_FIRST = 64 ' Force the API to look for a dongle on the network before looking in local ports
Public Const USE_ALT_LICENCE_NAME = 128 ' Use name specified in alt_licence_name instead of the default one
Public Const DONT_SET_MAXDAYS_EXPIRY = 256 ' If the max days expiry date has not been calculated then do not do it this time
Public Const MATCH_DONGLE_NUMBER = 512 ' Restrict the search to match the dongle number specified in the DRIS
Public Const DONT_RETURN_FD_DRIVE = 1024 ' if an FD dongle has been detected then don't return the flash drive/mount name in the DRIS
' Possible dris.type values
Public Const DONGLE_TYPE_PRO = 1 ' Dinkey Pro dongle
Public Const DONGLE_TYPE_FD = 2 ' Dinkey FD dongle
' Possible dris.model values
Public Const DONGLE_MODEL_LITE = 1 ' Lite dongle
Public Const DONGLE_MODEL_PLUS = 2 ' Plus dongle
Public Const DONGLE_MODEL_NET5 = 4 ' Net dongle, 5 users
Public Const DONGLE_MODEL_NETU = 7 ' Net dongle, unlimited users
' ------------------------------------------------------------------------------
' A function to initialise the DRIS with random values
Public Sub RandomSetDrisElements(DrisToSet As DRIS)
Dim TempDris(Len(DrisToSet)) As Byte
Dim I As Integer
Call Randomize
For I = 0 To Len(DrisToSet) - 1
TempDris(I) = Int(256 * Rnd()) ' The int part of a random float 0 <= N < 256, i.e. an int between 0 and 255
Next
Call CopyMemory(DrisToSet, TempDris(0), Len(DrisToSet))
End Sub
' ------------------------------------------------------------------------------
' This function will convert a C string returned in the DRIS to a VB string
Function TrimCString(CString As String) As String
Dim I As Integer
I = InStr(CString, vbNullChar) ' Find position of terminating null character
TrimCString = Left(CString, I - 1) ' Return everything before that position
End Function
' ------------------------------------------------------------------------------
' Visual Basic for Applications only supports signed integers,
' but some DRIS fields such as dongle_number are stored as unsigned integers.
' Use this function to convert those fields to Double values
Public Function UnsignedLongToDouble(Number As Long) As Double
If (Number < 0) Then
UnsignedLongToDouble = Number + 4294967296#
Else
UnsignedLongToDouble = Number
End If
End Function

View File

@@ -0,0 +1,267 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Using Dinkey Pro/FD with Excel</title>
<style>
body {
color: black;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
margin: 25px auto;
max-width: 800px;
}
p, ul, ol, table {
margin-top: 0;
margin-bottom: 15px;
}
ul.contents a {
text-decoration: none;
}
h1,h2,h3,h4,h5,h6 {
margin-top: 25px;
margin-bottom: 15px;
}
h2 {
border-top: 1px solid gray;
}
table {
margin-left: auto;
margin-right: auto;
border-collapse: collapse;
}
th, td {
border: 1px solid black;
padding: 0.5em;
text-align: left;
}
.ui_element
{ /* Use for things like program options and menu items */
color: #008000;
font-style: italic;
}
.filepath
{ /* Use for paths and filenames */
font-family: monospace;
font-size: 13px;
font-weight: bold;
}
.manual
{ /* Use when referring to user manual sections/chapters */
font-style: italic;
}
.alert
{
border: 1px solid black;
padding: 15px 15px 15px 58px;
font-weight: bold;
background-repeat: no-repeat;
background-position: 5px 15px;
margin-bottom: 15px;
}
.important
{
background-color: #FFFDD0;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH2wcJCS0n8fQB3QAACsBJREFUaIHtmWmMHMUVx3/Vx/Tc6/Xa61l717sEY/BibA4bAQIiOzGHIoMUiURgwEEEBYkoBESsSAGJBIFIEIQoARwlEBnJQTJBAhMDPggECQewYyPjSPgCG+ODXa/3mJ2e7pnuqnyY6Z6e3dkDDFE+8KSn6umpfv3/v/eq6lU1fC1fyymJ+LIMKRDPQbeCbxvwTaBbQguQrHaxdfhMwX88eB14YwXsO9X3njKBv0DOgh8L+KEByVwyaUzJZhNpy8IyTXQAKfE8D8d1GXZd+goF+0S57Ptw0oc/Cli9Avr/pwTWwVQfHlZwY3smo3W0tVnZlhZwXRgcRNg2ynURvg9KgaaBYYBpoiwLpRQD+TyHhoaKPZ6nFPzBg1/dDIWvnMBauE7An2dls7HT58yJx1Mp5OHDcPw4wnURgBYxHrQqotI0IZVCJRLYjsO+wUH7hO8XJNywArZ8JQTWgS5hta5p1y8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B7ckRgbjoFAngd/CRwt9/Yum9bdHVNS4g0MVP4slyls2IAwDKxFi0A09kWivZ303LmIyEaoTnyfocceY+CBB5DV2ksCIhZDCkFPuTz8Eax8GD6ltihPioAGWK/Ax1cqdZZ77Ng3pi9aZPq2jZfPhyWus3Urxddew5g1C/O008bzR70oRXHjRk7cfjt29SglUGFZYJr0Oo7dC0+vgheoX5DD8I2XQlZVEx2Qvh/+2pLNLuy4+GKruGcPzsGDow5wre5ukldfTXLZMswzz2xotLR7N8UtW7BffZXS3r0VLhEViQQYBr3Dw85JpbbeCXeUKrnvAsVqG6bSeATiEU10wpT74JnmZPKs9sWL43JwkMLu3SjPG0VEAFo2i9nZichmAZADA3iHDiGHh0PQUfBC09AyGXyl6M3niyeV2vYzuNuugHeq4J2ITkjAonIOExJpgcwv4cFmTbtsVnd3PDltGvaePZSOH0dUB+XIbwKNJAoeIdCSSbRkEse2OVEouEfhpV/A77wa+KgGUQAmHgN1B9BFUK/AP09XaiDR07OoNDBApqtLT3R1VcrfYrFWtDHay9HNiTIM9EwGvbkZH+gbHCwNuW7xLXjoN7BOVkCWgPKI1iMykCc63LWoRcCKtgsgdyvcORUuyzQ1aU25nGFNnYq0bbzBQaRtI123cqKnVOXk2jAQpomwLISm4eTz5PP5slMuy09h01Pwp08q38rcqrdHtsF1KJM5Xo8CDzQWtJdD53fg+21whRBCS6dSsXgmY5iWhW6aCEBJifQ8PNel7LoUbbvsuK7ng3sYNj4Pf9tVqfMDr0fbQEeBnywBqOwb4lXggVqAWb02ExC7BuZ3w+JWOC8OHTpkReV/JaHsw0ARDh+F7bvg36/CPq+WFtFUCQgE6tDgZPrzEAjEHAm8Si5o9Wo78nNZIHWfx6qg/AiBRkTKjCNf9DOrVgUdAA9UpzboR36sjBII2uB7hhfRclXrVtwvm8BI0WhMYKIPlVECkwL8tfy/yX8BjYmrtt9ODsIAAAAASUVORK5CYII=');
}
.information
{
background-color: #EBF8FF;
background-image: url('data:image/png;base64,iVBORw0KGgoAAA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NAYBZJT12kvWJifAwGnV+N37cYA432bd400Qyj/N+Duv7hOe0ZnTx9UcO+q/K7mxwBARExE1nv0G2ubIVR9ClJ96rq/NdYiEfQSUYaIIiIKiGhFmm5qELec2JYxAHNkDF+y9vj7F+YLG3oHphBEEcIoDYXCO4+kvgjvEnjvkcR1FKYmUZqfn3v+GB4D0AHAt0yIyANwAJyqyqvpAFa4lFgm3Cy/vm0vuv90Pz7alcXu+Wr2Xb1d3mbTdTApVAmVegqzZeOzYeUH0wUc/dzX8a0Tp1ECELcEtyHckus1QW4YYJn4pcLbFgFItW37rpH3b9i44cHhwb5UNuVQqxtMTBYa0zOzT589dfJgS3R9ybVtVwi/HsRq5gFaZrzULpw780y6I7PvzLnGnWEYuEaSWNdIXrg0fv77Lfh22+X3WZmIFYbQ8rBZ/kRCNJ9E2LIgk8l0924cuGNudnq0trBQxq97OGlZ3LIGXtn7S8fCVf/4W/Fyunlg8rLgtrXfM67sXbuk3i7SMrek7pdc3bK602uIXNV+oDUu2hB8FQNeGRqtA5YrYHQZhL9e9lkTgFfcrPl02mKXxvfy0oZoi9Rr9fK1yv8BQhlE2oxknwEAAAAASUVORK5CYII=');
}
.alert > p:last-child, .alert > ul:last-child, .alert > ol:last-child
{
/* Cancel double space at bottom of alert caused by above rule */
margin-bottom: 0;
}
.important .filepath, .information .filepath {
/* Make filepaths stand out in sections that are already bold */
font-weight: normal;
}
div.col_wrapper
{
clear: both;
overflow: hidden;
}
div.two_col
{
width: 50%;
float: left;
}
code {
color: gray;
white-space: nowrap;
}
pre {
padding: 15px;
background-color: #EEEEEE;
}
pre > code { /* Block level code snippets */
white-space: pre; /* Override nowrap used for inline code */
color: inherit;
}
code .comment
{
color: green;
}
code .keyword
{
font-weight: bold;
color: blue;
}
code .string
{
color: #A00000;
}
code .constant
{
font-weight: bold;
}
</style>
</head>
<body>
<h1>Using Dinkey Pro/FD with Excel</h1>
<div class="alert information">
<p>
The Shell protection method supports Windows executables produced by the DoneEx XCell Compiler.
</p>
<p>
API protection checks in Excel are implemented by adding Visual Basic for Applications (VBA) code to your workbook.
The VBA module <span class="filepath">DinkeyPro.bas</span> is used to communicate with the dongle via the appropriate API DLL
(<span class="filepath">dpwin32.dll</span> on 32-bit Windows, <span class="filepath">dpwin64.dll</span> on 64-bit Windows).
You should lock these DLLs with the API method using DinkeyAdd as described in the user manual, and distribute the locked DLLs with your software.
</p>
</div>
<p>
Using the <a href="https://doneex.com/excel-compiler/" target="_blank">DoneEx XCell Compiler</a> and the Shell method is the preferred option for most Excel users,
as it does not require you to write any VBA macro code, and so is easier to implement.
</p>
<h2>XCell Compiler and the Shell Method</h2>
<p>
The <a href="https://doneex.com/excel-compiler/" target="_blank">DoneEx XCell Compiler</a> converts an Excel workbook into an executable file (a program).
All of your data, formulas and VBA macro code are stored encrypted, which makes this method very secure.
XCell Compiler is a separate tool that must be purchased separately.
A <a href="https://doneex.com/excel-compiler/" target="_blank">free trial</a> is available to allow you to evaluate its functionality before buying.
</p>
<p>
There are a few things that you should be aware of when protecting your workbook with XCell Compiler and Dinkey Pro/FD:
</p>
<ul>
<li>
<p>
You must use the XCell Compiler option <span class="ui_element">Save into external storage (XSTG file)</span>.
This option means that your protected workbook's data is encrypted and securely stored in a separate file, not in the executable.
This is necessary to allow changes to your workbook to be saved, as Shell-protected executables cannot be modified.
</p>
</li>
<li>
<p>
If you use the Shell method background check (recommended and enabled by default),
if a background protection check fails then your protected workbook will be immediately closed without any warning messages, and any unsaved changes will be lost.
</p>
</li>
<li>
<p>
When a user closes your protected workbook, Excel will always ask the user if they want to save changes, even if no changes have been made.
</p>
</li>
</ul>
<h2>VBA Code and the API Method</h2>
<div class="alert important">
<p>
For a good level of security, your workbook should rely heavily on VBA code (macros).
See below for more information.
</p>
<p>
Before you distribute your protected workbook, you must protect your VBA code against modification.
To do this:
</p>
<ol>
<li>Open your project in the Visual Basic Editor.</li>
<li>Go to <span class="ui_element">Tools &gt; VBAProject Properties</span> in the menu.</li>
<li>Select the <span class="ui_element">Protection</span> tab.</li>
<li>Enable <span class="ui_element">Lock project for viewing</span> and enter a strong password, then click OK.</li>
</ol>
<p>
Now the workbook's VBA code cannot be viewed or modified without entering the password.
</p>
</div>
<p>
Even if you have never written code before, you will probably be familiar with macros: sequences of commands and functions that you can use to automate tasks in Excel.
Excel macros are stored in <em>modules</em> that contain sequences of instructions in a code language known as <em>Visual Basic for Applications</em>, or <em>VBA</em>.
The terms <em>macros</em> and <em>VBA</em> are often used interchangeably.
</p>
<p>
VBA code is a powerful and flexible tool with many uses. Unfortunately, the power of VBA means that macros created with malicious intentions can cause harm to your documents or your system.
As a result, Excel makes it possible for users to open and use workbooks with macros disabled, and to only allow the VBA code to be executed if the user trusts the owner of the workbook.
Obviously, this also prevents dongle checking code from running.
To prevent someone using this safety feature to work around the dongle protection, you should ensure that the functionality of your workbook relies heavily on macros.
That way if your workbook is opened with macros disabled, its functionality will be severely limited.
</p>
<p>
Legitimate users of your workbook may be concerned about executing the VBA code in your workbook.
Excel allows you to certify your macros with a digital signature so that users can verify that they are from a trustworthy source (i.e. you),
and that the code has not been modified since you wrote it. See the Excel documentation for more information.
</p>
<h3>Excel Example Files</h3>
<ul>
<li><span class="filepath">DinkeyPro.bas</span> - a module that provides a VBA interface to the Dinkey Pro/FD API.</li>
<li><span class="filepath">DPSample.xls</span> - various examples of using <span class="filepath">DinkeyPro.bas</span>.</li>
</ul>
<p>
<span class="filepath">DinkeyPro.bas</span> should be used, <strong>without modification</strong>, in your own project.
Use <span class="ui_element">File &gt; Import File</span> in the Visual Basic Editor to add <span class="filepath">DinkeyPro.bas</span>
to your VBA code.
</p>
<h3>Supported Versions</h3>
<p>
The Excel sample workbook and VBA code provided with the Dinkey Pro/FD SDK was created using Excel 2007,
and tested using Excel 2007 (32-bit) and Excel 2013 (64-bit).
All newer versions should be backwards compatible. The sample code should also work with older versions,
but no guarantees can be made, and support for older versions is likely to be very limited.
</p>
<h3>Try It Yourself</h3>
<div class="alert important">
<p>
The sample code is designed to teach you how to use the Dinkey Pro/FD API in Excel workbooks.
Do not copy the examples verbatim into your own code. Experiment with the sample code to understand how the API works,
and read the chapter <span class="manual">Increasing Your Protection</span> in the user manual for many suggestions on how to
make the best use of the API features.
</p>
</div>
<p>
<span class="filepath">DPSample.xls</span> gives simple examples of performing a protection check,
as well as using various other features of Dinkey Pro/FD.
To use <span class="filepath">DPSample.xls</span> you will first need to use DinkeyAdd to produce a locked copy of the DLL for your platform,
and program a dongle (if you are using Plus or Net dongles). Place the locked DLL in the same folder as the example files.
</p>
<p>
Open <span class="filepath">DPSample.xls</span> in Excel, then open the Visual Basic Editor by pressing <span class="ui_element">ALT+F11</span>.
Browse the examples in the <span class="filepath">DPSample</span> module to see how different features can be used.
All the examples follow the same basic pattern:
</p>
<ol>
<li>Set up the <code>DRIS</code> structure with the relevant information.</li>
<li>Call the API.</li>
<li>Use the information returned in the <code>DRIS</code>.</li>
</ol>
<p>
Uncomment the function calls in the <code>RunExampleButton_Click()</code> procedure
in the <span class="filepath">DPSample</span> module to enable the examples of different features,
then click the <span class="ui_element">Run Example</span> button on <span class="filepath">Sheet1</span> of the workbook to run the examples.
</p>
<p>
The <span class="filepath">DPSample</span> module also demonstrates loading the appropriate DLL for your platform.
</p>
<p>
Parts of the sample code are marked with <code>!!!!</code> must be customised with your own functions or values
for some features to work correctly. Not all features are supported by all dongle models.
See the user manual for more information.
</p>
</body>
</html>