I was wondering if DeleteFile completely removes the file from the hdd or just the references to the file?? If it doesn't remove it completely, what API can i use to achieve this??
Posted on 2006-01-04 03:40:07 by lone_samurai5
What do you mean by "deleting" a file? DeleteFile just marks it as "free space" on the hdd, so other files can use that space freely. The contents remain there though.

If you want to remove it's contents, just zero it before deleting. I don't know why you want this, though. It can be quite slow if the file gets large.

I might be wrong, but I think this is the basic principle behind it.
Posted on 2006-01-04 06:03:52 by The Grey Beast
If you want to securely delete a file you have to fill it with 0s then with 1s and so on. IIRC the pattern goes like this: 00, FF, EE, AA, 00. It has something to do with the way the bits are stored on a HDD. you should google for it if you're interested in super-secure file deleting.
Posted on 2006-01-04 08:28:04 by ti_mo_n
Posted on 2006-01-06 00:24:12 by XCHG
samurai,

If you are woried about the security aspects of what can be recovered from a HDD, open the file, get its length the create a buffer the same length filled with whatever character you like then write it back to the file. Do this about 10 or more time remembering to flush the write to disk each time and change the fill byte in the buffer each time. When you have written to it enough times and flushed it to disk to make sure it was actually written to disk, then delete the file and superman could not recover it.
Posted on 2006-01-06 02:22:22 by hutch--
Thanx everyone.. i'm not really worried bout security and stuff, i just came across this app, which said that it deletes the file and makes sure it can't be recovered.. I was just wondering how it was done..
Posted on 2006-01-06 08:58:41 by lone_samurai5

Posted on 2006-01-06 14:03:27 by skywalker

Posted on 2006-01-09 15:18:34 by skywalker
Here is the code I wrote previously.
Posted on 2006-01-09 16:33:43 by Darrel
Is there any point in using the SHFileOperation for deletion? Does it do anything that DeleteFile doesn't?
Posted on 2006-01-09 16:44:15 by f0dder