Vincent Povirk vincent@codeweavers.com 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.