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,224 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{2960c946-f28b-4c7c-9c85-55a82b8728d0}</ProjectGuid>
<Config Condition="'$(Config)'==''">Release</Config>
<FrameworkType>None</FrameworkType>
<ProjectVersion>14.4</ProjectVersion>
<Base>True</Base>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>3</TargetedPlatforms>
<AppType>Application</AppType>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
<Cfg_1_Win64>true</Cfg_1_Win64>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''">
<Cfg_2_Win64>true</Cfg_2_Win64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<OutputExt>exe</OutputExt>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>2057</VerInfo_Locale>
<BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
<DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
<DynamicRTL>true</DynamicRTL>
<ILINK_ObjectSearchPath>..\..\..\C;..\..\Visual Studio 5\DinkeyChange;..\..\C++Builder\DinkeyChange;$(ILINK_ObjectSearchPath)</ILINK_ObjectSearchPath>
<UsePackages>true</UsePackages>
<NoVCL>true</NoVCL>
<ProjectType>CppGuiApplication</ProjectType>
<PackageImports>vcl.bpi;rtl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;$(PackageImports)</PackageImports>
<BCC_wpar>false</BCC_wpar>
<IncludePath>..\..\;$(BDS)\include;..\..\..\C;..\..\Visual Studio 5\DinkeyChange;..\..\C++Builder\DinkeyChange;$(IncludePath)</IncludePath>
<AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>
<ILINK_LibraryPath>..\..\;$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\..\..\C;..\..\Visual Studio 5\DinkeyChange;$(ILINK_LibraryPath)</ILINK_LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<VerInfo_Locale>1033</VerInfo_Locale>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<Defines>NO_STRICT;$(Defines)</Defines>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<VerInfo_Locale>1033</VerInfo_Locale>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Optimize>false</DCC_Optimize>
<BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
<BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
<ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
<BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
<IntermediateOutputDir>Debug</IntermediateOutputDir>
<TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
<BCC_StackFrames>true</BCC_StackFrames>
<ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<BCC_DisableOptimizations>true</BCC_DisableOptimizations>
<TASM_Debugging>Full</TASM_Debugging>
<BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<Defines>_DEBUG;$(Defines)</Defines>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<Defines>_DEBUG;$(Defines)</Defines>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<IntermediateOutputDir>Release</IntermediateOutputDir>
<ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<TASM_Debugging>None</TASM_Debugging>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<LinkPackageImports>rtl.bpi;vcl.bpi</LinkPackageImports>
<Defines>NDEBUG;$(Defines)</Defines>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<LinkPackageImports>rtl.bpi;vcl.bpi</LinkPackageImports>
<Defines>NDEBUG;$(Defines)</Defines>
</PropertyGroup>
<ProjectExtensions>
<Borland.Personality>CPlusPlusBuilder.Personality.12</Borland.Personality>
<Borland.ProjectType>CppGuiApplication</Borland.ProjectType>
<BorlandProject>
<CPlusPlusBuilder.Personality>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">2057</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
</VersionInfoKeys>
<Debugging>
<Debugging Name="DebugSourceDirs"/>
</Debugging>
<Parameters>
<Parameters Name="RunParams"/>
<Parameters Name="Launcher"/>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="DebugCWD"/>
<Parameters Name="HostApplication"/>
<Parameters Name="RemoteHost"/>
<Parameters Name="RemotePath"/>
<Parameters Name="RemoteParams"/>
<Parameters Name="RemoteLauncher"/>
<Parameters Name="UseRemoteLauncher">False</Parameters>
<Parameters Name="RemoteCWD"/>
<Parameters Name="RemoteDebug">False</Parameters>
<Parameters Name="Debug Symbols Search Path"/>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<Linker>
<Linker Name="LibPrefix"/>
<Linker Name="LibSuffix"/>
<Linker Name="LibVersion"/>
</Linker>
<ProjectProperties>
<ProjectProperties Name="AutoShowDeps">False</ProjectProperties>
<ProjectProperties Name="ManagePaths">True</ProjectProperties>
<ProjectProperties Name="VerifyPackages">True</ProjectProperties>
</ProjectProperties>
</CPlusPlusBuilder.Personality>
<Platforms>
<Platform value="OSX32">False</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">True</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Cpp.Targets"/>
<ItemGroup>
<ResourceCompile Include="..\..\C++Builder\DinkeyChange\ChangeTest.rc">
<Form>ChangeTest.res</Form>
<BuildOrder>1</BuildOrder>
</ResourceCompile>
<CppCompile Include="changetest_imports.c">
<BuildOrder>2</BuildOrder>
</CppCompile>
<CppCompile Include="..\..\changetest.c">
<BuildOrder>0</BuildOrder>
</CppCompile>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
</Project>

View File

@@ -0,0 +1,50 @@
ChangeTest - sample code to call DinkeyChange.dll in C++ Builder XE3 (and more recent)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This project is written in C++ Builder XE3 but will work in more recent
versions (they will upgrade the Project to the latest version). For earlier versions
you should use the project in the C++Builder folder.
The source files in the project are:
File name Folder Description
changetest.c Samples\c main source code file for C
changetest.h Samples\c contains some useful constants
DinkeyChange_borland.lib Samples\c\import_libs contains the function definitions for DinkeyChange.dll
DinkeyChange64_borland.a Samples\c\import_libs contains the function definitions for DinkeyChange64.dll
changetest_imports.c Samples\c\C++Builder XE3\DinkeyChange contains code to link the correct import library
changetest.rc Samples\c\C++Builder\DinkeyChange resource for main dialog
resource.h Samples\c\C++Builder\DinkeyChange header file for resource
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 project can compile to both 32-bit and 64-bit platforms and will link the appropriate
import library. For 32-bit you will call DinkeyChange.dll and for 64-bit you will call
DinkeyChange64.dll.
The sample code contains 7 functions. Just use which ever functions are most
appropriate and customise in your own way. The sample code is just a guide.
As none of the parameters are sensitive then there is no need to implement
strong security in calling DinkeyChange.
Note - you will not be able to debug your program after DinkeyChange has been called.
Our strong anti-debug code will cause the debugger to throw an exception. However,
if you do need to debug your code you can use our debug module for DinkeyChange:
DinkeyChangeDebug.dll (or 64-bit version). So, you can use DinkeyChange.dll
for your release build and DinkeyChangeDebug.dll for your debug build.
Note - the 32-bit DinkeyChange_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\DinkeyChange_borland.lib DinkeyChange.dll
(This assumes that the current directory is the Samples\C directory).
Note - the 64-bit DinkeyChange64_borland.a was created using Borland's MKEXP tool. If there is a problem
with the file we provide you can create your own by running (for example):
(from a RAD Studio Command Prompt)
mklib import_libs\DinkeyChange64_borland.a DinkeyChange64.dll
(This assumes that the current directory is the Samples\C directory).

View File

@@ -0,0 +1,12 @@
// this file exists just to conditionally link in the correct import library
// (32-bit or 64-bit depending on the build)
// It is not very elegant but we cannot see any other way of doing it.
// If you know a better way of doing this then please let us know!
#ifdef __BORLANDC__
#ifdef __clang__
#pragma link "..\\..\\import_libs\\DinkeyChange64_borland.a" // link 64-bit import library
#else
#pragma link "..\\..\\import_libs\\DinkeyChange_borland.lib" // link 32-bit import library
#endif
#endif

View File

@@ -0,0 +1,229 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{139221f8-7474-4beb-9d31-ff91c75d2342}</ProjectGuid>
<Config Condition="'$(Config)'==''">Release</Config>
<FrameworkType>None</FrameworkType>
<ProjectVersion>14.4</ProjectVersion>
<Base>True</Base>
<Platform Condition="'$(Platform)'==''">Win64</Platform>
<TargetedPlatforms>3</TargetedPlatforms>
<AppType>Application</AppType>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
<Cfg_1_Win64>true</Cfg_1_Win64>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''">
<Cfg_2_Win64>true</Cfg_2_Win64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<OutputExt>exe</OutputExt>
<VerInfo_Locale>2057</VerInfo_Locale>
<BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
<DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
<DynamicRTL>true</DynamicRTL>
<ILINK_ObjectSearchPath>..\..\..\C;$(ILINK_ObjectSearchPath)</ILINK_ObjectSearchPath>
<UsePackages>true</UsePackages>
<NoVCL>true</NoVCL>
<ProjectType>CppGuiApplication</ProjectType>
<PackageImports>vcl.bpi;rtl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi;$(PackageImports)</PackageImports>
<BCC_wpar>false</BCC_wpar>
<IncludePath>..\..\;$(BDS)\include;..\..\..\C;$(IncludePath)</IncludePath>
<AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>
<ILINK_LibraryPath>..\..\;$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\..\..\C;$(ILINK_LibraryPath)</ILINK_LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<Defines>NO_STRICT;$(Defines)</Defines>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Optimize>false</DCC_Optimize>
<BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
<BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
<ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
<BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
<IntermediateOutputDir>Debug</IntermediateOutputDir>
<TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
<BCC_StackFrames>true</BCC_StackFrames>
<ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<BCC_DisableOptimizations>true</BCC_DisableOptimizations>
<TASM_Debugging>Full</TASM_Debugging>
<BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<LinkPackageImports>rtl.bpi;vcl.bpi</LinkPackageImports>
<Defines>_DEBUG;$(Defines)</Defines>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<Defines>_DEBUG;$(Defines)</Defines>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<IntermediateOutputDir>Release</IntermediateOutputDir>
<ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<TASM_Debugging>None</TASM_Debugging>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<LinkPackageImports>rtl.bpi;vcl.bpi</LinkPackageImports>
<Defines>NDEBUG;$(Defines)</Defines>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<LinkPackageImports>rtl.bpi;vcl.bpi</LinkPackageImports>
<Defines>NDEBUG;$(Defines)</Defines>
</PropertyGroup>
<ProjectExtensions>
<Borland.Personality>CPlusPlusBuilder.Personality.12</Borland.Personality>
<Borland.ProjectType>CppGuiApplication</Borland.ProjectType>
<BorlandProject>
<CPlusPlusBuilder.Personality>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">2057</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
</VersionInfoKeys>
<Debugging>
<Debugging Name="DebugSourceDirs"/>
</Debugging>
<Parameters>
<Parameters Name="RunParams"/>
<Parameters Name="Launcher"/>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="DebugCWD"/>
<Parameters Name="HostApplication"/>
<Parameters Name="RemoteHost"/>
<Parameters Name="RemotePath"/>
<Parameters Name="RemoteParams"/>
<Parameters Name="RemoteLauncher"/>
<Parameters Name="UseRemoteLauncher">False</Parameters>
<Parameters Name="RemoteCWD"/>
<Parameters Name="RemoteDebug">False</Parameters>
<Parameters Name="Debug Symbols Search Path"/>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<Linker>
<Linker Name="LibPrefix"/>
<Linker Name="LibSuffix"/>
<Linker Name="LibVersion"/>
</Linker>
<ProjectProperties>
<ProjectProperties Name="AutoShowDeps">False</ProjectProperties>
<ProjectProperties Name="ManagePaths">True</ProjectProperties>
<ProjectProperties Name="VerifyPackages">True</ProjectProperties>
</ProjectProperties>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\bcboffice2k170.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\bcbofficexp170.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k170.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp170.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</CPlusPlusBuilder.Personality>
<Platforms>
<Platform value="OSX32">False</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">True</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Cpp.Targets"/>
<ItemGroup>
<CppCompile Include="..\..\apitest.c">
<BuildOrder>0</BuildOrder>
</CppCompile>
<CppCompile Include="dlltest_imports.c">
<BuildOrder>3</BuildOrder>
</CppCompile>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
</Project>

View File

@@ -0,0 +1,71 @@
Sample code to call Runtime Modules in C++ Builder XE3 (or more recent)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This project is written in C++ Builder XE3 but will work in more recent
versions (they will upgrade the Project to the latest version). For earlier versions
you should use the C++ Builder sample.
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
dlltest_imports.c Samples\c\C++Builder\Runtime contains code to link the correct import library
dpwin32_borland.lib Samples\c\import_libs contains the function definitions for dpwin32.dll
dpwin64_borland.a Samples\c\import_libs contains the function definitions for dpwin64.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 DllTest project uses the dynamic runtime library (e.g. dpwin32.dll or dpwin64.dll).
NB There is no ObjTest project because currently there is no 64-bit static module for 64-bit C++ Builder.
The project can compile to both 32-bit and 64-bit platforms and will link the appropriate
import library. For 32-bit builds you need to protect dpwin32.dll and for 64-bit builds you
need to protect dpwin64.dll. The protected DLL will need to be in the same folder as your
compiled program for it to run correctly.
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.
NB You need to protect dpwin32.dll (dpwin64.dll) and *not* your program.
Because your program is linked to the DLL it is protected.
Note - once dpwin32.dll (dpwin64.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 the debug module:
dpwin32debug.dll (dpwin64debug.dll), but this should not be used for release. NB You will need
to link to the dpwin32debug_borland.lib (dpwin64debug_borland.a) import library if you use the
debug module. Edit dlltest_imports.c to do this.
(See readme.txt in samples\c for restrictions concerning the debug module).
Note - the 32-bit 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).
Note - the 64-bit dpwin64_borland.a was created using Borland's MKEXP tool. If there is a problem
with the file we provide you can create your own by running (for example):
(from a RAD Studio Command Prompt)
mklib import_libs\dpwin64_borland.lib dpwin64.dll
(This assumes that the current directory is the Samples\C directory).

View File

@@ -0,0 +1,12 @@
// this file exists just to conditionally link in the correct import library
// (32-bit or 64-bit depending on the build)
// It is not very elegent but we cannot see any other way of doing it.
// If you know a better then please let us know!
#ifdef __BORLANDC__
#ifdef __clang__
#pragma link "..\\..\\import_libs\\dpwin64_borland.a" // link 64-bit import library
#else
#pragma link "..\\..\\import_libs\\dpwin32_borland.lib" // link 32-bit import library
#endif
#endif

View File

@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{2960c946-f28b-4c7c-9c85-55a82b8728d0}</ProjectGuid>
<Config Condition="'$(Config)'==''">Debug</Config>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Base>true</Base>
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Base>true</Base>
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
<Defines>NO_STRICT</Defines>
<DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
<DynamicRTL>true</DynamicRTL>
<ILINK_ObjectSearchPath>..\..\..\C;..\..\Visual Studio 5\DinkeyChange</ILINK_ObjectSearchPath>
<UsePackages>true</UsePackages>
<NoVCL>true</NoVCL>
<ProjectType>CppGuiApplication</ProjectType>
<PackageImports>vcl.bpi;rtl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi</PackageImports>
<BCC_wpar>false</BCC_wpar>
<IncludePath>$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\..\..\C;..\..\Visual Studio 5\DinkeyChange</IncludePath>
<AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>
<ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\..\..\C;..\..\Visual Studio 5\DinkeyChange</ILINK_LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Optimize>false</DCC_Optimize>
<BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
<Defines>_DEBUG;$(Defines)</Defines>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
<BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
<ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
<BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
<DCC_Define>DEBUG</DCC_Define>
<BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
<IntermediateOutputDir>Debug</IntermediateOutputDir>
<TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
<BCC_StackFrames>true</BCC_StackFrames>
<ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<BCC_DisableOptimizations>true</BCC_DisableOptimizations>
<TASM_Debugging>Full</TASM_Debugging>
<BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<Defines>NDEBUG;$(Defines)</Defines>
<IntermediateOutputDir>Release</IntermediateOutputDir>
<ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<TASM_Debugging>None</TASM_Debugging>
</PropertyGroup>
<ProjectExtensions>
<Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>
<Borland.ProjectType>CppGuiApplication</Borland.ProjectType>
<BorlandProject>
<BorlandProject> <CPlusPlusBuilder.Personality> <VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">2057</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
</VersionInfoKeys>
<Debugging>
<Debugging Name="DebugSourceDirs"></Debugging>
</Debugging>
<Parameters>
<Parameters Name="RunParams"></Parameters>
<Parameters Name="Launcher"></Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="DebugCWD"></Parameters>
<Parameters Name="HostApplication"></Parameters>
<Parameters Name="RemoteHost"></Parameters>
<Parameters Name="RemotePath"></Parameters>
<Parameters Name="RemoteParams"></Parameters>
<Parameters Name="RemoteLauncher"></Parameters>
<Parameters Name="UseRemoteLauncher">False</Parameters>
<Parameters Name="RemoteCWD"></Parameters>
<Parameters Name="RemoteDebug">False</Parameters>
<Parameters Name="Debug Symbols Search Path"></Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<Linker>
<Linker Name="LibPrefix"></Linker>
<Linker Name="LibSuffix"></Linker>
<Linker Name="LibVersion"></Linker>
</Linker>
<ProjectProperties>
<ProjectProperties Name="AutoShowDeps">False</ProjectProperties>
<ProjectProperties Name="ManagePaths">True</ProjectProperties>
<ProjectProperties Name="VerifyPackages">True</ProjectProperties>
</ProjectProperties>
</CPlusPlusBuilder.Personality> </BorlandProject></BorlandProject>
</ProjectExtensions>
<Import Project="$(MSBuildBinPath)\Borland.Cpp.Targets" />
<ItemGroup>
<CppCompile Include="..\..\changetest.c">
<BuildOrder>0</BuildOrder>
</CppCompile>
<ResourceCompile Include="ChangeTest.rc">
<ModuleName>ChangeTest.rc</ModuleName>
<Form>ChangeTest.res</Form>
<BuildOrder>1</BuildOrder>
</ResourceCompile>
<LibFiles Include="..\..\import_libs\DinkeyChange_borland.lib">
<BuildOrder>2</BuildOrder>
</LibFiles>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
</BuildConfiguration>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,35 @@
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 215, 358
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "ChangeTest"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Get Dongle Information...",IDC_DONGLEINFO,45,14,119,14
LTEXT "Enter Diagnostic filename:",IDC_STATIC,7,40,201,8
EDITTEXT IDC_DIAG_PATH,7,49,201,14,ES_AUTOHSCROLL
PUSHBUTTON "Write Diagnostics to File",IDC_GETDIAGS,45,68,119,14
LTEXT "Enter short Update Code here:",IDC_STATIC,7,96,201,8
EDITTEXT IDC_UPDATE_CODE_STRING,7,106,201,14,ES_AUTOHSCROLL
PUSHBUTTON "Make Changes",IDC_DO_UPDATE_CODE_STRING,69,125,68,14
LTEXT "Enter path to Update Code file:",IDC_STATIC,7,153,201,8
EDITTEXT IDC_UPDATE_CODE_FILE,7,163,201,14,ES_AUTOHSCROLL
PUSHBUTTON "Make Changes",IDC_DO_UPDATE_CODE_FILE,68,183,68,14
PUSHBUTTON "Restore Dinkey FD Lite",IDC_RESTORE_FD_LITE,45,215,119,14
PUSHBUTTON "Get Machine ID",IDC_GET_MACHINE_ID,7,245,95,14
EDITTEXT IDC_MACHINE_ID,110,245,98,14,ES_UPPERCASE
PUSHBUTTON "Download Temporary Software Key",IDC_GET_TEMP_SWKEY,35,275,139,14
LTEXT "Demo Software Key Product Code:",IDC_STATIC,7,305,201,8
EDITTEXT IDC_SWKEY_PRODCODE,7,314,201,14,ES_AUTOHSCROLL | ES_UPPERCASE
PUSHBUTTON "Download Demo Software Key",IDC_GET_DEMO_SWKEY,35,333,139,14
END

View File

@@ -0,0 +1,35 @@
ChangeTest - sample code to call DinkeyChange.dll 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
changetest.c Samples\c main source code file for C
changetest.h Samples\c contains some useful constants
DinkeyChange_borland.lib Samples\c\import_libs contains the function definitions for DinkeyChange.dll
ChangeTest.rc Samples\c\C++Builder\DinkeyChange resource for main dialog
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 sample code contains 7 functions. Just use which ever functions are most
appropriate and customise in your own way. The sample code is just a guide.
As none of the parameters are sensitive then there is no need to implement
strong security in calling DinkeyChange.
Note - you will not be able to debug your program after DinkeyChange has been called.
Our strong anti-debug code will cause the debugger to throw an exception. However,
if you do need to debug your code you can use our debug module for DinkeyChange:
DinkeyChangeDebug.dll. So, you can use DinkeyChange.dll for your release build
and DinkeyChangeDebug.dll for your debug build.
Note - the DinkeyChange_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\DinkeyChange_borland.lib DinkeyChange.dll
(This assumes that the current directory is the Samples\C directory).

View File

@@ -0,0 +1,16 @@
// Used by ChangeTest.rc
#define IDD_DIALOG1 101
#define IDC_DONGLEINFO 1000
#define IDC_UPDATE_CODE_STRING 1001
#define IDC_DO_UPDATE_CODE_STRING 1002
#define IDC_DIAG_PATH 1003
#define IDC_GETDIAGS 1004
#define IDC_UPDATE_CODE_FILE 1005
#define IDC_DO_UPDATE_CODE_FILE 1006
#define IDC_RESTORE_FD_LITE 1007
#define IDC_GET_MACHINE_ID 1008
#define IDC_MACHINE_ID 1009
#define IDC_GET_TEMP_SWKEY 1010
#define IDC_SWKEY_PRODCODE 1011
#define IDC_GET_DEMO_SWKEY 1012

View File

@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{139221f8-7474-4beb-9d31-ff91c75d2342}</ProjectGuid>
<Config Condition="'$(Config)'==''">Debug</Config>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Base>true</Base>
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Base>true</Base>
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
<Defines>NO_STRICT</Defines>
<DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
<DynamicRTL>true</DynamicRTL>
<ILINK_ObjectSearchPath>..\..\..\C</ILINK_ObjectSearchPath>
<UsePackages>true</UsePackages>
<NoVCL>true</NoVCL>
<ProjectType>CppGuiApplication</ProjectType>
<PackageImports>vcl.bpi;rtl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi</PackageImports>
<BCC_wpar>false</BCC_wpar>
<IncludePath>$(BDS)\include;$(BDS)\include\dinkumware;..\..\..\C</IncludePath>
<AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>
<ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\..\..\C</ILINK_LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Optimize>false</DCC_Optimize>
<BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
<Defines>_DEBUG;$(Defines)</Defines>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
<BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
<ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
<BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
<DCC_Define>DEBUG</DCC_Define>
<BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
<IntermediateOutputDir>Debug</IntermediateOutputDir>
<TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
<BCC_StackFrames>true</BCC_StackFrames>
<ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<BCC_DisableOptimizations>true</BCC_DisableOptimizations>
<TASM_Debugging>Full</TASM_Debugging>
<BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<Defines>NDEBUG;$(Defines)</Defines>
<IntermediateOutputDir>Release</IntermediateOutputDir>
<ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<TASM_Debugging>None</TASM_Debugging>
</PropertyGroup>
<ProjectExtensions>
<Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>
<Borland.ProjectType>CppGuiApplication</Borland.ProjectType>
<BorlandProject>
<BorlandProject> <CPlusPlusBuilder.Personality> <VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">2057</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
</VersionInfoKeys>
<Debugging>
<Debugging Name="DebugSourceDirs"></Debugging>
</Debugging>
<Parameters>
<Parameters Name="RunParams"></Parameters>
<Parameters Name="Launcher"></Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="DebugCWD"></Parameters>
<Parameters Name="HostApplication"></Parameters>
<Parameters Name="RemoteHost"></Parameters>
<Parameters Name="RemotePath"></Parameters>
<Parameters Name="RemoteParams"></Parameters>
<Parameters Name="RemoteLauncher"></Parameters>
<Parameters Name="UseRemoteLauncher">False</Parameters>
<Parameters Name="RemoteCWD"></Parameters>
<Parameters Name="RemoteDebug">False</Parameters>
<Parameters Name="Debug Symbols Search Path"></Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<Linker>
<Linker Name="LibPrefix"></Linker>
<Linker Name="LibSuffix"></Linker>
<Linker Name="LibVersion"></Linker>
</Linker>
<ProjectProperties>
<ProjectProperties Name="AutoShowDeps">False</ProjectProperties>
<ProjectProperties Name="ManagePaths">True</ProjectProperties>
<ProjectProperties Name="VerifyPackages">True</ProjectProperties>
</ProjectProperties>
</CPlusPlusBuilder.Personality> </BorlandProject></BorlandProject>
</ProjectExtensions>
<Import Project="$(MSBuildBinPath)\Borland.Cpp.Targets" />
<ItemGroup>
<CppCompile Include="..\..\apitest.c">
<BuildOrder>0</BuildOrder>
</CppCompile>
<LibFiles Include="..\..\import_libs\dpwin32_borland.lib">
<BuildOrder>1</BuildOrder>
</LibFiles>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
</BuildConfiguration>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{e6943fc9-7514-48ab-91bc-57e69cb8cb4f}</ProjectGuid>
<Config Condition="'$(Config)'==''">Debug</Config>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Base>true</Base>
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Base>true</Base>
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
<Defines>NO_STRICT</Defines>
<DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
<DynamicRTL>true</DynamicRTL>
<ILINK_ObjectSearchPath>..\..\..\C</ILINK_ObjectSearchPath>
<UsePackages>true</UsePackages>
<NoVCL>true</NoVCL>
<ProjectType>CppGuiApplication</ProjectType>
<PackageImports>vcl.bpi;rtl.bpi;bcbie.bpi;vclx.bpi;vclactnband.bpi;xmlrtl.bpi;bcbsmp.bpi;dbrtl.bpi;vcldb.bpi;bdertl.bpi;vcldbx.bpi</PackageImports>
<BCC_wpar>false</BCC_wpar>
<IncludePath>$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\..\..\C</IncludePath>
<AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>
<ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;..\..\..\C</ILINK_LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Optimize>false</DCC_Optimize>
<BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
<Defines>_DEBUG;$(Defines)</Defines>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
<BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
<ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
<BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
<DCC_Define>DEBUG</DCC_Define>
<BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
<IntermediateOutputDir>Debug</IntermediateOutputDir>
<TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
<BCC_StackFrames>true</BCC_StackFrames>
<ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<BCC_DisableOptimizations>true</BCC_DisableOptimizations>
<TASM_Debugging>Full</TASM_Debugging>
<BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<Defines>NDEBUG;$(Defines)</Defines>
<IntermediateOutputDir>Release</IntermediateOutputDir>
<ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<TASM_Debugging>None</TASM_Debugging>
</PropertyGroup>
<ProjectExtensions>
<Borland.Personality>CPlusPlusBuilder.Personality</Borland.Personality>
<Borland.ProjectType>CppGuiApplication</Borland.ProjectType>
<BorlandProject>
<BorlandProject> <CPlusPlusBuilder.Personality> <VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">2057</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
</VersionInfoKeys>
<Debugging>
<Debugging Name="DebugSourceDirs"></Debugging>
</Debugging>
<Parameters>
<Parameters Name="RunParams"></Parameters>
<Parameters Name="Launcher"></Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="DebugCWD"></Parameters>
<Parameters Name="HostApplication"></Parameters>
<Parameters Name="RemoteHost"></Parameters>
<Parameters Name="RemotePath"></Parameters>
<Parameters Name="RemoteParams"></Parameters>
<Parameters Name="RemoteLauncher"></Parameters>
<Parameters Name="UseRemoteLauncher">False</Parameters>
<Parameters Name="RemoteCWD"></Parameters>
<Parameters Name="RemoteDebug">False</Parameters>
<Parameters Name="Debug Symbols Search Path"></Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<Linker>
<Linker Name="LibPrefix"></Linker>
<Linker Name="LibSuffix"></Linker>
<Linker Name="LibVersion"></Linker>
</Linker>
<ProjectProperties>
<ProjectProperties Name="AutoShowDeps">False</ProjectProperties>
<ProjectProperties Name="ManagePaths">True</ProjectProperties>
<ProjectProperties Name="VerifyPackages">True</ProjectProperties>
</ProjectProperties>
</CPlusPlusBuilder.Personality> </BorlandProject></BorlandProject>
</ProjectExtensions>
<Import Project="$(MSBuildBinPath)\Borland.Cpp.Targets" />
<ItemGroup>
<CppCompile Include="..\..\apitest.c">
<BuildOrder>0</BuildOrder>
</CppCompile>
<ObjFiles Include="..\..\object_modules\dpwin32_omf.obj">
<BuildOrder>1</BuildOrder>
</ObjFiles>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
</BuildConfiguration>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,57 @@
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).

View File

@@ -0,0 +1,68 @@
[Project]
FileName=ChangeTest.dev
Name=ChangeTest
UnitCount=2
Type=1
Ver=1
ObjFiles=
Includes=
Libs=
PrivateResource=ChangeTest_private.rc
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=../../import_libs/libDinkeyChange.a_@@_
IsCpp=0
Icon=
ExeOutput=
ObjectOutput=
OverrideOutput=0
OverrideOutputName=ChangeTest.exe
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000000
[Unit1]
FileName=..\..\changetest.c
CompileCpp=0
Folder=ChangeTest
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
[Unit2]
FileName=..\..\Visual Studio 5\DinkeyChange\ChangeTest.rc
Folder=ChangeTest
Compile=1
Link=0
Priority=1000
OverrideBuildCmd=0
BuildCmd=

View File

@@ -0,0 +1,30 @@
ChangeTest - sample code to call DinkeyChange.dll in 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
changetest.c Samples\c main source code file for C
changetest.h Samples\c contains some useful constants
libDinkeyChange.a Samples\c\import_libs contains the function definitions for DinkeyChange.dll
changetest.rc Samples\c\Visual Studio 5\DinkeyChange resource for main dialog
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 sample code contains 7 functions. Just use which ever functions are most
appropriate and customise in your own way. The sample code is just a guide.
As none of the parameters are sensitive then there is no need to implement
strong security in calling DinkeyChange.
Note - you will not be able to debug your program after DinkeyChange has been called.
Our strong anti-debug code will cause the debugger to throw an exception. However,
if you do need to debug your code you can use our debug module for DinkeyChange:
DinkeyChangeDebug.dll. So, you can use DinkeyChange.dll for your release build
and DinkeyChangeDebug.dll for your debug build.
Note - if you are interested in creating the libDinkeyChange.a import library yourself
then read the notes in the MinGW\Runtime\readme.txt file (Dev-C++ uses the minGW compiler).

View File

@@ -0,0 +1,59 @@
[Project]
FileName=DllTest.dev
Name=DllTest
UnitCount=1
Type=1
Ver=1
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=../../import_libs/libdpwin32.a_@@_
IsCpp=0
Icon=
ExeOutput=
ObjectOutput=
OverrideOutput=0
OverrideOutputName=DllTest.exe
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000000
[Unit1]
FileName=..\..\apitest.c
CompileCpp=0
Folder=DllTest
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0

View File

@@ -0,0 +1,59 @@
[Project]
FileName=ObjTest.dev
Name=ObjTest
UnitCount=1
Type=1
Ver=1
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=../../object_modules/dpwin32_coff.obj_@@_
IsCpp=0
Icon=
ExeOutput=
ObjectOutput=
OverrideOutput=0
OverrideOutputName=ObjTest.exe
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000000
[Unit1]
FileName=..\..\apitest.c
CompileCpp=0
Folder=DllTest
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0

View File

@@ -0,0 +1,53 @@
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).

View File

@@ -0,0 +1,40 @@
ChangeTest - sample code to call DinkeyChange in MinGW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tested using minGW 3.4.2 and 4.8.1 and minGW-w64 4.8.1
The source files in the project are:
File name Folder Description
changetest.c Samples\c main source code file for C
changetest.h Samples\c contains some useful constants
libDinkeyChange.a Samples\c\import_libs contains the function definitions for DinkeyChange.dll
libDinkeyChangeDebug.a Samples\c\import_libs contains the function definitions for DinkeyChangeDebug.dll
libDinkeyChange64.a Samples\c\import_libs contains the function definitions for DinkeyChange64.dll
libDinkeyChangeDebug64.a Samples\c\import_libs contains the function definitions for DinkeyChangeDebug64.dll
changetest.rc Samples\c\Visual Studio 5\DinkeyChange resource for main dialog
(NB for compiling you will also need to compile the resources)
To compile for 32-bit:
gcc -m32 ..\..\changetest.c -L..\..\import_libs -lDinkeyChange -o ChangeTest.exe
To compile for 64-bit:
gcc -m64 ..\..\changetest.c -L..\..\import_libs -lDinkeyChange64 -o ChangeTest64.exe
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 sample code contains 7 functions. Just use which ever functions are most
appropriate and customise in your own way. The sample code is just a guide.
As none of the parameters are sensitive then there is no need to implement
strong security in calling DinkeyChange.
Note - you will not be able to debug your program after DinkeyChange has been called.
Our strong anti-debug code will cause the debugger to throw an exception. However,
if you do need to debug your code you can use our debug module for DinkeyChange:
DinkeyChangeDebug.dll. So, you can use DinkeyChange.dll for your release build
and DinkeyChangeDebug.dll for your debug build.
Note - if you are interested in creating the libDinkeyChange.a import library yourself
then read the notes in the MinGW\Runtime\readme.txt file.

View File

@@ -0,0 +1,84 @@
Sample code to call static or dynamic runtime modules using MinGW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tested using minGW 3.4.2 and 4.8.1 and minGW-w64 4.8.1
The source files you need 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, dpwin64.obj
libdpwin32.a Samples\c\import_libs contains the function definitions for dpwin32.dll
To link the static runtime module compile like this:
32-bit:
gcc -m32 ..\..\apitest.c ..\..\object_modules\dpwin32_coff.obj -o ObjTest.exe
64-bit:
gcc -m64 ..\..\apitest.c ..\..\object_modules\dpwin64.obj -o ObjTest64.exe
(please ignore the warning about uuid.lib)
Alternatively to link with the dynamic runtime module compile like this:
32-bit:
gcc -m32 ..\..\apitest.c -L..\..\import_libs -ldpwin32 -o DllTest.exe
64-bit:
gcc -m64 ..\..\apitest.c -L..\..\import_libs -ldpwin64 -o DllTest64.exe
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.
Creating your own import library
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In order for MinGW to call functions in dpwin32.dll you need to link the import library
libdpwin32.a. We have created these for you, but if for some reason you need to create it
yourself then you should do the following:
1) Create a dpwin32.def file with the following format:
LIBRARY dpwin32.dll
EXPORTS
<Function1>
<Function2>
where <Function1> etc.. are the function names that the linker complains about when you
don't link with the import library. e.g. for dpwin32.dll you just need two functions:
DDProtCheck@8
DDGetNetUserList@20
(you do not need to specify the @n part for 64-bit modules)
2) Now use dlltool to create the import library:
dlltool --input-def dpwin32.def --output-lib libdpwin32.a -k
Note: for our DLLs you need to use the -k option otherwise you will get an "file format
not recognised error" when you link the import library.

View File

@@ -0,0 +1,18 @@
Using the Runtime Protection Check API in Qt Creator Projects
=============================================================
The runtime protection API sample code (apitest.c and dris.h) has been tested with Qt Creator 4.10.2 on Windows,
using MinGW as the compiler and qmake as the build system.
As Qt Creator supports such a wide variety of different compilers and build systems, no project files are included in this sample code.
It is better to create your own project using your preferred toolchain, and then use 'Add Existing Files...' to add apitest.c and dris.h.
Qt Creator may complain about the symbols BYTE and WINAPI in dris.h.
If it does, insert "#include <windows.h>" at the top of dris.h.
Qt Creator projects are Unicode by default, it may complain about the use of C strings in calls to MessageBox() in apitest.c.
To solve this issue, either set your project explicitly as an ANSI project, or change all occurrences of MessageBox() to MessageBoxA().
You will need to add a reference to the relevant static library (OBJ file) for your compiler.
For projects that use qmake, add the following to your *.pro project file:
LIBS += path\to\object_module.obj

View File

