Solved

Hard Disk Serial Number

Posted on 1998-11-26
2
535 Views
Last Modified: 2008-02-01
Ho do I get the hard disk serial number / or volume serial number using in win3.11. In win95 it is possible to use the GetVolumeInfo() API, but not for win3.11. Is the serial number in RAM, and if so where is it. Is it possible to write some in line assembley code to do fetch it.

Thanks

Rathe
0
Comment
Question by:rh113
2 Comments
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 100 total points
ID: 1178678
It is you code in C++(not Assembler):
void FindDiskName(char *szNameDisk)
{
  struct SREGS sregs;
  union  REGS regs;
  char   szTemp[512];
  int    block[5];
                              //clear all
  memset(&sregs , 0, sizeof(sregs));
  memset(&regs , 0, sizeof(regs));
  memset(szTemp , 0, sizeof(szTemp));
  memset(block, 0, sizeof(block));

  memset(szNameDisk, 0, sizeof(szNameDisk));

  block[2] = 1;
  block[3] =  FP_OFF(szTemp);
  block[4] =  FP_SEG(szTemp);

  sregs.ds = FP_SEG(block);
  regs.x.bx = FP_OFF(block);
//                     absread(as Interruption, vers 4.0 and //more)
  regs.h.al = 0x02;                  //disk C
  regs.x.cx = -1;                  //data in block
  regs.x.dx = 0;                  //1-st Sector

  int86x(0x25, &regs, &regs, &sregs);      //read
  if (regs.h.ah == 0)                  //ok?
    {
      for (int i = 42, j=0; j < 4; i--, j++)
      CtoStr(*(szTemp+i), szNameDisk + 2*j);
      szNameDisk[8] = '-';                  //form name
    }
}
static char *szDigit = "0123456789ABCDEF";
void CtoStr(char c , char *str)
{
   str[0] = szDigit [ (c>>4) & 0x0F];
   str[1] = szDigit[(c&0x0F)];
}
Regards, Alex
0
 

Author Comment

by:rh113
ID: 1178679
Thankyou Alex for your help, I guess this code will work for all platforms as well. e.i. win3.11, win95, winNT..

Thanks

Rathe
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

920 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

13 Experts available now in Live!

Get 1:1 Help Now