André Hentschel a écrit :
> Some Apps e.g. mingw-apps use lpReserved2 to pass some data to the child-process, this data starts with 4 Byte of Zeros(unsinged 0) to tell msvcrt not to read that as an inherit-block.
>
Hi André
a couple of comments to your patch
> See also Bug 18479
> ---
> dlls/msvcrt/file.c | 2 +-
> dlls/msvcrt/tests/Makefile.in | 2 +-
> dlls/msvcrt/tests/file.c | 50 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 52 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
> index 6671f2f..8f63e8d 100644
> --- a/dlls/msvcrt/file.c
> +++ b/dlls/msvcrt/file.c
> @@ -349,7 +349,7 @@ void msvcrt_init_io(void)
> InitializeCriticalSection(&MSVCRT_file_cs);
> MSVCRT_file_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": MSVCRT_file_cs");
> GetStartupInfoA(&si);
> - if (si.cbReserved2 != 0 && si.lpReserved2 != NULL)
> + if (si.cbReserved2 != 0 && si.lpReserved2 != NULL && *(unsigned*)si.lpReserved2)
>
IMO, we should also test that cbReserved2 is >= sizeof(unsigned)
otherwise we'd be in trouble
> {
> char* wxflag_ptr;
> HANDLE* handle_ptr;
> diff --git a/dlls/msvcrt/tests/Makefile.in b/dlls/msvcrt/tests/Makefile.in
> index 74199e1..8c71971 100644
> --- a/dlls/msvcrt/tests/Makefile.in
> +++ b/dlls/msvcrt/tests/Makefile.in
> @@ -4,7 +4,7 @@ SRCDIR = @srcdir@
> VPATH = @srcdir@
> TESTDLL = msvcrt.dll
> APPMODE = -mno-cygwin
> -IMPORTS = kernel32
> +IMPORTS = kernel32 user32
>
you should do it without user32. instead of doing this
> + while (MsgWaitForMultipleObjects( 1, &proc.hProcess, FALSE, INFINITE, QS_ALLINPUT ) != 0)
> + {
> + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
> + }
>
you could simply wait for the child process to terminate
A+
--
Eric Pouech
"The problem with designing something completely foolproof is to underestimate the ingenuity of a complete idiot." (Douglas Adams)