Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Getting BIOS-serial ?

Posted on 1998-06-03
6
Medium Priority
?
585 Views
Last Modified: 2011-03-07
Is it possible to get the computers BIOS-serialnumber by using Delphi ? How do I do it?

I run Delphi Developer 2.0...

Thanx!
/ Erik N
0
Comment
Question by:Erik N
[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
  • 2
6 Comments
 
LVL 1

Accepted Solution

by:
Edo082297 earned 600 total points
ID: 1350036
Here, try this:

unit GetBIOS;
interface

uses WINPROCS;

function GetBiosSerial: LongInt;

implementation

function allocRealModePointer(var P: pointer; Size: longInt): boolean; forward;
function freeRealModePointer(var p: pointer): boolean; forward;

function GetBiosSerial: LongInt;
{ code Test: The Rom-Bios' date is allways at $ffff:0005 (real-mode)}
var
  l: ^LongInt;
begin
  l := Ptr($FFFF, $0005); {FFFF5 -> data da Rom-Bios}
  if AllocRealModePointer(Pointer(l), 8) then {8 chars to RomBios' date}
  begin { Use p to read ROM Bios' date here}
    GetBiosSerial := l^;
    FreeRealModePointer(Pointer(l)); {dispose l}
  end;
end;

function allocRealModePointer(var P: pointer; Size: longInt): boolean;
var
  Selector, base : word;
  LinearBase : longint;
begin
  result := false;
  LinearBase := MakeLong(0,hiword(longint(p)) shr 12) + hiword(longint(P)) shl 4 +           loword(longint(P)); {converts 20-bit address into a 32-bit one} {i.e. $ffff:0006 into $000ffff6}        Selector := AllocSelector(DSeg); {Copies DSeg Selector properties }
  base := SetSelectorBase(Selector, LinearBase);
  SetSelectorLimit(Selector, Size);
  if (Selector <> 0) and (base<>0) then
  begin
    P := Ptr(Selector, 0);
    result := true;
  end;
end;

function freeRealModePointer(var p: pointer): boolean;
var
  fr : Word;
begin
  fr := FreeSelector(hiword(longint(p))); {seletor is at hiword(p)}
  if (fr=0) then
  begin {ok}
    p := nil;
    result := true;
  end
  else
  begin {fail}
    result := false;
  end;
end;

{Author: Jose Bastos Neto}

HTH

Edo
0
 
LVL 6

Expert Comment

by:Holger101497
ID: 1350037
Really cool! I haven't tried it yet, but this looks like something I was looking for as well...

Specifically, I was looking for a "unique System ID" that I can use to copy-protect my programs that are distributed to a very limited number of people (<20).

How likely is it to have two computers with the same BIOS serial no? Is this just a version number that will be the same in systems with the same motherboard/BIOS? Or is it almost unique?

Which other information from the computer could I use to get a unique ID? BIOS sounds good because it's rarely replaced... in times of huge harddisks that are replaced or repartitioned every once in a while, that's not a good indicator...

btw: Does anybody know how to get the serial-number of hard disks? I had some code to do it in DOS, but it doesn't work in windows (was some inline assembler! (read the boot sector))

Thanks!

P.S.: Erik, I would appreciate it if you waited a day or so with accepting the answer so I'll have time to read any additional comments... Thx!
0
 
LVL 1

Expert Comment

by:Edo082297
ID: 1350038
Hi Holger,
  I STAND TO BE CORRECTED:
  The BIOS serial is supposed to be unique. This, in conjunction with a username, gives you a very good chance of having a unique identifier for a given system. Hard disks may be replaced, but unless the motherboard is replaced, the same BIOS serial will remain (this information is stored in EEPROM in the cpu itself). People always want to do stuff like this. The problem is that when the user changes systems (and they will!), they will call you and whine. Users don't like this.
  MY RAMBLINGS:
  Someone needs to write a program that would use a call back modem (or some other such guaranteed identification process) to distribute a key to unlock a given software product. The user would be registered, and your software would automatically dial in, pass in a password of sorts, and get the new key, allowing the program to continue  functioning properly.
  If someone tried to fool the system, then all would go ok for a couple of days, before your program would format their hard drive (event: OnPiratedCopyFound) :)

Edo
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 6

Expert Comment

by:Holger101497
ID: 1350039
HELP!
I tried ypur code, but it won't work in 32-bit Delphi (i.e. Win 95/NT, which by now probably is much more common than Win3.1 *g*)
I feel a bit insecure messing with code I don't really understand. Well, I understand what it does, but I don't know if it still does the same thing if i change it...

The problems are at least these:
1) l := Ptr($FFFF, $0005); => Segment/Offset pairs not supported.
I forgot how to convert manually... wasn't it 16 bytes to a segment? So would it have to be I:=Ptr($FFFF5)?

2) AllocSelector: The AllocSelector function is not implemented in the Win32 API. Win32-based applications should use the VirtualLock and VirtualUnlock functions.
Well, the help says that VirtualLock makes sure the page is not paged out... How can the BIOS be paged out to the swap-file? It also says that this function doesn't do anything in Win 95

3) SetSelectorBase: Not known at all...

Of course I'm not normally allowed to read address 000FFFF5 and trying to do so causes an access violation.

I'd appreciate any help, because this is important! Thanks!!
0
 

Author Comment

by:Erik N
ID: 1350040
Thank you Edo !
/Erik N
0
 
LVL 6

Expert Comment

by:Holger101497
ID: 1350041
Any way to do it in Windows 95 with Delphi 3.0?
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

610 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