@@ -0,0 +1,117 @@
C and C++ Sample Code
=====================
The source files in this folder are common to all C/C++ implementations:
apitest.c examples of calling the runtime protection API, e.g. protection checks, reading/writing the dongle secure data area.
dris.h defines structures, constants and function prototypes for the runtime protection API.
changetest.c examples of calling the DinkeyChange API.
changetest.h defines structures, constants and function prototypes for the DinkeyChange API.
dapftest.c examples of calling the DinkeyAdd API.
dapf.h defines structures, constants and function prototypes for the DinkeyAdd API.
drpftest.c examples of calling the DinkeyRemote API.
drpf.h defines structures, constants and function prototypes for the DinkeyRemote API.
In order for the projects to compile without modification we have also included the folders:
import_libs import libraries that contain the function definitions for the dynamic API libraries (e.g. dpwin32.dll).
object_modules static API libraries:
Use dpwin32_coff.obj for Visual Studio, MinGW and other compilers that expect the COFF object module format.
Use dpwin32_omf.obj for C++ Builder and other compilers that expects an OMF object module.
There is only one 64-bit object module because in 64-bit Windows only the COFF format exists.
The subfolders contain projects for different IDEs and/or compilers:
Visual Studio 2008 for all version of Visual Studio from 2008 onwards. 32-bit and 64-bit.
Visual Studio 5 for earlier versions of Visual Studio. 32-bit only.
C++ Builder XE3 for versions of C++ Builder from XE3 onwards.
C++ Builder for versions of C++ Builder from 2007 to XE2. If you are using a version earlier than this then please read the README.txt file in that folder.
Within the subfolders are different projects:
The ObjTest project checks the dongle by calling the appropriate static library (object module).
The DllTest project checks the dongle by calling the dynamic library dpwin32.dll (or dpwin64.dll for 64-bit code).
The ChangeTest project calls the DinkeyChange API which accepts update codes generated by DinkeyRemote.
The dapfTest project calls the DinkeyAdd API to program dongles and lock your software.
The drpfTest project calls the DinkeyRemote API to generate remote update codes.
Notes concerning Debug Modules
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The debug modules are:
dpwin32_coff_debug.obj dpwin32_omf_debug.obj dpwin64debug.obj
dpwin32debug.dll dpwin64debug.dll
DinkeyChangeDebug.dll DinkeyChange64Debug.dll
Note - the DinkeyAdd and DinkeyRemote modules have no debug versions.
When you use a normal runtime module (e.g. dpwin32.dll) to protect your software the anti-debug code is
so strong that if you are debugging your code after the call DDProtCheck then it will crash. If you want to
be able to debug your code then you can setup your project so that your code calls one of the debug modules
when you are producing your debug code and one of the standard runtime modules when you produce your release
code. The Runtime debug module has the following restrictions:
1) It will not correctly start a network user (network dongles only). However, other than that the protection check
will function correctly and return success.
2) You will not be able to encrypt the DRIS. (If you do encrypt the DRIS in your release build then you should make
sure that CryptDRIS does not get called in your debug build).
3) The protection check will take slightly longer than normal.
4) The DDGetNetUserList function will return error 428 (not implemented).
5) A temporary subprocess is created which may be (falsely) detected as malicious by anti-virus programs.
Note: the debug DinkeyChange modules have no restrictions (except for number 5 above).
Loading Runtime module using LoadLibrary
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you want to control when the DLL is loaded / unloaded or you want to rename dpwin32.dll
(but cannot change the import library, e.g. with Microsoft Visual Studio),
then you should use LoadLibrary / GetProcAddress to load our library instead of linking the relevant import library.
The DLL is normally placed in the same folder as the program that is calling it.
This code snippet shows how you can do this:
#include "dris.h"
// declare function type
typedef int (__stdcall * TypeDDProtCheck)(DRIS*, BYTE *);
HMODULE hProtLib;
TypeDDProtCheck DDProtCheck;
hProtLib = LoadLibrary("dpwin32.dll"); // if you have renamed the dll then you should use the new name.
DDProtCheck = (TypeDDProtCheck)GetProcAddress(hProtLib, "DDProtCheck");
// use function as normal (see sample code)
// free handle when you no longer need to call the DLL (typically the end of your program)
FreeLibrary(hProtLib);
Unresolved External Symbol Errors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you using a static runtime module (e.g. dpwin64.obj) then in rare cases you can receive errors like this:
dpwin64.obj : error LNK2019: unresolved external symbol __imp_SetSecurityDescriptorDacl referenced in function
fatal error LNK1120: 6 unresolved externals
To fix this problem you need to make sure the following libraries are included in your project:
User32.lib
Advapi32.lib
ws2_32.lib
Normally these libraries are included as standard by your C/C++ IDE (e.g Visual Studio). However, in rare cases,
such as using the Qt platform or if you are using a C/C++ compiler/linker on the command line, these
libraries may not be included by default so you have include them yourself.

View File

@@ -0,0 +1,31 @@
dapfTest - Sample code for calling the DinkeyAdd Module in C
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This project is written in Visual Studio 2008 but will work in more recent
versions of Visual Studio (they will upgrade the Project to the latest version).
The main source files in the project are:
dapf.h - the source file contains declarations of our API.
dapftest.c - this is the sample code giving an example on how you can call our API.
It contains 5 functions. Just use which ever functions are most appropriate
and customise in your own way.
Note that the source paths of this project are structured to minimise files. If you
want to move this project the references to these files will probably be no longer valid.
The solutions have been modified to link in the correct library file (DinkeyAdd32.lib,
DinkeyAdd64.lib) depending on whether the output is 32-bit or 64-bit. They have also
been modified to assume Unicode characters are not the default (this sample uses ascii
characters because that is what the Dinkey dongle SDK requires).
Note - you will not be able to debug your program after the DinkeyAdd Module has been
called. Our strong anti-debug code will cause the debugger to throw an exception.
There are no debug modules for DinkeyAdd so you will have to find other ways of
debugging your code (for example taking out the call altogether).
Note - If you are using Visual Studio 2012 or higher then you may get the linker error
"LNK2026: module unsafe for SAFESEH image". To stop this please turn off SAFESEH by
going to your project properties > Linker > Advanced and setting
"Image Has Safe Exception Handlers" to "No".

View File

@@ -0,0 +1,26 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dapfTest", "dapfTest.vcproj", "{4FDBE0B2-9115-4CF3-ABCC-786CBE7DB7E0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4FDBE0B2-9115-4CF3-ABCC-786CBE7DB7E0}.Debug|Win32.ActiveCfg = Debug|Win32
{4FDBE0B2-9115-4CF3-ABCC-786CBE7DB7E0}.Debug|Win32.Build.0 = Debug|Win32
{4FDBE0B2-9115-4CF3-ABCC-786CBE7DB7E0}.Debug|x64.ActiveCfg = Debug|x64
{4FDBE0B2-9115-4CF3-ABCC-786CBE7DB7E0}.Debug|x64.Build.0 = Debug|x64
{4FDBE0B2-9115-4CF3-ABCC-786CBE7DB7E0}.Release|Win32.ActiveCfg = Release|Win32
{4FDBE0B2-9115-4CF3-ABCC-786CBE7DB7E0}.Release|Win32.Build.0 = Release|Win32
{4FDBE0B2-9115-4CF3-ABCC-786CBE7DB7E0}.Release|x64.ActiveCfg = Release|x64
{4FDBE0B2-9115-4CF3-ABCC-786CBE7DB7E0}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,351 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="dapfTest"
ProjectGUID="{4FDBE0B2-9115-4CF3-ABCC-786CBE7DB7E0}"
RootNamespace="dapfTest"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\import_libs\DinkeyAdd32.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\import_libs\DinkeyAdd32.lib"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\import_libs\DinkeyAdd64.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\import_libs\DinkeyAdd64.lib"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\dapftest.c"
>
</File>
<File
RelativePath="..\..\Visual Studio 5\DinkeyAdd\dapftest.rc"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,26 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChangeTest", "ChangeTest.vcproj", "{4DB5C093-DFF8-4EF9-92AF-73CAC5A2E0D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4DB5C093-DFF8-4EF9-92AF-73CAC5A2E0D6}.Debug|Win32.ActiveCfg = Debug|Win32
{4DB5C093-DFF8-4EF9-92AF-73CAC5A2E0D6}.Debug|Win32.Build.0 = Debug|Win32
{4DB5C093-DFF8-4EF9-92AF-73CAC5A2E0D6}.Debug|x64.ActiveCfg = Debug|x64
{4DB5C093-DFF8-4EF9-92AF-73CAC5A2E0D6}.Debug|x64.Build.0 = Debug|x64
{4DB5C093-DFF8-4EF9-92AF-73CAC5A2E0D6}.Release|Win32.ActiveCfg = Release|Win32
{4DB5C093-DFF8-4EF9-92AF-73CAC5A2E0D6}.Release|Win32.Build.0 = Release|Win32
{4DB5C093-DFF8-4EF9-92AF-73CAC5A2E0D6}.Release|x64.ActiveCfg = Release|x64
{4DB5C093-DFF8-4EF9-92AF-73CAC5A2E0D6}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,346 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="ChangeTest"
ProjectGUID="{4DB5C093-DFF8-4EF9-92AF-73CAC5A2E0D6}"
RootNamespace="ChangeTest"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/SAFESEH:NO"
AdditionalDependencies="..\..\import_libs\DinkeyChange.lib"
LinkIncremental="2"
IgnoreAllDefaultLibraries="false"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;..\..\import_libs\DinkeyChange64.lib&quot;"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/SAFESEH:NO"
AdditionalDependencies="&quot;..\..\import_libs\DinkeyChange.lib&quot;"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;..\..\import_libs\DinkeyChange64.lib&quot;"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\changetest.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\changetest.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath="..\..\Visual Studio 5\DinkeyChange\ChangeTest.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,35 @@
ChangeTest - sample code to call DinkeyChange Module in Visual Studio 2008
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This project is written in Visual Studio 2008 but will work in more recent
versions of Visual Studio (they will upgrade the Project to the latest version).
The main source files in the project are:
changetest.c Samples\c main source code file for C
changetest.h Samples\c contains some useful constants
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 solutions have been modified to link in the correct library file (DinkeyChange.lib,
DinkeyChange64.lib) depending on whether the output is 32-bit or 64-bit. They have also
been modified to assume Unicode characters are not the default (this sample uses ascii
characters because that is what the Dinkey dongle SDK requires).
The sample code contains 7 functions. Just use which ever functions are most
appropriate and customise in your own way. The sample code is just a guide.
As none of the parameters are sensitive then there is no need to implement
strong security in calling DinkeyChange.
Note - you will not be able to debug your program after DinkeyChange has been called.
Our strong anti-debug code will cause the debugger to throw an exception. However,
if you do need to debug your code you can use our debug module for DinkeyChange:
DinkeyChangeDebug.dll. So, you can use DinkeyChange.dll for your release build
and DinkeyChangeDebug.dll for your debug build. (64-bit versions of these files
also exist).
Note - If you are using Visual Studio 2012 or higher then you may get the linker error
"LNK2026: module unsafe for SAFESEH image". To stop this please turn off SAFESEH by
going to your project properties > Linker > Advanced and setting
"Image Has Safe Exception Handlers" to "No".

View File

@@ -0,0 +1,31 @@
drpfTest - Sample code for calling the DinkeyRemote Module in C
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This project is written in Visual Studio 2008 but will work in more recent
versions of Visual Studio (they will upgrade the Project to the latest version).
The main source files in the project are:
drpf.h - the source file contains declarations of our API.
drpftest.c - this is the sample code giving an example on how you can call our API.
It contains 2 functions. Just use which ever functions are most appropriate
and customise in your own way.
Note that the source paths of this project are structured to minimise files. If you
want to move this project the references to these files will probably be no longer valid.
The solutions have been modified to link in the correct library file (DinkeyRemote32.lib,
DinkeyRemote64.lib) depending on whether the output is 32-bit or 64-bit. They have also
been modified to assume Unicode characters are not the default (this sample uses ascii
characters because that is what the Dinkey dongle SDK requires).
Note - you will not be able to debug your program after the DinkeyRemote Module has been
called. Our strong anti-debug code will cause the debugger to throw an exception.
There are no debug modules for DinkeyRemote so you will have to find other ways of
debugging your code (for example taking out the call altogether).
Note - If you are using Visual Studio 2012 or higher then you may get the linker error
"LNK2026: module unsafe for SAFESEH image". To stop this please turn off SAFESEH by
going to your project properties > Linker > Advanced and setting
"Image Has Safe Exception Handlers" to "No".

View File

