?
Solved

Detecting actual physical drive size

Posted on 2001-06-29
4
Medium Priority
?
189 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
[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
4 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 300 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

Independent Software Vendors: 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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
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 …
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 learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

777 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