Index: win32/win32.c =================================================================== --- win32/win32.c (revision 27909) +++ win32/win32.c (working copy) @@ -992,10 +992,13 @@ { BOOL fRet; DWORD dwCreationFlags; - STARTUPINFO aStartupInfo; + STARTUPINFOW aStartupInfo; PROCESS_INFORMATION aProcessInformation; SECURITY_ATTRIBUTES sa; struct ChildRecord *child; + + WCHAR* wprog = NULL; + WCHAR* wcmd = NULL; if (!cmd && !prog) { errno = EFAULT; @@ -1015,9 +1018,17 @@ psa = &sa; } - memset(&aStartupInfo, 0, sizeof (STARTUPINFO)); + if (!(wprog = utf8_to_wstr(prog, NULL)) || !(wcmd = utf8_to_wstr(cmd, NULL))) + { + free(wcmd); + free(wprog); + + return NULL; + } + + memset(&aStartupInfo, 0, sizeof (STARTUPINFOW)); memset(&aProcessInformation, 0, sizeof (PROCESS_INFORMATION)); - aStartupInfo.cb = sizeof (STARTUPINFO); + aStartupInfo.cb = sizeof (STARTUPINFOW); aStartupInfo.dwFlags = STARTF_USESTDHANDLES; if (hInput) { aStartupInfo.hStdInput = hInput; @@ -1041,11 +1052,14 @@ dwCreationFlags = (NORMAL_PRIORITY_CLASS); RUBY_CRITICAL({ - fRet = CreateProcess(prog, (char *)cmd, psa, psa, + fRet = CreateProcessW(wprog, wcmd, psa, psa, psa->bInheritHandle, dwCreationFlags, NULL, NULL, &aStartupInfo, &aProcessInformation); errno = map_errno(GetLastError()); }); + + free(wcmd); + free(wprog); if (!fRet) { child->pid = 0; /* release the slot */