Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   editing with LBA with C (https://thetfp.com/tfp/tilted-technology/52979-editing-lba-c.html)

Dilbert1234567 04-19-2004 09:22 PM

editing with LBA with C
 
i want to make a program that can write to a haard drive via the LBA number (so i can go all the way through it)

what library can i do this with, dos.h can do CHS but i want to use LBA so i can do large drives.

basicly i want to write a program that i can run and it will wipe everything on a hard drive. it will take a while but it just needs to be done. im thinking of placeing it on a botable floppy so i stick it in and it erases hard drive 0.

manalone 04-20-2004 12:10 AM

if you're not wedded to writing it yourself, you could use one of those bootable linux floppies and write a shell script that uses dd to overwrite it.

Sorry I coulndn't be more helpful :)

Pragma 04-20-2004 05:50 AM

As a note, if you're doing this for information security (ie: I want to be paranoid and wipe all of my data):

The DoD standard for data wiping is a minimum of seven passes, alternating between writing 0x00 and 0xFF - though there are much more hefty methods involving 20+ passes writing random data.

Yakk 04-20-2004 06:52 AM

Code:

#!/usr/bin/perl
if ($ARGC < 2) {
  print "Usage: $0 hard_drive_name hard_drive_size\n";
}
my ($hard_drive,$hard_drive_size) = @ARGV;
for(my $i = 0; $i < 20; ++$i) {
`cat /dev/random | dd bs=1k count=$hard_drive_size>$hard_drive`;
}


Dilbert1234567 04-22-2004 06:15 PM

hmmm i've had no trouble finding libraries that will allow me to do CHS, but not LBA, CHS limits me to the first 528 meg of the hard drive, anyone else have an idea?

kel 04-22-2004 06:26 PM

Access to the HD is provided by the OS, it's also protected by it, so what operating system do you want to access the disk directly on?

Normally you access it through the filesystem and not directly, so most libraries don't focus on it.

The Win32 API probably has something for it, LBA access at least, you could inline assembly and talk directly to the HD.

I would say more, but Win32 and intel assembly aren't well documented ;-)

Dilbert1234567 04-22-2004 07:37 PM

in the end it will be from a boot disk, dos most likely

kel 04-22-2004 07:56 PM

Well if it's a boot disk then do exactly what Yakk showed you, you can probably find a floppy or CD linux distro that has Perl, Knoppix definitely does, and you could cut it up so Knoppix boots to the console really quickly without loading everything.

kel 04-23-2004 07:00 AM

You should be able to inline assembly in C
http://home.teleport.com/~brainy/diskaccess.htm

Here is a little on inlining assembly
http://www.idt.com/docs/79R3041_AN_78591.pdf
How you do it is compiler and platform specific.

Dilbert1234567 04-23-2004 10:16 AM

now were geting some where thanks for the help ill try with that and come back for more later


All times are GMT -8. The time now is 09:21 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54