@@ -0,0 +1,26 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "drpfTest", "drpfTest.vcproj", "{C56A2849-1C1D-4307-937F-D7DF9EA56CB0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C56A2849-1C1D-4307-937F-D7DF9EA56CB0}.Debug|Win32.ActiveCfg = Debug|Win32
{C56A2849-1C1D-4307-937F-D7DF9EA56CB0}.Debug|Win32.Build.0 = Debug|Win32
{C56A2849-1C1D-4307-937F-D7DF9EA56CB0}.Debug|x64.ActiveCfg = Debug|x64
{C56A2849-1C1D-4307-937F-D7DF9EA56CB0}.Debug|x64.Build.0 = Debug|x64
{C56A2849-1C1D-4307-937F-D7DF9EA56CB0}.Release|Win32.ActiveCfg = Release|Win32
{C56A2849-1C1D-4307-937F-D7DF9EA56CB0}.Release|Win32.Build.0 = Release|Win32
{C56A2849-1C1D-4307-937F-D7DF9EA56CB0}.Release|x64.ActiveCfg = Release|x64
{C56A2849-1C1D-4307-937F-D7DF9EA56CB0}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,351 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="drpfTest"
ProjectGUID="{C56A2849-1C1D-4307-937F-D7DF9EA56CB0}"
RootNamespace="drpfTest"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\import_libs\DinkeyRemote32.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\import_libs\DinkeyRemote32.lib"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\import_libs\DinkeyRemote64.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\import_libs\DinkeyRemote64.lib"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\drpftest.c"
>
</File>
<File
RelativePath="..\..\Visual Studio 5\DinkeyRemote\drpftest.rc"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,341 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="DllTest"
ProjectGUID="{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}"
RootNamespace="DllTest"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/SAFESEH:NO"
AdditionalDependencies="..\..\..\import_libs\dpwin32.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/SAFESEH:NO"
AdditionalDependencies="..\..\..\import_libs\dpwin32.lib"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\..\import_libs\dpwin64.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\..\import_libs\dpwin64.lib"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\apitest.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\dris.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,341 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="ObjTest"
ProjectGUID="{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}"
RootNamespace="ObjTest"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/SAFESEH:NO"
AdditionalDependencies="dpwin32_coff.obj"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\object_modules"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dpwin64.obj"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\object_modules"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/SAFESEH:NO"
AdditionalDependencies="dpwin32_coff.obj"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\object_modules"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dpwin64.obj"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\object_modules"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\apitest.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,69 @@
Sample code to call Runtime modules in Visual Studio 2008
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This project is written in Visual Studio 2008 but will work in more recent versions of
Visual Studio (they will upgrade the Project to the latest version).
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.lib Samples\c\import_libs contains the function definitions for dpwin32.dll
dpwin64.lib Samples\c\import_libs contains the function definitions for dpwin64.dll
dpwin32_coff.obj Samples\c\object_modules static object module
dpwin64.obj Samples\c\object_modules static object module
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 or dpwin64.obj)
The DllTest project uses the dynamic runtime library (e.g. dpwin32.dll or dpwin64.obj).
The solutions have been modified to assume Unicode characters are not the default
(this sample uses ascii characters because that is what the Dinkey dongle SDK requires).
The DllTest solution has been modified to link in the correct library file (dpwin32.lib, dpwin64.lib)
depending on whether the output is 32-bit or 64-bit.
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 (dpwin64.obj) then you should protect
your program. If you are linking to dpwin32.dll (dpwin64.dll) then you need to protect dpwin32.dll
(dpwin64.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 / dpwin64.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 (or 64-bit equivalents), but these should not be used
for release. See readme.txt in samples\c for restrictions concerning the debug module.
Note - If you are using Visual Studio 2012 or higher then you may get the linker error
"LNK2026: module unsafe for SAFESEH image". To stop this please turn off SAFESEH by
going to your project properties > Linker > Advanced and setting
"Image Has Safe Exception Handlers" to "No".
Important Note for Windows Store App Developers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Windows Store Apps (Metro Apps) are not compatible with Lite or Plus dongles because the restrictions
imposed by these applications. However, you can protect these Apps with network dongles (because the
restrictive access is performed by the non-Metro DinkeyServer process). If you do this you will need
to enable the "Private Networks (Client and Server)" Capability in your package manifest.

View File

@@ -0,0 +1,50 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DllTest", "DllTest\DllTest.vcproj", "{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ObjTest", "ObjTest\ObjTest.vcproj", "{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Debug|Any CPU.ActiveCfg = Debug|x64
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Debug|Mixed Platforms.Build.0 = Debug|x64
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Debug|Win32.ActiveCfg = Debug|Win32
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Debug|Win32.Build.0 = Debug|Win32
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Debug|x64.ActiveCfg = Debug|x64
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Debug|x64.Build.0 = Debug|x64
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Release|Any CPU.ActiveCfg = Release|x64
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Release|Mixed Platforms.ActiveCfg = Release|x64
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Release|Mixed Platforms.Build.0 = Release|x64
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Release|Win32.ActiveCfg = Release|Win32
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Release|Win32.Build.0 = Release|Win32
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Release|x64.ActiveCfg = Release|x64
{F0F1232C-ECAB-47CB-97EB-91D0C18316FF}.Release|x64.Build.0 = Release|x64
{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}.Debug|Any CPU.ActiveCfg = Debug|Win32
{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}.Debug|Mixed Platforms.Build.0 = Debug|x64
{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}.Debug|Win32.ActiveCfg = Debug|Win32
{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}.Debug|Win32.Build.0 = Debug|Win32
{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}.Debug|x64.ActiveCfg = Debug|Win32
{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}.Release|Any CPU.ActiveCfg = Release|Win32
{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}.Release|Mixed Platforms.Build.0 = Release|Win32
{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}.Release|Win32.ActiveCfg = Release|Win32
{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}.Release|Win32.Build.0 = Release|Win32
{C4DFF331-8ABF-4EE5-BBDC-B7873E3C1CC1}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,23 @@
dapfTest - Sample code for calling the DinkeyAdd Module in C
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This project is written in Visual Studio 5.0 but will work in more recent
versions of Visual Studio (they will upgrade the Project to the latest version).
For Visual Studio 2008 and higher please use the Visual Studio 2008 sample code.
The main source files in the project are:
dapf.h - the source file contains declarations of our API.
dapftest.c - this is the sample code giving an example on how you can call our API.
It contains 5 functions. Just use which ever functions are most appropriate
and customise in your own way.
Note that the source paths of this project are structured to minimise files. If you
want to move this project the references to these files will probably be no longer valid.
Note - you will not be able to debug your program after the DinkeyAdd Module has been
called. Our strong anti-debug code will cause the debugger to throw an exception.
There are no debug modules for DinkeyAdd so you will have to find other ways of
debugging your code (for example taking out the call altogether).

View File

@@ -0,0 +1,100 @@
# Microsoft Developer Studio Project File - Name="dapfTest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=dapfTest - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "dapfTest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "dapfTest.mak" CFG="dapfTest - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "dapfTest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "dapfTest - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "dapfTest - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "dapfTest - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "dapfTest - Win32 Release"
# Name "dapfTest - Win32 Debug"
# Begin Source File
SOURCE=..\..\dapftest.c
# End Source File
# Begin Source File
SOURCE=.\dapftest.rc
# End Source File
# Begin Source File
SOURCE=..\..\import_libs\DinkeyAdd32.lib
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "dapfTest"=".\dapfTest.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,117 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 252, 328
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Full path of dapf file:",IDC_STATIC,7,15,238,8
EDITTEXT IDC_DAPF_PATH,7,25,238,14,ES_AUTOHSCROLL
PUSHBUTTON "Program Dongle",IDC_PROGRAM_DONGLE,53,56,145,14
PUSHBUTTON "Program Dongle with Modification",
IDC_PROGRAM_DONGLE_MOD,53,84,145,14
PUSHBUTTON "Lock Software",IDC_LOCK_SOFTWARE,53,112,145,14
PUSHBUTTON "Encrypt Shell Data Files",IDC_ENCRYPT_SHELL_DATA_FILES,
53,140,145,14
GROUPBOX "Temporary Software Key",IDC_STATIC,7,170,238,82
LTEXT "Machine ID:",IDC_STATIC,22,189,40,8
EDITTEXT IDC_MACHINEID,91,187,132,14,ES_AUTOHSCROLL
LTEXT "Expiry Date:",IDC_STATIC,22,209,39,8
EDITTEXT IDC_TEMP_EXP_DAY,91,208,18,14,ES_AUTOHSCROLL
LTEXT "/",IDC_STATIC,114,210,8,8
EDITTEXT IDC_TEMP_EXP_MONTH,123,208,18,14,ES_AUTOHSCROLL
LTEXT "/",IDC_STATIC,148,210,8,8
EDITTEXT IDC_TEMP_EXP_YEAR,158,208,28,14,ES_AUTOHSCROLL
PUSHBUTTON "Create Software Key",IDC_CREATE_TEMP_SWKEY,53,230,145,14
GROUPBOX "Demo Software Key",IDC_STATIC,7,260,238,61
LTEXT "Max Days:",IDC_STATIC,22,279,40,8
EDITTEXT IDC_DEMO_MAX_DAYS,91,277,132,14,ES_AUTOHSCROLL
PUSHBUTTON "Create Demo Template",IDC_CREATE_DEMO_SWKEY,53,299,145,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 245
TOPMARGIN, 7
BOTTOMMARGIN, 321
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,18 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by dapftest.rc
//
#define IDD_DIALOG1 101
#define IDC_DAPF_PATH 1000
#define IDC_PROGRAM_DONGLE 1001
#define IDC_PROGRAM_DONGLE_MOD 1002
#define IDC_LOCK_SOFTWARE 1003
#define IDC_ENCRYPT_SHELL_DATA_FILES 1004
#define IDC_MACHINEID 1005
#define IDC_TEMP_EXP_DAY 1006
#define IDC_TEMP_EXP_MONTH 1007
#define IDC_TEMP_EXP_YEAR 1008
#define IDC_CREATE_TEMP_SWKEY 1009
#define IDC_DEMO_MAX_DAYS 1010
#define IDC_CREATE_DEMO_SWKEY 1011
#define IDC_STATIC -1

View File

@@ -0,0 +1,100 @@
# Microsoft Developer Studio Project File - Name="ChangeTest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=ChangeTest - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ChangeTest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ChangeTest.mak" CFG="ChangeTest - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ChangeTest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "ChangeTest - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "ChangeTest - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "ChangeTest - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "ChangeTest - Win32 Release"
# Name "ChangeTest - Win32 Debug"
# Begin Source File
SOURCE=..\..\changetest.c
# End Source File
# Begin Source File
SOURCE=.\ChangeTest.rc
# End Source File
# Begin Source File
SOURCE=..\..\import_libs\DinkeyChange.lib
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "ChangeTest"=".\ChangeTest.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,112 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 215, 358
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "ChangeTest"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Get Dongle Information...",IDC_DONGLEINFO,45,14,119,14
LTEXT "Enter Diagnostic filename:",IDC_STATIC,7,40,201,8
EDITTEXT IDC_DIAG_PATH,7,49,201,14,ES_AUTOHSCROLL
PUSHBUTTON "Write Diagnostics to File",IDC_GETDIAGS,45,68,119,14
LTEXT "Enter short Update Code here:",IDC_STATIC,7,96,201,8
EDITTEXT IDC_UPDATE_CODE_STRING,7,106,201,14,ES_AUTOHSCROLL
PUSHBUTTON "Make Changes",IDC_DO_UPDATE_CODE_STRING,69,125,68,14
LTEXT "Enter path to Update Code file:",IDC_STATIC,7,153,201,8
EDITTEXT IDC_UPDATE_CODE_FILE,7,163,201,14,ES_AUTOHSCROLL
PUSHBUTTON "Make Changes",IDC_DO_UPDATE_CODE_FILE,68,183,68,14
PUSHBUTTON "Restore Dinkey FD Lite",IDC_RESTORE_FD_LITE,45,215,119,14
PUSHBUTTON "Get Machine ID",IDC_GET_MACHINE_ID,7,245,95,14
EDITTEXT IDC_MACHINE_ID,110,245,98,14,ES_UPPERCASE
PUSHBUTTON "Download Temporary Software Key",IDC_GET_TEMP_SWKEY,35,275,139,14
LTEXT "Demo Software Key Product Code:",IDC_STATIC,7,305,201,8
EDITTEXT IDC_SWKEY_PRODCODE,7,314,201,14,ES_AUTOHSCROLL | ES_UPPERCASE
PUSHBUTTON "Download Demo Software Key",IDC_GET_DEMO_SWKEY,35,333,139,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 208
TOPMARGIN, 7
BOTTOMMARGIN, 347
END
END
#endif // APSTUDIO_INVOKED
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""windows.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,29 @@
ChangeTest - sample code to call DinkeyChange.dll in Visual Studio
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This project is written in Visual Studio 5.0 but will work in more recent
versions of Visual Studio (they will upgrade the Project to the latest version).
For Visual Studio 2008 and higher please use the Visual Studio 2008 sample code.
The source files in the project are:
File name Folder Description
changetest.c Samples\c main source code file for C
changetest.h Samples\c contains some useful constants
DinkeyChange.lib Samples\c\import_libs contains the function definitions for DinkeyChange.dll
changetest.rc Samples\c\Visual Studio\DinkeyChange resource for main dialog
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 sample code contains 7 functions. Just use which ever functions are most
appropriate and customise in your own way. The sample code is just a guide.
As none of the parameters are sensitive then there is no need to implement
strong security in calling DinkeyChange.
Note - you will not be able to debug your program after DinkeyChange has been called.
Our strong anti-debug code will cause the debugger to throw an exception. However,
if you do need to debug your code you can use our debug module for DinkeyChange:
DinkeyChangeDebug.dll. So, you can use DinkeyChange.dll for your release build
and DinkeyChangeDebug.dll for your debug build.

View File

@@ -0,0 +1,31 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by ChangeTest.rc
//
#define IDD_DIALOG1 101
#define IDC_DONGLEINFO 1000
#define IDC_UPDATE_CODE_STRING 1001
#define IDC_DO_UPDATE_CODE_STRING 1002
#define IDC_DIAG_PATH 1003
#define IDC_GETDIAGS 1004
#define IDC_UPDATE_CODE_FILE 1005
#define IDC_DO_UPDATE_CODE_FILE 1006
#define IDC_RESTORE_FD_LITE 1007
#define IDC_GET_MACHINE_ID 1008
#define IDC_MACHINE_ID 1009
#define IDC_GET_TEMP_SWKEY 1010
#define IDC_SWKEY_PRODCODE 1011
#define IDC_GET_DEMO_SWKEY 1012
#define IDC_STATIC (-1)
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1013
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,23 @@
drpfTest - Sample code for calling the DinkeyRemote Module in C
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This project is written in Visual Studio 5 but will work in more recent
versions of Visual Studio (they will upgrade the Project to the latest version).
For Visual Studio 2008 and higher please use the Visual Studio 2008 sample code.
The main source files in the project are:
drpf.h - the source file contains declarations of our API.
drpftest.c - this is the sample code giving an example on how you can call our API.
It contains 2 functions. Just use which ever functions are most appropriate
and customise in your own way.
Note that the source paths of this project are structured to minimise files. If you
want to move this project the references to these files will probably be no longer valid.
Note - you will not be able to debug your program after the DinkeyRemote Module has been
called. Our strong anti-debug code will cause the debugger to throw an exception.
There are no debug modules for DinkeyRemote so you will have to find other ways of
debugging your code (for example taking out the call altogether).

View File

@@ -0,0 +1,100 @@
# Microsoft Developer Studio Project File - Name="drpfTest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=drpfTest - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "drpfTest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "drpfTest.mak" CFG="drpfTest - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "drpfTest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "drpfTest - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "drpfTest - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "drpfTest - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "drpfTest - Win32 Release"
# Name "drpfTest - Win32 Debug"
# Begin Source File
SOURCE=..\..\import_libs\DinkeyRemote32.lib
# End Source File
# Begin Source File
SOURCE=..\..\drpftest.c
# End Source File
# Begin Source File
SOURCE=.\drpftest.rc
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "drpfTest"=".\drpfTest.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,100 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 343, 111
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Full path of drpf file:",IDC_STATIC,7,14,329,10
EDITTEXT IDC_DRPF_PATH,7,26,329,14,ES_AUTOHSCROLL
PUSHBUTTON "Generate Update Code",IDC_UPDATE_CODE,90,54,164,14
PUSHBUTTON "Generate Update Code with Modifications",
IDC_UPDATE_CODE_MOD,90,82,164,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 336
TOPMARGIN, 7
BOTTOMMARGIN, 104
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,20 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by drpftest.rc
//
#define IDD_DIALOG1 101
#define IDC_DRPF_PATH 1000
#define IDC_UPDATE_CODE 1001
#define IDC_UPDATE_CODE_MOD 1002
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1003
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,104 @@
# Microsoft Developer Studio Project File - Name="DllTest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=DllTest - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "DllTest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "DllTest.mak" CFG="DllTest - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "DllTest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "DllTest - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "DllTest - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "DllTest - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "DllTest - Win32 Release"
# Name "DllTest - Win32 Debug"
# Begin Source File
SOURCE=..\..\apitest.c
# End Source File
# Begin Source File
SOURCE=..\..\import_libs\dpwin32.lib
# End Source File
# Begin Source File
SOURCE=..\..\dris.h
# End Source File
# Begin Source File
SOURCE=.\readme.txt
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,96 @@
# Microsoft Developer Studio Project File - Name="ObjTest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=ObjTest - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ObjTest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ObjTest.mak" CFG="ObjTest - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ObjTest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "ObjTest - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "ObjTest - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "ObjTest - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "ObjTest - Win32 Release"
# Name "ObjTest - Win32 Debug"
# Begin Source File
SOURCE=..\..\apitest.c
# End Source File
# Begin Source File
SOURCE=..\..\object_modules\dpwin32_coff.obj
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,50 @@
Sample code to call Runtime Modules in Visual Studio
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This project is written in Visual Studio 5.0 but will work in more recent
versions of Visual Studio (they will upgrade the Project to the latest version).
For Visual Studio 2008 and higher please use the Visual Studio 2008 sample code.
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
dpwin32.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_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.

View File

@@ -0,0 +1,41 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "DllTest"=".\DllTest.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "ObjTest"=".\ObjTest.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,823 @@
// !! We strongly recommend that you read the "readme.txt" file for this sample.
// !! It contains important instructions on how to use the sample code
#include <windows.h> // for windows programs
#include <stdio.h> // for sprintf
#include <string.h> // for memset
#include "dris.h" // for DRIS definition
#define MY_SDSN 10101 // !!!! change this value to be the value of your SDSN (demo = 10101)
#define MY_PRODCODE "DEMO" // !!!! change this value to match the Product Code in the dongle
#ifdef _MSC_VER
#pragma warning(disable:4996) // to disable warnings about sprintf etc... means we can use the same source for all compilers
#endif
/* The sample code contains 11 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.
If you are using Dinkey Lite then you can only use 4 functions:
ProtCheck, ProtCheckWithAlg, ProtCheckEnc, ProtCheckWithAlgEnc
*/
// this file contains 10 protection-check functions.
int ProtCheck(void); // a standard protection check
int ProtCheckWithAlg(void); // a protection check & executing an Algorithm
int WriteBytes(void); // a protection check & write data to the dongle
int ReadBytes(void); // a protection check & read data from the dongle
int EncryptUserData(void); // a protection check & encrypting data and then decrypting the data
// these functions are the same as the functions listed above but encrypting all parameters passed to our API
int ProtCheckEnc(void); // a standard protection check
int ProtCheckWithAlgEnc(void); // a protection check & executing an Algorithm
int WriteBytesEnc(void); // a protection check & write data to the dongle
int ReadBytesEnc(void); // a protection check & read data from the dongle
int EncryptUserDataEnc(void); // a protection check & encrypting data and then decrypting the data
// this function displays the current network users
int DisplayNetUsers(DRIS *dris);
// useful routines that are called by our functions - implemented at the end of this file
void random_set(void *buffer, int length);
void DisplayError(int ret_code, int extended_error);
char g_szAppName[] = "test program";
// *************************** WinMain ***************************************
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCmdParam, int nCmdShow) {
// call the function(s) of your choice here
// by default I have chosen a standard protection check
ProtCheck();
return 0;
}
// ************************* 10 protection check functions **********************************
// ************************** ProtCheck ***************************************
int ProtCheck(void) {
DRIS dris;
int ret_code;
// set the DRIS to have random values
random_set(&dris, sizeof(DRIS));
// then set the values we want to use
memcpy(dris.header, "DRIS", 4);
dris.size = sizeof(DRIS);
dris.function = PROTECTION_CHECK; // standard protection check
dris.flags = 0; // no extra flags, but you may want to specify some if you want to start a network user or decrement execs,...
ret_code = DDProtCheck(&dris, NULL);
if (ret_code != 0) {
DisplayError(ret_code, dris.ext_err); // display messages for any errors that have occurred
return ret_code;
}
// later in your code you can check other values in the DRIS...
if (dris.sdsn != MY_SDSN) {
MessageBox(NULL, "Incorrect SDSN! Please modify your source code so that MY_SDSN is set to be your SDSN.", NULL, MB_OK);
return -1;
}
if (strcmp(dris.prodcode, MY_PRODCODE) != 0) {
MessageBox(NULL, "Incorrect Product Code! Please modify your source code so that MY_PRODCODE is set to be the Product Code in the dongle.", NULL, MB_OK);
return -1;
}
// later on in your program you can check the return code again
if (dris.ret_code != 0) {
MessageBox(NULL, "Dinkey Dongle protection error", NULL, MB_OK);
return -1;
}
MessageBox(NULL, "It worked", g_szAppName, MB_OK);
// if you are using a network dongle and you want to list the network users then use this function:
// DisplayNetUsers(&dris);
return 0;
}
// ************************** ProtCheckWithAlg ******************************
// !!!! You should replace this function with the one generated by the
// "generate source code" button in Algorithm tab for DinkeyAdd (if you have specified an algorithm)
// or from DinkeyLook if you are using a Dinkey Lite dongle.
int MyAlgorithm(int a, int b, int c, int d, int e, int f, int g, int h) {
return a + b + c + d + e + f + g + h;
}
// NB for this to work you must program at least "user algorithm" into the dongle
// NB We have used a very simple algorithm here (in the MyAlgorithm function). You must patch this with the
// sample code generated by DinkeyAdd for the algorithm that you are using. For Lite models copy the sample
// code from DinkeyLook
int ProtCheckWithAlg(void) {
DRIS dris;
int ret_code;
// set the DRIS to have random values
random_set(&dris, sizeof(DRIS));
// then set the values we want to use
memcpy(dris.header, "DRIS", 4);
dris.size = sizeof(DRIS);
dris.function = EXECUTE_ALGORITHM; // standard protection check & execute algorithm
dris.flags = 0; // no extra flags, but you may want to specify some if you want to start a network user or decrement execs,...
dris.alg_number = 1; // execute algorithm 1 (you do not need to specify this field if you are only using Lite models).
// you should remove these entries if you are using Dinkey Lite so that algorithm arguments are random
dris.var_a = 1; // sample values
dris.var_b = 2;
dris.var_c = 3;
dris.var_d = 4;
dris.var_e = 5;
dris.var_f = 6;
dris.var_g = 7;
dris.var_h = 8;
ret_code = DDProtCheck(&dris, NULL);
if (ret_code != 0) {
DisplayError(ret_code, dris.ext_err); // display messages for any errors that have occurred
return ret_code;
}
// later in your code you can check other values in the DRIS...
if (dris.sdsn != MY_SDSN) {
MessageBox(NULL, "Incorrect SDSN! Please modify your source code so that MY_SDSN is set to be your SDSN.", NULL, MB_OK);
return -1;
}
// ...later on in your program you can check the return code again
if (dris.ret_code != 0) {
MessageBox(NULL, "Dinkey Dongle protection error", NULL, MB_OK);
return -1;
}
// if you want you can check the algorithm answer - however if algorithm is from your code then best to just use the answer in your code
// !!!! Make sure you have replaced the MyAlgorithm routine with the algorithm you have specified in DinkeyAdd
if (MyAlgorithm(dris.var_a, dris.var_b, dris.var_c, dris.var_d, dris.var_e, dris.var_f, dris.var_g, dris.var_h) != dris.alg_answer) {
MessageBox(NULL, "Dinkey protection error!\nYou have not patched your algorithm in the MyAlgorithm routine", NULL, MB_OK);
return -1;
}
MessageBox(NULL, "It worked", g_szAppName, MB_OK);
return 0;
}
// ************************** WriteBytes ******************************
// This writes the Data "Hello, World" to the dongle data area at offset 7
// In order for this function to work you will need to have a data area in your dongle that is at least 21 bytes long.
int WriteBytes(void) {
DRIS dris;
char szDataToWrite[] = "Hello, World!";
int ret_code;
// set the DRIS to have random values
random_set(&dris, sizeof(DRIS));
// then set the values we want to use
memcpy(dris.header, "DRIS", 4);
dris.size = sizeof(DRIS);
dris.function = WRITE_DATA_AREA; // standard protection check and write data
dris.flags = 0; // no extra flags, but you may want to specify some if you want to start a network user or decrement execs,...
dris.rw_offset = 7;
dris.rw_length = sizeof(szDataToWrite);
dris.rw_data_ptr = szDataToWrite;
ret_code = DDProtCheck(&dris, NULL);
if (ret_code != 0) {
DisplayError(ret_code, dris.ext_err); // display messages for any errors that have occurred
return ret_code;
}
// ...later in your code you can check other values in the DRIS...
if (dris.sdsn != MY_SDSN) {
MessageBox(NULL, "Incorrect SDSN! Please modify your source code so that MY_SDSN is set to be your SDSN.", NULL, MB_OK);
return -1;
}
// later on in your program you can check the return code again
if (dris.ret_code != 0) {
MessageBox(NULL, "Dinkey Dongle protection error", NULL, MB_OK);
return -1;
}
MessageBox(NULL, "It worked", g_szAppName, MB_OK);
return 0;
}
// ************************ ReadBytes ************************************
// This reads 14 bytes of data from offset 7 in the dongle data area
// In order for this function to work you will need to have a data area in your dongle that is at least 21 bytes long.
// In order for the data to be displayed properly by this routine it will need to be text data
int ReadBytes(void) {
DRIS dris;
char szDataRead[14], szBuffer[200];
int ret_code;
// set the DRIS to have random values
random_set(&dris, sizeof(DRIS));
// then set the values we want to use
memcpy(dris.header, "DRIS", 4);
dris.size = sizeof(DRIS);
dris.function = READ_DATA_AREA; // standard protection check & read data
dris.flags = 0; // no extra flags, but you may want to specify some if you want to start a network user or decrement execs,...
dris.rw_offset = 7;
dris.rw_length = sizeof(szDataRead)-1;
dris.rw_data_ptr = szDataRead;
ret_code = DDProtCheck(&dris, NULL);
if (ret_code != 0) {
DisplayError(ret_code, dris.ext_err); // display messages for any errors that have occurred
return ret_code;
}
// ...later in your code you can check other values in the DRIS...
if (dris.sdsn != MY_SDSN) {
MessageBox(NULL, "Incorrect SDSN! Please modify your source code so that MY_SDSN is set to be your SDSN.", NULL, MB_OK);
return -1;
}
// later on in your program you can check the return code again
if (dris.ret_code != 0) {
MessageBox(NULL, "Dinkey Dongle protection error", NULL, MB_OK);
return -1;
}
szDataRead[sizeof(szDataRead)-1] = 0; // null - terminate string so it displays OK. NB we assume that we are reading text that can be displayed
sprintf(szBuffer, "It worked! Dinkey Dongle Data area, offset 7 is: %s", szDataRead);
MessageBox(NULL, szBuffer, g_szAppName, MB_OK);
return 0;
}
// ************************** EncryptUserData ************************************
// This function will do a protection check and ask the dongle to encrypt some data using encryption key 1
// It will then do another protection check & decrypt the data
int EncryptUserData(void) {
DRIS dris;
char szBuffer[100];
char szData[16] = "Hello, World!"; // pad message so it is multiple of 8-bytes long i.e. make array 16 bytes long (improves encryption)
int ret_code;
// set the DRIS to have random values
random_set(&dris, sizeof(DRIS));
// then set the values we want to use
memcpy(dris.header, "DRIS", 4);
dris.size = sizeof(DRIS);
dris.function = ENCRYPT_USER_DATA; // standard protection check & encrypt user data
dris.flags = 0; // no extra flags, but you may want to specify some if you want to start a network user or decrement execs,...
dris.data_crypt_key_num = 1;
dris.rw_length = sizeof(szData);
dris.rw_data_ptr = szData;
ret_code = DDProtCheck(&dris, NULL);
if (ret_code != 0) {
DisplayError(ret_code, dris.ext_err); // display messages for any errors that have occurred
return ret_code;
}
// ... could add code to check other elements of the DRIS, e.g. ret_code, sdsn, ...
// Now decrypt the same data to get the original values
random_set(&dris, sizeof(DRIS));
// then set the values we want to use
memcpy(dris.header, "DRIS", 4);
dris.size = sizeof(DRIS);
dris.function = DECRYPT_USER_DATA; // standard protection check & decrypt user data
dris.flags = 0; // no extra flags, but you may want to specify some if you want to start a network user or decrement execs,...
dris.data_crypt_key_num = 1;
dris.rw_length = sizeof(szData);
dris.rw_data_ptr = szData;
ret_code = DDProtCheck(&dris, NULL);
if (ret_code != 0) {
DisplayError(ret_code, dris.ext_err); // display messages for any errors that have occurred
return ret_code;
}
// ...later in your code you can check other values in the DRIS...
if (dris.sdsn != MY_SDSN) {
MessageBox(NULL, "Incorrect SDSN! Please modify your source code so that MY_SDSN is set to be your SDSN.", NULL, MB_OK);
return -1;
}
// later on in your program you can check the return code again
if (dris.ret_code != 0) {
MessageBox(NULL, "Dinkey Dongle protection error", NULL, MB_OK);
return -1;
}
sprintf(szBuffer, "It worked. Data decrypted is: %s", szData);
MessageBox(NULL, szBuffer, g_szAppName, MB_OK);
return 0;
}
// !!!!!!!!!!! all the functions listed below encrypt all parameters to our API !!!!!!!!!!!!!!!!!!!!!
// In order for them to work properly you need to choose "Encrypt DRIS" and "Encrypt Data passed to API"
// in the Extra Security tab of DinkeyAdd. In this example, for Data Encryption I use the r/w algorithm
// but the code can be modified easily to use the 3 encryption parameters.
// !!!! please overwrite this function with the one generated by DinkeyAdd for R/W Algorithm
int MyRWAlgorithm(int a, int b, int c, int d, int e, int f, int g, int h) {
return a ^ b ^ c ^ d ^ e ^ f;
}
// !!!! please overwrite this function with the one generated by DinkeyAdd
void CryptDRIS(DRIS *dris, unsigned int seed1, unsigned int seed2) {
int i, j, k;
unsigned char bigseed[256], S[256];
unsigned char temp, t;
for (i=0; i<256; i+=8) {
memcpy(bigseed+i, &seed1, 4);
memcpy(bigseed+i+4, &seed2, 4);
}
for (i=0; i<256; i++)
S[i] = i;
for (i=0, j=0; i<256; i++) {
j = (j + S[i] + bigseed[i] + 123) % 256;
temp = S[i];
S[i] = S[j];
S[j] = temp;
}
for (i=0, j=0, k=16; k<(int)sizeof(DRIS); k++) {
i = (i + 1) % 256;
j = (j + S[i] + 212) % 256;
temp = S[i];
S[i] = S[j];
S[j] = temp;
t = (S[i] + S[j] + 97) % 256;
((unsigned char *)dris)[k] ^= S[t];
}
return;
}
// !!!! please overwrite this function with the one generated by DinkeyAdd
void CryptApiData(unsigned char *data, int length, unsigned int seed1, unsigned int seed2, int alg_answer) {
int i, j, k;
unsigned char bigseed[256], S[256];
unsigned char temp, t;
for (i=0; i<256; i+=8) {
memcpy(bigseed+i, &seed1, 4);
memcpy(bigseed+i+4, &seed2, 4);
}
for (i=0; i<256; i++)
S[i] = i;
for (i=0, j=0; i<256; i++) {
j = (j + S[i] + bigseed[i] + (alg_answer & 0xFF)) % 256;
temp = S[i];
S[i] = S[j];
S[j] = temp;
}
for (i=0, j=0, k=0; k<length; k++) {
i = (i + 1) % 256;
j = (j + S[i] + ((alg_answer >> 8) & 0xFF)) % 256;
temp = S[i];
S[i] = S[j];
S[j] = temp;
t = (S[i] + S[j] + ((alg_answer >> 16) & 0xFF)) % 256;
data[k] ^= S[t];
}
return;
}
// **************************** ProtCheckEnc ***************************
// We encrypt the DRIS passed to the API. Patch the CryptDRIS function in this file from source code generated by DinkeyAdd.
// NB if you are using the debug module then do not call CryptDRIS as DRIS encryption is not supported. See notes in C readme.txt
int ProtCheckEnc(void) {
DRIS dris;
int ret_code;
// set the DRIS to have random values
random_set(&dris, sizeof(DRIS)); // NB this also fills seed1, seed2 with random values
// then set the values we want to use
memcpy(dris.header, "DRIS", 4);
dris.size = sizeof(DRIS);
dris.function = PROTECTION_CHECK; // standard protection check
dris.flags = 0; // no extra flags, but you may want to specify some if you want to start a network user or decrement execs,...
CryptDRIS(&dris, dris.seed1, dris.seed2); // encrypt DRIS (!!!!you should separate from DDProtCheck for greater security)
ret_code = DDProtCheck(&dris, NULL);
CryptDRIS(&dris, dris.seed1, dris.seed2); // decrypt DRIS (!!!!you should separate from DDProtCheck for greater security)
if (ret_code != 0) {
DisplayError(ret_code, dris.ext_err); // display messages for any errors that have occurred
return ret_code;
}
// later in your code you can check other values in the DRIS...
if (dris.sdsn != MY_SDSN) {
MessageBox(NULL, "Incorrect SDSN! Please modify your source code so that MY_SDSN is set to be your SDSN.", NULL, MB_OK);
return -1;
}
if (strcmp(dris.prodcode, MY_PRODCODE) != 0) {
MessageBox(NULL, "Incorrect Product Code! Please modify your source code so that MY_PRODCODE is set to be the Product Code in the dongle.", NULL, MB_OK);
return -1;
}
// later on in your program you can check the return code again
if (dris.ret_code != 0) {
MessageBox(NULL, "Dinkey Dongle protection error", NULL, MB_OK);
return -1;
}
MessageBox(NULL, "It worked", g_szAppName, MB_OK);
return 0;
}
// ************************* ProtCheckWithAlgEnc *****************************
// NB for this to work you must program at least "user algorithm" into the dongle
// NB We have used a very simple algorithm here (in the MyAlgorithm function). You must patch this with the
// sample code generated by DinkeyAdd for the algorithm that you are using. For Lite models copy the sample code from DinkeyLook.
// We encrypt the DRIS passed to the API. Patch the CryptDRIS function in this file from source code generated by DinkeyAdd.
int ProtCheckWithAlgEnc(void) {
DRIS dris;
int ret_code;
// set the DRIS to have random values
random_set(&dris, sizeof(DRIS)); // NB this also fills seed1, seed2 with random values
// then set the values we want to use
memcpy(dris.header, "DRIS", 4);
dris.size = sizeof(DRIS);
dris.function = EXECUTE_ALGORITHM; // standard protection check & execute algorithm
dris.flags = 0; // no extra flags, but you may want to specify some if you want to start a network user or decrement execs,...
dris.alg_number = 1; // execute algorithm 1 (you do not need to specify this field if you are only using Lite models).
// you should remove these entries if you are using Dinkey Lite so that algorithm arguments are random
dris.var_a = 1; // sample values
dris.var_b = 2;
dris.var_c = 3;
dris.var_d = 4;
dris.var_e = 5;
dris.var_f = 6;
dris.var_g = 7;
dris.var_h = 8;
CryptDRIS(&dris, dris.seed1, dris.seed2); // encrypt DRIS (!!!!you should separate from DDProtCheck for greater security)
ret_code = DDProtCheck(&dris, NULL);
CryptDRIS(&dris, dris.seed1, dris.seed2); // decrypt DRIS (!!!!you should separate from DDProtCheck for greater security)
if (ret_code != 0) {
DisplayError(ret_code, dris.ext_err); // display messages for any errors that have occurred
return ret_code;
}
// later in your code you can check other values in the DRIS...
if (dris.sdsn != MY_SDSN) {
MessageBox(NULL, "Incorrect SDSN! Please modify your source code so that MY_SDSN is set to be your SDSN.", NULL, MB_OK);
return -1;
}
// ...later on in your program you can check the return code again
if (dris.ret_code != 0) {
MessageBox(NULL, "Dinkey Dongle protection error", NULL, MB_OK);
return -1;
}
// if you want you can check the algorithm answer - however if algorithm is from your code then best to just use the answer in your code
// !!!! Make sure you have replaced the MyAlgorithm routine with the algorithm you have specified in DinkeyAdd
if (MyAlgorithm(dris.var_a, dris.var_b, dris.var_c, dris.var_d, dris.var_e, dris.var_f, dris.var_g, dris.var_h) != dris.alg_answer) {
MessageBox(NULL, "Dinkey protection error!\nYou have not patched your algorithm in the MyAlgorithm routine", NULL, MB_OK);
return -1;
}
MessageBox(NULL, "It worked", g_szAppName, MB_OK);
return 0;
}
// **************************** WriteBytesEnc ********************************
// This writes the Data "Hello, World" to the dongle data area at offset 7
// In order for this function to work you will need to have a data area in your dongle that is at least 21 bytes long.
// We encrypt the DRIS and Data passed to the API. Patch the CryptDRIS and CryptApiData functions in this file from source code generated by DinkeyAdd.
int WriteBytesEnc(void) {
DRIS dris;
char szDataToWrite[] = "Hello, World!";
int ret_code, alg_ans;
// set the DRIS to have random values
random_set(&dris, sizeof(DRIS)); // NB this also fills seed1, seed2, var_a...var_h with random values
// then set the values we want to use
memcpy(dris.header, "DRIS", 4);
dris.size = sizeof(DRIS);
dris.function = WRITE_DATA_AREA; // standard protection check & write data
dris.flags = 0; // no extra flags, but you may want to specify some if you want to start a network user or decrement execs,...
dris.rw_offset = 7;
dris.rw_length = sizeof(szDataToWrite);
dris.rw_data_ptr = szDataToWrite;
// calculate r/w algorithm answer - NB need to replace MyRWAlgorithm code with code for r/w algorithm
alg_ans = MyRWAlgorithm(dris.var_a, dris.var_b, dris.var_c, dris.var_d, dris.var_e, dris.var_f, dris.var_g, dris.var_h);
// encrypt data we want to write.
CryptApiData((BYTE *)szDataToWrite, sizeof(szDataToWrite), dris.seed1, dris.seed2, alg_ans);
CryptDRIS(&dris, dris.seed1, dris.seed2); // encrypt DRIS (!!!!you should separate from DDProtCheck for greater security)
ret_code = DDProtCheck(&dris, NULL);
CryptDRIS(&dris, dris.seed1, dris.seed2); // decrypt DRIS (!!!!you should separate from DDProtCheck for greater security)
if (ret_code != 0) {
DisplayError(ret_code, dris.ext_err); // display messages for any errors that have occurred
return ret_code;
}
// ...later in your code you can check other values in the DRIS...
if (dris.sdsn != MY_SDSN) {
MessageBox(NULL, "Incorrect SDSN! Please modify your source code so that MY_SDSN is set to be your SDSN.", NULL, MB_OK);
return -1;
}
// later on in your program you can check the return code again
if (dris.ret_code != 0) {
MessageBox(NULL, "Dinkey Dongle protection error", NULL, MB_OK);
return -1;
}
MessageBox(NULL, "It worked", g_szAppName, MB_OK);
return 0;
}
// **************************** ReadBytesEnc *********************************
// This reads 14 bytes of data from offset 7 in the dongle data area
// In order for this function to work you will need to have a data area in your dongle that is at least 21 bytes long.
// In order for the data to be displayed properly by this routine it will need to be text data
// We encrypt the DRIS and Data passed from the API. Patch the CryptDRIS and CryptApiData functions in this file from source code generated by DinkeyAdd.
int ReadBytesEnc(void) {
DRIS dris;
char szDataRead[14], szBuffer[200];
int ret_code, alg_ans;
// set the DRIS to have random values
random_set(&dris, sizeof(DRIS)); // NB this also fills seed1, seed2, var_a...var_h with random values
// then set the values we want to use
memcpy(dris.header, "DRIS", 4);
dris.size = sizeof(DRIS);
dris.function = READ_DATA_AREA; // standard protection check & read data
dris.flags = 0; // no extra flags, but you may want to specify some if you want to start a network user or decrement execs,...
dris.rw_offset = 7;
dris.rw_length = sizeof(szDataRead)-1;
dris.rw_data_ptr = szDataRead;
// calculate r/w algorithm answer - NB need to replace MyRWAlgorithm code with code for r/w algorithm
alg_ans = MyRWAlgorithm(dris.var_a, dris.var_b, dris.var_c, dris.var_d, dris.var_e, dris.var_f, dris.var_g, dris.var_h);
CryptDRIS(&dris, dris.seed1, dris.seed2); // encrypt DRIS (!!!!you should separate from DDProtCheck for greater security)
ret_code = DDProtCheck(&dris, NULL);
CryptDRIS(&dris, dris.seed1, dris.seed2); // decrypt DRIS (!!!!you should separate from DDProtCheck for greater security)
if (ret_code != 0) {
DisplayError(ret_code, dris.ext_err); // display messages for any errors that have occurred
return ret_code;
}
// ...later in your code you can check other values in the DRIS...
if (dris.sdsn != MY_SDSN) {
MessageBox(NULL, "Incorrect SDSN! Please modify your source code so that MY_SDSN is set to be your SDSN.", NULL, MB_OK);
return -1;
}
// later on in your program you can check the return code again
if (dris.ret_code != 0) {
MessageBox(NULL, "Dinkey Dongle protection error", NULL, MB_OK);
return -1;
}
// decrypt data that was read.
CryptApiData((BYTE *)szDataRead, sizeof(szDataRead)-1, dris.seed1, dris.seed2, alg_ans);
szDataRead[sizeof(szDataRead)-1] = 0; // null - terminate string so it displays OK. NB we assume that we are reading text that can be displayed
sprintf(szBuffer, "It worked! Dinkey Dongle Data area, offset 7 is: %s", szDataRead);
MessageBox(NULL, szBuffer, g_szAppName, MB_OK);
return 0;
}
// ************************* EncryptUserDataEnc ******************************
// This function will do a protection check and ask the dongle to encrypt some data using encryption key 1
// It will then do another protection & decrypt the data
// We encrypt the DRIS and Data passed to/from the API. Patch the CryptDRIS and CryptApiData functions in this file from source code generated by DinkeyAdd.
int EncryptUserDataEnc(void) {
DRIS dris;
char szBuffer[100];
char szData[16] = "Hello, World!"; // pad message so it is multiple of 8-bytes long i.e. make array 16 bytes long (improves encryption)
int ret_code, alg_ans;
// set the DRIS to have random values
random_set(&dris, sizeof(DRIS));
// then set the values we want to use
memcpy(dris.header, "DRIS", 4);
dris.size = sizeof(DRIS);
dris.function = ENCRYPT_USER_DATA; // standard protection check & encrypt user data
dris.flags = 0; // no extra flags, but you may want to specify some if you want to start a network user or decrement execs,...
dris.data_crypt_key_num = 1;
dris.rw_length = sizeof(szData);
dris.rw_data_ptr = szData;
// calculate r/w algorithm answer - NB need to replace MyRWAlgorithm code with code for r/w algorithm
alg_ans = MyRWAlgorithm(dris.var_a, dris.var_b, dris.var_c, dris.var_d, dris.var_e, dris.var_f, dris.var_g, dris.var_h);
// encrypt data we want to pass.
CryptApiData((BYTE *)szData, sizeof(szData), dris.seed1, dris.seed2, alg_ans);
CryptDRIS(&dris, dris.seed1, dris.seed2); // encrypt DRIS (!!!!you should separate from DDProtCheck for greater security)
ret_code = DDProtCheck(&dris, NULL);
CryptDRIS(&dris, dris.seed1, dris.seed2); // decrypt DRIS (!!!!you should separate from DDProtCheck for greater security)
if (ret_code != 0) {
DisplayError(ret_code, dris.ext_err); // display messages for any errors that have occurred
return ret_code;
}
// ... could add code to check other elements of the DRIS, e.g. ret_code, sdsn, ...
// Now decrypt the same data to get the original values
random_set(&dris, sizeof(DRIS));
// then set the values we want to use
memcpy(dris.header, "DRIS", 4);
dris.size = sizeof(DRIS);
dris.function = DECRYPT_USER_DATA; // standard protection check & decrypt user data
dris.flags = 0; // no extra flags, but you may want to specify some if you want to start a network user or decrement execs,...
dris.data_crypt_key_num = 1;
dris.rw_length = sizeof(szData);
dris.rw_data_ptr = szData;
CryptDRIS(&dris, dris.seed1, dris.seed2); // encrypt DRIS (!!!!you should separate from DDProtCheck for greater security)
ret_code = DDProtCheck(&dris, NULL);
CryptDRIS(&dris, dris.seed1, dris.seed2); // decrypt DRIS (!!!!you should separate from DDProtCheck for greater security)
// ...later in your code you can check other values in the DRIS...
if (ret_code != 0) {
DisplayError(ret_code, dris.ext_err); // display messages for any errors that have occurred
return ret_code;
}
if (dris.sdsn != MY_SDSN) {
MessageBox(NULL, "Incorrect SDSN! Please modify your source code so that MY_SDSN is set to be your SDSN.", NULL, MB_OK);
return -1;
}
// later on in your program you can check the return code again
if (dris.ret_code != 0) {
MessageBox(NULL, "Dinkey Dongle protection error", NULL, MB_OK);
return -1;
}
alg_ans = MyRWAlgorithm(dris.var_a, dris.var_b, dris.var_c, dris.var_d, dris.var_e, dris.var_f, dris.var_g, dris.var_h);
// decrypt data that was passed to us by the API
CryptApiData((BYTE *)szData, sizeof(szData), dris.seed1, dris.seed2, alg_ans);
sprintf(szBuffer, "It worked. Data decrypted is: %s", szData);
MessageBox(NULL, szBuffer, g_szAppName, MB_OK);
return 0;
}
// ********************* DisplayNetUsers ***********************
// This function displays the current network users (for DinkeyNet only).
// The DDProtCheck function must be called before this function is called.
// (Normally you would use DinkeyServer to view the network users but this enables you to do it from the client if you want)
char net_user_display_msg[] = "%d. licence: %s, user: %s, computer: %s, ipaddress: %s\n";
#define MAX_MESSAGE_SIZE (sizeof(NU_INFO) + sizeof(net_user_display_msg))
// !!!! NB You should check for errors when dynamic allocating memory
int DisplayNetUsers(DRIS *dris) {
int ret_code, extended_error, max_net_users, num_net_users, i;
char szBuffer[MAX_MESSAGE_SIZE];
char *szMsg;
NU_INFO *nu_info;
if (dris->net_users == -1)
max_net_users = 100; // if unlimited network users are allowed then display up to 100 users (for example)
else
max_net_users = dris->net_users;
if (max_net_users == 0) // no network users are allowed, so nothing to do!
return 0;
if (dris->model < 3) {
MessageBox(NULL, "A network dongle has not been detected. Therefore you cannot display the network users.", "Net Users", MB_OK);
return -1;
}
// allocate memory for array of network user information structures and also to display the message to users
nu_info = (NU_INFO *)malloc(sizeof(NU_INFO) * max_net_users);
szMsg = (char *)malloc(MAX_MESSAGE_SIZE * max_net_users);
// get network user information
ret_code = DDGetNetUserList(NULL, &num_net_users, nu_info, max_net_users, &extended_error);
if (ret_code != 0) {
sprintf(szMsg, "Error %d/%d finding network user information.", ret_code, extended_error);
MessageBox(NULL, szMsg, "Net Users", MB_OK);
}
else {
sprintf(szMsg, "number of net users: %d\n", num_net_users);
for (i=0; i<num_net_users; i++) {
sprintf(szBuffer, net_user_display_msg, i+1, nu_info[i].licenceName, nu_info[i].userName, nu_info[i].computerName, nu_info[i].ipAddress);
strcat(szMsg, szBuffer);
}
MessageBox(NULL, szMsg, "Net Users", MB_OK);
}
free(szMsg);
free(nu_info);
return ret_code;
}
// ************* useful routines that are called from our functions **********
// fills the buffer with length bytes of random data
// NB there are better ways of doing this (for example with the Windows Crypto API calls)
void random_set(void *buffer, int length) {
int i;
srand(GetTickCount());
for (i=0; i<length; i++)
((unsigned char *)buffer)[i] = (unsigned char)rand();
return;
}
// displays messages for the most common errors. You will want to change this for your code
void DisplayError(int ret_code, int extended_error) {
char szBuffer[200];
switch (ret_code) {
case 401:
MessageBox(NULL, "Error! No dongles detected!", g_szAppName, MB_OK);
break;
case 403:
MessageBox(NULL, "Error! The dongle detected has a different type to the one specified in DinkeyAdd.", g_szAppName, MB_OK);
break;
case 404:
MessageBox(NULL, "Error! The dongle detected has a different model to those specified in DinkeyAdd.", g_szAppName, MB_OK);
break;
case 409:
MessageBox(NULL, "Error! The dongle detected has not been programmed by DinkeyAdd.", g_szAppName, MB_OK);
break;
case 410:
MessageBox(NULL, "Error! The dongle detected has a different Product Code to the one specified in DinkeyAdd.", g_szAppName, MB_OK);
break;
case 411:
MessageBox(NULL, "Error! The dongle detected does not contain the licence associated with this program.", g_szAppName, MB_OK);
break;
case 413:
MessageBox(NULL, "Error! This program has not been protected by DinkeyAdd. For guidance please read the DinkeyAdd chapter of the Dinkey manual.", g_szAppName, MB_OK);
break;
case 417:
MessageBox(NULL, "Error! One or more of the parameters set in the DRIS is incorrect. This could be caused if you are encrypting the DRIS in your code but did not specify DRIS encryption in DinkeyAdd - or vice versa.", g_szAppName, MB_OK);
break;
case 423:
MessageBox(NULL, "Error! The number of network users has been exceeded.", g_szAppName, MB_OK);
break;
case 435:
MessageBox(NULL, "Error! DinkeyServer has not been detected on the network.", g_szAppName, MB_OK);
break;
case 922:
MessageBox(NULL, "Error! The Software Key has expired.", g_szAppName, MB_OK);
break;
default:
sprintf(szBuffer, "An error occurred checking the dongle.\nError: %d, Extended Error: %d", ret_code, extended_error);
MessageBox(NULL, szBuffer, g_szAppName, MB_OK);
break;
}
return;
}

View File

@@ -0,0 +1,306 @@
// ChangeTest
// Sample code for calling DinkeyChange.Dll
#include <windows.h>
#include <stdio.h>
#include "Visual Studio 5\DinkeyChange\resource.h"
#include "ChangeTest.h"
#ifdef _MSC_VER
#pragma warning(disable:4996) // to disable warnings about sprintf etc... means we can use the same source for all compilers
#endif
char g_szAppName[] = "ChangeTest";
void DisplayError(int ret_code, int extended_error);
// routine for main dialog box
BOOL CALLBACK MainDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
int ret_code, i, num_found, confirmation_code, extended_error;
char szType[4], szModel[5];
char szDisplayMsg[12800], szBuffer[257], szProdCode[9];
// these are the arrays that are filled-in by DCGetInfo
int type[MAX_USB_DEVICES];
int model[MAX_USB_DEVICES];
char prodcode[MAX_USB_DEVICES][MAX_PRODCODE_LEN];
unsigned int dongle_number[MAX_USB_DEVICES];
int update_number[MAX_USB_DEVICES];
unsigned int machineID;
switch (message)
{
case WM_INITDIALOG:
// nothing to do
break;
case WM_COMMAND:
// *** Get Dongle Information button clicked ***
if (LOWORD(wParam) == IDC_DONGLEINFO && HIWORD(wParam) == BN_CLICKED) {
// find dongle information for all dongle types, Plus & Net models, for all product codes
// NB In practice you will probably want to set the prodcode_mask to the value of your product code
ret_code = DCGetInfo(TYPE_MASK_ALL, MODEL_MASK_DEFAULT, NULL, MAX_USB_DEVICES, &num_found, type, model, prodcode, dongle_number, update_number);
// check error code and display error if an error occurs
if (ret_code == 401) {
MessageBox(hwnd, "No dongles detected matching the search criteria specified", g_szAppName, MB_OK);
return 0;
}
else if (ret_code != 0) {
sprintf(szDisplayMsg, "Error %d getting dongle information", ret_code);
MessageBox(hwnd, szDisplayMsg, g_szAppName, MB_OK);
return 0;
}
// display info from dongle(s) detected
szDisplayMsg[0] = 0; // null string
for (i=0; i<num_found; i++) {
// get type of dongle
if (type[i] == TYPE_PRO)
strcpy(szType, "Pro");
else
strcpy(szType, "FD");
// get model of dongle
if (model[i] == MODEL_LITE)
strcpy(szModel, "Lite");
else if (model[i] == MODEL_PLUS)
strcpy(szModel, "Plus");
else
strcpy(szModel, "Net");
sprintf(szBuffer, "%d. Dinkey %s %s with dongle number: %u, product code: %s, update number: %d\n",
i+1, szType, szModel, dongle_number[i], prodcode[i], update_number[i]);
strcat(szDisplayMsg, szBuffer);
}
MessageBox(hwnd, szDisplayMsg, "Dongle Information", MB_OK);
}
// *** Write Dongle Diagnostics to file ***
if (LOWORD(wParam) == IDC_GETDIAGS && HIWORD(wParam) == BN_CLICKED) {
GetDlgItemText(hwnd, IDC_DIAG_PATH, szBuffer, sizeof(szBuffer));
// NB this could take a while if the data area is very large
ret_code = DCGetDiagnosticInfo(szBuffer);
// check error code and display error if an error occurs
if (ret_code == 754) {
sprintf(szDisplayMsg, "Could not create the diagnostic file. Please check that the path exists: %s", szBuffer);
MessageBox(hwnd, szDisplayMsg, g_szAppName, MB_OK);
return 0;
}
else if (ret_code != 0) {
sprintf(szDisplayMsg, "Error %d writing diagnostic information", ret_code);
MessageBox(hwnd, szDisplayMsg, g_szAppName, MB_OK);
return 0;
}
// display success
MessageBox(hwnd, "Diagnostic file written successfully.", g_szAppName, MB_OK);
}
// *** Make Changes button clicked for Short Codes ***
if (LOWORD(wParam) == IDC_DO_UPDATE_CODE_STRING && HIWORD(wParam) == BN_CLICKED) {
GetDlgItemText(hwnd, IDC_UPDATE_CODE_STRING, szBuffer, sizeof(szBuffer));
// make changes.
ret_code = DCDoUpdateCodeString(szBuffer, &confirmation_code, &extended_error);
// check error code and display error if an error occurs
if (ret_code != 0) {
DisplayError(ret_code, extended_error);
return 0;
}
sprintf(szDisplayMsg, "Dongle updated successfully!\nConfirmation code is : %.4x", confirmation_code);
MessageBox(hwnd, szDisplayMsg, g_szAppName, MB_OK);
}
// *** Make Changes button clicked for file ***
if (LOWORD(wParam) == IDC_DO_UPDATE_CODE_FILE && HIWORD(wParam) == BN_CLICKED) {
GetDlgItemText(hwnd, IDC_UPDATE_CODE_FILE, szBuffer, sizeof(szBuffer));
// make changes.
ret_code = DCDoUpdateCodeFromFile(szBuffer, &confirmation_code, &extended_error);
// check error code and display error if an error occurs
if (ret_code != 0) {
DisplayError(ret_code, extended_error);
return 0;
}
sprintf(szDisplayMsg, "Dongle updated successfully!\nConfirmation code is : %.4x", confirmation_code);
MessageBox(hwnd, szDisplayMsg, g_szAppName, MB_OK);
}
// *** Restore Dinkey FD Lite ***
if (LOWORD(wParam) == IDC_RESTORE_FD_LITE && HIWORD(wParam) == BN_CLICKED) {
ret_code = DCRestoreDinkeyFDLite();
// check error code and display error if an error occurs
if (ret_code != 0) {
DisplayError(ret_code, 0);
return 0;
}
MessageBox(hwnd, "Dinkey FD Lite restored successfully.", g_szAppName, MB_OK);
}
// *** Get Machine ID ***
if (LOWORD(wParam) == IDC_GET_MACHINE_ID && HIWORD(wParam) == BN_CLICKED) {
ret_code = DCGetMachineID(&machineID, &extended_error);
// check error code and display error if an error occurs
if (ret_code != 0) {
DisplayError(ret_code, extended_error);
return 0;
}
// don't display a success message just display the machineID
sprintf(szBuffer, "%.8X", machineID);
SetDlgItemText(hwnd, IDC_MACHINE_ID, szBuffer);
}
// *** Download Temporary Software Key ***
if (LOWORD(wParam) == IDC_GET_TEMP_SWKEY && HIWORD(wParam) == BN_CLICKED) {
// first get the machine ID...
ret_code = DCGetMachineID(&machineID, &extended_error);
// check error code and display error if an error occurs
if (ret_code != 0) {
DisplayError(ret_code, extended_error);
return 0;
}
// ... and then try to download the temporary software key
ret_code = DCDownloadTempSoftwareKey(machineID, &extended_error);
// check error code and display error if an error occurs
if (ret_code != 0) {
DisplayError(ret_code, extended_error);
return 0;
}
MessageBox(hwnd, "Temporary Software Key downloaded successfully.", g_szAppName, MB_OK);
}
// *** Download Demo Software Key ***
if (LOWORD(wParam) == IDC_GET_DEMO_SWKEY && HIWORD(wParam) == BN_CLICKED) {
GetDlgItemText(hwnd, IDC_SWKEY_PRODCODE, szProdCode, sizeof(szProdCode));
// get the machine ID
ret_code = DCGetMachineID(&machineID, &extended_error);
// check error code and display error if an error occurs
if (ret_code != 0) {
DisplayError(ret_code, extended_error);
return 0;
}
// try to download the demo software key
// (NB we are assuming only one dongle model is set in the Demo Software Template.
// If multiple models are set you will also need to specify the exact model)
ret_code = DCDownloadDemoSoftwareKey(machineID, szProdCode, SWKEY_MODEL_DEFAULT, &extended_error);
// check error code and display error if an error occurs
if (ret_code != 0) {
DisplayError(ret_code, extended_error);
return 0;
}
MessageBox(hwnd, "Demo Software Key downloaded successfully.", g_szAppName, MB_OK);
}
break;
case WM_CLOSE:
EndDialog(hwnd, TRUE);
return TRUE;
}
return FALSE;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow ) {
// display dialog allow user to enter code
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)MainDlgProc); // display main screen
return 0;
}
// displays messages for the most common errors. You will want to change this for your code
void DisplayError(int ret_code, int extended_error) {
char szBuffer[200];
switch (ret_code) {
case 401:
MessageBox(NULL, "Error! No dongles detected that meet the search criteria!", g_szAppName, MB_OK);
break;
case 409:
MessageBox(NULL, "Error! The dongle detected has not been programmed by DinkeyAdd.", g_szAppName, MB_OK);
break;
case 758:
MessageBox(NULL, "Error! Cannot open the Update Code file specified.", g_szAppName, MB_OK);
break;
case 759:
MessageBox(NULL, "Error! The file specified is not a valid Update Code file.", g_szAppName, MB_OK);
break;
case 762:
case 763:
case 764:
MessageBox(NULL, "Error! Update Code is not in a correct format / update code file is corrupt.", g_szAppName, MB_OK);
break;
case 765:
MessageBox(NULL, "Error! The Update Code does not match any dongle attached to your machine.", g_szAppName, MB_OK);
break;
case 766:
MessageBox(NULL, "Error! The update number for this Update Code is too high. You need to first enter an update code that was previously sent to you.", g_szAppName, MB_OK);
break;
case 767:
MessageBox(NULL, "Error! You have already entered this Update Code.", g_szAppName, MB_OK);
break;
case 1905:
MessageBox(NULL, "Error! There is no Software Key available for download.", g_szAppName, MB_OK);
break;
case 1907:
MessageBox(NULL, "Error! The Temporary Software Key has expired. Cannot download it.", g_szAppName, MB_OK);
break;
case 1910:
MessageBox(NULL, "Error! The Software Key has already been downloaded.", g_szAppName, MB_OK);
break;
case 1921:
MessageBox(NULL, "Error! You specified the 'default model' but there is more than one model available. You need to specify a specific dongle model.", g_szAppName, MB_OK);
break;
case 1922:
MessageBox(NULL, "Error! The model you requested is not available.", g_szAppName, MB_OK);
break;
case 1923:
MessageBox(NULL, "Error! The Demo Software Key Template has been disabled.", g_szAppName, MB_OK);
break;
case 1924:
MessageBox(NULL, "Error! You have run out of Demo Software Key activations. You need to order some more.", g_szAppName, MB_OK);
break;
default:
sprintf(szBuffer, "An error occurred.\nError: %d, Extended Error: %d", ret_code, extended_error);
MessageBox(NULL, szBuffer, g_szAppName, MB_OK);
break;
}
return;
}

