Restore support for building Tor in non-Unicode Windows installations
When we merged WinCE support in 8d31141ccbdbeee9589d04ea99819af7aa35193b, we reportedly broke Win98 (!?) by requiring the Unicode versions of functions that previously had used the ascii variants.
The real fix here is to use the generic version of each WinAPI function, plus appropriate macros to make it build either with the UNICODE preprocessor macro defined or undefined.
In other words, where previously we said in our Windows code
void func(const char *filename) {
HANDLE library = LoadLibrary("filename.dll");
CreateFile(filename, ...)
}
and now since 8d31141 we say
void func(const char *filename) {
HANDLE library = LoadLibraryW(L"filename.dll");
WCHAR wfilename[MAX_PATH]= {0};
mbstowcs(wfilename,filename,MAX_PATH);
CreateFileW(wfilename, ...)
}
we should instead say
void func(const char *filename) {
HANDLE library = LoadLibrary(TEXT("filename.dll"));
#ifdef UNICODE
WCHAR tfilename[MAX_PATH]= {0};
mbstowcs(tfilename,filename,MAX_PATH);
#else
const char *tfilename = filename;
#endif
CreateFile(tfilename, ...)
}
Thanks to mingw-san for pointing this out on bug #1715 (moved).