Solved

serial number in BIOS?

Posted on 1997-04-03
3
790 Views
Last Modified: 2008-02-26
We are looking for way to identify PC hardware programatically.  We considered using the ethernet address coded into the card, but we sometimes change out network cards.  DOS environment variables are not secure enough.

My boss says that the newer BIOS chips have a serial number in them that is unique.   I am looking for a way to retrieve the serial number that is flexible enough to handle different BIOS suppliers (AMI, Phoenix) and will handle new BIOS revisions.  If there is indeed a serial number coded into the BIOS, I'm sure it moves around every time the code is assembled.
0
Comment
Question by:jnearing
[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 Comments
 
LVL 2

Accepted Solution

by:
javiertb earned 100 total points
ID: 1249807
It's not safe getting the BIOS serial number. It's better to obtain the hard disk serial number of a DOS drive

Here you have the code:

*/
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
 #include <dos.h>

struct info {
    int  info;             //  DW 0         Info Level
    long serial_num;       //  DD ?         Volume Serial Number
    char label[11];        //  DB 11 Dup(?) Volume Label
    char file_sys[8];      //  DB  8 Dup(?) File System Name
};

int main(int argc, char* argv[])
{
   union {
      unsigned long sn;
      unsigned int words[2];
   } sn;

   struct SREGS sregs;
   union  REGS  regs;
   struct info  buff;

   int  drive = 0, error;

   if(argc == 2)
      drive = tolower( argv[1][0] ) - 'a' + 1;

   regs.x.dx = FP_OFF(&buff);
   sregs.ds  = FP_SEG(&buff);
   regs.h.bl = drive;          // BL contains the drive. 0=current, 1=A,
etc.
   regs.x.ax = 0x6900;

   error = intdosx( &regs, &regs, &sregs );
   if( regs.x.cflag )
      {
      fprintf(stderr, "DOS Error: Disk Drive type %d\n", error);
      return 1;
      }

   sn.sn = buff.serial_num;
   printf("Disk serial number: %04X-%04X\n", sn.words[1], sn.words[0]);

   return 0;
}

// get volume label name

#include <stdio.h>
#include <dir.h>
#include <dos.h>

main()
{
   ffblk ffblk;  //DOS file control block structure used to get label name
   findfirst ("c:\\*.*", &ffblk, FA_LABEL);
   printf("\n%s\n", ffblk.ff_name);
   return 0;
}

Hope this help
0
 
LVL 3

Expert Comment

by:pc012197
ID: 1249808
If you  use HD serial numbers you'll get into trouble when you upgrade to a bigger disk...
Whatever hardware info you use, you'll always get into trouble when you upgrade part of your system.

0
 

Expert Comment

by:alexander031597
ID: 1249809
You can get ID of CPU. This is only additional information, but
it's good enough with information about BIOS. If you need it,
send me E-mail and I explain it in details.
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 thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

734 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