Fix compile error on MSVC 2010: tchar.h must come before strsafe.h
Use _tmain() instead of main() when compiling on Windows
Fix compilation under C89

Visual Studio 2010 doesn't support C99(!).
Use StringCchPrintf/snwprintf consistently throughout
Use TCHAR consistently throughout
Enable compiler warnings, and fail on warnings