Solved

Unique System ID

Posted on 2004-08-03
11
274 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now