JSBձոգչ
JSBձոգչ

Reputation: 41378

Programatically determine if native .exe is 32-bit or 64-bit

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?

Upvotes: 6

Views: 5122

Answers (3)

Steve Townsend
Steve Townsend

Reputation: 54148

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.

Upvotes: 12

Johannes Rudolph
Johannes Rudolph

Reputation: 35741

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.

Upvotes: 1

Liviu Mandras
Liviu Mandras

Reputation: 6617

This post will surely help you.

Is C# related but it will give you the idea.

Upvotes: 5

Related Questions