Here is what happened since last post:
Freeloader is now able to read files and follow symlinks from btrfs partition. One major issue is left here - case sensitivity. BTRFS is case-sensitive file system, so paths like /ReactOS/System32, /reactos/system32, /ReactOS/system32 are different here. But in Windows world most software is written assuming that case does not matter during path lookup. This thing is solved in WinBtrfs driver, but for Freeloader it can be a bit tricky. Right now I’ve implemented a hack for this, we will handle this later.
During Freeloader development, I’ve found a bug in VirtualBox BIOS implementation. At first, my boot sector didn’t work on VirtualBox and finding out what’s wrong there was annoying. The problem was in INT 13h AH=42h implementation: in VirtualBox it can’t read more than 8 sectors per call. Simple fix, but much time spent on debugging…
After Freeloader was done and VirtualBox bug fixed, I was able to get to first error message from btrfs-booted ReactOS :)
Now it’s time to fix errors in ReactOS itself, not in bootloader.
This message was not obvious to fix. The exception, which caused this error (STATUS_ACCESS_VIOLATION), lead me to winsxs code, which is mostly imported from Wine. But finally, I’ve found the reason - it’s a bug in WinBtrfs driver. It works wrong when using NtQueryDirectoryFile with a file mask, which starts with the "*" symbol.
Our winsxs implementation heavily relies on this function and makes queries like "*_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.*.*_*_*.manifest" to find appropriate manifest when needed, so it failed quite early because of this bug. A pull-request to the upstream repository with a bugfix is here.
This was the only bug, which prevented booting to desktop:
So, right now ReactOS is able to boot from BTRFS partition and it is in quite stable state. But there are a lot of problems left:
- Pagefile cannot be created on such partition. Our paging implementation is different from Windows one and requires extra functions in FS driver to be implemented.
- Errors during some write operations. For example, it is not able to install Git right now. Will need to investigate this.
- Occasional BSODs during shutdown. This problem is already tracked down, seems like nobody tried to use WinBtrfs as boot driver before :)
More PRs to upstream are expected next week.
I want to say huge thanks to all mentors in IRC and especially Hermès Bélusca-Maïto who helped me a lot with tracking down all these issues :)