Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 801
  • Last Modified:

serial number in BIOS?

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
jnearing
Asked:
jnearing
1 Solution
 
javiertbCommented:
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
 
pc012197Commented:
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
 
alexander031597Commented:
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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now