Add Original SDK
This commit is contained in:
BIN
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/App.ico
Normal file
BIN
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/App.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
58
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/AssemblyInfo.cs
Normal file
58
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/AssemblyInfo.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
214
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/Form1.cs
Normal file
214
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/Form1.cs
Normal file
@@ -0,0 +1,214 @@
|
||||
// !! We strongly recommend that you read the "readme.txt" file in the sample code folder.
|
||||
// !! It contains important instructions on how to use the sample code
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
using System.Data;
|
||||
using System.IO; // for file I/O
|
||||
using System.Runtime.InteropServices; // so we can marshal our structures in drpf.cs
|
||||
|
||||
namespace drpfTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Form1.
|
||||
/// </summary>
|
||||
public class Form1 : System.Windows.Forms.Form
|
||||
{
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox drpfFile;
|
||||
private System.Windows.Forms.Button updatecode;
|
||||
private System.Windows.Forms.Button updatecodeMod;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
public string AppName = "drpfTest";
|
||||
|
||||
public Form1()
|
||||
{
|
||||
//
|
||||
// Required for Windows Form Designer support
|
||||
//
|
||||
InitializeComponent();
|
||||
|
||||
//
|
||||
// TODO: Add any constructor code after InitializeComponent call
|
||||
//
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if (components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.drpfFile = new System.Windows.Forms.TextBox();
|
||||
this.updatecode = new System.Windows.Forms.Button();
|
||||
this.updatecodeMod = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Location = new System.Drawing.Point(16, 24);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(440, 16);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Full path of drpf file:";
|
||||
//
|
||||
// drpfFile
|
||||
//
|
||||
this.drpfFile.Location = new System.Drawing.Point(16, 40);
|
||||
this.drpfFile.Name = "drpfFile";
|
||||
this.drpfFile.Size = new System.Drawing.Size(424, 20);
|
||||
this.drpfFile.TabIndex = 1;
|
||||
this.drpfFile.Text = "";
|
||||
//
|
||||
// updatecode
|
||||
//
|
||||
this.updatecode.Location = new System.Drawing.Point(96, 88);
|
||||
this.updatecode.Name = "updatecode";
|
||||
this.updatecode.Size = new System.Drawing.Size(264, 23);
|
||||
this.updatecode.TabIndex = 2;
|
||||
this.updatecode.Text = "Generate Update Code";
|
||||
this.updatecode.Click += new System.EventHandler(this.updatecode_Click);
|
||||
//
|
||||
// updatecodeMod
|
||||
//
|
||||
this.updatecodeMod.Location = new System.Drawing.Point(96, 128);
|
||||
this.updatecodeMod.Name = "updatecodeMod";
|
||||
this.updatecodeMod.Size = new System.Drawing.Size(264, 23);
|
||||
this.updatecodeMod.TabIndex = 3;
|
||||
this.updatecodeMod.Text = "Generate Update Code with modifications ";
|
||||
this.updatecodeMod.Click += new System.EventHandler(this.updatecodeMod_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
||||
this.ClientSize = new System.Drawing.Size(456, 174);
|
||||
this.Controls.Add(this.updatecodeMod);
|
||||
this.Controls.Add(this.updatecode);
|
||||
this.Controls.Add(this.drpfFile);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
/* The sample code contains 2 functions. Use which ever functions are most appropriate and customise
|
||||
in your own way. The sample code is just a guide.
|
||||
|
||||
There are two methods to loading a DRPF file. These are shown in the these two functions
|
||||
updatecode_Click and updatecodeMod_Click:
|
||||
|
||||
updatecode_Click: 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.
|
||||
|
||||
updatecodeMod_Click: 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.
|
||||
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
|
||||
private void updatecode_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
IntPtr drpfHandle;
|
||||
int err_code;
|
||||
UPDATE_CODE_OUTPUTS Outputs = new UPDATE_CODE_OUTPUTS();
|
||||
|
||||
// load DRPF from File into memory
|
||||
drpfHandle = DinkeyRemote.LoadDRPFFromFile(drpfFile.Text, out err_code);
|
||||
if (drpfHandle == IntPtr.Zero)
|
||||
{
|
||||
MessageBox.Show(DinkeyRemote.GetLastMessage(), AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return;
|
||||
}
|
||||
|
||||
// generate update code as specified by the DRPF file
|
||||
err_code = DinkeyRemote.GenerateUpdateCode(drpfHandle, 0, 0, null, null, out Outputs);
|
||||
|
||||
// Unload DRPF from memory
|
||||
DinkeyRemote.UnloadDRPF(ref drpfHandle);
|
||||
|
||||
// display message (error or success)
|
||||
MessageBox.Show(DinkeyRemote.GetLastMessage(), AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
}
|
||||
|
||||
private void updatecodeMod_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
IntPtr drpfHandle;
|
||||
int dummy1, dummy2, err_code;
|
||||
REMOTEINFO RemoteInfo;
|
||||
LICENCEINFO[] LicenceInfo;
|
||||
ALGCHANGE[] AlgChanges;
|
||||
DATACHANGE[] DataChanges;
|
||||
UPDATE_CODE_OUTPUTS Outputs = new UPDATE_CODE_OUTPUTS();
|
||||
|
||||
// in this case we need to read the DRPF into our structures, so that the DRPF values can be modified
|
||||
err_code = DinkeyRemote.ReadDRPFEx(drpfFile.Text, out RemoteInfo, out LicenceInfo, out AlgChanges, out DataChanges, out dummy1, out dummy2);
|
||||
if (err_code != 0)
|
||||
{
|
||||
MessageBox.Show(DinkeyRemote.GetLastMessage(), AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return;
|
||||
}
|
||||
|
||||
// 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 = DinkeyRemote.LoadDRPF(RemoteInfo, LicenceInfo, AlgChanges, DataChanges, out err_code);
|
||||
if (drpfHandle == IntPtr.Zero)
|
||||
{
|
||||
MessageBox.Show(DinkeyRemote.GetLastMessage(), AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return;
|
||||
}
|
||||
|
||||
// generate update code as specified by the modified DRPF file
|
||||
err_code = DinkeyRemote.GenerateUpdateCode(drpfHandle, 0, 0, null, null, out Outputs);
|
||||
|
||||
// Unload DRPF from memory
|
||||
DinkeyRemote.UnloadDRPF(ref drpfHandle);
|
||||
|
||||
// display message (error or success)
|
||||
MessageBox.Show(DinkeyRemote.GetLastMessage(), AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
166
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/Form1.resx
Normal file
166
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/Form1.resx
Normal file
@@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="label1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="label1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="label1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="drpfFile.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="drpfFile.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="drpfFile.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="updatecode.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="updatecode.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="updatecode.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="updatecodeMod.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="updatecodeMod.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="updatecodeMod.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>Form1</value>
|
||||
</data>
|
||||
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>(Default)</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>8, 8</value>
|
||||
</data>
|
||||
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>80</value>
|
||||
</data>
|
||||
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
</root>
|
||||
50
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/README.txt
Normal file
50
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/README.txt
Normal file
@@ -0,0 +1,50 @@
|
||||
drpfTest - sample code to call DinkeyRemote Module in C#
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This project is written in Visual Studio 2002 but will work in more recent
|
||||
versions of Visual Studio (they will upgrade the Project to the latest version.
|
||||
If prompted you should also upgrade the .NET framework the project requires).
|
||||
|
||||
For users of Visual Studio 2005 or higher, the default setting to projects is to
|
||||
compile for the Target Platform "Any". This means that on 32-bit Windows, your
|
||||
code will run as 32-bit code (and needs to call DinkeyRemote32.dll) and under 64-bit
|
||||
Windows your code will run as 64-bit code (and needs to call DinkeyRemote64.dll).
|
||||
The sample code works this out automatically. If you select the target platform as "x86"
|
||||
then it will always be 32-bit and so you only need to use DinkeyRemote32.dll. If you
|
||||
select "x64" then your code will be 64-bit and you only need to use DinkeyRemote64.dll.
|
||||
|
||||
The main source files in the project are:
|
||||
|
||||
drpf.cs - the source file contains declarations of our API. We automatically
|
||||
work out whether your code is running in 32-bit or 64-bit and load
|
||||
the appropriate DinkeyRemote module.
|
||||
|
||||
Form1.cs - this is the sample code giving an example on how you can call our API.
|
||||
It contains 2 functions. Just use the function most appropriate for you
|
||||
and customise in your own way.
|
||||
|
||||
The best approach is to compile the sample code and see how it works and then to take
|
||||
the appropriate code and apply it to your own project. You should include the drpf.cs
|
||||
file in your project and use/modify which ever functions from Form1.cs you feel are
|
||||
appropriate. The drpf.cs file should not be modified.
|
||||
|
||||
The sample code is just a guide. As none of the parameters are security sensitive then
|
||||
there is no need to implement strong security in calling DinkeyRemote.
|
||||
|
||||
Make sure you remember to do the following when creating your own project:
|
||||
|
||||
1) Insert the following namespaces in your code file:
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
2) Insert the drpf.cs file in your project.
|
||||
|
||||
3) You need to put DinkeyRemote32.dll and/or DinkeyRemote64.dll into the folder that
|
||||
contains drpfTest. Otherwise the System.DllNotFoundException error will appear
|
||||
when you run drpfTest.
|
||||
|
||||
Notes on Debugging 64-bit Code
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
When you use the 64-bit module (DinkeyRemote64.dll) the anti-debug code is so strong
|
||||
that if you are debugging your code, after calling our API then it will crash with
|
||||
an SEH 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).
|
||||
385
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/drpf.cs
Normal file
385
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/drpf.cs
Normal file
@@ -0,0 +1,385 @@
|
||||
// !! this file should not be modified
|
||||
|
||||
// DRPF file is in the following format:
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices; // so we can marshal the structures as a block of memory
|
||||
using System.Text; // for StringBuilder class for GetLastMessage API
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi, Pack=1)]
|
||||
public struct REMOTEINFO
|
||||
{
|
||||
public byte Header1; // Should be set to "DRPF" = DinkeyRemote Parameter File
|
||||
public byte Header2;
|
||||
public byte Header3;
|
||||
public byte Header4;
|
||||
public int Version; // version of this structure - currently 2
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=12)]
|
||||
public string ProdCode; // Product Code
|
||||
public uint DongleNumber;
|
||||
public int UpdateNumber;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)]
|
||||
public string Notes; // user-defined notes
|
||||
public int NumLicences;
|
||||
public int NumAlgs; // number of algs to set (incl r/w alg)
|
||||
public int NumDataChanges; // number of data change blocks specified
|
||||
public int DataAreaSize; // -1 = increase as necessary. specifies the new size of the data area
|
||||
public int PerLicence; // 0 = no change, 1 = per licence net users, 2 = per product net users
|
||||
public int MaxNetUsers; // product net users, unlimited = -1, no change = -2
|
||||
public int LastUsedDay; // Day = 0 (only) -> no change
|
||||
public int LastUsedMonth;
|
||||
public int LastUsedYear;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=12)]
|
||||
public string DataEncKeyProdCode;
|
||||
public int ChangeCodeType; // 0 = no change, bit0 = only accept secure codes, bit1 = accept secure & short codes
|
||||
public int CodeType; // type of code to generate. 0 = secure code, 1 = short code
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)]
|
||||
public string OutputFileName; // name of file to output code to. Null (default) -> UpdateCode.ducf
|
||||
public int LockDongle; // 1 = lock dongle to user's computer
|
||||
public int ResetDongleLock; // 1 = reset the dongle lock so that the dongle can be locked to a new machine
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi, Pack=1)]
|
||||
public struct LICENCEINFO
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)]
|
||||
public string LicenceName; // name of the licence
|
||||
public int Action; // 0 = change, 1 = delete, 2 = add
|
||||
public int AddSetExecs; // 0 = no change to execs, 1 = add, 2 = set
|
||||
public int Execs; // -1 = no limit
|
||||
public int ExecsWarn; // 0 = remove warning, -1 = no change
|
||||
public int ExpiryDay; // -1 = no limit, 0 = no change
|
||||
public int ExpiryMonth;
|
||||
public int ExpiryYear;
|
||||
public int AddSetMaxDays; // 0 = no change, 1 = add, 2 = set
|
||||
public int MaxDays; // -1 = no limit
|
||||
public int DaysWarn; // 0 = remove warning, -1 = no change
|
||||
public int FeaturesFlag; // 0 = don't change features, 1 = change features
|
||||
public uint Features; // all values OK
|
||||
public int LicenceNetUsers; // unlimited = -1, no change = -2
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi, Pack=1)]
|
||||
public struct ALGCHANGE
|
||||
{
|
||||
public int alg_number; // number of algorithm to set (0 = r/w algorithm)
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=12)]
|
||||
public byte[] alg; // algorithm
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi, Pack=1)]
|
||||
public struct DATACHANGE
|
||||
{
|
||||
public int type; // 1 = file, 2 = hex data, 3 = ascii, 4 = ascii null-term string
|
||||
public int offset; // offset in dongle data memory to write data
|
||||
public int length; // length of data to change
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=256)]
|
||||
public byte[] data; // data to write OR name of data file depending on which method set
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi, Pack=1)]
|
||||
public struct UPDATE_CODE_OUTPUTS
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=128*3)]
|
||||
public string ShortCode; // the update code (for short update codes only)
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)]
|
||||
public string UpdateCodeFile; // the output ducf that contains the update code
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=8)]
|
||||
public string ConfirmationCode; // the confirmation code
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ********************** API functions ************************
|
||||
// we declare classes for all the API functions for each bitness
|
||||
|
||||
// Loads DRPF from disk and returns handle
|
||||
class LoadDRPFFromFile32
|
||||
{
|
||||
[DllImport("DinkeyRemote32.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern IntPtr LoadDRPFFromFile(string drpf_file, out int err_code);
|
||||
}
|
||||
|
||||
class LoadDRPFFromFile64
|
||||
{
|
||||
[DllImport("DinkeyRemote64.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern IntPtr LoadDRPFFromFile(string drpf_file, out int err_code);
|
||||
}
|
||||
|
||||
// Loads DRPF from disk into structures supplied (so we can modify DRPF in memory)
|
||||
class ReadDRPFEx32
|
||||
{
|
||||
[DllImport("DinkeyRemote32.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern int ReadDRPFEx(string drpf_file, out REMOTEINFO RemoteInfo, byte[] licence_bytes, byte[] algchange_bytes, byte[] datachange_bytes, out int drpf_version, out int drpf_format);
|
||||
}
|
||||
|
||||
class ReadDRPFEx64
|
||||
{
|
||||
[DllImport("DinkeyRemote64.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern int ReadDRPFEx(string drpf_file, out REMOTEINFO RemoteInfo, byte[] licence_bytes, byte[] algchange_bytes, byte[] datachange_bytes, out int drpf_version, out int drpf_format);
|
||||
}
|
||||
|
||||
// Loads DRPF from structures and returns a handle
|
||||
class LoadDRPF32
|
||||
{
|
||||
[DllImport("DinkeyRemote32.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern IntPtr LoadDRPF(ref REMOTEINFO RemoteInfo, byte[] licence_bytes, byte[] algchange_bytes, byte[] datachange_bytes, out int ret_code);
|
||||
}
|
||||
|
||||
class LoadDRPF64
|
||||
{
|
||||
[DllImport("DinkeyRemote64.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern IntPtr LoadDRPF(ref REMOTEINFO RemoteInfo, byte[] licence_bytes, byte[] algchange_bytes, byte[] datachange_bytes, out int ret_code);
|
||||
}
|
||||
|
||||
// saves the DRPF file to disk
|
||||
class WriteDRPFEx32
|
||||
{
|
||||
[DllImport("DinkeyRemote32.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern int WriteDRPFEx(IntPtr drpf_handle, string drpf_file, int drpf_format, int drpf_version, int flags);
|
||||
}
|
||||
|
||||
class WriteDRPFEx64
|
||||
{
|
||||
[DllImport("DinkeyRemote64.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern int WriteDRPFEx(IntPtr drpf_handle, string drpf_file, int drpf_format, int drpf_version, int flags);
|
||||
}
|
||||
|
||||
// unloads the DRPF file
|
||||
class UnloadDRPF32
|
||||
{
|
||||
[DllImport("DinkeyRemote32.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern void UnloadDRPF(ref IntPtr drpf_handle);
|
||||
}
|
||||
|
||||
class UnloadDRPF64
|
||||
{
|
||||
[DllImport("DinkeyRemote64.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern void UnloadDRPF(ref IntPtr drpf_handle);
|
||||
}
|
||||
|
||||
class GenerateUpdateCode32
|
||||
{
|
||||
[DllImport("DinkeyRemote32.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern int GenerateUpdateCode(IntPtr drpf_handle, uint dongle_number, int update_number, string ducf_file, string logfile, out UPDATE_CODE_OUTPUTS Outputs);
|
||||
}
|
||||
|
||||
class GenerateUpdateCode64
|
||||
{
|
||||
[DllImport("DinkeyRemote64.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern int GenerateUpdateCode(IntPtr drpf_handle, uint dongle_number, int update_number, string ducf_file, string logfile, out UPDATE_CODE_OUTPUTS Outputs);
|
||||
}
|
||||
|
||||
class GetLastMessage32
|
||||
{
|
||||
[DllImport("DinkeyRemote32.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern void GetLastMessage(StringBuilder message, int buffer_size, out int message_length);
|
||||
}
|
||||
|
||||
class GetLastMessage64
|
||||
{
|
||||
[DllImport("DinkeyRemote64.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern void GetLastMessage(StringBuilder message, int buffer_size, out int message_length);
|
||||
}
|
||||
|
||||
class GetLastExtendedError32
|
||||
{
|
||||
[DllImport("DinkeyRemote32.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern int GetLastExtendedError();
|
||||
}
|
||||
|
||||
class GetLastExtendedError64
|
||||
{
|
||||
[DllImport("DinkeyRemote64.dll", CharSet = CharSet.Ansi)]
|
||||
public static extern int GetLastExtendedError();
|
||||
}
|
||||
|
||||
// ********************* DinkeyRemote class **********************
|
||||
class DinkeyRemote
|
||||
{
|
||||
// constants
|
||||
public const int DRPF_VERSION = 2; // current DRPF version
|
||||
|
||||
// WriteDRPFEx API flags
|
||||
public const int 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
|
||||
public const int DRPF_FORMAT_BINARY = 1;
|
||||
public const int DRPF_FORMAT_JSON = 2;
|
||||
public const int DRPF_FORMAT_JSON_MIN = 3; // this value is only used with WriteDRPFEx. ReadDRPFEx cannot return this value.
|
||||
|
||||
// private constants
|
||||
private const int MAX_LICENCES = 255; // max number of licence changes in a DRPF file (theoretically unlimited but easier if we limit it)
|
||||
private const int MAX_ALG_CHANGES = 21; // max number of alg changes in DRPF file
|
||||
private const int MAX_DATA_CHANGES = 127; // max number of data area changes in DRPF file
|
||||
|
||||
// **** main API
|
||||
// We only want to load the correct DLL for the bit-ness of the computer. The other DLL may not exist.
|
||||
// if the appropriate DLL does not exist in the same directory as this test program you will receive a DllNotFoundException
|
||||
|
||||
public static IntPtr LoadDRPFFromFile(string drpf_file, out int err_code)
|
||||
{
|
||||
if (IntPtr.Size == 4)
|
||||
return LoadDRPFFromFile32.LoadDRPFFromFile(drpf_file, out err_code);
|
||||
return LoadDRPFFromFile64.LoadDRPFFromFile(drpf_file, out err_code);
|
||||
}
|
||||
|
||||
// we have to do some marshalling of arrays of bytes into arrays of structures
|
||||
public static int ReadDRPFEx(string drpf_file, out REMOTEINFO RemoteInfo, out LICENCEINFO[] LicenceInfo, out ALGCHANGE[] AlgChanges, out DATACHANGE[] DataChanges, out int drpf_version, out int drpf_format)
|
||||
{
|
||||
int ret_code, i;
|
||||
byte[] licence_bytes = new byte[MAX_LICENCES * Marshal.SizeOf(typeof(LICENCEINFO))];
|
||||
byte[] licence_bytes_one_struct = new byte[Marshal.SizeOf(typeof(LICENCEINFO))];
|
||||
byte[] algchange_bytes = new byte[MAX_ALG_CHANGES * Marshal.SizeOf(typeof(ALGCHANGE))];
|
||||
byte[] algchange_bytes_one_struct = new byte[Marshal.SizeOf(typeof(ALGCHANGE))];
|
||||
byte[] datachange_bytes = new byte[MAX_DATA_CHANGES * Marshal.SizeOf(typeof(DATACHANGE))];
|
||||
byte[] datachange_bytes_one_struct = new byte[Marshal.SizeOf(typeof(DATACHANGE))];
|
||||
GCHandle MyGC;
|
||||
RemoteInfo = new REMOTEINFO();
|
||||
LicenceInfo = null;
|
||||
AlgChanges = null;
|
||||
DataChanges = null;
|
||||
|
||||
if (IntPtr.Size == 4)
|
||||
ret_code = ReadDRPFEx32.ReadDRPFEx(drpf_file, out RemoteInfo, licence_bytes, algchange_bytes, datachange_bytes, out drpf_version, out drpf_format);
|
||||
else
|
||||
ret_code = ReadDRPFEx64.ReadDRPFEx(drpf_file, out RemoteInfo, licence_bytes, algchange_bytes, datachange_bytes, out drpf_version, out drpf_format);
|
||||
|
||||
if (ret_code != 0)
|
||||
return ret_code;
|
||||
|
||||
// convert byte array to an array of structs
|
||||
LicenceInfo = new LICENCEINFO[RemoteInfo.NumLicences];
|
||||
for (i=0; i<RemoteInfo.NumLicences; i++)
|
||||
{
|
||||
Array.Copy(licence_bytes, i*Marshal.SizeOf(typeof(LICENCEINFO)), licence_bytes_one_struct, 0, Marshal.SizeOf(typeof(LICENCEINFO)));
|
||||
MyGC = GCHandle.Alloc(licence_bytes_one_struct, GCHandleType.Pinned);
|
||||
LicenceInfo[i] = (LICENCEINFO)Marshal.PtrToStructure(MyGC.AddrOfPinnedObject(), typeof(LICENCEINFO));
|
||||
MyGC.Free();
|
||||
}
|
||||
|
||||
AlgChanges = new ALGCHANGE[RemoteInfo.NumAlgs];
|
||||
for (i=0; i<RemoteInfo.NumAlgs; i++)
|
||||
{
|
||||
Array.Copy(algchange_bytes, i*Marshal.SizeOf(typeof(ALGCHANGE)), algchange_bytes_one_struct, 0, Marshal.SizeOf(typeof(ALGCHANGE)));
|
||||
MyGC = GCHandle.Alloc(algchange_bytes_one_struct, GCHandleType.Pinned);
|
||||
AlgChanges[i] = (ALGCHANGE)Marshal.PtrToStructure(MyGC.AddrOfPinnedObject(), typeof(ALGCHANGE));
|
||||
MyGC.Free();
|
||||
}
|
||||
|
||||
DataChanges = new DATACHANGE[RemoteInfo.NumDataChanges];
|
||||
for (i=0; i<RemoteInfo.NumDataChanges; i++)
|
||||
{
|
||||
Array.Copy(datachange_bytes, i*Marshal.SizeOf(typeof(DATACHANGE)), datachange_bytes_one_struct, 0, Marshal.SizeOf(typeof(DATACHANGE)));
|
||||
MyGC = GCHandle.Alloc(datachange_bytes_one_struct, GCHandleType.Pinned);
|
||||
DataChanges[i] = (DATACHANGE)Marshal.PtrToStructure(MyGC.AddrOfPinnedObject(), typeof(DATACHANGE));
|
||||
MyGC.Free();
|
||||
}
|
||||
|
||||
return ret_code;
|
||||
}
|
||||
|
||||
// we have to do some marshalling of an array of structures into an array of bytes
|
||||
public static IntPtr LoadDRPF(REMOTEINFO RemoteInfo, LICENCEINFO[] LicenceInfo, ALGCHANGE[] AlgChanges, DATACHANGE[] DataChanges, out int ret_code)
|
||||
{
|
||||
int i;
|
||||
byte[] licence_bytes = new byte[MAX_LICENCES * Marshal.SizeOf(typeof(LICENCEINFO))];
|
||||
byte[] licence_bytes_one_struct = new byte[Marshal.SizeOf(typeof(LICENCEINFO))];
|
||||
byte[] algchange_bytes = new byte[MAX_ALG_CHANGES * Marshal.SizeOf(typeof(ALGCHANGE))];
|
||||
byte[] algchange_bytes_one_struct = new byte[Marshal.SizeOf(typeof(ALGCHANGE))];
|
||||
byte[] datachange_bytes = new byte[MAX_DATA_CHANGES * Marshal.SizeOf(typeof(DATACHANGE))];
|
||||
byte[] datachange_bytes_one_struct = new byte[Marshal.SizeOf(typeof(DATACHANGE))];
|
||||
GCHandle MyGC;
|
||||
|
||||
// convert array of structs to a byte array
|
||||
for (i=0; i<RemoteInfo.NumLicences; i++)
|
||||
{
|
||||
MyGC = GCHandle.Alloc(licence_bytes_one_struct, GCHandleType.Pinned);
|
||||
Marshal.StructureToPtr(LicenceInfo[i], MyGC.AddrOfPinnedObject(), false);
|
||||
MyGC.Free();
|
||||
Array.Copy(licence_bytes_one_struct, 0, licence_bytes, i*Marshal.SizeOf(typeof(LICENCEINFO)), Marshal.SizeOf(typeof(LICENCEINFO)));
|
||||
}
|
||||
|
||||
for (i=0; i<RemoteInfo.NumAlgs; i++)
|
||||
{
|
||||
MyGC = GCHandle.Alloc(algchange_bytes_one_struct, GCHandleType.Pinned);
|
||||
Marshal.StructureToPtr(AlgChanges[i], MyGC.AddrOfPinnedObject(), false);
|
||||
MyGC.Free();
|
||||
Array.Copy(algchange_bytes_one_struct, 0, algchange_bytes, i*Marshal.SizeOf(typeof(ALGCHANGE)), Marshal.SizeOf(typeof(ALGCHANGE)));
|
||||
}
|
||||
|
||||
for (i=0; i<RemoteInfo.NumDataChanges; i++)
|
||||
{
|
||||
MyGC = GCHandle.Alloc(datachange_bytes_one_struct, GCHandleType.Pinned);
|
||||
Marshal.StructureToPtr(DataChanges[i], MyGC.AddrOfPinnedObject(), false);
|
||||
MyGC.Free();
|
||||
Array.Copy(datachange_bytes_one_struct, 0, datachange_bytes, i*Marshal.SizeOf(typeof(DATACHANGE)), Marshal.SizeOf(typeof(DATACHANGE)));
|
||||
}
|
||||
|
||||
if (IntPtr.Size == 4)
|
||||
return LoadDRPF32.LoadDRPF(ref RemoteInfo, licence_bytes, algchange_bytes, datachange_bytes, out ret_code);
|
||||
return LoadDRPF64.LoadDRPF(ref RemoteInfo, licence_bytes, algchange_bytes, datachange_bytes, out ret_code);
|
||||
}
|
||||
|
||||
// we have to do some marshalling of an array of structures into an array of bytes
|
||||
public static int WriteDRPFEx(IntPtr drpf_handle, string drpf_file, int drpf_format, int drpf_version, int flags)
|
||||
{
|
||||
if (IntPtr.Size == 4)
|
||||
return WriteDRPFEx32.WriteDRPFEx(drpf_handle, drpf_file, drpf_format, drpf_version, flags);
|
||||
return WriteDRPFEx64.WriteDRPFEx(drpf_handle, drpf_file, drpf_format, drpf_version, flags);
|
||||
}
|
||||
|
||||
public static void UnloadDRPF(ref IntPtr drpf_handle)
|
||||
{
|
||||
if (IntPtr.Size == 4)
|
||||
UnloadDRPF32.UnloadDRPF(ref drpf_handle);
|
||||
else
|
||||
UnloadDRPF64.UnloadDRPF(ref drpf_handle);
|
||||
return;
|
||||
}
|
||||
|
||||
public static int GenerateUpdateCode(IntPtr drpf_handle, uint dongle_number, int update_number, string ducf_file, string logfile, out UPDATE_CODE_OUTPUTS Outputs)
|
||||
{
|
||||
if (IntPtr.Size == 4)
|
||||
return GenerateUpdateCode32.GenerateUpdateCode(drpf_handle, dongle_number, update_number, ducf_file, logfile, out Outputs);
|
||||
return GenerateUpdateCode64.GenerateUpdateCode(drpf_handle, dongle_number, update_number, ducf_file, logfile, out Outputs);
|
||||
}
|
||||
|
||||
// do a bit of work here to make the function easier to use for C#
|
||||
public static string GetLastMessage()
|
||||
{
|
||||
int length, dummy;
|
||||
StringBuilder message;
|
||||
|
||||
if (IntPtr.Size == 4)
|
||||
{
|
||||
GetLastMessage32.GetLastMessage(null, 0, out length);
|
||||
message = new StringBuilder(length);
|
||||
GetLastMessage32.GetLastMessage(message, length, out dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetLastMessage64.GetLastMessage(null, 0, out length);
|
||||
message = new StringBuilder(length);
|
||||
GetLastMessage64.GetLastMessage(message, length, out dummy);
|
||||
}
|
||||
|
||||
return message.ToString();
|
||||
}
|
||||
|
||||
public static int GetLastExtendedError()
|
||||
{
|
||||
if (IntPtr.Size == 4)
|
||||
return GetLastExtendedError32.GetLastExtendedError();
|
||||
return GetLastExtendedError64.GetLastExtendedError();
|
||||
}
|
||||
|
||||
}
|
||||
121
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/drpfTest.csproj
Normal file
121
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/drpfTest.csproj
Normal file
@@ -0,0 +1,121 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "7.0.9466"
|
||||
SchemaVersion = "1.0"
|
||||
ProjectGuid = "{7C474B2E-28FA-4821-8FF0-FD2181A0B242}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = "App.ico"
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "drpfTest"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
OutputType = "WinExe"
|
||||
RootNamespace = "drpfTest"
|
||||
StartupObject = ""
|
||||
>
|
||||
<Config
|
||||
Name = "Debug"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "DEBUG;TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "true"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "true"
|
||||
Optimize = "false"
|
||||
OutputPath = "bin\Debug\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "false"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
Optimize = "true"
|
||||
OutputPath = "bin\Release\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Drawing"
|
||||
AssemblyName = "System.Drawing"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Windows.Forms"
|
||||
AssemblyName = "System.Windows.Forms"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.XML"
|
||||
AssemblyName = "System.Xml"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<File
|
||||
RelPath = "App.ico"
|
||||
BuildAction = "Content"
|
||||
/>
|
||||
<File
|
||||
RelPath = "AssemblyInfo.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "drpf.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Form1.cs"
|
||||
SubType = "Form"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Form1.resx"
|
||||
DependentUpon = "Form1.cs"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "readme.txt"
|
||||
BuildAction = "Content"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
||||
21
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/drpfTest.sln
Normal file
21
Dinkey Pro 7.6.1/Samples/C#/DinkeyRemote/drpfTest.sln
Normal file
@@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 7.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "drpfTest", "drpfTest.csproj", "{7C474B2E-28FA-4821-8FF0-FD2181A0B242}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
ConfigName.0 = Debug
|
||||
ConfigName.1 = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{7C474B2E-28FA-4821-8FF0-FD2181A0B242}.Debug.ActiveCfg = Debug|.NET
|
||||
{7C474B2E-28FA-4821-8FF0-FD2181A0B242}.Debug.Build.0 = Debug|.NET
|
||||
{7C474B2E-28FA-4821-8FF0-FD2181A0B242}.Release.ActiveCfg = Release|.NET
|
||||
{7C474B2E-28FA-4821-8FF0-FD2181A0B242}.Release.Build.0 = Release|.NET
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Reference in New Issue
Block a user