Search code examples
windowswindows-vistavolume-shadow-serviceshadow-copylocked-files

Microsoft VSHADOW.EXE shadow copies contain locked files?


I've been writing a backup program using VSS and started out with VSHADOW.EXE from the Windows SDK 6.1 Samples. It generally works, but I was astonished to see that certain files are still locked inside the shadow copies it creates, such as

C:\Users\Felix\NtUser.dat
C:\Users\Felix\NtUser.dat.log1
C:\Users\Felix\AppData\Local\Microsoft\Windows\UsrClass.dat
C:\Users\Felix\AppData\Local\Microsoft\Windows\UsrClass.dat.log1
...

Accessing these files in the shadow copy (either with CreateFileEx, CopyFileEx or with Total Commander or any other tool) usually gives me an Error 32 (The process cannot access the file because it is being used by another process). It seems to occur arbitrarily. How can that be?

My previous edit (event log messages) turned out not to be the core of this issue, because I got it fixed and it didn't help.


Solution

  • The files in question turned out to be symbolic links to other locked files. The respective files in the shadow copy were also symbolic links which pointed to the locked files on the original hard disc. To solve the problem, the symlink must be resolved and the file it points to must be found out, then this file must be located in the shadow copy.