It's easier to check [Optional Header][1] magic number. For a valid exe, only two values are possible: 0x10B => PE32 => 32 bit 0x20B => PE32+ => 64 bit [1]: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#optional-header-image-only