CreateChild.patch

Vit Ondruch, 05/20/2010 06:32 PM

Download (1.51 KB)

View differences:

win32/win32.c (working copy)
992 992
{
993 993
    BOOL fRet;
994 994
    DWORD  dwCreationFlags;
995
    STARTUPINFO aStartupInfo;
995
    STARTUPINFOW aStartupInfo;
996 996
    PROCESS_INFORMATION aProcessInformation;
997 997
    SECURITY_ATTRIBUTES sa;
998 998
    struct ChildRecord *child;
999
    
1000
    WCHAR* wprog = NULL;
1001
    WCHAR* wcmd = NULL;
999 1002

  
1000 1003
    if (!cmd && !prog) {
1001 1004
	errno = EFAULT;
......
1015 1018
	psa = &sa;
1016 1019
    }
1017 1020

  
1018
    memset(&aStartupInfo, 0, sizeof (STARTUPINFO));
1021
    if (!(wprog = utf8_to_wstr(prog, NULL)) || !(wcmd = utf8_to_wstr(cmd, NULL)))
1022
    {
1023
        free(wcmd);
1024
        free(wprog);
1025
        
1026
    	return NULL;
1027
    }
1028

  
1029
    memset(&aStartupInfo, 0, sizeof (STARTUPINFOW));
1019 1030
    memset(&aProcessInformation, 0, sizeof (PROCESS_INFORMATION));
1020
    aStartupInfo.cb = sizeof (STARTUPINFO);
1031
    aStartupInfo.cb = sizeof (STARTUPINFOW);
1021 1032
    aStartupInfo.dwFlags = STARTF_USESTDHANDLES;
1022 1033
    if (hInput) {
1023 1034
	aStartupInfo.hStdInput  = hInput;
......
1041 1052
    dwCreationFlags = (NORMAL_PRIORITY_CLASS);
1042 1053

  
1043 1054
    RUBY_CRITICAL({
1044
	fRet = CreateProcess(prog, (char *)cmd, psa, psa,
1055
	fRet = CreateProcessW(wprog, wcmd, psa, psa,
1045 1056
			     psa->bInheritHandle, dwCreationFlags, NULL, NULL,
1046 1057
			     &aStartupInfo, &aProcessInformation);
1047 1058
	errno = map_errno(GetLastError());
1048 1059
    });
1060
    
1061
    free(wcmd);
1062
    free(wprog);
1049 1063

  
1050 1064
    if (!fRet) {
1051 1065
	child->pid = 0;		/* release the slot */