0

I am working on a windows VSS application, I want some help regarding it. After creating snapshot, how can I copy the files or files' blocks(sectors), preferably files' blocks, from volume snapshot using C/C++. Can someone guide me on this or can direct me to any samples or documentation doing the same.

Thanks in advance.

Jorge Chon
  • 61
  • 8

1 Answers1

0

You can access VSS snapshot items using regular functions

CreateFile() to open a file

ReadFile() or BackupRead() to read/backup its data

Only the root path to the items will change

(for example, \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopyX\ instead of C:\ )

What do you want to know exactly?

mbarthelemy
  • 12,465
  • 4
  • 41
  • 43
  • Hi, Thanks for replying, exactly I want to copy all the file's block(sectors) that are present in the snapshot. So would your suggested method would be applicable for this? – Jorge Chon Oct 17 '12 at 10:08
  • Also one more question I have to ask, I have exposed the shadow copy as a mount point to a directory, now that directory is read only, so how can I read it. I tried to open it using CreateFile but I got Error 5(Access Denied). So how can I access it using CreateFile? – Jorge Chon Oct 17 '12 at 10:19
  • Hi, Ok now I solved the Access denied error by using FILE_FLAG_BACKUP_SEMANTICS in CreateFile. Now how can I copy all the file's block(sectors) or files that are present in the shadow copy? – Jorge Chon Oct 17 '12 at 12:52
  • Did you try the ReadFile() or BackupRead() functions mentionned in my answer? Or do you need something else? To enumerate the snapshot's content (files, directories...) you would have to use FindFirstFile()/FindNextFile() (see http://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx) – mbarthelemy Oct 17 '12 at 17:32
  • Hi, Enumerated the files using FindFirstFile()/FindNextFile(), but its not listing all the files present in my drive. For eg: $AttrDef, $Bitmap, $MFT etc. how can I list all these files also? And also do you know anything about FSCTL_GET_RETRIEVAL_POINTERS? – Jorge Chon Oct 22 '12 at 08:01