INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Recovering files with vb6

Recovering files with vb6

(OP)
Is there a way to build a file recovery utility using vb6?
I have a Sony HD camera with internal memory and plug in card memory that I foolishly selected the format function when what I really wanted to do was change from internal memory format to plug in card memory. The Sony camera touch screen menu is a bit misleading.

The camera appears just like a FAT32 32gb USB memory stick so you can view files and folders normally.
The format process was very quick so I don't think it actually wrote over the original file and I haven't used it since my mistake.

I would want to copy the "deleted" AVCHD (.MTS) files to my computer, not reinstate the original files in the camera like the old Windows DOS Recover routine used to do.

The commercially available ones I have tried only recover Jpgs, Movs and AVIs as they were written some time ago as you can only enter the file types from a fixed list.

If possible what would be the approach?

RE: Recovering files with vb6

This isn't something I'd recommend trying from VB. But there are tools - yes, free ones - that can help and will find all types of files. One such is http://www.easeus.com/resource/memory-card-format-.... The limitation with the free version is that it will only recover files smaller than 1Gb, which may be a problem for video files. But you could at least try it and see whether it is then worth paying to remove the limitation.

RE: Recovering files with vb6

(OP)
Thanks.
As part of this exercise I was interested in learning how this is done (as well as recovering my files)
For example how do I view the previously used parts of a disk?
If I could, would I be able to search for the pattern of the start and end of each lost file?
I verified that the first 20 bytes of all my AVCHD (.MTS) files start with the same characters represented by ÿØÿágExifII* z when a simple input function is used on a good file.
I vaguely remember doing this sort of thing in the old DOS days.

I guess if some of the movie files are fragmented, it would be difficult to reassemble them if the fragmentation reference is lost.

RE: Recovering files with vb6

>For example how do I view the previously used parts of a disk?

Well, once upon a time some of us used to do it through DOS interrupt 21 (as I recall) ...

We can't do that these days, and not with VB. We have to take a different approach.

Here's an outline of the process using Win32 API calls:

1.Get a handle to the drive (CreateFile)
2.Determine sector size (GetDiskFreeSpace)
3.Allocate a data buffer (VirtualAlloc)
4.Find the start of the sector(s) we want to read (SetFilePointer)
5.Read the entire sector(s) in the buffer (ReadFile)

However the problem will be determine where the files start since formatting erases both copies of the File Allocation Table, the core index used by FAT file systems to track where a file starts and the sequence of clusters used by the file (i.e. the 'fragmentation reference' as per your post)

So that means you'd have to search through the sectors looking for the start of your files and somehow reconstructing them sector (or cluster) by sector.

I had a large, detailed technical book that broke down all of FAT for me, but that is long gone (chucked out by a wife who felt I really didn't need all my ancient manuals), but the following wiki page give a fairly good summary of how FAT is layed out, which should help http://en.wikipedia.org/wiki/Design_of_the_FAT_fil.... Good luck

RE: Recovering files with vb6

(OP)
Yes I too have a wife who continually asks me if I want this or that piece of 'memorabilia' when the local council have one of their 'clean up your junk' kerbside collections. I have to guard it all carefully!
My favorite is an original Cleveland Xt made in 1985. The only wholly Australian manufactured PC's ever made (except for the chips). It was named after the suburb of Cleveland in Brisbane, not Ohio.
It only has a floppy, 5k ram and an orange 10" screen.

Thanks for the info. I shall investigate further.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close