[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] #1797 [Tor - Tor client]: Restore support for building Tor in non-Unicode Windows installations



#1797: Restore support for building Tor in non-Unicode Windows installations
------------------------------+---------------------------------------------
 Reporter:  nickm             |       Owner:     
     Type:  defect            |      Status:  new
 Priority:  normal            |   Milestone:     
Component:  Tor - Tor client  |     Version:     
 Keywords:  easy, windows     |      Parent:     
------------------------------+---------------------------------------------
 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 [http://msdn.microsoft.com/en-
 us/library/dd317766(v=VS.85).aspx 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.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/1797>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs