Unicode fix for VS2013

VS2013 compiles with Unicode set so needs to handle Windows functions returning WCHAR's instead of char.

@robn is this ok for MINGW?