Is it 32 or 64 bit?
-
- Addict
- Posts: 989
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Is it 32 or 64 bit?
Any way to look at a file to know if it is a 64 or 32 bit app?
And while we're at it -- are all apps compiled using 64 bit PB automatically 64 bit?
Antbody?
And while we're at it -- are all apps compiled using 64 bit PB automatically 64 bit?
Antbody?
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.
-
- Addict
- Posts: 989
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Re: Is it 32 or 64 bit?
I found an answer on the web to part one above:Randy Walker wrote: Mon Aug 12, 2024 7:34 am Any way to look at a file to know if it is a 64 or 32 bit app?
Antbody?
"The easiest way, without installing another program or running the file, is just to right click on the file, choose Properties, and then go the the Compatibility tab. If there are no greyed out options and Windows XP and 9x modes are offered, it's 32-bit. If there are greyed out options and Vista is the earliest mode offered, it's 64-bit. No need to start the application at all."
No telling if that is bullet proof, but seems to work.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.
Re: Is it 32 or 64 bit?
Yes. For your other question: I don't know.Randy Walker wrote: Mon Aug 12, 2024 7:34 amare all apps compiled using 64 bit PB automatically 64 bit?
Re: Is it 32 or 64 bit?
If compiled by a 64 bit compiler a program is 64 bit.Randy Walker wrote: Mon Aug 12, 2024 7:34 am And while we're at it -- are all apps compiled using 64 bit PB automatically 64 bit?
If compiled by a 32 bit compiler a program is 32 bit.
This is true whether or not the c compilers are used for the compilation.
It should be noted that you can also arrange for a 32 bit compiler to be used in a 64 bit version of the PureBasic IDE.
Re: Is it 32 or 64 bit?
For PE executables, check the Machine Types of the header
Last edited by Bitblazer on Mon Aug 12, 2024 4:44 pm, edited 2 times in total.
- NicTheQuick
- Addict
- Posts: 1503
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Is it 32 or 64 bit?
On Linux just use the `file` tool:
Code: Select all
~$ file /usr/bin/ls
/usr/bin/ls: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=36b86f957a1be53733633d184c3a3354f3fc7b12, for GNU/Linux 3.2.0, stripped
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Re: Is it 32 or 64 bit?
Hi Randy
You can use Detect It Easy v3.09 and get more information
You can use Detect It Easy v3.09 and get more information
Egypt my love
Re: Is it 32 or 64 bit?
There are several free tools for windows to detect and display PE structures. For example my current favorite hex editor ImHex.
Re: Is it 32 or 64 bit?
Code: Select all
Procedure.i SL_IsApp64Bit(fnpath_dll_exe$)
; Mijikai, https://www.purebasic.fr/english/viewtopic.php?p=530113#p530113
Protected.i ri, ri2
ri = ReadFile(#PB_Any, fnpath_dll_exe$)
If ri
Protected.i pos
Protected IDH.IMAGE_DOS_HEADER
Protected INH.IMAGE_NT_HEADERS
If IsFile(ri)
pos = Loc(ri)
FileSeek(ri, #Null, #PB_Absolute)
If ReadData(ri, @IDH, SizeOf(IMAGE_DOS_HEADER)) = SizeOf(IMAGE_DOS_HEADER)
If IDH\e_magic = $5A4D
If (IDH\e_lfanew - 8) < Lof(ri)
FileSeek(ri, IDH\e_lfanew, #PB_Absolute)
If ReadData(ri, @INH, SizeOf(IMAGE_NT_HEADERS)) = SizeOf(IMAGE_NT_HEADERS)
If INH\Signature = $4550
Select (INH\FileHeader\Machine & $FFFF) ; Helles Code
Case $014C
ri2 = 0 ;32
Case $8664
ri2 = 1 ;64
EndSelect
EndIf
EndIf
EndIf
EndIf
EndIf
FileSeek(ri, pos, #PB_Absolute)
EndIf
CloseFile(ri)
EndIf
ProcedureReturn ri2
EndProcedure
Debug SL_IsApp64Bit("C:\PureBasic-x86\Compilers\Scintilla.dll")
Debug SL_IsApp64Bit("C:\PureBasic-x64\Compilers\Scintilla.dll")
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
-
- Addict
- Posts: 989
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Re: Is it 32 or 64 bit?
Thank you BitBlazer, I've been using freewsare "WinVI" which has been great for a portable plain hex editor.
https://www.winvi.de/en/
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.
-
- Addict
- Posts: 989
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Re: Is it 32 or 64 bit?
Thanks for that skywalk!! Some very cool code.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.