Solved

Low level disk i/o in C++ for editing the metafiles

Posted on 2004-08-22
6
165 Views
Last Modified: 2010-04-01
I currently own two Maxtor hard drives--both of which I've experienced at one time or another a failure or corruption of the master file table (\$MFT).  As a result of this I frequently have backed up the drives metafiles using R-Studio NTFS, but have no way to restore the backed up files without typing in each byte from the backed up file.  Frustrated by this, I decided to design a C++ program that would both read and write these metafiles, however I do not know how to do low-level disk I/O in C++ under Windows 2000.  Can anyone point me in the right direction to how I might do low-level disk reads and writes in a Windows 2000 C++ environment so that I can save and restore my drives metafiles?

Thanks,

Chris
0
Comment
Question by:crward
  • 4
6 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11867043
I guess Windows2000 won't allow you to write directly to any sector of your disk. So the unique solution I know is to build a driver to access IDE I/O port, just like in DOS.
Look at this question related to writting directly to system I/O ports.
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VisualC_PLUS_PLUS_DOT_NET/Q_21045309.html
0
 
LVL 30

Expert Comment

by:Axter
ID: 11867171
Look at DeviceIoControl API function
0
 
LVL 30

Expert Comment

by:Axter
ID: 11867197
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 30

Expert Comment

by:Axter
ID: 11867200
0
 
LVL 30

Accepted Solution

by:
Axter earned 500 total points
ID: 11867215
Verry strange.  For some reason the links are not working right.

Lets try this one more time:
http:Q_20666119.html
http:Q_20009071.html
http:Q_10081599.html
http:Q_20389244.html
0
 
LVL 22

Expert Comment

by:grg99
ID: 11869013
You can open up any disk device with some funny drive name incantation, see the drive paths that scroll up your screen when you do a "safe mode" boot.   Put those in a call to CreateFile() and you shoul dbe good to go.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

910 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

24 Experts available now in Live!

Get 1:1 Help Now