Low Level Hard Disk Access

This is a discussion on Low Level Hard Disk Access within the Tech Board forums, part of the Community Boards category; I need a utility that can analyse a disk at a very low level AND write single sectors, or a ...

  1. #1
    Budding Synth Programmer samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Trefforest
    Posts
    368

    Low Level Hard Disk Access

    I need a utility that can analyse a disk at a very low level AND
    write single sectors, or a range of sectors to a file (WinXP).

    I've got a damaged partition that's unreadable and I want to try and retrieve some files (mainly old C projects - stored in human-readable format so it shouldn't be too much bother).

    I've found one facility that looks at the partition sector-by-sector (and sure enough, there's data there) and it can save sectors to disc but only one at a time. And I'm not going to manually sift through 40000+ sectors.

    I've found facilities that CLAIM to do what I want but cannot read the partition.

    Does anyone know of a utility that can do what I need?

  2. #2
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    I've made a program called HyperEdit which can do what you ask for, but it hasn't any specific data recovery features, only raw disk access. It's a hex editor.

    http://www.strandmark.com/hyperedit.shtml

    If it fails to read the disk at some position, it'll exit.

    EDIT: I've used my program to view data on failed floppy disks.
    Last edited by Sang-drax; 03-31-2005 at 05:06 PM.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  3. #3
    Budding Synth Programmer samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Trefforest
    Posts
    368
    HyperEdit doesn't open the partition - it says "The parameter is incorrect". This is basically what most of these utilities do. The only one that allows me to open the drive only does it one sector at a time and no search...

  4. #4
    Budding Synth Programmer samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Trefforest
    Posts
    368
    I've found another utility that lets me read it (Roadkil' Sector Editor) and lets me search - so I've been able to locate all my old source code and I've been saving it manually sector by sector (442 sectors so far).

    Once I'm done I'll write some utility to concatenate files with consecutive names...

  5. #5
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    >>Once I'm done I'll write some utility to concatenate files with consecutive names...

    how bout cat ?

  6. #6
    Budding Synth Programmer samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Trefforest
    Posts
    368
    Quote Originally Posted by Perspective
    >>Once I'm done I'll write some utility to concatenate files with consecutive names...

    how bout cat ?
    Didn't know it existed. Anyway, what a coincidence - that's what I called my utility. It was more specialised, as each sector's filename was the number of the sector it came off so the algorithm had to merge files with consecutive names and start a new file once the sequence was broken.

    Code:
    #include <iostream.h>
    #include <string.h>
    #include <stdio.h>
    
    int main (void)
    {
    	FILE *inFile;
    	FILE *outFile;
    
    	bool newFile = true;
    
    	int inFileNo;
    	int outFileNo = 1;
    
    	char inFileName [21];
    	char outFileName [21];
    
    	char path [21];
    
    	unsigned char currentByte;
    
    	cout << "File concatenator." << endl;
    	cout << "2005 Sam D, Gwilliam." << endl;
    	cout << "Enter Path: " << endl;
    	cin >> path;
    
    	for (inFileNo = 20200; inFileNo <= 9000000; inFileNo++)		// Not the most efficient way but a quick fix.
    	{
    		// Generate new in filename and attempt open:
    		sprintf (inFileName, "%s%d.bin", path, inFileNo);	
    		inFile = fopen (inFileName, "rb");
    
    		// If no file, then next infile number:
    		if (!inFile)	
    		{
    			fclose (outFile);
    
    			if (!newFile)
    			{
    				newFile = true;		// If no file found (i.e. sequence broken) start new out file.
    				cout << "Ended file " << outFileName << ", searching..." << endl;
    			}
    
    			continue;
    		}
    
    		// Otherwise success:
    		cout << "Successfully opened file " << inFileName << "." << endl;
    
    		// If this is the start of a sequence then create a new out file:
    		if (newFile)
    		{
    			sprintf (outFileName, "%s%d.txt", path, outFileNo++);
    			cout << "Adding to new file " << outFileName << "." << endl;
    
    			outFile = fopen (outFileName, "wb");
    
    			newFile = false;	// Append this file from now on.
    		}
    
    		// Otherwise, add to the existing one:
    		else
    			cout << "Adding to existing file " << outFileName << "." << endl;
    
    		// Add to out file:
    		for (int fl = 0; fl < 512; fl++)
    		{
    			currentByte = fgetc (inFile);
    			fputc (currentByte, outFile);
    		}
    
    		fclose (inFile);
    	}
    
    	cout << "All done!" << endl;
    
    	return 1;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. hard disk space and spyware
    By oldmancan in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 01-23-2003, 12:24 AM
  2. truely Cleaning a hard disk
    By xds4lx in forum A Brief History of Cprogramming.com
    Replies: 29
    Last Post: 01-22-2003, 11:37 PM
  3. how to store a node on hard disk
    By ALLRIGHT in forum C Programming
    Replies: 3
    Last Post: 05-13-2002, 10:11 AM
  4. program to check hard disk transfer rate
    By shadow99er in forum C Programming
    Replies: 3
    Last Post: 03-01-2002, 04:04 PM
  5. Direct disk access in DOS
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 02-26-2002, 01:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21