?
Solved

Unique System ID

Posted on 2004-08-03
11
Medium Priority
?
285 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 150 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

764 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