2

When I boot Windows the log shows then instead of the login screen it shows a black screen with a cursor. The same thing happens with safe mode.

When running Startup Repair the SrtTrail.txt says a recently serviced boot binary is corrupt. but it doesn't tell me which one!

Therefore, I am booting into the Windows Recovery Environment from an install USB to try to repair my system files.

My Windows drive is mounted as F:\ so I am running dism with:

dism.exe /Image:F:\ /Cleanup-Image /Restorehealth

Which seems to suggest that there is no corruption so I then run sfc with:

sfc /scannow /offbootdir=F:\ /offwindir=F:\Windows /offbootdir=F:\Windows\System32\LogFiles\sfc-1.txt

However, whenever I run that command, SFC fails with

Windows Resource Protection could not perform the requested operation.

and at the bottom of the log it says:

00001177 [SR] Verify complete
00001178 [SR] Verifying 1 components
00001179 [SR] Beginning Verify and Repair transaction
0000117a@2020/1/4:12:46:43.995 (F) onecore\base\wcp\sil\fs_rerooted.cpp(424): Error c0000039 [Error,Facility=(system),Code=57 (0x0039)] originated in function Windows::Rtl::SystemImplementation::CRerootedFileSystemProvider::SysCreateFile expression: (null)
0000117b (F) c0000039 [Error,Facility=(system),Code=57 (0x0039)] #2775836# from Windows::Rtl::SystemImplementation::CSystemIsolationLayer_IRtlSystemIsolationLayerTearoff::OpenFilesystemDirectory(flags = 0, da = (FILE_GENERIC_READ|FILE_EXECUTE), dn = [l:7]'\??\C:\', sa = (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE), oo = (FILE_DIRECTORY_FILE|FILE_SYNCHRONOUS_IO_NONALERT|FILE_OPEN_FOR_BACKUP_INTENT), dir = NULL, disp = (null))
0000117c (F) c0000039 [Error,Facility=(system),Code=57 (0x0039)] #2775835# from CFileInstaller::CommitChanges(...)
0000117d (F) c0000039 [Error,Facility=(system),Code=57 (0x0039)] #2775834# from PrimitiveInstaller::CCoordinator::FinalizeChanges(...)
0000117e Direct SIL provider: Number of files opened: 25318.
0000117f Direct SIL provider: Number of files opened: 4.
00000003 Servicing stack shim unable to mark handle 1e0 ('\Device\Ramdisk{d9b257fc-684e-4dcb-ab79-03cfa2f6b750}\Windows\temp\SSS_8f26c8f8fcc2d501010000005c032403\msdelta.dll') for delete-on-close, error STATUS_CANNOT_DELETE
00000004 Servicing stack shim unable to mark handle 198 ('\Device\Ramdisk{d9b257fc-684e-4dcb-ab79-03cfa2f6b750}\Windows\temp\SSS_8f26c8f8fcc2d501010000005c032403') for delete-on-close, error STATUS_DIRECTORY_NOT_EMPTY

I tried moving F:\Windows\System32\msdelta.dll to a different directory and re-running sfc but I still get the same error for the same file.

The same thing happens even after a reboot. It gets stuck on that same file even if it isn't in the System32 directory.

The error seems to be saying that it can't delete the file after it has finished with it rather than saying that there is anything wrong with it.

Is there anything I can do to avoid this?

The only option I can think of is to write a bat file that loops over all the files in System32 and calls sfc with the scanfile option instead.

EDIT: I ran sfc with the /scanfile option to check a single file and got the same message at the end of the log file:

    sfc /scanfile=F:\Windows\System32\dwm.exe /offbootdir=F:\ /offwindir=F:\Windows /offbootdir=F:\Windows\System32\LogFiles\sfc-1.txt

Gives

00000003 [SR] Verifying 1 components
00000004 [SR] Beginning Verify and Repair transaction
00000005 [SR] Verify complete
00000006 Direct SIL provider: Number of files opened: 22.
00000007 Direct SIL provider: Number of files opened: 4.
00000003 Servicing stack shim unable to mark handle 84 ('\Device\Ramdisk{d9b257fc-684e-4dcb-ab79-03cfa2f6b750}\Windows\temp\SSS_fbc9cb9692c3d50101000000f006f406\msdelta.dll') for delete-on-close, error STATUS_CANNOT_DELETE
00000004 Servicing stack shim unable to mark handle 194 ('\Device\Ramdisk{d9b257fc-684e-4dcb-ab79-03cfa2f6b750}\Windows\temp\SSS_fbc9cb9692c3d50101000000f006f406') for delete-on-close, error STATUS_DIRECTORY_NOT_EMPTY

Which makes me think that the reference to msdelta.dll is maybe not the problem here, although it is strange and confusing as to why it appears in the log every time.

opticyclic
  • 1,549
  • 1
  • 14
  • 21
  • You have run chkdsk right? Resource Protection typically is an indication of a issue that chkdsk will discover[.](https://superuser.com/questions/694349/how-do-i-repair-the-corrupted-files-found-by-sfc-scannow-windows-resource-pro) – Ramhound Jan 04 '20 at 06:10
  • What got you in this situation, what problem are you trying to solve? Have you checked the SMART data for that hard drive? – Moab Jan 04 '20 at 16:15
  • chkdsk shows no problems. I havent checked SMART. FYI: my Ubuntu partition boots fine. I think what got me into this situation might have been shrinking the Windows partition and moving it to the right to make space for a recovery partition. – opticyclic Jan 04 '20 at 21:15
  • 2
    @opticyclic `DISM`'s `/restorehealth` parameter checks for/repairs corruption in `%WinDir%\WinSxS`, which houses a backup of all system files. `SFC` then uses the known good backups in `WinSxS` to check for/repair corruption in `%WinDir%`, which is why `/restorehealth` must precede `SFC`. You could also try extracting the `WinSxS` directory from the `install.esd` (mount, then copy/paste outside the mount), then running `/restorehealth` with that `WinSxS` directory as the `/source` (or using the `WinSxS` directory from another PC), but short of that, you may have to perform a clean install. – JW0914 Jan 05 '20 at 13:00
  • 1
    @opticyclic [This](https://repo.palkeo.com/repositories/mirror7.meh.or.id/Windows/ntstatus.txt) is the only thing I could find that explains what error `c0000039` is: `STATUS_OBJECT_PATH_INVALID Object Path Component was not a directory object`. If DISM cannot repair the Component Store (`%WinDir%\WinSxS`) and `SFC` cannot repair `%WinDir%` with a clean Component Store, the only efficient option is to do a repair install if able to boot to Windows, else a clean install _(if you select the same partition, the installer will move all data from the current install to `C:\Windows.old`)_. – JW0914 Jan 05 '20 at 13:07
  • @opticyclic Did you run the `/StartComponentCleanup` parameter prior to running `/RestoreHealth`? As to moving Windows partitions, if that ever causes an issue, `BootRec /FixMbr` > `BootRec /FixBoot` _(BIOS only, not UEFI)_ > `BootRec /RebuildBCD` will resolve – JW0914 Jan 05 '20 at 13:09
  • I did run the component cleanup as mentioned in the other question. I'm currently in the middle of backing up the users dir but I'll try extracting Winsxs after it completes (12 hours so far!) – opticyclic Jan 05 '20 at 18:30

0 Answers0