View File

@@ -0,0 +1,54 @@
// DinkeyChange constants
// !! this file should not be modified
// maximum number of USB devices that can be attached to a machine at any time
#define MAX_USB_DEVICES 128
#define MAX_PRODCODE_LEN 9
// mask values
#define TYPE_MASK_PRO 1
#define TYPE_MASK_FD 2
#define TYPE_MASK_ALL (TYPE_MASK_PRO | TYPE_MASK_FD)
#define MODEL_MASK_LITE 1
#define MODEL_MASK_PLUS 2
#define MODEL_MASK_NET 4
#define MODEL_MASK_ALL (MODEL_MASK_LITE | MODEL_MASK_PLUS | MODEL_MASK_NET)
#define MODEL_MASK_DEFAULT (MODEL_MASK_PLUS | MODEL_MASK_NET)
// type values for DCGetInfo (returned in the array)
#define TYPE_PRO 1
#define TYPE_FD 2
// model values for DCGetInfo (returned in the array)
#define MODEL_LITE 1
#define MODEL_PLUS 2
#define MODEL_NET5 4
#define MODEL_NETU 7
// model values for DCDownloadDemoSoftwareKey
#define SWKEY_MODEL_DEFAULT -1 // NB this assumes that the Demo Software Key Template was created with only one valid dongle model
#define SWKEY_MODEL_PRO_LITE 0
#define SWKEY_MODEL_PRO_PLUS 1
#define SWKEY_MODEL_PRO_NET 2
#define SWKEY_MODEL_FD_LITE 3
#define SWKEY_MODEL_FD_PLUS 4
#define SWKEY_MODEL_FD_NET 5
// DinkeyChange module API declarations
#ifdef __cplusplus
extern "C" {
#endif
int WINAPI DCGetInfo(IN int type_mask, IN int model_mask, IN char *prodcode_mask, IN int array_length, OUT int *num_found, OUT int *type, OUT int *model, OUT char (*prodcode)[MAX_PRODCODE_LEN], OUT unsigned int *dongle_number, OUT int *update_number);
int WINAPI DCGetDiagnosticInfo(IN char *filename);
int WINAPI DCDoUpdateCodeString(IN char* UpdateCodeAscii, OUT int *confirmation_code, OUT int *ext_err);
int WINAPI DCDoUpdateCodeFromFile(IN char* filename, OUT int *confirmation_code, OUT int *ext_err);
int WINAPI DCRestoreDinkeyFDLite(void);
int WINAPI DCGetMachineID(unsigned int *machineID, int *ext_err);
int WINAPI DCDownloadTempSoftwareKey(unsigned int machineID, int *ext_err);
int WINAPI DCDownloadDemoSoftwareKey(unsigned int machineID, char *szProdCode, int model, int *ext_err);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,176 @@
// dapf.h
// !! this file should not be modified
// NB DAPF file is:
// DINKEYINFO
// LICENCEINFO (however many are needed)
// FILEINFO (however many are needed)
// ALGORITHM (however many are needed)
// DATAFILEENC (however many are needed)
#pragma pack (push,1) // so it is byte-aligned
typedef struct DINKEYINFO {
char Header[4]; // Should be set to "DAPF" ( = DinkeyAdd Parameter File)
int Version; // version of this structure. Currently 9.
int SelectedModels; // BIT0 = Dinkey Pro Lite, BIT1 = Dinkey Pro Plus, BIT2 = Dinkey Pro Net etc...
char ProdCode[12];
int PerLicence; // 1 = per licence, 0 = per product (default)
int MaxNetUsers; // product net users, unlimited = -1, no entry = -2
int RangeSettings; // 0 = any number, 1 = dongle in computer, 2 = range
unsigned int RangeMin;
unsigned int RangeMax;
int NumLicences; // number of LICENCEINFO structures in this DAPF file
int NumProgs; // number of FILEINFO structures in this DAPF file
int NumAlgs; // number of ALGORITHM structures in this DAPF file
int DataSizeType; // 1 = set the zero data size, 0 = use file to initialise data area
int ZeroDataSize; // size of the data area area in bytes
char DataFile[256]; // path to data file (0 = no data file)
int DataAreaSize; // file size in bytes, -1 = file not found
char szShellMsgs[10][256]; // success, no dongle, expirydate, expiryexecs, warndate, warnexecs, net user limit, other error, background
char RWAlgorithm[12]; // coded form of rw algorithm (0 = no algorithm)
int SecOptions; // BIT0: DRIS encryption, BIT1: Data encryption, BIT2: Data enc with alg, BIT3: only secure update codes
unsigned char SecDRISEncKey[4]; // DRIS encryption parameters (last byte ignored)
unsigned char SecDataEncKey[4]; // API Data encryption parameters (last byte ignored)
int ProtectionType; // 0 = software + dongle, 1 = dongle only, 2 = program only
char DataEncKeyProdCode[12]; // Alternative Product Code used to generate internal encryption keys. Normally set to 0.
char Notes[256]; // user-defined notes
int LockDongle; // 0 = don't lock (default), 1 = lock dongle to user's computer
int Reserved1; // must be 0
int Reserved2; // must be 0
unsigned int AdvancedOptions; // BIT0 = do not allow usb-over-network for non-Net dongles, BIT1 = do not check for Software Key at Runtime.
int NumDataFileEnc; // Number of data files in our encryption list
} DINKEYINFO;
typedef struct LICENCEINFO {
char LicenceName[256]; // name of licence
int MaxDays; // -1 = no limit
int ExpiryDay; // -1 = no limit
int ExpiryMonth;
int ExpiryYear;
int Execs; // -1 = no limit
int ExecsWarn; // 0 = no warning (just for Shell method)
int DaysWarn; // 0 = no warning (just for Shell method)
unsigned int Features;
int LicenceNetUsers; // unlimited = -1 (-2 = not needed (this is for display only))
} LICENCEINFO;
typedef struct FILEINFO {
char InputName[256];
char OutputName[256];
char CallingProg[256]; // calling program name
int LicenceIndex; // index (of licence) in the LicenceInfo structure (1-based index. 0 = no selection)
int Method; // 0-api, 1-shell, 2-shell & api
int ShellFlags; // same bit flag values as in dris. i.e. 1 = DEC_ONE_EXEC, 4 = START_NET_USER
int BackGround; // 0=no background, 1=1min, 2=5min, 3=10min, 4=30min, 5=60min
int OtherShellOptions; // BIT0 = Shell Data Encryption is enabled, BIT1: Extra Anti-Debug is disabled, BIT2: Extra Anti-Piracy is disabled
char EncFileList[256]; // files (or file types) that the Shell-protected program will treat as encrypted (separated by ':')
char ExceptList[256]; // files (or file types) that are exceptions to the above list (separated by ':')
int ExtraAntiPiracy; // 0 = off, 1=min, 10=max
} FILEINFO;
typedef struct ALGORITHM {
unsigned char Algorithm[12];
} ALGORITHM;
typedef struct DATAFILEENC {
char InputName[256]; // file name, wild cards are allowed
char OutputName[256]; // file name (or folder name if input is a wildcard)
} DATAFILEENC;
typedef struct TEMP_SWKEY_INFO {
int size; // size of this structure (must be initialised)
unsigned int machineID; // machine ID in (hex) integer form
int expiry_day; // expiry date of the Software Key
int expiry_month;
int expiry_year;
int dongle_model; // model of the Software Key. See constant values below
unsigned int dongle_number; // dongle number of the Software Key. 0 = default (random)
} TEMP_SWKEY_INFO;
typedef struct DEMO_SWKEY_INFO {
int size; // size of this structure (must be initialised)
int max_days; // max days demo swkey installation is valid (0-60)
int models; // bitmap of valid dongle models. See constant values below. 0 = default (only use if only one model is selected in DINKEYINFO)
} DEMO_SWKEY_INFO;
typedef void *DAPF_HANDLE; // for DinkeyAdd Module API functions
#pragma pack (pop)
// constants
#define DAPF_VERSION 9 // current DAPF version
// WriteDAPF API flags
#define FLAGS_LOSE_FEATURES 1 // means that you can save the DAPF file to an earlier version even if it means losing some new features that have been currently set
// AddProtection API action values
#define ACTION_USE_DAPF_SETTINGS 0 // means you just ignore the action value and use the default dapf settings
#define ACTION_PROGRAM_DONGLE 1 // program the dongle only
#define ACTION_PROTECT_SOFTWARE 2 // protect a software file (index indicated by separate parameter)
#define ACTION_PROGRAM_AND_PROTECT 3 // program the dongle and protect software
// AddProtection API flags values
#define FLAGS_OVERWRITE_OUTPUT 1 // overwrite the output file if it already exists (default is to give an error)
// SoftwareKey API flags
#define FLAGS_OVERWRITE_SWKEY 1 // overwrite an existing swkey with the new one
#define FLAGS_EXPIRY_DONTCARE 2 // create the Software Key even though the expiry date (or max days) is less than the expiry date of the key itself.
// constants for dapf_format in ReadDAPFEx and WriteDAPFEx functions
#define DAPF_FORMAT_BINARY 1
#define DAPF_FORMAT_JSON 2
#define DAPF_FORMAT_JSON_MIN 3 // this value is only used with WriteDAPEx. ReadDAPFEx cannot return this value.
// constants for values for dongle_model in the TEMP_SWKEY_INFO structure
#define SWKEY_MODEL_PRO_LITE 0
#define SWKEY_MODEL_PRO_PLUS 1
#define SWKEY_MODEL_PRO_NET 2
#define SWKEY_MODEL_FD_LITE 3
#define SWKEY_MODEL_FD_PLUS 4
#define SWKEY_MODEL_FD_NET 5
// constants for models bitmap in the DEMO_SWKEY_INFO structure
#define SWKEY_BITMAP_DEFAULT 0 // use default value set in DINKEYINFO.SelectedModels
#define SWKEY_BITMAP_PRO_LITE 1 // BIT0
#define SWKEY_BITMAP_PRO_PLUS 2 // BIT1
#define SWKEY_BITMAP_PRO_NET 4 // BIT2
#define SWKEY_BITMAP_FD_LITE 8 // BIT3
#define SWKEY_BITMAP_FD_PLUS 16 // BIT4
#define SWKEY_BITMAP_FD_NET 32 // BIT5
#define MAX_LICENCES 255 // max number of licences in a DAPF file
#define MAX_FILE_INFO 255 // theoretically unlimited but in practice it is easier if we limit it
#define MAX_USER_ALGS 20 // max number of user algs in DAPF file
#define MAX_DATA_ENCS 255 // max number of Shell data encryption files in DAPF file
// DinkeyAdd module API declarations
#ifdef __cplusplus
extern "C" {
#endif
int WINAPI ReadDAPFEx(char *szFileDAPF, DINKEYINFO *pDinkeyInfo, LICENCEINFO *pLicenceInfo, FILEINFO *pFileInfo, ALGORITHM *pAlgorithms, DATAFILEENC *pDataFileEnc, int *dapf_version, int *dapf_format);
DAPF_HANDLE WINAPI LoadDAPF(DINKEYINFO *pDinkeyInfo, LICENCEINFO *pLicenceInfo, FILEINFO *pFileInfo, ALGORITHM *pAlgorithms, DATAFILEENC *pDataFileEnc, int *err_code);
DAPF_HANDLE WINAPI LoadDAPFFromFile(char *szFileDAPF, int *err_code);
int WINAPI WriteDAPFEx(DAPF_HANDLE handle, char *szFileDAPF, int dapf_format, int dapf_version, int flags);
void WINAPI UnloadDAPF(DAPF_HANDLE *handle);
int WINAPI AddProtection(DAPF_HANDLE handle, int action, int file_num, int flags, unsigned int *dongle_number);
int WINAPI CreateTempSoftwareKey(DAPF_HANDLE handle, TEMP_SWKEY_INFO *swkey_info, int flags);
int WINAPI CreateDemoSoftwareKeyTemplate(DAPF_HANDLE handle, DEMO_SWKEY_INFO *swkey_info, int flags);
int WINAPI EncryptShellDataFiles(DAPF_HANDLE handle, int file_num, int flags);
void WINAPI GetLastMessage(char *szMessage, int buffer_size, int *message_length);
int WINAPI GetLastExtendedError(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,330 @@
// dapfTest
// Sample code for calling DinkeyAdd module
// The sample code contains 5 functions. You will not need to use all these functions in your code.
// Just use which ever are most appropriate and customise in your own way. The sample code
// is just a guide.
// There are two methods to loading a DAPF file. These are shown in the first two functions:
// DoProgramDongle (simple) and DoProgramDonglewithMod (more complex)
// DoProgramDongle: we load the DAPF file from disk and get a handle and use it "as is" using the API
// call LoadDAPFFromFile. You can make some limited changes to overwrite the default
// behaviour by using API flags.
// DoProgramDonglewithMod: we load the DAPF file from disk and load into structures. We can then modify the
// DAPF settings by modifying this structure. This method uses the API calls
// ReadDAPFEx and LoadDAPF.
// The other functions use the first method (as it is simpler) but you can use the second method instead if
// you prefer.
// Note - an alternative to using the DoProgramDongleWithMod technique is to modify the DAPF file on disk
// and then use the DoProgramDongle technique. To modify a binary DAPF you would use the binary structures
// that are defined in dapf.h. To modify JSON DAPF you would need to use a JSON parser. In the case of
// C/C++ we think it is easier to use the DoProgramDongleWithMod technique.
// DoLockSoftware: locks software (protect it) to a dongle as specified by the DAPF file.
// DoEncryptShellData: encrypts the shell data files specified in the DAPF file (this is used with encrypting
// data file if you use the Shell Method with "Data File Encryption" enabled).
// DoCreateTempSoftwareKey: creates a Temporary Software Key based on the DAPF file and settings the user has entered.
// DoCreateDemoSoftwareTemplate: creates a Demo Software Key Template based on the DAPF file and settings the user has entered
#include <windows.h>
#include <stdio.h>
#include "Visual Studio 5\DinkeyAdd\resource.h"
#include "dapf.h"
#ifdef _MSC_VER
#pragma warning(disable:4996) // to disable warnings about sprintf etc... means we can use the same source for all compilers
#endif
char g_szAppName[] = "dapfTest";
void DisplayLastMessage(void); // gets & displays the message from the DinkeyAdd Module
// load a DAPF file from disk and program the dongle as specified by the DAPF file
int DoProgramDongle(char *szFileDAPF) {
DAPF_HANDLE dapfHandle;
int err_code;
unsigned int dongle_number;
// load DAPF from File into memory
dapfHandle = LoadDAPFFromFile(szFileDAPF, &err_code);
if (dapfHandle == NULL) {
DisplayLastMessage();
return err_code;
}
// program dongle as specified by the DAPF file
err_code = AddProtection(dapfHandle, ACTION_PROGRAM_DONGLE, 0, 0, &dongle_number);
// Unload DAPF from memory
UnloadDAPF(&dapfHandle);
// display message (error or success)
DisplayLastMessage();
return err_code;
}
// load a DAPF file from disk, modify it in memory and then program the dongle
int DoProgramDongleWithMod(char *szFileDAPF) {
DAPF_HANDLE dapfHandle;
int dummy1, dummy2, err_code;
unsigned int dongle_number;
DINKEYINFO DinkeyInfo;
LICENCEINFO LicenceInfo[MAX_LICENCES];
FILEINFO FileInfo[10];
ALGORITHM Algorithms[MAX_USER_ALGS];
DATAFILEENC DataFileEnc[MAX_DATA_ENCS];
// in this case we need to read the DAPF into our structures, so that the DAPF values can be modified
err_code = ReadDAPFEx(szFileDAPF, &DinkeyInfo, (LICENCEINFO *)&LicenceInfo, (FILEINFO *)&FileInfo, (ALGORITHM *)&Algorithms, (DATAFILEENC *)&DataFileEnc, &dummy1, &dummy2);
if (err_code != 0) {
DisplayLastMessage();
return err_code;
}
// patch new values
LicenceInfo[0].Features = 12345;
LicenceInfo[0].Execs = 100;
strcpy(LicenceInfo[0].LicenceName, "fred");
// get DAPF handle
dapfHandle = LoadDAPF(&DinkeyInfo, LicenceInfo, FileInfo, Algorithms, DataFileEnc, &err_code);
if (dapfHandle == NULL) {
DisplayLastMessage();
return err_code;
}
// program dongle
err_code = AddProtection(dapfHandle, ACTION_PROGRAM_DONGLE, 0, 0, &dongle_number);
// Unload DAPF from memory
UnloadDAPF(&dapfHandle);
// display message (error or success)
DisplayLastMessage();
return err_code;
}
// load a DAPF file from disk and protect the files specified
// (in practice it is better to protect the files one at a time and output messages as you go along, similar to DinkeyAdd.exe)
// In this example we specify the flag to overwrite any existing output file that might exist.
int DoLockSoftware(char *szFileDAPF) {
DAPF_HANDLE dapfHandle;
int err_code;
unsigned int dummy;
// load DAPF from File into memory
dapfHandle = LoadDAPFFromFile(szFileDAPF, &err_code);
if (dapfHandle == NULL) {
DisplayLastMessage();
return err_code;
}
// program dongle as specified by the DAPF file
err_code = AddProtection(dapfHandle, ACTION_PROTECT_SOFTWARE, -1, FLAGS_OVERWRITE_OUTPUT, &dummy);
// Unload DAPF from memory
UnloadDAPF(&dapfHandle);
// display message (error or success)
DisplayLastMessage();
return err_code;
}
// load a DAPF file from disk and encrypt the shell data files specified
// (in practice it is better to encrypt the files one at a time and output messages as you go along, similar to DinkeyAdd.exe)
// In this example we specify the flag to overwrite any existing output file that might exist.
int DoEncryptShellDataFiles(char *szFileDAPF) {
DAPF_HANDLE dapfHandle;
int err_code;
// load DAPF from File into memory
dapfHandle = LoadDAPFFromFile(szFileDAPF, &err_code);
if (dapfHandle == NULL) {
DisplayLastMessage();
return err_code;
}
// program dongle as specified by the DAPF file
err_code = EncryptShellDataFiles(dapfHandle, -1, FLAGS_OVERWRITE_OUTPUT);
// Unload DAPF from memory
UnloadDAPF(&dapfHandle);
// display message (error or success)
DisplayLastMessage();
return err_code;
}
// load a DAPF file from disk and create a Temporary Software Key using the info that the user entered
int DoCreateTempSoftwareKey(char *szFileDAPF, char *szMachineID, char *szExpDay, char *szExpMonth, char *szExpYear) {
DAPF_HANDLE dapfHandle;
TEMP_SWKEY_INFO swkey_info;
int err_code;
unsigned int machineID = 0;
// load DAPF from File into memory
dapfHandle = LoadDAPFFromFile(szFileDAPF, &err_code);
if (dapfHandle == NULL) {
DisplayLastMessage();
return err_code;
}
// fill out the SWKEY structure from the values the user entered
swkey_info.size = sizeof(TEMP_SWKEY_INFO);
if (szMachineID != NULL)
sscanf(szMachineID, "%x", &machineID);
swkey_info.machineID = machineID;
swkey_info.expiry_day = atoi(szExpDay);
swkey_info.expiry_month = atoi(szExpMonth);
swkey_info.expiry_year = atoi(szExpYear);
// !!!! in this case we just choose Pro Plus. You could load the DAPF file into structures and see which model is selected.
// If there is more than one model selected you can ask the customer to choose which model they want.
swkey_info.dongle_model = SWKEY_MODEL_PRO_PLUS;
swkey_info.dongle_number = 0; // default
// create the Temporary Software Key
err_code = CreateTempSoftwareKey(dapfHandle, &swkey_info, 0);
// Unload DAPF from memory
UnloadDAPF(&dapfHandle);
// display message (error or success)
DisplayLastMessage();
return err_code;
}
// load a DAPF file from disk and create a Demo Software Key Template using the info that the user entered
int DoCreateDemoSoftwareTemplate(char *szFileDAPF, char *szMaxDays) {
DAPF_HANDLE dapfHandle;
DEMO_SWKEY_INFO swkey_info;
int err_code;
// load DAPF from File into memory
dapfHandle = LoadDAPFFromFile(szFileDAPF, &err_code);
if (dapfHandle == NULL) {
DisplayLastMessage();
return err_code;
}
// fill out the SWKEY structure from the values the user entered
swkey_info.size = sizeof(DEMO_SWKEY_INFO);
swkey_info.max_days = atoi(szMaxDays);
// !!!! in this case we just choose the default model (assuming you only selected one in the DAPF file).
// If you want to specify more than one model then OR the flags together. e.g. SWKEY_BITMAP_PRO_LITE | SWKEY_BITMAP_PRO_PLUS
swkey_info.models = SWKEY_BITMAP_DEFAULT;
// create the Temporary Software Key
err_code = CreateDemoSoftwareKeyTemplate(dapfHandle, &swkey_info, 0);
// Unload DAPF from memory
UnloadDAPF(&dapfHandle);
// display message (error or success)
DisplayLastMessage();
return err_code;
}
// routine for main dialog box
BOOL CALLBACK MainDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
char szFileDAPF[256];
char szMachineID[9], szMaxDays[3];
char szExpDay[3], szExpMonth[3], szExpYear[5];
switch (message)
{
case WM_INITDIALOG:
SetDlgItemText(hwnd, IDC_TEMP_EXP_DAY, "dd");
SetDlgItemText(hwnd, IDC_TEMP_EXP_MONTH, "mm");
SetDlgItemText(hwnd, IDC_TEMP_EXP_YEAR, "yyyy");
break;
case WM_COMMAND:
GetDlgItemText(hwnd, IDC_DAPF_PATH, szFileDAPF, sizeof(szFileDAPF));
// *** Program Dongle button clicked ***
if (LOWORD(wParam) == IDC_PROGRAM_DONGLE && HIWORD(wParam) == BN_CLICKED) {
DoProgramDongle(szFileDAPF);
}
// *** Program Dongle with Modification button clicked ***
if (LOWORD(wParam) == IDC_PROGRAM_DONGLE_MOD && HIWORD(wParam) == BN_CLICKED) {
DoProgramDongleWithMod(szFileDAPF);
}
// *** Lock Software button clicked ***
if (LOWORD(wParam) == IDC_LOCK_SOFTWARE && HIWORD(wParam) == BN_CLICKED) {
DoLockSoftware(szFileDAPF);
}
// *** Encrypt Shell Data Files button clicked ***
if (LOWORD(wParam) == IDC_ENCRYPT_SHELL_DATA_FILES && HIWORD(wParam) == BN_CLICKED) {
DoEncryptShellDataFiles(szFileDAPF);
}
// *** Create Temporary Software Key button clicked ***
if (LOWORD(wParam) == IDC_CREATE_TEMP_SWKEY && HIWORD(wParam) == BN_CLICKED) {
GetDlgItemText(hwnd, IDC_MACHINEID, szMachineID, sizeof(szMachineID));
GetDlgItemText(hwnd, IDC_TEMP_EXP_DAY, szExpDay, sizeof(szExpDay));
GetDlgItemText(hwnd, IDC_TEMP_EXP_MONTH, szExpMonth, sizeof(szExpMonth));
GetDlgItemText(hwnd, IDC_TEMP_EXP_YEAR, szExpYear, sizeof(szExpYear));
DoCreateTempSoftwareKey(szFileDAPF, szMachineID, szExpDay, szExpMonth, szExpYear);
}
// *** Create Demo Software Key Template button clicked ***
if (LOWORD(wParam) == IDC_CREATE_DEMO_SWKEY && HIWORD(wParam) == BN_CLICKED) {
GetDlgItemText(hwnd, IDC_DEMO_MAX_DAYS, szMaxDays, sizeof(szMaxDays));
DoCreateDemoSoftwareTemplate(szFileDAPF, szMaxDays);
}
break;
case WM_CLOSE:
EndDialog(hwnd, TRUE);
return TRUE;
}
return FALSE;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow ) {
// display dialog allow user to enter code
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)MainDlgProc); // display main screen
return 0;
}
// gets & displays the message from the last API call to the DinkeyAdd Module
void DisplayLastMessage(void) {
char *szMessage;
int msg_len;
GetLastMessage(NULL, 0, &msg_len);
szMessage = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, msg_len);
if (szMessage != NULL) {
GetLastMessage(szMessage, msg_len, NULL);
MessageBox(NULL, szMessage, g_szAppName, MB_OK);
HeapFree(GetProcessHeap(), 0, szMessage);
}
return;
}

