Solved

Detecting actual physical drive size

Posted on 2001-06-29
4
183 Views
Last Modified: 2008-03-10
Is there a routine I can use to detect the actual physical drive size (including Non-formatted space!) of a drive?

I seem to recall the Win API report the formatted space but I need a routine/function that reports the actual physical size the drive was built for.
0
Comment
Question by:rascal
  • 2
4 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 100 total points
ID: 6239042
You need to use the API function DeviceIoControl and the IOCTL_DISK_GET_DRIVE_GEOMETRY command.
0
 
LVL 1

Author Comment

by:rascal
ID: 6239052
I assume this requires I write a device driver? Is there a non-device driver way to perform the same thing by any chance?
0
 
LVL 1

Author Comment

by:rascal
ID: 6239068
I looked up IOCTL_DISK_GET_DRIVE_GEOMETRY and found an example in the MSDN and it appears I do not need a device driver (phew!).

I neglected to mention I need a solution that works on Win9X platforms as well as NT and Win2K and IOCTL_DISK_GET_DRIVE_GEOMETRY is NT/Win2K specific.

Can you recommend a Win9x solution as well by any chance?
0
 
LVL 86

Expert Comment

by:jkr
ID: 6239087
In addition to what jhance already suggested, 'IOCTL_DISK_GET_DRIVE_LAYOUT' might be an option, too...
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

746 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

9 Experts available now in Live!

Get 1:1 Help Now