Re: FileCopy overwrites the existing file

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



gtea wrote:
Hi,

I have a question about the use CopyFile() function from the Windows API. if the Boolean flag sets to false and new file already exists, the function overwrite the existing file and succeeds. In this case, does the contents of copied-to file (before overwriting) still exist on the hard driver somewhere and can be retrived using some type of trieval software?

Any responses would be really appreciated!

If you're lucky your new file will overwrite the disk sectors occupied by old file (if new file is of the same size or larger), but you can't make any assumption about that. It is possible as well that the new file will be stored in completely different disk sectors/clusters and the old file will be possible to recover.

Note that even if you wrote a low level utility (driver?) overwrites exactly the same the sectors as old file, it would still be possible to recover parts of that file if it has been moved earlier by for example a defragmentation program service. The usual approach to be 100% sure is to rewrite all unnocupied sectors in the hardrive (quite expensive approach).

Also be aware that simple overwriting of the file is not enough to make it unrecoverable by data recovery specializing entities. You'll need to perform multiple overwrite of such file's sectors with *random* data.

--
Grzegorz Wróbel
http://www.4neurons.com/
677265676F727940346E6575726F6E732E636F6D
.



Relevant Pages

  • Re: secure file deletion
    ... Tim Haynes wrote: ... >> On what to overwrite with I'd say I expect the number of overwrites to be ... Some drives employ unpublished 'reserve' tracks and use them to ... replace sectors which start to become unreliable. ...
    (comp.os.linux.security)
  • Re: on old hard disks
    ... The problem there is that you may not be able to overwrite all sectors via ... if you could recover both the most recently written data ...
    (sci.electronics.design)
  • Re: Basic Floppy Disk loader help.
    ... > Does anybody see why this bombs if i put 3Ch or above in ... This is a really old bug I can't seem to pinpoint. ... wouldn't this overwrite your code? ... Whereas 59 sectors writes that last byte just before ...
    (comp.lang.asm.x86)
  • Re: disks
    ... > I would like to overwrite all sectors of the disk. ... Type in "man format" ...
    (comp.unix.solaris)
  • RE: Interesting One reading a 30x over-written drive
    ... I believe that DoD recommendations is to completely overwrite the drive ... As stated in other posts this does not mean "deleting the ... original data is then too hard to hard recover. ...
    (Security-Basics)