trashy Posted March 12, 2014 Share Posted March 12, 2014 (edited) How to check if an exe is 32 or 64 bit. I want to check OS version and Arch on an offline drive. I've got this but I'd like something better. I don't think FileGetVersion can do this and what about something like an AutoIt compiled exe or a dll. $version = StringLeft(FileGetVersion(GUICtrlRead($Combo1) & "\Windows\system32\WinVer.exe"), 3) If StringLeft($version, 3) = "6.1" Then $version = "WIN7" ElseIf StringLeft($version, 3) = "6.0" Then $version = "VISTA" ElseIf StringLeft($version, 3) = "5.1" Then $version = "XP" EndIf $arch = (GUICtrlRead($Combo1) & "\Program Files (x86)") If Not FileExists($arch) Then $arch = "_x86" ElseIf FileExists($arch) Then $arch = "_x64" EndIf Edited March 12, 2014 by trashy Link to comment Share on other sites More sharing options...
JohnOne Posted March 12, 2014 Share Posted March 12, 2014 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
trashy Posted March 12, 2014 Author Share Posted March 12, 2014 (edited) Already found that one but didn't have any luck with it Edited March 12, 2014 by trashy Link to comment Share on other sites More sharing options...
JohnOne Posted March 12, 2014 Share Posted March 12, 2014 Maybe try wrapping shgetfileinfo AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
trashy Posted March 12, 2014 Author Share Posted March 12, 2014 Let's just use iexplore.exe for example. There's not an easy to determine if it' a 32 or 64 bit app? Link to comment Share on other sites More sharing options...
FireFox Posted March 12, 2014 Share Posted March 12, 2014 (edited) Converted from a working C# function : #include <FileConstants.au3> Local $Native = 0, $I386 = 0x014c, $Itanium = 0x0200, $x64 = 0x8664 Switch GetMachineType(@AutoItExe) Case $Native ConsoleWrite("Native" & @Lf) Case $I386 ConsoleWrite("I386" & @Lf) Case $Itanium ConsoleWrite("Itanium" & @Lf) Case $x64 ConsoleWrite("x64" & @Lf) EndSwitch Func GetMachineType($sFileName) Local Const $PE_POINTER_OFFSET = 60 Local Const $MACHINE_OFFSET = 4 Local $hFile = FileOpen($sFileName, $FO_BINARY) Local $bData = FileRead($hFile, 4096) FileClose($hFile) ;dos header is 64 bytes, last element, long (4 bytes) is the address of the PE header Local $PE_HEADER_ADDR = Number(BinaryMid($bData, 1 + $PE_POINTER_OFFSET, 4)) Local $iMachineUint = Number(BinaryMid($bData, 1 + $PE_HEADER_ADDR + $MACHINE_OFFSET, 2)) Return $iMachineUint EndFunc _ Br, FireFox. Edited March 12, 2014 by FireFox Link to comment Share on other sites More sharing options...
UEZ Posted March 12, 2014 Share Posted March 12, 2014 How about this: #800855 Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
FireFox Posted March 12, 2014 Share Posted March 12, 2014 How about this: #800855 Br, UEZ Same link as post #2. Link to comment Share on other sites More sharing options...
UEZ Posted March 12, 2014 Share Posted March 12, 2014 (edited) Indeed. What about _WinAPI_GetBinaryType() function? Br, UEZ Edited March 12, 2014 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
JohnOne Posted March 12, 2014 Share Posted March 12, 2014 (edited) I imagine that is same as kafu's Edited March 12, 2014 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
guinness Posted March 12, 2014 Share Posted March 12, 2014 I imagine that is same as kafu's But included as part of the AutoIt UDFs. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
trashy Posted March 12, 2014 Author Share Posted March 12, 2014 WinAPI_GetBinaryType() Could be just what I' looking for. Out of time right now , I'll check it out later and post my results. Thanks Link to comment Share on other sites More sharing options...
UEZ Posted March 12, 2014 Share Posted March 12, 2014 2x @trashy: why is that function not working for you? iexplorer.exe reports the architecture properly. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
funkey Posted March 12, 2014 Share Posted March 12, 2014 @UEZ: Did you read the question? Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
UEZ Posted March 12, 2014 Share Posted March 12, 2014 @funkey: you mean Let's just use iexplore.exe for example. There's not an easy to determine if it' a 32 or 64 bit app? If run the example for _WinAPI_GetBinaryType I get 32-bit for iexplore.exe located in c:Program Files (x86)Internet Explorer and 64-bit for the exe located in c:Program FilesInternet Explorer. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
funkey Posted March 12, 2014 Share Posted March 12, 2014 How to check if an exe is 32 or 64 bit. I want to check OS version and Arch on an offline drive. I've got this but I'd like something better. I don't think FileGetVersion can do this and what about something like an AutoIt compiled exe or a dll. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
FireFox Posted March 12, 2014 Share Posted March 12, 2014 And we answered the first question. Link to comment Share on other sites More sharing options...
JohnOne Posted March 12, 2014 Share Posted March 12, 2014 If a drive containing an os has the folder Program Files (x86) can it not be concluded it's a 64 bit os? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
FireFox Posted March 12, 2014 Share Posted March 12, 2014 (edited) If a drive containing an os has the folder Program Files (x86) can it not be concluded it's a 64 bit os? Yes. But better check the registry if there is a Wow64 key in case a dumb user has created the Program Files (x86) folder. Edited March 12, 2014 by FireFox Link to comment Share on other sites More sharing options...
UEZ Posted March 12, 2014 Share Posted March 12, 2014 Regarding to check which os is installed on the ext. disk you can try these steps: load the ext. registry hive using REG LOAD <KeyName> <FileName> (cmdline tool) extract the needed values from the loaded hive using RegRead (<Keyname>HKLMSOFTWAREMicrosoftWindows NTCurrentVersion) unload the hive REG UNLOAD <KeyName> Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now