Move Windows OS-specific functions to make porting easier.

Several functions that need to be redefined for a Windows port are right
in the middle of other code that is relatively portable. This patch
isolates the functions that need Windows-specific implementations so
they can be built conditionally in the portable tree.

ok jsing@ deraadt@