I need to know whether a given .exe is 32-bit or a 64-bit, before I launch it. IsWow64Process
is no use here, since there is no process yet. Is there some other API that will give me this information?
Programatically determine if native .exe is 32-bit or 64-bit
Asked Answered
possible duplicate of How to find if native dll is compiled as x64 or x86? –
Unconsidered
Actually, I withdraw the dup - this is a lot easier for EXEs than for DLLs, it seems. –
Unconsidered
If you really only want to do this for EXEs and not DLLs, just use GetBinaryType.
Determines whether a file is an executable (.exe) file, and if so, which subsystem runs the executable file.
Yes, this is exactly what I want, and it's much easier than reading the PE header myself, which is what the other answers suggested. Thanks. –
Fellatio
You are lucky you just need EXEs :-) Those complex contortions appear necessary to do this for DLLs. A gap in Win32, imo. –
Unconsidered
This post will surely help you.
Is C# related but it will give you the idea.
This information is available in one of the headers of the PE File file format (the format used for exe's and dll's). The information in these headers can either be extracted programmatically (they are at a specified offset) or more safely queried via the Win32 API.
Alright, Liviu got the correct pointer for you.
© 2022 - 2024 — McMap. All rights reserved.