diff options
author | Nick Mathewson <nickm@torproject.org> | 2010-08-20 12:30:25 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-08-20 13:40:01 -0400 |
commit | c0c78682508c72940c8c7eee99aaea0da16ce34a (patch) | |
tree | 274e45ffaddd3ea8316e7de1f56cf4e9b76746ec /src/or/config.c | |
parent | 34551cda6f699cee5816a5935b56787ccb7b8f67 (diff) | |
download | tor-c0c78682508c72940c8c7eee99aaea0da16ce34a.tar.gz tor-c0c78682508c72940c8c7eee99aaea0da16ce34a.zip |
Make the windows build succeed with or without -DUNICODE enabled.
This should keep WinCE working (unicode always-on) and get Win98
working again (unicode never-on).
There are two places where we explicitly use ASCII-only APIs, still:
in ntmain.c and in the unit tests.
This patch also fixes a bug in windoes tor_listdir that would cause
the first file to be listed an arbitrary number of times that was
also introduced with WinCE support.
Should fix bug 1797.
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/config.c b/src/or/config.c index 7ad272f74c..6b3bcf6da8 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -3832,7 +3832,7 @@ get_windows_conf_root(void) { static int is_set = 0; static char path[MAX_PATH+1]; - WCHAR wpath[MAX_PATH] = {0}; + TCHAR tpath[MAX_PATH] = {0}; LPITEMIDLIST idl; IMalloc *m; @@ -3859,8 +3859,12 @@ get_windows_conf_root(void) return path; } /* Convert the path from an "ID List" (whatever that is!) to a path. */ - result = SHGetPathFromIDListW(idl, wpath); - wcstombs(path,wpath,MAX_PATH); + result = SHGetPathFromIDList(idl, tpath); +#ifdef UNICODE + wcstombs(path,tpath,MAX_PATH); +#else + strlcpy(path,tpath,sizeof(path)); +#endif /* Now we need to free the memory that the path-idl was stored in. In * typical Windows fashion, we can't just call 'free()' on it. */ |