Fix stat/lstat/getpid on Windows