View File

@@ -0,0 +1,101 @@
// dris.h
// Dinkey Runtime Information Structure (DRIS)
// !! this file should not be modified
#pragma pack(1)
typedef struct DRIS {
// the first 4 fields are never encrypted
char header[4]; // should be set to DRIS
// inputs
int size; // size of this structure
int seed1; // seed for data/dris encryption
int seed2; // as above
// (maybe encrypted from now on)
int function; // specify only one function
int flags; // options for the function selected. To use more than one OR them together: OPTION1 | OPTION2...
unsigned int execs_decrement; // amount by which to dec execs if we use flag: DEC_MANY_EXECS
int data_crypt_key_num; // number of the key (1-3) that the dongle uses to encrypt or decrypt user data
int rw_offset; // offset in the dongle data area to read or write data
int rw_length; // length of data are to read/write/encrypt/decrypt
char *rw_data_ptr; // pointer to data to write / be read
char alt_licence_name[256]; // protection check for different licence instead of the default one, must be null-terminated
int var_a; // variable values for user algorithm
int var_b;
int var_c;
int var_d;
int var_e;
int var_f;
int var_g;
int var_h;
int alg_number; // the number of the user algorithm that you want to execute
// outputs
int ret_code; // return code from the protection check
int ext_err; // extended error
int type; // type of dongle detected. 1 = Pro, 2 = FD
int model; // model of dongle detected. 1 = Lite, 2 = Plus, 4 = Net 5, 7 = Net Unlimited
int sdsn; // Software Developer's Serial Number
char prodcode[12]; // Product Code (null-terminated)
unsigned int dongle_number;
int update_number;
unsigned int data_area_size; // size of the data area used in the dongle detected
int max_alg_num; // the maximum algorithm number in the dongle detected
int execs; // executions left: -1 indicates 'no limit'
int exp_day; // expiry day: -1 indicates 'no limit'
int exp_month; // expiry month: -1 indicates 'no limit'
int exp_year; // expiry year: -1 indicates 'no limit'
unsigned int features; // features value
int net_users; // maximum number of network users for the dongle detected: -1 indicates 'no limit'
int alg_answer; // answer to the user algorithm executed with the given variable values
unsigned int fd_capacity; // capacity of the data area in FD dongle.
char fd_drive[128]; // drive letter of FD dongle detected e.g. 'f:\' (or mount name under Linux)
int swkey_type; // 0 = no swkey detected, 1 = temporary software key, 2 = demo software key
int swkey_exp_day; // software key expiry date (if software key detected)
int swkey_exp_month;
int swkey_exp_year;
} DRIS;
typedef struct NU_INFO {
char licenceName[256];
char userName[50];
char computerName[256];
char ipAddress[16];
} NU_INFO;
#pragma pack()
// functions - must specify only one
#define PROTECTION_CHECK 1 // checks for dongle, check program params...
#define EXECUTE_ALGORITHM 2 // protection check + calculate answer for specified algorithm with specified inputs
#define WRITE_DATA_AREA 3 // protection check + writes dongle data area
#define READ_DATA_AREA 4 // protection check + reads dongle data area
#define ENCRYPT_USER_DATA 5 // protection check + the dongle will encrypt user data
#define DECRYPT_USER_DATA 6 // protection check + the dongle will decrypt user data
#define FAST_PRESENCE_CHECK 7 // checks for the presence of the correct dongle only with minimal security, no flags allowed.
#define STOP_NET_USER 8 // stops a network user (a protection check is NOT performed)
// flags - can specify as many as you like
#define DEC_ONE_EXEC 1 // decrement execs by 1
#define DEC_MANY_EXECS 2 // decrement execs by number specified in execs_decrement
#define START_NET_USER 4 // starts a network user
#define USE_FUNCTION_ARGUMENT 16 // use the extra argument in the function for pointers
#define CHECK_LOCAL_FIRST 32 // always look in local ports before looking in network ports
#define CHECK_NETWORK_FIRST 64 // always look on the network before looking in local ports
#define USE_ALT_LICENCE_NAME 128 // use name specified in alt_licence_name instead of the default one
#define DONT_SET_MAXDAYS_EXPIRY 256 // if the max days expiry date has not been calculated then do not do it this time
#define MATCH_DONGLE_NUMBER 512 // restrict the search to match the dongle number specified in the DRIS
#define DONT_RETURN_FD_DRIVE 1024 // if an FD dongle has been detected then don't return the flash drive/mount name in the DRIS
// Runtime module API declarations
#ifdef __cplusplus
extern "C" {
#endif
int WINAPI DDProtCheck(DRIS *dris, unsigned char *data);
int WINAPI DDGetNetUserList(char *licence_name, int *num_net_users, NU_INFO *nu_info, int num_info_structs, int *extended_error);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,117 @@
// drpf.h
// !! this file should not be modified
// NB DRPF file is:
// REMOTEINFO
// LICENCEINFO (however many are needed)
// ALGCHANGE (however many are needed)
// DATACHANGE (however many are needed) - may refer to external files.
// Remember: you only need to specify a value if you want to change it. Otherwise you
// specify the default "no change" setting. For most entries this is indicated by 0.
// However, for MaxNetUsers and LicenceNetUsers it is "-2" because 0 is a valid value to change to.
#pragma pack (push,1) // so it is byte-aligned
typedef struct REMOTEINFO {
char Header[4]; // Should be set to "DRPF" = DinkeyRemote Parameter File
unsigned int Version; // version of this structure - currently 2
char ProdCode[12];
unsigned int DongleNumber;
int UpdateNumber;
char Notes[256]; // user-defined notes
unsigned int NumLicences;
unsigned int NumAlgs; // number of algs to set (incl r/w alg)
unsigned int NumDataChanges; // number of data change blocks specified
unsigned int DataAreaSize; // -1 = increase as necessary. specifies the new size of the data area
int PerLicence; // 0 = no change, 1 = per licence net users, 2 = per product net users
int MaxNetUsers; // product net users, unlimited = -1, no change = -2
unsigned int LastUsedDay; // Day = 0 (only) -> no change
unsigned int LastUsedMonth;
unsigned int LastUsedYear;
char DataEncKeyProdCode[12];
unsigned int ChangeCodeType; // 0 = no change, bit0 = only accept secure codes, bit1 = accept secure & short codes
int CodeType; // type of code to generate. 0 = secure code, 1 = short code
char OutputFileName[256];// name of file to output code to. Null (default) -> UpdateCode.ducf
int LockDongle; // 1 = lock dongle to user's computer
int ResetDongleLock; // 1 = reset the dongle lock so that the dongle can be locked to a new machine
} REMOTEINFO;
typedef struct LICENCEINFO {
char LicenceName[256];
unsigned int Action; // 0 = change, 1 = delete, 2 = add
unsigned int AddSetExecs; // 0 = no change to execs, 1 = add, 2 = set
int Execs; // -1 = no limit
int ExecsWarn; // 0 = remove warning, -1 = no change
int ExpiryDay; // -1 = no limit, 0 = no change
int ExpiryMonth;
int ExpiryYear;
unsigned int AddSetMaxDays; // 0 = no change, 1 = add, 2 = set
int MaxDays; // -1 = no limit
int DaysWarn; // 0 = remove warning, -1 = no change
int FeaturesFlag; // 0 = don't change features, 1 = change features
unsigned int Features; // all values OK
int LicenceNetUsers; // unlimited = -1, no change = -2
} LICENCEINFO;
typedef struct ALGCHANGE {
int alg_number; // number of algorithm to set (0 = r/w algorithm)
unsigned char algorithm[12]; // algorithm
} ALGCHANGE;
typedef struct DATACHANGE {
unsigned int type; // 1 = file, 2 = hex data, 3 = ascii, 4 = ascii null-term string
unsigned int offset; // offset in dongle data memory to write data
int length; // length of data to change
unsigned char data[256]; // data to write OR name of data file depending on which method set
} DATACHANGE;
typedef struct UPDATE_CODE_OUTPUTS {
char szShortCode[128*3]; // the update code (for short update codes only)
char szUpdateCodeFile[256]; // the output ducf that contains the update code
char szConfirmationCode[8]; // the confirmation code
} UPDATE_CODE_OUTPUTS;
typedef void *DRPF_HANDLE; // for DinkeyRemote Module API functions
#pragma pack (pop)
// constants
#define DRPF_VERSION 2 // current DRPF version
// WriteDRPF API flags
#define FLAGS_LOSE_FEATURES 1 // means that you can save the DRPF file to an earlier version even if it means losing some new features that have been currently set
// constants for drpf_format in ReadDRPFEx and WriteDRPFEx functions
#define DRPF_FORMAT_BINARY 1
#define DRPF_FORMAT_JSON 2
#define DRPF_FORMAT_JSON_MIN 3 // this value is only used with WriteDRPEx. ReadDRPFEx cannot return this value.
#define MAX_LICENCES 255 // max number of licence changes in a DRPF file (theoretically unlimited but easier if we limit it)
#define MAX_ALG_CHANGES 21 // max number of alg changes in DRPF file
#define MAX_DATA_CHANGES 127 // max number of data area changes in DRPF file
// DinkeyRemote module API declarations
#ifdef __cplusplus
extern "C" {
#endif
int WINAPI ReadDRPFEx(char *szFileDRPF, REMOTEINFO *pRemoteInfo, LICENCEINFO *pLicenceInfo, ALGCHANGE *pAlgChanges, DATACHANGE *pDataChanges, int *drpf_version, int *drpf_format);
DRPF_HANDLE WINAPI LoadDRPF(REMOTEINFO *pRemoteInfo, LICENCEINFO *pLicenceInfo, ALGCHANGE *pAlgChanges, DATACHANGE *pDataChanges, int *err_code);
DRPF_HANDLE WINAPI LoadDRPFFromFile(char *szFileDRPF, int *err_code);
int WINAPI WriteDRPFEx(DRPF_HANDLE handle, char *szFileDRPF, int drpf_format, int drpf_version, int flags);
void WINAPI UnloadDRPF(DRPF_HANDLE *handle);
int WINAPI GenerateUpdateCode(DRPF_HANDLE handle, unsigned int dongle_number, int update_number, char *ducf_file, char *logfile, UPDATE_CODE_OUTPUTS *pOutputs);
void WINAPI GetLastMessage(char *szMessage, int buffer_size, int *message_length);
int WINAPI GetLastExtendedError(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,156 @@
// drpfTest
// Sample code for calling the DinkeyRemote module
// The sample code contains 2 functions. The sample code is just a guide.
// There are two methods to loading a DRPF file. These are shown in the first two functions:
// DoUpdateCode and DoUpdateCodewithMod
// DoUpdateCode: we load the DRPF file from disk and get a handle and use it "as is" using the API
// call LoadDRPFFromFile. You can make some limited changes to overwrite the default
// behaviour by using API flags.
// DoUpdateCodewithMod: we load the DRPF file from disk and load into structures. We can then modify the
// DRPF settings by modifying this structure. This method uses the API calls
// ReadDRPFEx and LoadDRPF.
#include <windows.h>
#include <stdio.h>
#include "Visual Studio 5\DinkeyRemote\resource.h"
#include "drpf.h"
#ifdef _MSC_VER
#pragma warning(disable:4996) // to disable warnings about sprintf etc... means we can use the same source for all compilers
#endif
char g_szAppName[] = "drpfTest";
void DisplayLastMessage(void); // gets & displays the message from the DinkeyRemote Module
// load a DRPF file from disk and generate an update code as specified by the DRPF file
int DoUpdateCode(char *szFileDRPF) {
DRPF_HANDLE drpfHandle;
UPDATE_CODE_OUTPUTS Outputs;
int err_code;
// load DRPF from File into memory
drpfHandle = LoadDRPFFromFile(szFileDRPF, &err_code);
if (drpfHandle == NULL) {
DisplayLastMessage();
return err_code;
}
// generate the update code as specified by the DRPF file
err_code = GenerateUpdateCode(drpfHandle, 0, 0, NULL, NULL, &Outputs);
// Unload DRPF from memory
UnloadDRPF(&drpfHandle);
// display message (error or success)
DisplayLastMessage();
return err_code;
}
// load a DRPF file from disk, modify it in memory and then generate the update code
int DoUpdateCodeWithMod(char *szFileDRPF) {
DRPF_HANDLE drpfHandle;
int dummy1, dummy2, err_code;
REMOTEINFO RemoteInfo;
LICENCEINFO LicenceInfo[MAX_LICENCES];
ALGCHANGE AlgChanges[MAX_ALG_CHANGES];
DATACHANGE DataChanges[MAX_DATA_CHANGES];
UPDATE_CODE_OUTPUTS Outputs;
// in this case we need to read the DRPF into our structures, so that the DRPF values can be modified
err_code = ReadDRPFEx(szFileDRPF, &RemoteInfo, (LICENCEINFO *)&LicenceInfo, (ALGCHANGE *)&AlgChanges, (DATACHANGE *)&DataChanges, &dummy1, &dummy2);
if (err_code != 0) {
DisplayLastMessage();
return err_code;
}
// patch new values in the RemoteInfo, LicenceInfo, AlgChanges, DataChanges structures
LicenceInfo[0].FeaturesFlag = 1; // so that the features value below will be recognised
LicenceInfo[0].Features = 12345;
LicenceInfo[0].AddSetExecs = 1; // so the executions will be added to existing
LicenceInfo[0].Execs = 100;
// get DRPF handle
drpfHandle = LoadDRPF(&RemoteInfo, LicenceInfo, AlgChanges, DataChanges, &err_code);
if (drpfHandle == NULL) {
DisplayLastMessage();
return err_code;
}
// generate the update code as specified by the DRPF file
err_code = GenerateUpdateCode(drpfHandle, 0, 0, NULL, NULL, &Outputs);
// Unload DRPF from memory
UnloadDRPF(&drpfHandle);
// display message (error or success)
DisplayLastMessage();
return err_code;
}
// routine for main dialog box
BOOL CALLBACK MainDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
char szFileDRPF[256];
switch (message)
{
case WM_INITDIALOG:
break;
case WM_COMMAND:
GetDlgItemText(hwnd, IDC_DRPF_PATH, szFileDRPF, sizeof(szFileDRPF));
// *** Generate Update Code button clicked ***
if (LOWORD(wParam) == IDC_UPDATE_CODE && HIWORD(wParam) == BN_CLICKED) {
DoUpdateCode(szFileDRPF);
}
// *** Generate Update Code with Modification button clicked ***
if (LOWORD(wParam) == IDC_UPDATE_CODE_MOD && HIWORD(wParam) == BN_CLICKED) {
DoUpdateCodeWithMod(szFileDRPF);
}
break;
case WM_CLOSE:
EndDialog(hwnd, TRUE);
return TRUE;
}
return FALSE;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow ) {
// display dialog allow user to enter code
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)MainDlgProc); // display main screen
return 0;
}
// gets & displays the message from the last API call to the DinkeyRemote Module
void DisplayLastMessage(void) {
char *szMessage;
int msg_len;
GetLastMessage(NULL, 0, &msg_len);
szMessage = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, msg_len);
if (szMessage != NULL) {
GetLastMessage(szMessage, msg_len, NULL);
MessageBox(NULL, szMessage, g_szAppName, MB_OK);
HeapFree(GetProcessHeap(), 0, szMessage);
}
return;
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,31 @@
Import Libraries
~~~~~~~~~~~~~~~~
These are used with C/C++ languages so that the compiler knows what functions
can be found in which DLLs. You need to link the appropriate import library to
your source code so that the DLL can be called correctly.
Microsoft import libraries
~~~~~~~~~~~~~~~~~~~~~~~~~~
dpwin32.lib
dpwin32debug.lib
DinkeyChange.lib
DinkeyChangeDebug.lib
Borland C++ Builder import libraries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dpwin32_borland.lib
dpwin32debug_borland.lib
DinkeyChange_borland.lib
DinkeyChangeDebug_borland.lib
Dev C++ and MinGW import libraries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libdpwin32.a
libdpwin32debug.a
libDinkeyChange.a
libDinkeyChangeDebug.a
If you look at the sample code for the relevant language / compiler then it
will tell you how to use these import libraries.

Binary file not shown.

Binary file not shown.

Binary file not shown.