Cross-build on Windows and DBCS fix

Hi,
I fixed some issues around cross-building (mostly for Win64) and DBCS.
Please check it.