From: Alexandre Julliard Subject: Re: [PATCH 1/2] rundll32: Re-exec as 32-bit or 64-bit if necessary. Message-Id: <87tv92eweh.fsf@wine> Date: Mon, 23 Sep 2019 19:48:38 +0200 In-Reply-To: <20190923010623.14266-1-vincent@codeweavers.com> (Vincent Povirk's message of "Sun, 22 Sep 2019 20:06:22 -0500") References: <20190923010623.14266-1-vincent@codeweavers.com> Vincent Povirk writes: > + /* Figure out what type of dll it is. */ > + dll_type = get_image_type(szDllName); > + > + /* Re-exec with another architecture if necessary. */ > +#ifdef __i386__ > + if (dll_type == IMAGE_FILE_MACHINE_AMD64) { > + BOOL is_wow64; > + if (IsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64 && reexec_self(TRUE)) > + goto CLEANUP; > + } > +#endif > +#ifdef __x86_64__ > + if ((dll_type == IMAGE_FILE_MACHINE_I386 || dll_type == IMAGE_OS2_SIGNATURE) && > + reexec_self(FALSE)) > + goto CLEANUP; > +#endif You should probably use GetBinaryType(), so that you don't need CPU-specific checks. Also I'd suggest doing this only when loading the dll has failed. -- Alexandre Julliard julliard@winehq.org