Remove WinAPI and implement a small subset of it.