🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Last trie

#9521
From: Remy Lebeau (TeamB)
Date: Wed, 07 Jul 2004 05:43
45 lines
2280 bytes
"Edward" <Registrados2004@aol.com> wrote in message
news:40eb41eb$1@newsgroups.borland.com...

> What I wound up doing, was something much simpler, but just as effective.

That won't always work, either.

>   while(i < sizeof(biosnro))
>   {
>     biosnro[i] = ' ';
>     i++;
>   }

You could use memset() instead of looping manually.

>   Reg->OpenKey("\\HARDWARE\\DESCRIPTION\\System", false);
>   if(Reg->KeyExists("\\HARDWARE\\DESCRIPTION\\System"))
>   {

You should be checking the return value of OpenKey() instead of KeyExists():

    if( Reg->OpenKey("\\HARDWARE\\DESCRIPTION\\System", false) )
    {

>      Reg->ReadBinaryData("SystemBiosVersion",&biosnro,sizeof(biosnro));

I just checked on my Win98 machine, and although the key you are using does
exist, the particular value you are querying does not.  Which means that
your code would fail on my machine, for instance.

>     It doenst work because some times the datavaleu os
> "SystemBiosVersion" are REG_MULTI_SZ other times
> REG_SZ and other times are Unknow type

And other times it simply does not exist at all.

> I dont know what more i can do.

If all you want is a unique ID, then why not just generate a new GUID via
the CoCreateGuid() function?  It is already guaranteed to produce a unique
identifier every time it is called.


Gambit
Technical Details
Message-ID: <40eb8d7b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40c86e9e@newsgroups.borland.com> <40eb41eb$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e3066f787953dff9
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <40c86e9e@newsgroups.borland.com> <40eb41eb$1@newsgroups.borland.com>
Subject: Re: Last trie
Date: Tue, 6 Jul 2004 22:43:50 -0700
Lines: 47
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.10
Message-ID: <40eb8d7b$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1089179003 68.69.17.10 (6 Jul 2004 22:43:23 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail