04-19-2004, 09:22 PM | #1 (permalink) |
Devils Cabana Boy
Location: Central Coast CA
|
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.
__________________
Donate Blood! "Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen |
04-20-2004, 12:10 AM | #2 (permalink) |
Once upon a time...
|
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
__________________
-- Man Alone ======= Abstainer: a weak person who yields to the temptation of denying himself a pleasure. Ambrose Bierce, The Devil's Dictionary. |
04-20-2004, 05:50 AM | #3 (permalink) |
I am Winter Born
Location: Alexandria, VA
|
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.
__________________
Eat antimatter, Posleen-boy! |
04-20-2004, 06:52 AM | #4 (permalink) |
Wehret Den Anfängen!
Location: Ontario, Canada
|
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`; }
__________________
Last edited by JHVH : 10-29-4004 BC at 09:00 PM. Reason: Time for a rest. |
04-22-2004, 06:15 PM | #5 (permalink) |
Devils Cabana Boy
Location: Central Coast CA
|
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?
__________________
Donate Blood! "Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen |
04-22-2004, 06:26 PM | #6 (permalink) |
WARNING: FLAMMABLE
Location: Ask Acetylene
|
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 ;-)
__________________
"It better be funny" Last edited by kel; 04-22-2004 at 06:36 PM.. |
04-22-2004, 07:56 PM | #8 (permalink) |
WARNING: FLAMMABLE
Location: Ask Acetylene
|
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.
__________________
"It better be funny" |
04-23-2004, 07:00 AM | #9 (permalink) |
WARNING: FLAMMABLE
Location: Ask Acetylene
|
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.
__________________
"It better be funny" Last edited by kel; 04-23-2004 at 07:03 AM.. |
04-23-2004, 10:16 AM | #10 (permalink) |
Devils Cabana Boy
Location: Central Coast CA
|
now were geting some where thanks for the help ill try with that and come back for more later
__________________
Donate Blood! "Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen |
Tags |
editing, lba |
|
|