Solved

Unique System ID

Posted on 2004-08-03
11
276 Views
Last Modified: 2010-04-05
Hi

Is there any way to get some kind of Id which is unique to a system to use with delphi. I want to my application to work only in system it is installed.

Prince
0
Comment
Question by:princemahesh
  • 3
  • 3
  • 2
  • +3
11 Comments
 

Author Comment

by:princemahesh
ID: 11703476
I am using delphi 5 and 7......enterprise version....
0
 
LVL 7

Expert Comment

by:LRHGuy
ID: 11703689
Check out Turbopowers' OnGuard package at sourceforge:

http://sourceforge.net/projects/tponguard/

It has a routine "GetMachineID" which should suit your needs.

Larry
0
 

Author Comment

by:princemahesh
ID: 11704389
Hi Larry

Thanks for your comment

I checked these components but there is no method called "GetMachineName"

Prince
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 4

Expert Comment

by:alikoank
ID: 11704418
If the target machine has an ethernet card, the best way would be using MAC address. It is also possible to use CPUID info but it can be disabled.
0
 
LVL 7

Accepted Solution

by:
LRHGuy earned 50 total points
ID: 11704851
Oops! Sorry, it's CreateMachineID ... I had encapsulated it for my own purposes... It should be in OnGuard.pas.

Larry
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 11706977
Using the MAC address would fail if the user changes the network card in his system or adds a second one... Or if he, like me, has a small USB device that acts as a network card through USB... Then the system might or might not have a MAC address...
0
 

Author Comment

by:princemahesh
ID: 11707698
Ya Larry i found this one....thanks.....

Is this also generate key on the system harware information.....if it does then if user make any change to those harwares then the application won't work.....am i right?

Prince.....
0
 
LVL 4

Expert Comment

by:alikoank
ID: 11708364
if you want to have unique system ID, that is unique and re-generetable to a system, this id will have to contain some kind of hardware-specific data, be it MAC address or CPUID ...

There is of course the risk of changing hardware and invalidation of key, but you cannot have a unique system id without this risk.

Changing a network card may not be an issue, most new motherboards have built-in ethernet adapters and if you have one working, you possibly use one for several years.

Adding a second ethernet card does NOT affect copy protection, you can always enumarate all adapters and use the registered one.

I do not know much about USB based ethernet cards but I highly suspect they will have an MAC address. They have to have one for windows TCP/IP stack to work. You cannot have ARP tables without MAC addresses.
0
 
LVL 7

Expert Comment

by:LRHGuy
ID: 11710593
The CreateMachineId routine takes a parameter...you tell it which "pieces" of the computer to look at to create the ID, so it depends on which parameters you select. You can include user name, drive sizes, network ID...take your pick! IF they change the hardware, the machine ID could change.

Larry
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 11714212
> I want to my application to work only in system it is installed.

do you want to check if the program is installed on the system
or should it be a kind of copyprotection and registration so that
the program should only run on systems someone has paid for?
0
 
LVL 1

Expert Comment

by:aruana
ID: 11715725
I use a simple approach. Create one myself.
Create a text file and rename it to   myID.reg
It should contain the following:

REGEDIT4
[HKEY_LOCAL_MACHINE\Software\MyAppOrCompanyName\ComputerID]
"ComputerID"="ID12345"

double click on the file and it gets loaded into Windows registry. fast and simple.
you can change the value and double click as many time as you like, the value would be overwritten.
then read the registry value using this command in your app:


 ComputerID:=ReadHKEY_LOCAL_MACHINE(Software\MyAppOrCompanyName\ComputerID', 'ComputerID');


ReadHKEY_LOCAL_MACHINE is defined as below ( also remember to add registry to your uses clause):


function ReadHKEY_LOCAL_MACHINE(KeyName: string; ValueName: string): string;
var
  Registry: TRegistry;
begin
  Registry := TRegistry.Create(KEY_READ);
  try
    Registry.RootKey := HKEY_LOCAL_MACHINE;
    // False because we do not want to create it if it doesn't exist
    Registry.OpenKey(KeyName, False);
    Result := Registry.ReadString(ValueName);
  finally
    Registry.Free;
  end;
end;


if you want more security, remove the xxx.reg file once you are done or use the WriteString method to write the ID value instead of using the text file. And also use a less obvious name for your registry key name, value name, and ID value.

0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to disable mouse scroll in a combo box field within a Delphi cxGrid 4 137
add combobox item based on numbers 9 144
Create a path if not exists 7 78
update joined tables 2 47
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question