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
Solved

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

Posted on 2004-08-22
6
168 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 how to clear a vector as well as how to detect empty vectors in C++.

856 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