I just built Tor and the test suite with UNICODE enabled (MS Visual-C v16 on Win-XP SP3). With some patching, the test-programs compiled and ran mostly fine. Except test_util_spawn_background_ok() failed for a reason I did't understand initially:
test --warn
util/spawn_background_ok: Nov 23 14:35:55.531 [warn] Failed to create child process test-child.exe: Systemet finner ikke angitt fil.
FAIL test_util.c:1405: assert(process_handle.status == expected_status): -1 vs 1 [spawn_background_ok FAILED]
util/spawn_background_partial_read: Nov 23 14:35:55.546 [warn] Failed to create child process test-child.exe: Systemet finner ikke angitt fil.
FAIL test_util.c:1521: assert(process_handle.status == expected_status): -1 vs 1 [spawn_background_partial_read FAILED]
("Systemet finner ikke angitt fil" -> "System doesn't find specified file").
I think the reason is that CreateProcessW() is used in common/util.c. The function is passed a 'const char *const filename'. Either we should always use CreateProcessA() or convert 'filename' using mbstowcs(). What do you think?
--gv
On Wed, Nov 23, 2011 at 11:02 AM, Gisle Vanem gvanem@broadpark.no wrote: [...]
("Systemet finner ikke angitt fil" -> "System doesn't find specified file").
I think the reason is that CreateProcessW() is used in common/util.c. The function is passed a 'const char *const filename'. Either we should always use CreateProcessA() or convert 'filename' using mbstowcs(). What do you think?
So, in the rest of util.c it looks like we do a conditional mbstowcs() before calling a Windows function that expects a TCHAR. So we should either do that, or have a wrapper function that does a conditional mbstowcs or strlcpy depending on whether UNICODE is defined.