Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Tor Tor
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 313
    • Issues 313
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 34
    • Merge requests 34
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • The Tor Project
  • Core
  • TorTor
  • Issues
  • #1797
Closed
Open
Created Aug 04, 2010 by Nick Mathewson@nickm👁Owner

Restore support for building Tor in non-Unicode Windows installations

When we merged WinCE support in 8d31141c, 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 8d31141c 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 legacy/trac#1715 (moved).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking