?
Solved

Hard Disk Serial Number

Posted on 1998-11-26
2
Medium Priority
?
540 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
[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
2 Comments
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 400 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

Technology Partners: 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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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…
Suggested Courses

752 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