ToringoDRMInfo Module

This module contains functions for uniquely identifying a computer and some assistantassistant methods.
 

GetMachineID Method

Based on some getatable and stable information of computer hardware devices and parameters you passed, this method will generate a string.

Syntax

Result = ToringoDRMInfo.GetMachineID ([UserID, PKU])

Part

Type

Description

Result

String

Based on some computer physical information and parameter UserID as well as PKU , it returns a string(namely, machine id) made up of 16 Hex characters.

UserID

String

Optional, can be username, Email address, or any other information.

PKU

String

Optional, can be PKU, part number, the name and version of your software production, or any other information.

Notes

The machine ids of the same computer under different types of operating systems acquired by this method may not be the same. Usually it will remain the same under the same type operating systems of the same computer. If the hardware devices such as CPU and masterboard are replaced, the machine id will change.

You can also design the function to generate machine ids by using other methods provided. For more information, see the methods list in Information Functions section.

Generally you need the user to provide this machine id to you via email, or your software send this id back to your server. Then you can use some encoding or encrypting algorithm on it (such as the RSA and DES/TDEA encryption/decryption methods provided by plugin) to generate a serial number, a license key or a digit certificate file, and send it back to the user.

Besides combination with encoding or encrypting functions resided in REALbasic and some third party plugins, this method can also be used together with GuancheMOS plugin of Mosquito SW to generate software serial numbers. You can simply pass the Result as Seed1 parameter to Create and Validate methods of GuancheMOS plugin.

To protect the privacy of the user, GetMachineID method uses inreversible algorithm to ensure nobody can calculate the physical information of the user based on the return value of this method.

Example

The following example shows how to use GetMachineID method.

Const UserID = ToringoDRMInfo. GetCurrentUserName
Const PKU = "ToringoDRMInfo 1.0"
Dim Result As String

Result=ToringoDRMInfo. GetMachineID(UserID,PKU)
MsgBox "Please send your ID to me: " + Result + "."

See Also

GetCurrentUserName Method of ToringoDRMInfo Module.

Other keywords mentioned are built-in items of REALbasic, please refer to their entries in REALbasic’s Language Reference.
 

GetHDSerialNumber Method

Used to get the serial numbers of all ATA/IDE and SATA hard disks which have been installed in a computer.

Syntax

Result = ToringoDRMInfo.GetHDSerialNumber

Part

Type

Description

Result

String()

The returned value is a String array, whose elements are serial numbers of each physical hard disk in a computer. They may also include marks and types of hard disks.

Notes

Manufacturers of hard disks will give a unique serial number of each ATA/IDE or SATA hard disk. This method is used to get the hard disk serial number instead of the volume serial number, the later will change after disk formatting, but the former not.

On Windows, this method will also return the product mark and type, and each element of the Result array will be saved in the form of “hard disk serial number-product mark and type”.

The return value of this method is a string array. Since REALbasic 2007r3 and earlier versions don't support returning arrays from methods of a module of third party plugins, if you are using these versions, please use method GetHDSerialNumberStr instead.

Because Mac OS X doesn't support getting hard disk serial number from user-level application, and ToringoLib series plugins haven't been designed to support Mac OS Classic, this method only supports Windows and Linux operating systems.

Also, only users of administrator group (Windows) or root group (Linux) have the permission to get hard disk serial number. For users who login by using non-administrator accounts on Windows2000 (such as User and PowerUser account, seldom used) or limited accounts on XP (rarely used), and Vista users, to make the hard disk serial number working, right click the executable file and select "Run as administrator", or launch it from a privileged console window. On Linux, for non-root users, launch it from terminal by execute "sudo ./ApplicationName" command.

Example

The following example displays all serial numbers of hard disks in a message box.

Dim HDSNs As String
Dim HDSNArray() As String = ToringoDRMInfo. GetHDSerialNumber

If UBound(HDSNArray)<0 Then Return

For i As Integer = 0 To UBound(HDSNArray)
    If i<>UBound(HDSNArray) Then
        HDSNs = HDSNs + HDSNArray(i) + EndOfLine
    Else
        HDSNs = HDSNs + HDSNArray(i)
    End If
Next i

MsgBox "Serial numbers of my hard disks are:" + EndOfLine + HDSNs

See Also

GetHDSerialNumberStr Method of ToringoDRMInfo Module.

Other keywords mentioned are built-in items of REALbasic, please refer to their entries in REALbasic’s Language Reference.
 

GetHDSerialNumberStr Method

Used to get the serial numbers of all ATA/IDE and SATA hard disks.

Syntax

Result = ToringoDRMInfo.GetHDSerialNumberStr

