Cannot install Windows update. Error 0x80073712

Few days I got a complain from one of the users that he cannot install Windows update. I came and checked it and I can see that it is failed with error code 0x80073712. And then I started to research this problem. On one of the pages I found recommendation to execute following commands:

DISM.exe /Online /Cleanup-image /Scanhealth
DISM.exe /Online /Cleanup-image /Restorehealth

Well, this is simple, and I did execute these commands. Both these commands failed with error “The WOF driver encountered a corruption in the compressed file's Resource Table”. Interesting. Then I started searching for this error and found recommendation to execute following command:

sfc /scannow

After I executed this command I got this error at 5%: “windows resource protection could not perform the requested operation”. Then I found advice to execute this command:

chkdsk C: /R

and then re-execute previous command. I did all of these and nothing seems to work. I also found recommendation to execute this command:

ICACLS C:\Windows\WinSxS

I don’t know why everybody recommending execute this command, as it is just display permissions to that directory and it does not do anything at all.

Anyway, nothing helped, and I stared checking logs. One of the logs you have to check is this one: C:\Windows\Logs\CBS\CBS.log. And here things became interesting. I found something like this:

2020-01-17 17:56:30, Error                 CSI    00000062 (F) c0000242 [Error,Facility=(system),Code=578 (0x0242)] #5019776# from Windows::Rtl::SystemImplementation::DirectFileSystemProvider::SysReadFile(h = b2c ('\Device\HarddiskVolume5\ Windows\WinSxS\amd64_microsoft-windows-c..services-certca-dll_31bf3856ad364e35_10.0.18362.1_none_d64bde5c67467f4d\certca.dll'), evt = 0, apcr = NULL, apcc = NULL, iosb = @0x400e77b8f0, data = {l:0 b:}, byteoffset = 0, key = (null))

Apparently, these is problem with file \Device\HarddiskVolume5\ Windows\WinSxS\amd64_microsoft-windows-c..services-certca-dll_31bf3856ad364e35_10.0.18362.1_none_d64bde5c67467f4d\certca.dll

\Device\HarddiskVolume5 is internal name of volume where you did install Windows. If you would like to see mapping of volumes to disks check PowerShell script in this link: https://superuser.com/questions/1058217/list-every-device-harddiskvolume. So effectively something is wrong with file C:\ Windows\WinSxS\amd64_microsoft-windows-c..services-certca-dll_31bf3856ad364e35_10.0.18362.1_none_d64bde5c67467f4d\certca.dll assuming you installed Windows on drive C. Note: problem was actually with different file, but I didn’t save name of the file. I did check this file and it was missing. And directory was missing too. I copied that directory from another computer. It is a bit tricky because by default you don’t have permission to copy files there. So, I had to take ownership of directory I just created and then copy file. Standard stuff, I sure you can find information how to do it.

Anyway, I did execute sfc command again and now it failed at 12% with same error. I checked C:\Windows\Logs\CBS\CBS.log and this time it complained on file C:\Windows\System32\certca.dll. I took that file from different computer, but before I overwrite existing file it is always good idea to save old file, just in case. But when I attempt to copy this file, I got message: “The specified buffer contains ill-formed data”. I tried Explorer, command line and other utilities and I always got this error. I even write small app and that app also returns the same error. Hmm. At that moment I suspected that it can be virus, damaged file system, or disk failure. I did boot from USB drive and still not able to read file. chkdsk couldn’t find any issues and vendor tool didn’t find any issues with disk. And then I accidentally found that C:\Windows\System32\certca.dll is not a file but hard link. Somehow file was deleted and hard link stays pointing to nothing. It should not happen became hard link should increase reference count on file and file should stay anyway. Internally hard link is almost the same as regular file entry in directory.

I executed following command on another computer:

C:\Windows\System32>fsutil.exe hardlink list certca.dll

And got this output:

\Windows\System32\certca.dll
\Windows\WinSxS\amd64_microsoft-windows-c..services-certca-dll_31bf3856ad364e35_10.0.18362.1_none_d64bde5c67467f4d\certca.dll

So effectively certca.dll is just pointer to \Windows\WinSxS\amd64_microsoft-windows-c..services-certca-dll_31bf3856ad364e35_10.0.18362.1_none_d64bde5c67467f4d\certca.dll. I did re-create hard link \Windows\System32\certca.dll that points to \Windows\WinSxS\amd64_microsoft-windows-c..services-certca-dll_31bf3856ad364e35_10.0.18362.1_none_d64bde5c67467f4d\certca.dll and executed sfc command. And now it failed at 55%.

Later I found another case that file and hard link are exist, but file is corrupted, so I have to delete both and do the same as above.

Unfortunately, this story does not have happy ending. After sfc went to 100% it founds that many files should be restored but they are missing or corrupted in SxS store. After that I came to conclusion that that Windows is damaged so badly, that it is not worth my time.

I had USB drive with latest version of Windows (1903 at this moment) and just plugged it in and run setup.exe from it. Then I selected to “Keep my apps and file” and after 2 hours and I got working Windows with all files and settings. I was able to install update, and everything works fine.

So, while I wasn’t able to restore Windows by myself, I think it could be helpful for someone in case when one or two files are broken.