Re: dlls/msvcrt: msvcrt-popen-2.diff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On November 2, 2002 10:41 am, Jaco Greeff wrote:
> +#define POPEN_WCMD_EXEC     "C:\\Windows\\System32\\cmd.exe /c"

Do we need this hardcoded path here?!? What about the COMSPEC
idea that Francois suggested?

> +#define LPCWSTR_TO_LPSTR(wszIn, nIn, szOut, nOut) \
> +    *nOut = WideCharToMultiByte(CP_ACP, 0, wszIn, nIn, NULL, 0, NULL,
> NULL);    \
> +    szOut = (CHAR *)MSVCRT_malloc((*nOut+1)*sizeof(CHAR));                
>      \
> +    if (szOut)                                                            
>      \
> +    {                                                                    
>      \
> +        WideCharToMultiByte(CP_ACP, 0, wszIn, nIn, szOut, *nOut+1, NULL,
> NULL); \
> +        szOut[nLen] = '\0';                                              
>      \
> +    }                                                                    
>      \
> +    else                                                                  
>      \
> +        *nOut = 0;
> +
> +#define CREATE_PIPE(hRead, hWrite, security) \
> +    if (!CreatePipe(&hRead, &hWrite, &security, 0))                      
>      \
> +    {                                                                    
>      \
> +        TRACE("Creation of pipe failed\n");                              
>      \
> +        return NULL;                                                      
>      \
> +    }
> +
> +#define REDIRECT_STREAM(type, handle)\
> +    if (!SetStdHandle(type, handle))                                      
>      \
> +    {                                                                    
>      \
> +        TRACE("Redirection of stream failed");                            
>      \
> +        return NULL;                                                      
>      \
> +    }
> +
> +#define RESTORE_STREAM(type, handle) \
> +    if (!SetStdHandle(type, handle))                                      
>      \
> +        TRACE("Restore of stream failed\n");
> +
> +#define DUPLICATE_HANDLE(hHandle, hDup, type, hOrig) \
> +    if (!DuplicateHandle(GetCurrentProcess(), hHandle,                    
>      \
> +                         GetCurrentProcess(), &hDup, 0,                  
>      \
> +                         FALSE, DUPLICATE_SAME_ACCESS))                  
>      \
> +    {                                                                    
>      \
> +        TRACE("Duplication of piped handle failed\n");                    
>        \
> +        RESTORE_STREAM(type, hOrig);                                      
>      \
> +        return NULL;                                                      
>      \
> +    }                                                                    
>      \
> +    else                                                                  
>      \
> +        CloseHandle(hHandle);

What's up with all the macro abuse? :) We don't like cpp that much! ;)
Please, try to do things without macros, it can't be that bad.

-- 
Dimi.



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux