madasraka Posted June 6, 2010 Share Posted June 6, 2010 (edited) I have a file in @scriptdir File is 64bit executable (will not work on 32bit OS) Is there a way for autoit to tell if this executable 64 or 32bit ? By the way Attached script returning all possible file properties is no help.Get file property number.au3 Edited June 6, 2010 by madasraka Link to comment Share on other sites More sharing options...
Ascend4nt Posted June 6, 2010 Share Posted June 6, 2010 Check this post where KaFu uses GetBinaryType My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
trancexx Posted June 6, 2010 Share Posted June 6, 2010 (edited) Of course. Keyword is IMAGE_OPTIONAL_HEADER structure. Yo can do it manually or thru ImageNtHeader function (in that case IMAGE_NT_HEADERS structure plays, but that's just three different structures joined together IMAGE_NT_SIGNATURE+IMAGE_FILE_HEADER+IMAGE_OPTIONAL_HEADER). edit: But making it simple as the above post kills all the fun. Edited June 6, 2010 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
madasraka Posted June 6, 2010 Author Share Posted June 6, 2010 Oh cool Thanks guys ! I now have to change few codes because if this discovery. Link to comment Share on other sites More sharing options...
madasraka Posted June 6, 2010 Author Share Posted June 6, 2010 Ok i looked both at your links and search advices and found Based on my level of autoit (programing) knowledge i could not put any of those two together. 1 of found examples involved executing an executable=BAD IDEA Anoter example provided function involving DLL (i learned DLL files return different values in different OS 32 and 64 bit so this is no use too) As for keyword "IMAGE_OPTIONAL_HEADER" ? Well i git lost even more now Maybe there is a simpler way to lets say: Hex Read the file and finding traces of 64bit code ? Then if that matches then $Var = "X64" ? I dont know guys this seems way to complicated for me at this point. Previously i would just rely on: $var = '32' If fileexist ('filename64.exe') = 1 Then assign ('var','64') but this is to eazy and that file is not 100% guarantied to be there. Link to comment Share on other sites More sharing options...
trancexx Posted June 6, 2010 Share Posted June 6, 2010 What possible thing could distract you? You were linked to the easiest possible solution. What are you talking about? What links were you following? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
madasraka Posted June 6, 2010 Author Share Posted June 6, 2010 http://www.autoitscript.com/forum/index.php?showtopic=114516&view=findpost&p=800855 Then i searched for IMAGE_OPTIONAL_HEADER Link to comment Share on other sites More sharing options...
JohnOne Posted June 6, 2010 Share Posted June 6, 2010 Kafu has written and posted the function for you. If StringLeft(_GetBinaryType($yourfile),2) = "64" Then ;Yeah its 64bit Else ;No its not EndIf 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...
madasraka Posted June 6, 2010 Author Share Posted June 6, 2010 Sorry i wasn't sure how to use it Thanks 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