🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2999

Re: Best technique

#2999
From: Colin B Maharaj
Date: Wed, 06 Sep 2006 02:12
56 lines
2432 bytes
This was discussed some time ago.....
This part of the registry is created every time you reboot the PC. It is 
a fixed value. It can be altered by an administrator, but, will revert 
after a reboot.

You can then HASH this and use the hash as a unique string for your system.

AnsiString SystemBiosVersion()
{
    HKEY hKey;
    DWORD keyType   = 0;
    DWORD retValue  = 0;
    DWORD keyLength = 0;
    char *t = new char [MAX_PATH];
    char *CV = new char [256];
    AnsiString A="Unknown Bios";

    strcpy(CV, "Hardware\\Description\\System");
    retValue = RegOpenKeyEx(HKEY_LOCAL_MACHINE, CV, NULL, KEY_READ, &hKey);
    if (retValue != ERROR_SUCCESS)
    {
      delete CV;
      delete t;
      return A;
    }
    RegQueryValueEx(hKey, "SystemBiosVersion", NULL, &keyType, NULL, 
&keyLength);
    retValue = RegQueryValueEx(hKey, "SystemBiosVersion", NULL, 
&keyType, (UCHAR *)t, &keyLength);
    RegCloseKey(hKey);

    if (retValue != ERROR_SUCCESS)
    {
       delete CV;
       delete t;
       return A;
    }
    A = t;
    delete CV;
    delete t;
    return A;
}


ki wrote:
> Hello world
> 
> I want to write a serial key generator algorithm for a program for the 
> registration and trial version.
> For that i want a unique id from the pc.
> What is the best technique.
> Any suggestion greately appreciated.
> 
> Thanks 
> 
> 
Technical Details
Message-ID: <44fe2e9e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <44fe06e7@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,dfbdf2a7b25bea5b
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 05 Sep 2006 22:12:47 -0400
From: Colin B Maharaj <noreply@myhost.com>
User-Agent: Thunderbird 1.5.0.5 (Windows/20060719)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Best technique
References: <44fe06e7@newsgroups.borland.com>
In-Reply-To: <44fe06e7@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 0635-5, 04/09/2006), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 200.108.20.13
Message-ID: <44fe2e9e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1157508766 200.108.20.13 (5 Sep 2006 19:12:46 -0700)
Lines: 56
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail