Fix Windows Bug

File IO was causing issues on Windows - due to the half-baked file
permissions IO wasn't happening correctly; many #defines have had to
\#undef'd and ignored.

The start of using a key structure has also been outlined (it'll be part
of the next release).