Enable build on windows.

Also rename CreateDirectory to CreateDir to avoid conflicts, since windows
has defined a CreateDirectory macro already.