Port MainWindowBuildTools to the build tools written in C
Fix remaining issues for using the build tools written in C

It is finally compilable.