?
Solved

How to retrieve HardDisk Address

Posted on 2004-09-15
9
Medium Priority
?
228 Views
Last Modified: 2010-04-17
i want to get the address of my hard disk attatched with my computer,
like i get the MAC Address.
Is there any way,
i would be grateful

ifza
0
Comment
Question by:ifzah
[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
  • 4
  • 4
9 Comments
 
LVL 5

Accepted Solution

by:
ITcrow earned 500 total points
ID: 12073016
Go to Command Prompt:
Start => Run => cmd

On the prompt type:
dir

Result has your disk serial number.

Although this number is not like MAC address, it doesn't change after creating the partition and formatting a drive. This number is generated every time you format a drive. It gets calculated based on date and time and is stored on drive's boot sector.
0
 

Author Comment

by:ifzah
ID: 12073119
How to get programatically , in C++
0
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 12073158
Try the GetVolumeInformation API call
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Author Comment

by:ifzah
ID: 12073726
can u write some code please, how to use it..
in order to get serial number.
I would be grateful..
ifza
0
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 12073767
This should do it

#include <windows.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
      char szBuffer[256] ;
      char szBuffer2[256] ;
      DWORD dwSerial, dwMax, dwFlags ;

      dwSerial = 0 ;
      GetVolumeInformation ( "C:\\", szBuffer, 256, &dwSerial, &dwMax, &dwFlags, szBuffer2, 256 ) ;

      printf ( "Serial number: %d\n", dwSerial ) ;

      return 0 ;
}
0
 

Author Comment

by:ifzah
ID: 12073798
i am grateful
thanks
ifza
0
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 12073931
Just as a matter of interest - why did you ask for source code and then allocate points to the answer on how to get the serial number from the command line? I am very confused.
0
 

Author Comment

by:ifzah
ID: 12074393
oh sorry julian
i thought, that it was u, who answered me from beginning to end.
i am really sorry.
please forgive me. i did't see ...
really i am sorry..
these points were for u only............

please forgive me..

take care and lots of love in helping me...
0
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 12074438
you are forgiven ... mostly ;)

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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