Implemented file handling on Windows

The pwd.h header does not work for Windows but shlobj.h replaces this
functionality.

Used platform specific functions for the rest of the code since it was
already dependent on it for the pwd.h replacement.