Solved

serial number in BIOS?

Posted on 1997-04-03
3
780 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
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 122
How do I set up two external hard drives with Acronis True Image? 12 81
delete-remove 14 65
outlook office 365 8 85
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

863 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

28 Experts available now in Live!

Get 1:1 Help Now