Part

Type

Description

Result

String

Get the serial number of each physical hard disk in a computer. The return value is a string separated by commas.

Notes

See the notes section of GetHDSerialNumber method.

See Also

GetHDSerialNumber Method of ToringoDRMInfo Module.
 

GetPrimaryMACAddress Method

Used to get the serial numbers of all ATA/IDE and SATA hard disks.

Syntax

Result = ToringoDRMInfo.GetHDSerialNumberStr

Part

Type

Description

Result

String

Get the serial number of each physical hard disk in a computer. The return value is a string separated by commas.

Notes

See the notes section of GetHDSerialNumber method.

See Also

GetHDSerialNumber Method of ToringoDRMInfo Module.
 

GetSystemMACAddress Method

Used to get the MAC addresses of all kinds of installed devices of the system.

Syntax

Result = ToringoDRMInfo.GetSystemMACAddress

Part

Type

Description

Result

String()

The return value is an array. Each element of it is a MAC address of one communication device in the computer.

Notes

GetSystemMACAddress can get the MAC addresse of each communication device (such as the wired network card and the wireless network card, IEEE 1394/Firewire) of the system.

The return value of this method is a string array. Since REALbasic 2007r3 and earlier versions don't support returning arrays from methods of a module of third party plugins, if you are using these versions, please use GetSystemMACAddressStr method instead.

Part of the MAC addresses returned by this method is editable. Relative to primary MAC, this kind of MAC address is usually called "locally-administered MAC address". For example, the MAC address of a ethernet network card using RTL8139 chip can be changed directly in the Device Manager of Windows. On Mac OS X and Linux, you can use command ifconfig to change the MAC addresses of network cards and some other devices. Besides, you can also change the MAC addresses of some devices by modifying Register on Windows or configuration files on some Linux distributions. As a result, method GetSystemMACAddress doesn't completely fit in DRM.

MAC address will return as the native format of OS. On Mac OS X, there are colons in the return value, while on Windows dash (“-”) is used as separator.

Example

The following example displays all MAC addresses of all communication devices used in the operating system in a message box.

Dim MACs As String
Dim MACArray() As String = ToringoDRMInfo.GetSystemMACAddress 

If UBound(MACArray)<0 Then Return

For i As Integer = 0 To UBound(MACArray)
    If i<>UBound(MACArray) Then
        MACs = MACs + MACArray(i) + EndOfLine
    Else
        MACs = MACs + MACArray(i)
    End If
Next i

MsgBox "MAC addresses used in my system are:" + EndOfLine + MACs

See Also

GetPrimaryMACAddress and GetSystemMACAddressStr methods of ToringoDRMInfo Module.

Other keywords mentioned are built-in items of REALbasic, please refer to their entries in REALbasic’s Language Reference.
 

GetSystemMACAddressStr Method

Used to get the MAC addresses of all kinds of installed devices of the system.

Syntax

Result = ToringoDRMInfo.GetSystemMACAddressStr

Part

Type

Description

Result

String

Get the MAC addresses of all kinds of installed devices of the system. The returned value is a string separated by commas.

Notes

See the notes section of GetSystemMACAddress method.

See Also

GetPrimaryMACAddress and GetSystemMACAddress methods of ToringoDRMInfo Module.
 

GetMacSerialNumber Method

Used to get the serial number of a Apple Macintosh, that is the serial number showed in About This Mac dialog (It will appear after clicking string under the Apple logo and “Mac OS X” twice).

Syntax

Result = ToringoDRMInfo.GetMacSerialNumber

Part

Type

Description

Result

String

The serial number of a Macintosh computer.

Notes

It's only available on the Mac OS X operating system installed in a Macintosh computer produced by Apple.
 

GetCPUID Method

Used to get the mark, type and serial number of a CPU.

Syntax

Result = ToringoDRMInfo.GetCPUID

Part

Type

Description

Result

String

The type (usually contains the manufacturer’s name and the mark) of a CPU and its serial number (if it exists).

Notes

Currently it only supports Windows and Linux operating systems. For the same computer, the return value of Windows and Linux may has a little difference. The return value is in the form of “CPU type-CPU serial number”. It only supports x86 CPUs.
 

GetCurrentUserName Method

Used to get the username of the current user.

Syntax

Result = ToringoDRMInfo.GetCurrentUserName

Part

Type

Description

Result

String

The username of the log-in user.

Notes

For those applications that need users to input the username and serial number (or license key and so on), the return value of this method can be displayed as the default username. However, usually the application should allow the user changing it to a more appropriate name. On Windows GetCurrentUserName actually returns the username of the current process, which is usually also the username of the current user.