is exe file x64 or x86? Howto?
Posted: 01 Mar 2017, 05:41
Is it possible using AHK script to determine whether the file (exe or dll) is x64 or x86?
Please give me advise howto?
Please give me advise howto?
Let's help each other out
https://www.autohotkey.com/boards/
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=28681
msdn wrote:Determines whether a file is an executable (.exe) file, and if so, which subsystem runs the executable file.
Code: Select all
MsgBox % GetBinaryType("C:\Windows\System32\calc.exe") ; -> 32BIT
GetBinaryType(Application)
{
static Type := {0 : "32BIT", 1: "DOS", 2: "WOW", 3: "PIF", 4: "POSIX", 5: "OS216", 6: "64BIT"}
DllCall("GetBinaryType", "str", Application, "uint*", BinaryType)
return Type[BinaryType]
}
Code: Select all
MsgBox % GetBinaryType("C:\Program Files\AutoHotkey\AutoHotkeyU64.exe") ; Shows as 32BIT
MsgBox % GetBinaryType("C:\Program Files\Calibre2\calibre.exe") ; Shows as 32BIT, even when not installed
MsgBox % GetBinaryType("C:\This\is a\fictitious\filepath.exe") ; Shows as 32BIT despite filepath not existing
GetBinaryType(Application)
{
static Type := {0 : "32BIT", 1: "DOS", 2: "WOW", 3: "PIF", 4: "POSIX", 5: "OS216", 6: "64BIT"}
DllCall("GetBinaryType", "str", Application, "uint*", BinaryType)
return Type[BinaryType]
}
Code: Select all
MsgBox % GetBinaryType("C:\Program Files\AutoHotkey\AutoHotkeyU64.exe") ; Shows as 32BIT
MsgBox % GetBinaryType("C:\Program Files\Calibre2\calibre.exe") ; Shows as 32BIT
MsgBox % GetBinaryType("C:\This\is a\fictitious\filepath.exe") ; Shows as 32BIT
GetBinaryType(Application)
{
static Type := {0 : "32BIT", 1: "DOS", 2: "WOW", 3: "PIF", 4: "POSIX", 5: "OS216", 6: "64BIT"}
DllCall("GetBinaryTypeW", "str", Application, "uint*", BinaryType)
return Type[BinaryType]
}
Code: Select all
MsgBox % GetBinaryType("C:\Windows\System32\notepad.exe") ; -> 64BIT
MsgBox % GetBinaryType("C:\Windows\SysWOW64\notepad.exe") ; -> 32BIT
MsgBox % GetBinaryType("C:\Temp\ThisFileDoesNotExist.exe") ; -> 0
GetBinaryType(Application)
{
static GetBinaryType := "GetBinaryType" (A_IsUnicode ? "W" : "A")
static Type := {0 : "32BIT", 1: "DOS", 2: "WOW", 3: "PIF", 4: "POSIX", 5: "OS216", 6: "64BIT"}
if !(DllCall(GetBinaryType, "str", Application, "uint*", BinaryType))
return 0
return Type[BinaryType]
}