Solved

Hard Disk Serial Number

Posted on 1998-11-26
2
531 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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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 viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

763 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

10 Experts available now in Live!

Get 1:1 Help Now