Free desktop tools and utilities for Windows. Download our software now.Free desktop tools and utilities for Windows. Download our software now.
HomeContact
molecular biology software
scf trace assembly

Hardware ID Extractor
Hardware serial number extractor library

Delphi programming C/C++  programming VB (Visual Basic)  programming

DNA chromatogram assembly

Documentation for non-Delphi users



Types of variables in Delphi:


Cardinal = 32 bits unsigned
Integer = 32 bits signed

Longint = Same as Integer
Byte = 8 bits unsigned


String = Same as short string. Its length can be up to 2GB.
ShortString= ShortString is not the same as PChar (char *). It is an array of char with the first char being the length of the string. It has no trailing #0 character. It cannot be longer than 255 chars.
Char = Same as Byte

 

Delphi procedures:


In Delphi a procedure is a function that returns nothing.

 

 

Calling convention:


All functions were exported using the "stdcall" convention. This is slow but ensures compatibility with all Windows based programming languages (Visusal C, Visual Basic, etc).

 

 

 

 

 

 

 

 

 

 

 

 


 

Visual C

typedef struct ShortString {
  char len;
  char data[255];
};
typedef void (_stdcall *GETCPUID)(struct ShortString *result, BYTE cpuCore);

GETCPUID pGetSerial;

HMODULE hWtsLib = LoadLibrary("HardwareIDExtractor.dll");
if (hWtsLib) {
  ShortString serial;
  pGetSerial = (GETCPUID)GetProcAddress(hWtsLib, "GetCPUID");
  pGetSerial(&serial, '1');
  char *str = malloc(serial.len + 1); // include space for the trailing \0
  strlcpy(str, serial.data, serial.len);
  str[serial.len] = '\0'; // drop in the trailing null
}

 

DotNet C#

[DllImport("the_name_of_the_delphi_library.dll")]
public static extern string CPUFamily();

[DllImport("the_name_of_the_delphi_library.dll")]
public static extern int GetCpuTheoreticSpeed();

[DllImport("the_name_of_the_delphi_library.dll")]
public static extern bool IsCPUIDAvailable();

[DllImport("the_name_of_the_delphi_library.dll")]
public static extern string GetCPUID(byte cpuCore);

[DllImport("the_name_of_the_delphi_library.dll")]
public static extern string GetCPUVendor();

[DllImport("the_name_of_the_delphi_library.dll")]
public static extern uint MemoryStatus(int memType);

[DllImport("the_name_of_the_delphi_library.dll")]
public static extern string MemoryStatus_MB(int memType);

[DllImport("the_name_of_the_delphi_library.dll")]
public static extern string GetPartitionID(char partition);

[DllImport("the_name_of_the_delphi_library.dll")]
public static extern string GetIDESerialNumber(byte driveNumber);
class Program
{
    [DllImport("the_name_of_the_delphi_library.dll")]
    public static extern double GetCPUSpeed();

    static void Main(string[] args)
    {
        double cpuSpeed = GetCPUSpeed();
        Console.WriteLine("CPU speed: {0}", cpuSpeed);
    }
}

 

Delphi

 

In the Interface section of your unit declare the function you want to import. For example, to show your CPU type/family, use:

     function CPUFamily : ShortString; stdcall; external 'HardwareIDExtractor.DLL';

 

Then, in the 'Implementation section call that function. Like this:

     Label1.Caption:= CPUFamily;

 

Full demo source code is availalbe here.

 

 

 

 

 

 

 

 

 

 

 

Note: Please remember that we are Delphi developers. The information provided for other programming languages except Delphi may not be accurate.

 

 

Related words: Get disk serial, real hard drive serial number, hardware ID number, programming code, DLL library, extract hardware info, get CPU producer frequency and producer

contig assembly software
   
  Hardware ID Extractor